Class AbstractNonBlockingReceiveOperationHandler

java.lang.Object
org.openspaces.events.polling.receive.AbstractNonBlockingReceiveOperationHandler
All Implemented Interfaces:
ReceiveOperationHandler
Direct Known Subclasses:
AbstractMemoryOnlySearchReceiveOperationHandler

public abstract class AbstractNonBlockingReceiveOperationHandler extends Object implements ReceiveOperationHandler
Support class to perform either non blocking or blocking receive operation.
Author:
kimchy
  • Field Details

    • nonBlocking

      protected boolean nonBlocking
    • nonBlockingFactor

      protected int nonBlockingFactor
  • Constructor Details

    • AbstractNonBlockingReceiveOperationHandler

      public AbstractNonBlockingReceiveOperationHandler()
  • Method Details

    • setNonBlocking

      public void setNonBlocking(boolean nonBlocking)
      Allows to configure the take operation to be performed in a non blocking manner.

      If configured to use non blocking, will perform setNonBlockingFactor(int) number of non blocking operations (default to 10) within the receive timeout.

    • setNonBlockingFactor

      public void setNonBlockingFactor(int nonBlockingFactor)
      The factor (number of times) to perform the receive operation when working in non blocking mode within the given receive timeout. Defaults to 10.
    • receive

      public Object receive(Object template, GigaSpace gigaSpace, long receiveTimeout) throws org.springframework.dao.DataAccessException
      Performs the receive operation. If blocking, we call doReceiveBlocking(Object, org.openspaces.core.GigaSpace, long) and expect it to block for the receive timeout (or until a match is found). If non blocking, will perform setNonBlockingFactor(int) number of doReceiveNonBlocking(Object, org.openspaces.core.GigaSpace) operations within the receive timeout (default factor is 10).
      Specified by:
      receive in interface ReceiveOperationHandler
      Parameters:
      template - The template to use for the receive operation.
      gigaSpace - The GigaSpace interface to perform the receive operations with
      receiveTimeout - Receive timeout value
      Returns:
      The receive result. null indicating no receive occurred. Single object or an array of objects indicating the receive operation result.
      Throws:
      org.springframework.dao.DataAccessException
    • doReceiveBlocking

      protected abstract Object doReceiveBlocking(Object template, GigaSpace gigaSpace, long receiveTimeout) throws org.springframework.dao.DataAccessException
      Performs a receive operations in a blocking manner.
      Throws:
      org.springframework.dao.DataAccessException
    • doReceiveNonBlocking

      protected abstract Object doReceiveNonBlocking(Object template, GigaSpace gigaSpace) throws org.springframework.dao.DataAccessException
      Performs a receive operations in a non blocking manner.
      Throws:
      org.springframework.dao.DataAccessException