org.infinispan.topology
Class CacheTopologyControlCommand

java.lang.Object
  extended by org.infinispan.topology.CacheTopologyControlCommand
All Implemented Interfaces:
ReplicableCommand

public class CacheTopologyControlCommand
extends Object
implements ReplicableCommand

A control command for all cache membership/rebalance operations. It is not a CacheRpcCommand because it needs to run on the coordinator even when the coordinator doesn't have a certain cache running.

Since:
5.2
Author:
Dan Berindei

Nested Class Summary
static class CacheTopologyControlCommand.Type
           
 
Field Summary
static byte COMMAND_ID
           
 
Constructor Summary
CacheTopologyControlCommand()
           
CacheTopologyControlCommand(String cacheName, CacheTopologyControlCommand.Type type, Address sender, CacheJoinInfo joinInfo, int viewId)
           
CacheTopologyControlCommand(String cacheName, CacheTopologyControlCommand.Type type, Address sender, CacheTopology cacheTopology, int viewId)
           
CacheTopologyControlCommand(String cacheName, CacheTopologyControlCommand.Type type, Address sender, int viewId)
           
CacheTopologyControlCommand(String cacheName, CacheTopologyControlCommand.Type type, Address sender, int topologyId, Throwable throwable, int viewId)
           
 
Method Summary
 boolean canBlock()
          If true, the command is processed asynchronously in a thread provided by an Infinispan thread pool.
 String getCacheName()
           
 byte getCommandId()
          Used by marshallers to convert this command into an id for streaming.
 ConsistentHash getCurrentCH()
           
 Address getOrigin()
           
 Object[] getParameters()
          Used by marshallers to stream this command across a network
 ConsistentHash getPendingCH()
           
 Throwable getThrowable()
           
 int getTopologyId()
           
 CacheTopologyControlCommand.Type getType()
           
 void init(LocalTopologyManager localTopologyManager, ClusterTopologyManager clusterTopologyManager, RebalancePolicy rebalancePolicy)
           
 boolean isReturnValueExpected()
          If true, a return value will be provided when performed remotely.
 Object perform(InvocationContext ctx)
          Performs the primary function of the command.
 void setParameters(int commandId, Object[] parameters)
          Used by the CommandsFactory to create a command from raw data read off a stream.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COMMAND_ID

public static final byte COMMAND_ID
See Also:
Constant Field Values
Constructor Detail

CacheTopologyControlCommand

public CacheTopologyControlCommand()

CacheTopologyControlCommand

public CacheTopologyControlCommand(String cacheName,
                                   CacheTopologyControlCommand.Type type,
                                   Address sender,
                                   int viewId)

CacheTopologyControlCommand

public CacheTopologyControlCommand(String cacheName,
                                   CacheTopologyControlCommand.Type type,
                                   Address sender,
                                   CacheJoinInfo joinInfo,
                                   int viewId)

CacheTopologyControlCommand

public CacheTopologyControlCommand(String cacheName,
                                   CacheTopologyControlCommand.Type type,
                                   Address sender,
                                   int topologyId,
                                   Throwable throwable,
                                   int viewId)

CacheTopologyControlCommand

public CacheTopologyControlCommand(String cacheName,
                                   CacheTopologyControlCommand.Type type,
                                   Address sender,
                                   CacheTopology cacheTopology,
                                   int viewId)
Method Detail

init

public void init(LocalTopologyManager localTopologyManager,
                 ClusterTopologyManager clusterTopologyManager,
                 RebalancePolicy rebalancePolicy)

perform

public Object perform(InvocationContext ctx)
               throws Throwable
Description copied from interface: ReplicableCommand
Performs the primary function of the command. Please see specific implementation classes for details on what is performed as well as return types. Important: this method will be invoked at the end of interceptors chain. It should never be called directly from a custom interceptor.

Specified by:
perform in interface ReplicableCommand
Parameters:
ctx - invocation context
Returns:
arbitrary return value generated by performing this command
Throws:
Throwable - in the event of problems.

getCacheName

public String getCacheName()

getOrigin

public Address getOrigin()

getType

public CacheTopologyControlCommand.Type getType()

getTopologyId

public int getTopologyId()

getCurrentCH

public ConsistentHash getCurrentCH()

getPendingCH

public ConsistentHash getPendingCH()

getThrowable

public Throwable getThrowable()

getCommandId

public byte getCommandId()
Description copied from interface: ReplicableCommand
Used by marshallers to convert this command into an id for streaming.

Specified by:
getCommandId in interface ReplicableCommand
Returns:
the method id of this command. This is compatible with pre-2.2.0 MethodCall ids.

getParameters

public Object[] getParameters()
Description copied from interface: ReplicableCommand
Used by marshallers to stream this command across a network

Specified by:
getParameters in interface ReplicableCommand
Returns:
an object array of arguments, compatible with pre-2.2.0 MethodCall args.

setParameters

public void setParameters(int commandId,
                          Object[] parameters)
Description copied from interface: ReplicableCommand
Used by the CommandsFactory to create a command from raw data read off a stream.

Specified by:
setParameters in interface ReplicableCommand
Parameters:
commandId - command id to set. This is usually unused but *could* be used in the event of a command having multiple IDs, such as PutKeyValueCommand.
parameters - object array of args

toString

public String toString()
Overrides:
toString in class Object

isReturnValueExpected

public boolean isReturnValueExpected()
Description copied from interface: ReplicableCommand
If true, a return value will be provided when performed remotely. Otherwise, a remote ResponseGenerator may choose to simply return null to save on marshalling costs.

Specified by:
isReturnValueExpected in interface ReplicableCommand
Returns:
true or false

canBlock

public boolean canBlock()
Description copied from interface: ReplicableCommand
If true, the command is processed asynchronously in a thread provided by an Infinispan thread pool. Otherwise, the command is processed directly in the JGroups thread.

This feature allows to avoid keep a JGroups thread busy that can originate discard of messages and retransmissions. So, the commands that can block (waiting for some state, acquiring locks, etc.) should return true.

Specified by:
canBlock in interface ReplicableCommand
Returns:
true if the command can block/wait, false otherwise

-->

Copyright © 2013 JBoss, a division of Red Hat. All Rights Reserved.