Class JChannelCommandDispatcher<CC,MC>
java.lang.Object
org.wildfly.clustering.server.jgroups.dispatcher.JChannelCommandDispatcher<CC,MC>
- Type Parameters:
CC- the command execution contextMC- the marshalling context
- All Implemented Interfaces:
AutoCloseable,CommandDispatcher<ChannelGroupMember,CC>
public class JChannelCommandDispatcher<CC,MC>
extends Object
implements CommandDispatcher<ChannelGroupMember,CC>
MessageDispatcher-based command dispatcher.
- Author:
- Paul Ferraro
-
Constructor Summary
ConstructorsConstructorDescriptionJChannelCommandDispatcher(CC commandContext, org.jgroups.blocks.MessageDispatcher dispatcher, CommandMarshaller<CC> marshaller, MC marshallingContext, ChannelGroup group, Duration timeout, Runnable closeTask) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()<R,E extends Exception>
Map<ChannelGroupMember, CompletionStage<R>> dispatchToGroup(Command<R, ? super CC, E> command, Set<ChannelGroupMember> excluding) Executes the specified command on all members of the group, optionally excluding some members.<R,E extends Exception>
CompletionStage<R> dispatchToMember(Command<R, ? super CC, E> command, ChannelGroupMember member) Executes the specified command on the specified group member.Returns the context with which this dispatcher was created.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.wildfly.clustering.server.dispatcher.CommandDispatcher
dispatchToGroup
-
Constructor Details
-
JChannelCommandDispatcher
public JChannelCommandDispatcher(CC commandContext, org.jgroups.blocks.MessageDispatcher dispatcher, CommandMarshaller<CC> marshaller, MC marshallingContext, ChannelGroup group, Duration timeout, Runnable closeTask)
-
-
Method Details
-
getContext
Description copied from interface:CommandDispatcherReturns the context with which this dispatcher was created.- Specified by:
getContextin interfaceCommandDispatcher<CC,MC> - Returns:
- a command execution context
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCommandDispatcher<CC,MC>
-
dispatchToMember
public <R,E extends Exception> CompletionStage<R> dispatchToMember(Command<R, ? super CC, throws IOExceptionE> command, ChannelGroupMember member) Description copied from interface:CommandDispatcherExecutes the specified command on the specified group member. If the member has no corresponding dispatcher, the returned completion stage throws aCancellationException.- Specified by:
dispatchToMemberin interfaceCommandDispatcher<CC,MC> - Type Parameters:
R- the command execution return type- Parameters:
command- the command to executemember- the group member on which to execute the command- Returns:
- the future result of the command execution
- Throws:
IOException- if the command could not be sent
-
dispatchToGroup
public <R,E extends Exception> Map<ChannelGroupMember,CompletionStage<R>> dispatchToGroup(Command<R, ? super CC, throws IOExceptionE> command, Set<ChannelGroupMember> excluding) Description copied from interface:CommandDispatcherExecutes the specified command on all members of the group, optionally excluding some members. If a given member has no corresponding dispatcher, its completion stage throws aCancellationException.- Specified by:
dispatchToGroupin interfaceCommandDispatcher<CC,MC> - Type Parameters:
R- the command execution return type- Parameters:
command- the command to executeexcluding- the members to be excluded from group command execution- Returns:
- a completion stage per member of the group on which the command was executed
- Throws:
IOException- if the command could not be sent
-