Package org.jtrim2.concurrent.query.io
Interface ChannelProcessor<DataType,ChannelType extends Channel>
- Type Parameters:
DataType- the type of the data provided by theChannelProcessorto theAsyncDataListenerChannelType- the type of the channel which can be handled and processed by theChannelProcessor
- All Known Implementing Classes:
DeserializerChannelProcessor
public interface ChannelProcessor<DataType,ChannelType extends Channel>
Defines an interface for processing the data of an open
Channel and
to forward the processed data to an AsyncDataListener.
This interface was designed for the AsyncChannelLink which relies
on a ChannelProcessor to actually process the content of the channel
opened and provide the requested data.
Thread safety
Implementations of this interface must be safe to be accessed by multiple threads concurrently.Synchronization transparency
Implementations of this interface are not required to be synchronization transparent.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceThe interface through which theChannelProcessormay set the current state of progress of the processing of the channel. -
Method Summary
Modifier and TypeMethodDescriptionvoidprocessChannel(ChannelType channel, AsyncDataListener<DataType> listener, ChannelProcessor.StateListener stateListener) Processes the content of specified open channel and forwards the processed content to the specifiedAsyncDataListener.
-
Method Details
-
processChannel
void processChannel(ChannelType channel, AsyncDataListener<DataType> listener, ChannelProcessor.StateListener stateListener) throws IOException Processes the content of specified open channel and forwards the processed content to the specifiedAsyncDataListener. This method may or may not call theonDoneReceivemethod of the specified listener but if it does, it must honor the contract of theAsyncDataListenerand stop forwarding anymore data.- Parameters:
channel- the channel whose content is to be processed and be forwarded to the specified listener. This channel may only be accessed in this method call and does not need to be closed in this method call. This argument cannot benull.listener- the listener to which processed data is to be forwarded. The data maybe forwarded only during this method call. TheonDoneReceivemethod of this listener does not need to be called by this method but otherwise, this method must honor the contract of the listener. This argument cannot benull.stateListener- theStateListenerthrough which this method call may show its current progress of processing the channel. This argument cannot benull.- Throws:
IOException- thrown if there was some error, while processing the channel. Throwing this exception, of course, means the termination of the data providing.
-