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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ObjectdoReceiveBlocking(Object template, GigaSpace gigaSpace, long receiveTimeout) Performs a receive operations in a blocking manner.protected abstract ObjectdoReceiveNonBlocking(Object template, GigaSpace gigaSpace) Performs a receive operations in a non blocking manner.Performs the receive operation.voidsetNonBlocking(boolean nonBlocking) Allows to configure the take operation to be performed in a non blocking manner.voidsetNonBlockingFactor(int nonBlockingFactor) The factor (number of times) to perform the receive operation when working in non blocking mode within the given receive timeout.
-
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 to10. -
receive
public Object receive(Object template, GigaSpace gigaSpace, long receiveTimeout) throws org.springframework.dao.DataAccessException Performs the receive operation. If blocking, we calldoReceiveBlocking(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 performsetNonBlockingFactor(int)number ofdoReceiveNonBlocking(Object, org.openspaces.core.GigaSpace)operations within the receive timeout (default factor is 10).- Specified by:
receivein interfaceReceiveOperationHandler- Parameters:
template- The template to use for the receive operation.gigaSpace- The GigaSpace interface to perform the receive operations withreceiveTimeout- Receive timeout value- Returns:
- The receive result.
nullindicating 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
-