org.esbtools.eventhandler.lightblue.client

Class BulkLightblueRequester

  • java.lang.Object
    • org.esbtools.eventhandler.lightblue.client.BulkLightblueRequester
  • All Implemented Interfaces:
    LightblueRequester, Requester<com.redhat.lightblue.client.request.CRUDRequest,com.redhat.lightblue.client.response.LightblueDataResponse>


    public class BulkLightblueRequester
    extends Object
    implements LightblueRequester
    A partially thread-safe requester which queues up requests until an associated Future is resolved, at which point all queued requests are performed in a single batch.

    This class may be used across multiple threads safely, however the returned Futures are not threadsafe. That is, a given future instance should not be shared among multiple threads, which should not be a relevant limitation (if it is, however, it would not be hard to make them thread safe). Requests are queued up atomically, and performed and cleared atomically as well. That is, when one future is resolved, the current batch of requests is frozen, copied, cleared, and performed. A thread queueing a request while another thread resolves a future will not result in a loss of requests. It will either make it in for the batch, or be queued for the next.

    While this class is thread safe, the logical "scope" of returned Futures is significant to consider. If you know you are going to batch up a bunch of requests, you don't want some other thread interrupting your batch performing your requests before you've finished queueing all of them up. So, you should create a new BulkLightblueRequester instance per logical "batch," and generally should avoid sharing an instance among multiple threads.

    • Constructor Detail

      • BulkLightblueRequester

        public BulkLightblueRequester(com.redhat.lightblue.client.LightblueClient lightblue)
      • BulkLightblueRequester

        public BulkLightblueRequester(com.redhat.lightblue.client.LightblueClient lightblue,
                                      boolean ordered)

Copyright © 2017. All rights reserved.