net.sf.jbaobab.io
Class ThreadedSocketCore<P>
java.lang.Object
net.sf.jbaobab.io.SimpleSocketCore<P>
net.sf.jbaobab.io.ThreadedSocketCore<P>
- All Implemented Interfaces:
- ChannelCore<P>, SocketCore<P>
public class ThreadedSocketCore<P>
- extends SimpleSocketCore<P>
A SocketCore
that runs Protocol
jobs on root executor
(obtained with ExecutorPool.getRootExecutor()
)
and runs on PacketHandler
jobs given
ExecutorService
.
- Author:
- Oakyoon Cha
- See Also:
ExecutorPool
factory
protected ProtocolFactory<P> factory
protocol
protected ThreadLocal<Protocol<P>> protocol
protocolExecutor
protected ExecutorService protocolExecutor
packetJobExecutor
protected ExecutorService packetJobExecutor
ThreadedSocketCore
public ThreadedSocketCore(ProtocolFactory<P> factory,
ExecutorService executor)
ThreadedSocketCore
public ThreadedSocketCore(ProtocolFactory<P> factory)
executor
public ExecutorService executor()
protocol
public Protocol<P> protocol()
- Specified by:
protocol
in interface ChannelCore<P>
- Overrides:
protocol
in class SimpleSocketCore<P>
receive
public int receive(PacketHandler<P> handler)
throws IOException
- Specified by:
receive
in interface ChannelCore<P>
- Overrides:
receive
in class SimpleSocketCore<P>
- Throws:
IOException