Class EmbeddedCacheManagerCommandDispatcher<A extends Comparable<A>, M extends GroupMember<A>, C>
java.lang.Object
org.wildfly.clustering.server.infinispan.dispatcher.EmbeddedCacheManagerCommandDispatcher<A,M,C>
- Type Parameters:
A- the address type for group membersM- the group member typeC- the command context type
- All Implemented Interfaces:
AutoCloseable, CommandDispatcher<CacheContainerGroupMember, C>
public class EmbeddedCacheManagerCommandDispatcher<A extends Comparable<A>, M extends GroupMember<A>, C>
extends Object
implements CommandDispatcher<CacheContainerGroupMember, C>
A
CommandDispatcher for dispatching commands to embedded cache manager group members.- Author:
- Paul Ferraro
-
Constructor Summary
ConstructorsConstructorDescriptionEmbeddedCacheManagerCommandDispatcher(CommandDispatcher<M, C> dispatcher, Function<CacheContainerGroupMember, M> unwrapper, Function<M, CacheContainerGroupMember> wrapper) Creates a command dispatcher decorator. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()<R, E extends Exception>
Map<CacheContainerGroupMember, CompletionStage<R>> dispatchToGroup(Command<R, ? super C, E> command) Executes the specified command on all members of the group, optionally excluding some members.<R, E extends Exception>
Map<CacheContainerGroupMember, CompletionStage<R>> dispatchToGroup(Command<R, ? super C, E> command, Set<CacheContainerGroupMember> 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 C, E> command, CacheContainerGroupMember member) Executes the specified command on the specified group member.Returns the context with which this dispatcher was created.
-
Constructor Details
-
EmbeddedCacheManagerCommandDispatcher
public EmbeddedCacheManagerCommandDispatcher(CommandDispatcher<M, C> dispatcher, Function<CacheContainerGroupMember, M> unwrapper, Function<M, CacheContainerGroupMember> wrapper) Creates a command dispatcher decorator.- Parameters:
dispatcher- the decorated command dispatcherunwrapper- a function that converts a cache container group member to the member type expected by the decorated command dispatcherwrapper- a function that converts a cache container group member from the member type expected by the decorated command dispatcher
-
-
Method Details
-
getContext
Description copied from interface:CommandDispatcherReturns the context with which this dispatcher was created.- Specified by:
getContextin interfaceCommandDispatcher<A extends Comparable<A>, M extends GroupMember<A>>- Returns:
- a command execution context
-
dispatchToMember
public <R, E extends Exception> CompletionStage<R> dispatchToMember(Command<R, ? super C, E> command, CacheContainerGroupMember member) throws IOException 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<A extends Comparable<A>, M extends GroupMember<A>>- Type Parameters:
R- the command execution return typeE- the command exception 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<CacheContainerGroupMember, CompletionStage<R>> dispatchToGroup(Command<R, ? super C, E> command) throws IOException 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<A extends Comparable<A>, M extends GroupMember<A>>- Type Parameters:
R- the command execution return typeE- the command exception type- Parameters:
command- the command to execute- Returns:
- a completion stage per member of the group on which the command was executed
- Throws:
IOException- if the command could not be sent
-
dispatchToGroup
public <R, E extends Exception> Map<CacheContainerGroupMember, CompletionStage<R>> dispatchToGroup(Command<R, ? super C, E> command, Set<CacheContainerGroupMember> excluding) throws IOException 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<A extends Comparable<A>, M extends GroupMember<A>>- Type Parameters:
R- the command execution return typeE- the command exception 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
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCommandDispatcher<A extends Comparable<A>, M extends GroupMember<A>>
-