org.infinispan.commands.control
Class LockControlCommand

java.lang.Object
  extended by org.infinispan.commands.tx.AbstractTransactionBoundaryCommand
      extended by org.infinispan.commands.control.LockControlCommand
All Implemented Interfaces:
FlagAffectedCommand, CacheRpcCommand, ReplicableCommand, TransactionBoundaryCommand, VisitableCommand

public class LockControlCommand
extends AbstractTransactionBoundaryCommand
implements FlagAffectedCommand

LockControlCommand is a command that enables distributed locking across infinispan nodes.

For more details refer to: https://jira.jboss.org/jira/browse/ISPN-70 https://jira.jboss.org/jira/browse/ISPN-48

Since:
4.0
Author:
Vladimir Blagojevic (vblagoje@redhat.com), Mircea.Markus@jboss.com

Field Summary
static int COMMAND_ID
           
 
Fields inherited from class org.infinispan.commands.tx.AbstractTransactionBoundaryCommand
cacheName, configuration, globalTx, icc, invoker, txTable
 
Constructor Summary
LockControlCommand(Collection<Object> keys, String cacheName, Set<Flag> flags, GlobalTransaction gtx)
           
LockControlCommand(Object key, String cacheName, Set<Flag> flags, GlobalTransaction gtx)
           
LockControlCommand(String cacheName)
           
 
Method Summary
 Object acceptVisitor(InvocationContext ctx, Visitor visitor)
          Accept a visitor, and return the result of accepting this visitor.
 boolean equals(Object o)
           
 byte getCommandId()
          Used by marshallers to convert this command into an id for streaming.
 Set<Flag> getFlags()
           
 Collection<Object> getKeys()
           
 Object[] getParameters()
          Used by marshallers to stream this command across a network
 Object getSingleKey()
           
 boolean hasFlag(Flag flag)
          Check whether a particular flag is present in the command
 int hashCode()
           
 boolean isUnlock()
           
 boolean multipleKeys()
           
 Object perform(InvocationContext ignored)
          Performs the primary function of the command.
 void replaceKey(Object oldKey, Object replacement)
           
 void replaceKeys(Map<Object,Object> replacements)
           
 void setFlags(Set<Flag> flags)
          Use it to store the flags from the InvocationContext into the Command before remoting the Command.
 void setGlobalTransaction(GlobalTransaction gtx)
           
 void setParameters(int commandId, Object[] args)
          Used by the CommandsFactory to create a command from raw data read off a stream.
 void setUnlock(boolean unlock)
           
 String toString()
           
 
Methods inherited from class org.infinispan.commands.tx.AbstractTransactionBoundaryCommand
getCacheName, getConfiguration, getGlobalTransaction, getOrigin, ignoreCommandOnStatus, init, injectComponents, invalidRemoteTxReturnValue, isReturnValueExpected, markTransactionAsRemote, setOrigin, shouldInvoke, visitRemoteTransaction
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

COMMAND_ID

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

LockControlCommand

public LockControlCommand(String cacheName)

LockControlCommand

public LockControlCommand(Collection<Object> keys,
                          String cacheName,
                          Set<Flag> flags,
                          GlobalTransaction gtx)

LockControlCommand

public LockControlCommand(Object key,
                          String cacheName,
                          Set<Flag> flags,
                          GlobalTransaction gtx)
Method Detail

setGlobalTransaction

public void setGlobalTransaction(GlobalTransaction gtx)

getKeys

public Collection<Object> getKeys()

replaceKey

public void replaceKey(Object oldKey,
                       Object replacement)

replaceKeys

public void replaceKeys(Map<Object,Object> replacements)

multipleKeys

public boolean multipleKeys()

getSingleKey

public Object getSingleKey()

acceptVisitor

public Object acceptVisitor(InvocationContext ctx,
                            Visitor visitor)
                     throws Throwable
Description copied from interface: VisitableCommand
Accept a visitor, and return the result of accepting this visitor.

Specified by:
acceptVisitor in interface VisitableCommand
Parameters:
ctx - invocation context
visitor - visitor to accept
Returns:
arbitrary return value
Throws:
Throwable - in the event of problems

perform

public Object perform(InvocationContext ignored)
               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
Overrides:
perform in class AbstractTransactionBoundaryCommand
Parameters:
ignored - invocation context
Returns:
arbitrary return value generated by performing this command
Throws:
Throwable - in the event of problems.

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
Overrides:
getParameters in class AbstractTransactionBoundaryCommand
Returns:
an object array of arguments, compatible with pre-2.2.0 MethodCall args.

setParameters

public void setParameters(int commandId,
                          Object[] args)
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
Overrides:
setParameters in class AbstractTransactionBoundaryCommand
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.
args - object array of args

isUnlock

public boolean isUnlock()

setUnlock

public void setUnlock(boolean unlock)

equals

public boolean equals(Object o)
Overrides:
equals in class AbstractTransactionBoundaryCommand

hashCode

public int hashCode()
Overrides:
hashCode in class AbstractTransactionBoundaryCommand

toString

public String toString()
Overrides:
toString in class AbstractTransactionBoundaryCommand

getFlags

public Set<Flag> getFlags()
Specified by:
getFlags in interface FlagAffectedCommand
Returns:
the Flags which where set in the context - only valid to invoke after FlagAffectedCommand.setFlags(Set)

setFlags

public void setFlags(Set<Flag> flags)
Description copied from interface: FlagAffectedCommand
Use it to store the flags from the InvocationContext into the Command before remoting the Command.

Specified by:
setFlags in interface FlagAffectedCommand

hasFlag

public boolean hasFlag(Flag flag)
Description copied from interface: FlagAffectedCommand
Check whether a particular flag is present in the command

Specified by:
hasFlag in interface FlagAffectedCommand
Parameters:
flag - to lookup in the command
Returns:
true if the flag is present

-->

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