com.hazelcast.spi
Class InvocationBuilder

java.lang.Object
  extended by com.hazelcast.spi.InvocationBuilder

public abstract class InvocationBuilder
extends Object

The InvocationBuilder is responsible for building an invocation of an operation and invoking it. The original design exposed the actual Invocation class, but this will limit flexibility since the whole invocation can't be changed or fully removed easily.


Field Summary
protected  Callback<Object> callback
           
protected  long callTimeout
           
static long DEFAULT_CALL_TIMEOUT
           
static boolean DEFAULT_DESERIALIZE_RESULT
           
static int DEFAULT_REPLICA_INDEX
           
static int DEFAULT_TRY_COUNT
           
static long DEFAULT_TRY_PAUSE_MILLIS
           
protected  String executorName
           
protected  com.hazelcast.spi.impl.NodeEngineImpl nodeEngine
           
protected  Operation op
           
protected  int partitionId
           
protected  int replicaIndex
           
protected  boolean resultDeserialized
           
protected  String serviceName
           
protected  com.hazelcast.nio.Address target
           
protected  int tryCount
           
protected  long tryPauseMillis
           
 
Constructor Summary
InvocationBuilder(com.hazelcast.spi.impl.NodeEngineImpl nodeEngine, String serviceName, Operation op, int partitionId, com.hazelcast.nio.Address target)
           
 
Method Summary
 Callback getCallback()
           
 long getCallTimeout()
           
 String getExecutorName()
          Gets the name of the Executor to use.
 Operation getOp()
           
 int getPartitionId()
           
 int getReplicaIndex()
           
 String getServiceName()
           
 com.hazelcast.nio.Address getTarget()
           
 int getTryCount()
           
 long getTryPauseMillis()
           
abstract  InternalCompletableFuture invoke()
           
 boolean isResultDeserialized()
          Checks if the Future should automatically deserialize the result.
 InvocationBuilder setCallback(Callback<Object> callback)
           
 InvocationBuilder setCallTimeout(long callTimeout)
           
 InvocationBuilder setExecutorName(String executorName)
          Sets the executor name.
 InvocationBuilder setReplicaIndex(int replicaIndex)
           
 InvocationBuilder setResultDeserialized(boolean resultDeserialized)
          Sets the automatic deserialized option for the result.
 InvocationBuilder setTryCount(int tryCount)
           
 InvocationBuilder setTryPauseMillis(long tryPauseMillis)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CALL_TIMEOUT

public static final long DEFAULT_CALL_TIMEOUT
See Also:
Constant Field Values

DEFAULT_REPLICA_INDEX

public static final int DEFAULT_REPLICA_INDEX
See Also:
Constant Field Values

DEFAULT_TRY_COUNT

public static final int DEFAULT_TRY_COUNT
See Also:
Constant Field Values

DEFAULT_TRY_PAUSE_MILLIS

public static final long DEFAULT_TRY_PAUSE_MILLIS
See Also:
Constant Field Values

DEFAULT_DESERIALIZE_RESULT

public static final boolean DEFAULT_DESERIALIZE_RESULT
See Also:
Constant Field Values

nodeEngine

protected final com.hazelcast.spi.impl.NodeEngineImpl nodeEngine

serviceName

protected final String serviceName

op

protected final Operation op

partitionId

protected final int partitionId

target

protected final com.hazelcast.nio.Address target

callback

protected Callback<Object> callback

callTimeout

protected long callTimeout

replicaIndex

protected int replicaIndex

tryCount

protected int tryCount

tryPauseMillis

protected long tryPauseMillis

executorName

protected String executorName

resultDeserialized

protected boolean resultDeserialized
Constructor Detail

InvocationBuilder

public InvocationBuilder(com.hazelcast.spi.impl.NodeEngineImpl nodeEngine,
                         String serviceName,
                         Operation op,
                         int partitionId,
                         com.hazelcast.nio.Address target)
Method Detail

getExecutorName

public String getExecutorName()
Gets the name of the Executor to use. This functionality is useful if you want to customize which executor is going to run an operation. By default you don't need to configure anything, but in some case, for example map reduce logic, where you don't want to hog the partition threads, you could offload to another executor.

Returns:
the name of the executor. Returns null if no explicit executor has been configured.

setExecutorName

public InvocationBuilder setExecutorName(String executorName)
Sets the executor name. Value can be null, meaning that no custom executor will be used.

Parameters:
executorName - the name of the executor.

setReplicaIndex

public InvocationBuilder setReplicaIndex(int replicaIndex)

isResultDeserialized

public boolean isResultDeserialized()
Checks if the Future should automatically deserialize the result. In most cases you don't want get Data to be returned, but the deserialized object. But in some cases you want to get the raw Data object. Defaults to true.

Returns:
true if the the result is automatically deserialized, false otherwise.

setResultDeserialized

public InvocationBuilder setResultDeserialized(boolean resultDeserialized)
Sets the automatic deserialized option for the result.

Parameters:
resultDeserialized - true if data
Returns:
the updated InvocationBuilder.
See Also:
isResultDeserialized()

setTryCount

public InvocationBuilder setTryCount(int tryCount)

setTryPauseMillis

public InvocationBuilder setTryPauseMillis(long tryPauseMillis)

setCallTimeout

public InvocationBuilder setCallTimeout(long callTimeout)

getServiceName

public String getServiceName()

getOp

public Operation getOp()

getReplicaIndex

public int getReplicaIndex()

getTryCount

public int getTryCount()

getTryPauseMillis

public long getTryPauseMillis()

getTarget

public com.hazelcast.nio.Address getTarget()

getPartitionId

public int getPartitionId()

getCallTimeout

public long getCallTimeout()

getCallback

public Callback getCallback()

setCallback

public InvocationBuilder setCallback(Callback<Object> callback)

invoke

public abstract InternalCompletableFuture invoke()


Copyright © 2014 Hazelcast, Inc.. All Rights Reserved.