org.infinispan.commands
Interface CommandsFactory

All Known Implementing Classes:
CommandsFactoryImpl

public interface CommandsFactory

A factory to build commands, initializing and injecting dependencies accordingly. Commands built for a specific, named cache instance cannot be reused on a different cache instance since most commands contain the cache name it was built for along with references to other named-cache scoped components.

Since:
4.0
Author:
Manik Surtani, Mircea.Markus@jboss.com, Galder ZamarreƱo

Method Summary
 ClearCommand buildClearCommand()
          Builds a ClearCommand
 ClusteredGetCommand buildClusteredGetCommand(Object key)
          Builds a ClusteredGetCommand, which is a remote lookup command
 CommitCommand buildCommitCommand(GlobalTransaction gtx)
          Builds a CommitCommand
 EntrySetCommand buildEntrySetCommand()
          Builds a EntrySetCommand
 EvictCommand buildEvictCommand(Object key)
          Builds an EvictCommand
 GetKeyValueCommand buildGetKeyValueCommand(Object key)
          Builds a GetKeyValueCommand
 InvalidateCommand buildInvalidateCommand(Object... keys)
          Builds an InvalidateCommand
 InvalidateCommand buildInvalidateFromL1Command(boolean forRehash, Object... keys)
          Builds an InvalidateFromL1Command
 KeySetCommand buildKeySetCommand()
          Builds a KeySetCommand
 LockControlCommand buildLockControlCommand(Collection keys, boolean implicit)
          Builds a LockControlCommand to control explicit remote locking
 PrepareCommand buildPrepareCommand(GlobalTransaction gtx, List<WriteCommand> modifications, boolean onePhaseCommit)
          Builds a PrepareCommand
 PutKeyValueCommand buildPutKeyValueCommand(Object key, Object value, long lifespanMillis, long maxIdleTimeMillis)
          Builds a PutKeyValueCommand
 PutMapCommand buildPutMapCommand(Map map, long lifespanMillis, long maxIdleTimeMillis)
          Builds a PutMapCommand
 RehashControlCommand buildRehashControlCommand(Address sender, Map<Object,InternalCacheValue> state)
          Builds a RehashControlCommand for coordinating a rehash event.
 RehashControlCommand buildRehashControlCommand(RehashControlCommand.Type subtype, Address sender)
          Builds a RehashControlCommand for coordinating a rehash event.
 RehashControlCommand buildRehashControlCommand(RehashControlCommand.Type subtype, Address sender, Map<Object,InternalCacheValue> state, ConsistentHash consistentHash)
          A more generic version of this factory method that allows the setting of various fields.
 RehashControlCommand buildRehashControlCommandTxLog(Address sender, List<WriteCommand> state)
          Builds a RehashControlCommand for coordinating a rehash event.
 RehashControlCommand buildRehashControlCommandTxLogPendingPrepares(Address sender, List<PrepareCommand> state)
          Builds a RehashControlCommand for coordinating a rehash event.
 RemoveCommand buildRemoveCommand(Object key, Object value)
          Builds a RemoveCommand
 ReplaceCommand buildReplaceCommand(Object key, Object oldValue, Object newValue, long lifespanMillis, long maxIdleTimeMillis)
          Builds a ReplaceCommand
 MultipleRpcCommand buildReplicateCommand(List<ReplicableCommand> toReplicate)
          Builds an RpcCommand "envelope" containing multiple ReplicableCommands
 RollbackCommand buildRollbackCommand(GlobalTransaction gtx)
          Builds a RollbackCommand
 SingleRpcCommand buildSingleRpcCommand(ReplicableCommand call)
          Builds a SingleRpcCommand "envelope" containing a single ReplicableCommand
 SizeCommand buildSizeCommand()
          Builds a SizeCommand
 StateTransferControlCommand buildStateTransferControlCommand(boolean block)
          Builds a StateTransferControlCommand
 ValuesCommand buildValuesCommand()
          Builds a ValuesCommand
 void initializeReplicableCommand(ReplicableCommand command)
          Initializes a ReplicableCommand read from a data stream with components specific to the target cache instance.
 

Method Detail

buildPutKeyValueCommand

PutKeyValueCommand buildPutKeyValueCommand(Object key,
                                           Object value,
                                           long lifespanMillis,
                                           long maxIdleTimeMillis)
Builds a PutKeyValueCommand

Parameters:
key - key to put
value - value to put
lifespanMillis - lifespan in milliseconds. -1 if lifespan is not used.
maxIdleTimeMillis - max idle time in milliseconds. -1 if maxIdle is not used.
Returns:
a PutKeyValueCommand

buildRemoveCommand

RemoveCommand buildRemoveCommand(Object key,
                                 Object value)
Builds a RemoveCommand

Parameters:
key - key to remove
value - value to check for ina conditional remove, or null for an unconditional remove.
Returns:
a RemoveCommand

buildInvalidateCommand

InvalidateCommand buildInvalidateCommand(Object... keys)
Builds an InvalidateCommand

Parameters:
keys - keys to invalidate
Returns:
an InvalidateCommand

buildInvalidateFromL1Command

InvalidateCommand buildInvalidateFromL1Command(boolean forRehash,
                                               Object... keys)
Builds an InvalidateFromL1Command

Parameters:
forRehash - set to true if the invalidation is happening due to a new node taking ownership. False if it is due to a write, changing the state of the entry.
keys - keys to invalidate
Returns:
an InvalidateFromL1Command

buildReplaceCommand

ReplaceCommand buildReplaceCommand(Object key,
                                   Object oldValue,
                                   Object newValue,
                                   long lifespanMillis,
                                   long maxIdleTimeMillis)
Builds a ReplaceCommand

Parameters:
key - key to replace
oldValue - existing value to check for if conditional, null if unconditional.
newValue - value to replace with
lifespanMillis - lifespan in milliseconds. -1 if lifespan is not used.
maxIdleTimeMillis - max idle time in milliseconds. -1 if maxIdle is not used.
Returns:
a ReplaceCommand

buildSizeCommand

SizeCommand buildSizeCommand()
Builds a SizeCommand

Returns:
a SizeCommand

buildGetKeyValueCommand

GetKeyValueCommand buildGetKeyValueCommand(Object key)
Builds a GetKeyValueCommand

Parameters:
key - key to get
Returns:
a GetKeyValueCommand

buildKeySetCommand

KeySetCommand buildKeySetCommand()
Builds a KeySetCommand

Returns:
a KeySetCommand

buildValuesCommand

ValuesCommand buildValuesCommand()
Builds a ValuesCommand

Returns:
a ValuesCommand

buildEntrySetCommand

EntrySetCommand buildEntrySetCommand()
Builds a EntrySetCommand

Returns:
a EntrySetCommand

buildPutMapCommand

PutMapCommand buildPutMapCommand(Map map,
                                 long lifespanMillis,
                                 long maxIdleTimeMillis)
Builds a PutMapCommand

Parameters:
map - map containing key/value entries to put
lifespanMillis - lifespan in milliseconds. -1 if lifespan is not used.
maxIdleTimeMillis - max idle time in milliseconds. -1 if maxIdle is not used.
Returns:
a PutMapCommand

buildClearCommand

ClearCommand buildClearCommand()
Builds a ClearCommand

Returns:
a ClearCommand

buildEvictCommand

EvictCommand buildEvictCommand(Object key)
Builds an EvictCommand

Parameters:
key - key to evict
Returns:
an EvictCommand

buildPrepareCommand

PrepareCommand buildPrepareCommand(GlobalTransaction gtx,
                                   List<WriteCommand> modifications,
                                   boolean onePhaseCommit)
Builds a PrepareCommand

Parameters:
gtx - global transaction associated with the prepare
modifications - list of modifications
onePhaseCommit - is this a one-phase or two-phase transaction?
Returns:
a PrepareCommand

buildCommitCommand

CommitCommand buildCommitCommand(GlobalTransaction gtx)
Builds a CommitCommand

Parameters:
gtx - global transaction associated with the commit
Returns:
a CommitCommand

buildRollbackCommand

RollbackCommand buildRollbackCommand(GlobalTransaction gtx)
Builds a RollbackCommand

Parameters:
gtx - global transaction associated with the rollback
Returns:
a RollbackCommand

initializeReplicableCommand

void initializeReplicableCommand(ReplicableCommand command)
Initializes a ReplicableCommand read from a data stream with components specific to the target cache instance.

Implementations should also be deep, in that if the command contains other commands, these should be recursed into.

Parameters:
command - command to initialize. Cannot be null.

buildReplicateCommand

MultipleRpcCommand buildReplicateCommand(List<ReplicableCommand> toReplicate)
Builds an RpcCommand "envelope" containing multiple ReplicableCommands

Parameters:
toReplicate - ReplicableCommands to include in the envelope
Returns:
a MultipleRpcCommand

buildSingleRpcCommand

SingleRpcCommand buildSingleRpcCommand(ReplicableCommand call)
Builds a SingleRpcCommand "envelope" containing a single ReplicableCommand

Parameters:
call - ReplicableCommand to include in the envelope
Returns:
a SingleRpcCommand

buildStateTransferControlCommand

StateTransferControlCommand buildStateTransferControlCommand(boolean block)
Builds a StateTransferControlCommand

Parameters:
block - whether to start blocking or not
Returns:
a StateTransferControlCommand

buildClusteredGetCommand

ClusteredGetCommand buildClusteredGetCommand(Object key)
Builds a ClusteredGetCommand, which is a remote lookup command

Parameters:
key - key to look up
Returns:
a ClusteredGetCommand

buildLockControlCommand

LockControlCommand buildLockControlCommand(Collection keys,
                                           boolean implicit)
Builds a LockControlCommand to control explicit remote locking

Parameters:
keys - keys to lock
implicit - whether the lock command was implicit (triggered internally) or explicit (triggered by an API call)
Returns:
a LockControlCommand

buildRehashControlCommand

RehashControlCommand buildRehashControlCommand(RehashControlCommand.Type subtype,
                                               Address sender)
Builds a RehashControlCommand for coordinating a rehash event. This version of this factory method creates a simple control command with just a command type and sender.

Parameters:
subtype - type of RehashControlCommand
sender - sender's Address
Returns:
a RehashControlCommand

buildRehashControlCommand

RehashControlCommand buildRehashControlCommand(Address sender,
                                               Map<Object,InternalCacheValue> state)
Builds a RehashControlCommand for coordinating a rehash event. This version of this factory method creates a control command with a sender and a payload - a map of state to be pushed to the recipient. The RehashControlCommand.Type of this command is RehashControlCommand.Type.PUSH_STATE.

Parameters:
sender - sender's Address
state - state map to be pushed to the recipient of this command
Returns:
a RehashControlCommand

buildRehashControlCommandTxLog

RehashControlCommand buildRehashControlCommandTxLog(Address sender,
                                                    List<WriteCommand> state)
Builds a RehashControlCommand for coordinating a rehash event. This version of this factory method creates a control command with a sender and a payload - a transaction log of writes that occured during the generation and delivery of state. The RehashControlCommand.Type of this command is RehashControlCommand.Type.DRAIN_TX.

Parameters:
sender - sender's Address
state - list of writes
Returns:
a RehashControlCommand

buildRehashControlCommandTxLogPendingPrepares

RehashControlCommand buildRehashControlCommandTxLogPendingPrepares(Address sender,
                                                                   List<PrepareCommand> state)
Builds a RehashControlCommand for coordinating a rehash event. This version of this factory method creates a control command with a sender and a payload - a transaction log of pending prepares that occured during the generation and delivery of state. The RehashControlCommand.Type of this command is RehashControlCommand.Type.DRAIN_TX_PREPARES.

Parameters:
sender - sender's Address
state - list of pending prepares
Returns:
a RehashControlCommand

buildRehashControlCommand

RehashControlCommand buildRehashControlCommand(RehashControlCommand.Type subtype,
                                               Address sender,
                                               Map<Object,InternalCacheValue> state,
                                               ConsistentHash consistentHash)
A more generic version of this factory method that allows the setting of various fields.

Parameters:
subtype - type of RehashControlCommand
sender - sender's Address
state - state to push
consistentHash - consistent hash to deliver
Returns:
a RehashControlCommand

Google Analytics

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