| java.lang.Object org.jgroups.util.TimedWriter
TimedWriter | public class TimedWriter (Code) | | Waits until the buffer has been written to the output stream, or until timeout msecs have elapsed,
whichever comes first.
TODO: make it more generic, so all sorts of timed commands should be executable. Including return
values, exceptions and Timeout exception. Also use ReusableThread instead of creating a new threa
each time.
author: Bela Ban |
Inner Class :static class Timeout extends Exception | |
Inner Class :class WriterThread extends Thread | |
Inner Class :class SocketCreator extends Thread | |
Method Summary | |
public synchronized Socket | createSocket(InetAddress local, InetAddress remote, int port, long timeout) Tries to create a socket to remote_peer:remote_port. | public static void | main(String[] args) | void | start(InetAddress local, InetAddress remote, int peer_port) | void | start(OutputStream out, byte[] buf) | void | start(OutputStream out, int i) | void | stop() | public synchronized void | write(OutputStream out, byte[] buf, long timeout) Writes data to an output stream. | public synchronized void | write(OutputStream out, int i, long timeout) |
completed | boolean completed(Code) | | |
createSocket | public synchronized Socket createSocket(InetAddress local, InetAddress remote, int port, long timeout) throws Exception, Timeout, InterruptedException(Code) | | Tries to create a socket to remote_peer:remote_port. If not sucessful within timeout
milliseconds, throws the Timeout exception. Otherwise, returns the socket or throws an
IOException.
|
write | public synchronized void write(OutputStream out, byte[] buf, long timeout) throws Exception, Timeout, InterruptedException(Code) | | Writes data to an output stream. If the method does not return within timeout milliseconds,
a Timeout exception will be thrown.
|
|
|