All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.craft.atom.nio.NioOrderedDirectChannelEventDispatcher Maven / Gradle / Ivy

There is a newer version: 3.1.2
Show newest version
package io.craft.atom.nio;

import io.craft.atom.io.ChannelEvent;
import io.craft.atom.nio.spi.AbstractNioChannelEventDispatcher;
import io.craft.atom.nio.spi.NioChannelEventDispatcher;
import lombok.ToString;


/**
 * An {@link NioChannelEventDispatcher} that maintains order of {@link NioByteChannelEvent} in the same channel.
 * It use io process thread pool to dispatch event.
 * 
 * @author mindwind
 * @version 1.0, Feb 22, 2013
 */
@ToString(callSuper = true)
public class NioOrderedDirectChannelEventDispatcher extends AbstractNioChannelEventDispatcher {
	
	
	public NioOrderedDirectChannelEventDispatcher() {
		super();
	}

	public NioOrderedDirectChannelEventDispatcher(int totalEventSize) {
		super(totalEventSize);
	}
	
	
	// ~ ------------------------------------------------------------------------------------------------------------

	
	@Override
	public void dispatch(ChannelEvent event) {
		NioByteChannel channel = (NioByteChannel) event.getChannel();
		beforeDispatch(channel);
		try {
			event.fire();
		} finally {
			afterDispatch(channel);
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy