I executing Lua-function in async mode and I use NIOEventLoops. When I try getting the next event loop and execute Lua-function I have some exception:
com.aerospike.client.AerospikeException$Connection: Error -7 from BB967EF43270008 127.0.0.1 3000: Node BB967EF43270008 127.0.0.1 3000 event loop 5 max connections 100 would be exceeded.
at com.aerospike.client.cluster.Node.getAsyncConnection(Node.java:657) ~[aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioCommand.executeCommand(NioCommand.java:184) [aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioCommand.run(NioCommand.java:146) [aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioEventLoop.registerCommands(NioEventLoop.java:211) [aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioEventLoop.runCommands(NioEventLoop.java:173) [aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioEventLoop.run(NioEventLoop.java:156) [aerospike-client-4.2.2.jar:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]
That is my method for getting the next event loop:
private synchronized EventLoop getNextEventLoop() {
EventLoop next;
do {
next = eventLoops.next();
} while (next.getProcessSize() >= maxConnectionsPerEventLoop);
return next;
}
That is how I executing my Lua-function:
as.execute(getNextEventLoop()
, new ExecuteListener() {
@Override
public void onSuccess(Key key, Object obj) {
...
}
@Override
public void onFailure(AerospikeException exception) {
...
}
}
, writePolicy
, key
, "lua-pack"
, "funcName"
, Value.get(binName), Value.get(value)
);
How can I avoid this exception?