Package com.aerospike.client.async
Class NioEventLoop
java.lang.Object
com.aerospike.client.async.EventLoopBase
com.aerospike.client.async.NioEventLoop
Aerospike wrapper around NIO Selector.
Implements the Aerospike EventLoop interface.
-
Constructor Summary
ConstructorsConstructorDescriptionNioEventLoop
(EventPolicy policy, SelectorProvider provider, int index, boolean daemon, String poolName) Construct Aerospike event loop wrapper from NIO Selector. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
static ByteBuffer
createByteBuffer
(int size) com.aerospike.client.async.AsyncConnector
createConnector
(com.aerospike.client.cluster.Cluster cluster, Node node, com.aerospike.client.async.AsyncConnector.Listener listener) Create async connector command.void
execute
(com.aerospike.client.cluster.Cluster cluster, com.aerospike.client.async.AsyncCommand command) Execute async command.void
Schedule execution of runnable command on event loop.void
executeBatchRetry
(Runnable other, com.aerospike.client.async.AsyncCommand command, long deadline) Execute async batch retry.boolean
Is current thread the event loop thread.void
putByteBuffer
(ByteBuffer byteBuffer) void
run()
void
Schedule execution with a reusable ScheduleTask.void
Schedule execution of runnable command with delay in milliseconds.Methods inherited from class com.aerospike.client.async.EventLoopBase
createState, getIndex, getProcessSize, getQueueSize
-
Constructor Details
-
NioEventLoop
public NioEventLoop(EventPolicy policy, SelectorProvider provider, int index, boolean daemon, String poolName) throws IOException Construct Aerospike event loop wrapper from NIO Selector.- Throws:
IOException
-
-
Method Details
-
execute
public void execute(com.aerospike.client.cluster.Cluster cluster, com.aerospike.client.async.AsyncCommand command) Execute async command. Execute immediately if in event loop. Otherwise, place command on event loop queue. -
execute
Schedule execution of runnable command on event loop. Command is placed on event loop queue and is never executed directly. -
executeBatchRetry
public void executeBatchRetry(Runnable other, com.aerospike.client.async.AsyncCommand command, long deadline) Execute async batch retry.- Specified by:
executeBatchRetry
in interfaceEventLoop
-
schedule
Schedule execution of runnable command with delay in milliseconds. -
schedule
Schedule execution with a reusable ScheduleTask. Saves memory allocation for repeatedly scheduled task. -
createConnector
public com.aerospike.client.async.AsyncConnector createConnector(com.aerospike.client.cluster.Cluster cluster, Node node, com.aerospike.client.async.AsyncConnector.Listener listener) Create async connector command.- Specified by:
createConnector
in interfaceEventLoop
-
inEventLoop
public boolean inEventLoop()Is current thread the event loop thread.- Specified by:
inEventLoop
in interfaceEventLoop
-
createByteBuffer
-
getByteBuffer
-
putByteBuffer
-
run
public void run() -
close
public void close()
-