Search in sources :

Example 6 with RecordSequenceListener

use of com.aerospike.client.listener.RecordSequenceListener in project aerospike-client-java by aerospike.

the class TestAsyncScan method asyncScan.

@Test
public void asyncScan() {
    recordCount = 0;
    ScanPolicy policy = new ScanPolicy();
    client.scanAll(eventLoop, new RecordSequenceListener() {

        @Override
        public void onRecord(Key key, Record record) throws AerospikeException {
            recordCount++;
            if ((recordCount % 10000) == 0) {
                ;
            }
        }

        @Override
        public void onSuccess() {
            notifyComplete();
        }

        @Override
        public void onFailure(AerospikeException e) {
            setError(e);
            notifyComplete();
        }
    }, policy, args.namespace, args.set);
    waitTillComplete();
}
Also used : AerospikeException(com.aerospike.client.AerospikeException) RecordSequenceListener(com.aerospike.client.listener.RecordSequenceListener) ScanPolicy(com.aerospike.client.policy.ScanPolicy) Record(com.aerospike.client.Record) Key(com.aerospike.client.Key) Test(org.junit.Test)

Aggregations

AerospikeException (com.aerospike.client.AerospikeException)6 Key (com.aerospike.client.Key)6 Record (com.aerospike.client.Record)6 RecordSequenceListener (com.aerospike.client.listener.RecordSequenceListener)6 ScanPolicy (com.aerospike.client.policy.ScanPolicy)3 Statement (com.aerospike.client.query.Statement)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 Test (org.junit.Test)2 PartitionFilter (com.aerospike.client.query.PartitionFilter)1