Infinispan Distribution 5.2.6.Final-redhat-2

org.infinispan.commands.read
Class ReduceCommand<KOut,VOut>

java.lang.Object
  extended by org.infinispan.commands.remote.BaseRpcCommand
      extended by org.infinispan.commands.read.ReduceCommand<KOut,VOut>
All Implemented Interfaces:
CancellableCommand, CacheRpcCommand, ReplicableCommand

public class ReduceCommand<KOut,VOut>
extends BaseRpcCommand
implements CancellableCommand

ReduceCommand is a container to migrate Reducer to a remote Infinispan node where it will get executed and return the result to an invoking/master node.

Since:
5.2
Author:
Vladimir Blagojevic

Field Summary
static int COMMAND_ID
           
 
Fields inherited from class org.infinispan.commands.remote.BaseRpcCommand
cacheName
 
Constructor Summary
ReduceCommand(String cacheName)
           
ReduceCommand(String taskId, Reducer<KOut,VOut> reducer, String cacheName, Collection<KOut> inputKeys)
           
 
Method Summary
 boolean equals(Object obj)
           
 byte getCommandId()
          Used by marshallers to convert this command into an id for streaming.
 Set<KOut> getKeys()
           
 Object[] getParameters()
          Used by marshallers to stream this command across a network
 Reducer<KOut,VOut> getReducer()
           
 String getTaskId()
           
 UUID getUUID()
          Returns UUID of a command
 int hashCode()
           
 void init(MapReduceManager mrManager)
           
 boolean isEmitCompositeIntermediateKeys()
           
 boolean isReturnValueExpected()
          If true, a return value will be provided when performed remotely.
 Object perform(InvocationContext context)
          Performs invocation of reduce phase on assigned Infinispan node
 void setEmitCompositeIntermediateKeys(boolean emitCompositeIntermediateKeys)
           
 void setParameters(int commandId, Object[] args)
          Used by the CommandsFactory to create a command from raw data read off a stream.
 String toString()
           
 
Methods inherited from class org.infinispan.commands.remote.BaseRpcCommand
getCacheName, getOrigin, setOrigin
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.infinispan.commands.remote.CacheRpcCommand
getCacheName, getOrigin, setOrigin
 

Field Detail

COMMAND_ID

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

ReduceCommand

public ReduceCommand(String cacheName)

ReduceCommand

public ReduceCommand(String taskId,
                     Reducer<KOut,VOut> reducer,
                     String cacheName,
                     Collection<KOut> inputKeys)
Method Detail

init

public void init(MapReduceManager mrManager)

perform

public Object perform(InvocationContext context)
               throws Throwable
Performs invocation of reduce phase on assigned Infinispan node

Specified by:
perform in interface ReplicableCommand
Parameters:
context - invocation context
Returns:
Map of intermediate key value pairs
Throws:
Throwable - in the event of problems.

isEmitCompositeIntermediateKeys

public boolean isEmitCompositeIntermediateKeys()

setEmitCompositeIntermediateKeys

public void setEmitCompositeIntermediateKeys(boolean emitCompositeIntermediateKeys)

getKeys

public Set<KOut> getKeys()

getReducer

public Reducer<KOut,VOut> getReducer()

getTaskId

public String getTaskId()

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.

getUUID

public UUID getUUID()
Description copied from interface: CancellableCommand
Returns UUID of a command

Specified by:
getUUID in interface CancellableCommand
Returns:
command UUID

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[] 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
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

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

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class BaseRpcCommand

Infinispan Distribution 5.2.6.Final-redhat-2

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