org.apache.mina.core.filterchain.DefaultIoFilterChain Java Examples

The following examples show how to use org.apache.mina.core.filterchain.DefaultIoFilterChain. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NioSession.java    From jane with GNU Lesser General Public License v3.0 6 votes vote down vote up
NioSession(AbstractIoService service, SocketChannel channel, ConnectFuture future) {
	this.service = service;
	this.channel = channel;
	config = new SessionConfigImpl(service);
	IoSessionDataStructureFactory factory = service.getSessionDataStructureFactory();
	attributes = factory.getAttributeMap(this);
	writeRequestQueue = factory.getWriteRequestQueue(this);
	if (future != null) {
		// DefaultIoFilterChain will notify the future. (We support ConnectFuture only for now).
		setAttribute(DefaultIoFilterChain.SESSION_CREATED_FUTURE, future);
		// In case that ConnectFuture.cancel() is invoked before setSession() is invoked,
		// add a listener that closes the connection immediately on cancellation.
		future.addListener((ConnectFuture cf) -> {
			if (cf.isCanceled())
				closeNow();
		});
	}
}
 
Example #2
Source File: NioSession.java    From neoscada with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * 
 * Creates a new instance of NioSession, with its associated IoProcessor.
 * <br>
 * This method is only called by the inherited class.
 *
 * @param processor The associated IoProcessor
 */
protected NioSession(IoProcessor<NioSession> processor, IoService service, Channel channel) {
    super(service);
    this.channel = channel;
    this.processor = processor;
    filterChain = new DefaultIoFilterChain(this);
}