Can I designate a specific selector?

Hi, I use the java async api. I am executing 2 queries at once that both rely on the RecordSequenceListener interface (one is batch request for records given a list of keys and the other is a geospatial query). I’m OK with not knowing which one will call onSuccess first, but it’d be really helpful if I didn’t need to synchronize them (ie - selector-thread-1 and selector-thread-2 are each calling onSuccess at the same time). Is there a way for me to do something like this:

  • send first request
  • send second request such that it’ll use the same selector thread as the first request
  • onSuccess first or second request
  • onSuccess the other

I haven’t dug deep enough into the java implementation to even know if that’s possible.

Thanks, Ben

Unfortunately, there is no current way to specify which selector thread to use when issuing an async command. Potential solutions are:

  1. Use AtomicBoolean to determine which command finishes first.

  2. Issue geospatial query in batch callback (commands issued sequentially).

  3. Create exactly one selector thread on startup.

© 2015 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.