org.jgroups.util

Class TimedWriter

public class TimedWriter extends Object

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

Method Summary
SocketcreateSocket(InetAddress local, InetAddress remote, int port, long timeout)
Tries to create a socket to remote_peer:remote_port.
static voidmain(String[] args)
voidwrite(OutputStream out, byte[] buf, long timeout)
Writes data to an output stream.
voidwrite(OutputStream out, int i, long timeout)

Method Detail

createSocket

public Socket createSocket(InetAddress local, InetAddress remote, int port, long timeout)
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.

main

public static void main(String[] args)

write

public void write(OutputStream out, byte[] buf, long timeout)
Writes data to an output stream. If the method does not return within timeout milliseconds, a Timeout exception will be thrown.

write

public void write(OutputStream out, int i, long timeout)
Copyright ? 1998-2005 Bela Ban. All Rights Reserved.