public AsyncCluster(AsyncClientPolicy policy, Host[] hosts) : base(policy, hosts)
        {
            maxCommands = policy.asyncMaxCommands;

            switch (policy.asyncMaxCommandAction)
            {
            case MaxCommandAction.REJECT: commandQueue = new AsyncCommandRejectingQueue(); break;

            case MaxCommandAction.BLOCK: commandQueue = new AsyncCommandBlockingQueue(); break;

            case MaxCommandAction.DELAY: commandQueue = new AsyncCommandDelayingQueue(); break;

            default: throw new AerospikeException(ResultCode.PARAMETER_ERROR, "Unsupported MaxCommandAction value: " + policy.asyncMaxCommandAction.ToString() + ".");
            }

            for (int i = 0; i < maxCommands; i++)
            {
                SocketAsyncEventArgs eventArgs = new SocketAsyncEventArgs();
                eventArgs.UserToken  = new BufferSegment();
                eventArgs.Completed += AsyncCommand.SocketListener;
                commandQueue.ReleaseArgs(eventArgs);
            }

            bufferPool = new BufferPool();
            InitTendThread(policy.failIfNotConnected);
        }
 public void PutEventArgs(SocketAsyncEventArgs args)
 {
     commandQueue.ReleaseArgs(args);
 }