Package org.spiderwiz.zutils
Interface ZDispenser<T>
- Type Parameters:
T- type of the buffered objects.
- All Known Implementing Classes:
Channel
public interface ZDispenser<T>
Used by
ZBuffer to dispense buffered objects.
A ZBuffer that runs on its own thread uses an implementation of this interface for dispensing the
pulled objects.
- See Also:
ZBuffer
-
Method Details
-
dispense
Dispenses the objects pulled from the associatedZBufferobject.Implement this method to handle objects that are pulled from the associated buffer. The
objectparameter is the dispensed object. It can benullif the buffer's pull waiting time is limited and there are no objects in the buffer. Theurgentparameter tells that the object was pushed to the bottom of the buffer because of its urgency, and therefore it should be handled accordingly. For instance if the dispensed objects are written to a communication socket, the socket should be flushed after writing urgent objects.- Parameters:
object- the object pulled from the associated buffer, or null if the buffer is empty.urgent- marks an urgent object.
-
handleException
Handles an exception occurred while processing the associatedZBufferobject.Implement this method to handle exceptions in the associated buffer.
- Parameters:
ex- the exception.
-