net.sf.jbaobab.io
Class SimpleSocketCore<P>
java.lang.Object
net.sf.jbaobab.io.SimpleSocketCore<P>
- All Implemented Interfaces:
- ChannelCore<P>, SocketCore<P>
- Direct Known Subclasses:
- ThreadedSocketCore
public class SimpleSocketCore<P>
- extends Object
- implements SocketCore<P>
A SocketCore
that shares same thread with ChannelManager
.
- Author:
- Oakyoon Cha
DEBUG
protected static final boolean DEBUG
EOF
protected static ByteBuffer EOF
protocol
protected Protocol<P> protocol
buffer
protected GrowingByteBuffer buffer
queue
protected Queue<ByteBuffer> queue
channel
protected SocketChannel channel
receiver
protected ChannelManager<SocketChannel> receiver
sender
protected ChannelManager<SocketChannel> sender
SimpleSocketCore
public SimpleSocketCore(Protocol<P> protocol)
prepare
public void prepare(SocketChannel channel,
ChannelManager<SocketChannel> receiver,
ChannelManager<SocketChannel> sender)
- Specified by:
prepare
in interface SocketCore<P>
channel
public SocketChannel channel()
- Specified by:
channel
in interface SocketCore<P>
protocol
public Protocol<P> protocol()
- Specified by:
protocol
in interface ChannelCore<P>
receive
public int receive(PacketHandler<P> handler)
throws IOException
- Specified by:
receive
in interface ChannelCore<P>
- Throws:
IOException
send
public int send()
throws IOException
- Specified by:
send
in interface ChannelCore<P>
- Throws:
IOException
shutdown
public void shutdown()
- Specified by:
shutdown
in interface ChannelCore<P>
schedulePacket
public void schedulePacket(P packet)
- Specified by:
schedulePacket
in interface ChannelCore<P>
scheduleShutdown
public void scheduleShutdown()
- Specified by:
scheduleShutdown
in interface ChannelCore<P>
track
public String track()
- Specified by:
track
in interface ChannelCore<P>
toString
public String toString()
- Overrides:
toString
in class Object