|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--juju.reattore.core.reactor.impl.CombinedReactor
Base implementation of a combined server/client reactor
Constructor Summary | |
CombinedReactor()
Creates a new reactor. |
Method Summary | |
void |
attach(java.nio.channels.ServerSocketChannel ch,
ServerSocketHandler handler)
Binds this reactor to a new handler and socket. |
void |
attach(java.nio.channels.SocketChannel ch,
ClientSocketHandler handler)
Binds this reactor to a new handler and socket. |
void |
close()
Causes this reactor to stop once all of the handlers are done. |
void |
connect(java.nio.channels.SocketChannel ch,
java.net.SocketAddress addr,
ClientSocketHandler handler)
Similar to #attach, but takes a currently unconnected socket, connects it, and manages it. |
void |
go()
Hands over execution to this reactor. |
void |
poll()
Polls the list of sockets and processes any that have become active. |
void |
setStatsInterval(int interval)
Sets how often the statistics are dumped to the console. |
void |
stop()
Causes this reactor to asynchronisally stop. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CombinedReactor() throws java.io.IOException
java.io.IOException
- if a selector cannot be opened (fatal)Method Detail |
public void setStatsInterval(int interval)
interval
- The time in ms, or <=0 to disable.public void go() throws java.io.IOException
java.io.IOException
- if an unspecified (fatal) error occurs.public void stop()
public void close()
public void poll() throws java.io.IOException
java.io.IOException
- on a fatal error PENDINGpublic void attach(java.nio.channels.ServerSocketChannel ch, ServerSocketHandler handler) throws java.io.IOException
ServerSocketReactor
attach
in interface ServerSocketReactor
ch
- The socket to managehandler
- The handler to call when the socket changes
java.io.IOException
- on PENDINGServerSocketReactor
public void attach(java.nio.channels.SocketChannel ch, ClientSocketHandler handler) throws java.io.IOException
ClientSocketReactor
attach
in interface ClientSocketReactor
ch
- The socket to managehandler
- The handler to call when the socket changes
java.io.IOException
- on PENDINGClientSocketReactor
public void connect(java.nio.channels.SocketChannel ch, java.net.SocketAddress addr, ClientSocketHandler handler) throws java.io.IOException
ClientSocketReactor
connect
in interface ClientSocketReactor
ch
- The socket to manageaddr
- The address to connect tohandler
- The handler to call when the socket changes
java.io.IOException
- on PENDINGClientSocketReactor
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |