public QueryAggregateExecutor(Cluster cluster, QueryPolicy policy, Statement statement, Node node) throws AerospikeException { super(cluster, policy, statement, node); inputQueue = new ArrayBlockingQueue<LuaValue>(500); resultSet = new ResultSet(this, policy.recordQueueSize); // Work around luaj LuaInteger static initialization bug. // Calling LuaInteger.valueOf(long) is required because LuaValue.valueOf() does not have // a method that takes in a long parameter. The problem is directly calling // LuaInteger.valueOf(long) results in a static initialization error. // // If LuaValue.valueOf() is called before any luaj calls, then the static initializer in // LuaInteger will be initialized properly. LuaValue.valueOf(0); // Retrieve lua instance from cache. lua = LuaCache.getInstance(); try { // Initialize threads, but do not run yet. initializeThreads(); // Start Lua thread which reads from a queue, applies aggregate function and // writes to a result set. threadPool.execute(this); } catch (RuntimeException re) { // Put the lua instance back if thread creation fails. LuaCache.putInstance(lua); throw re; } }
public QueryAggregateExecutor(Cluster cluster, QueryPolicy policy, Statement statement, Node node) throws AerospikeException { super(cluster, policy, statement, node); inputQueue = new ArrayBlockingQueue<LuaValue>(500); resultSet = new ResultSet(this, policy.recordQueueSize);