org.jgroups.util

Class TimedWriter


public class TimedWriter
extends java.lang.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

Socket
createSocket(InetAddress local, InetAddress remote, int port, long timeout)
Tries to create a socket to remote_peer:remote_port.
static void
main(String[] args)
void
write(OutputStream out, byte[] buf, long timeout)
Writes data to an output stream.
void
write(OutputStream out, int i, long timeout)

Method Details

createSocket

public Socket createSocket(InetAddress local,
                           InetAddress remote,
                           int port,
                           long timeout)
            throws Exception,
                   org.jgroups.util.TimedWriter.Timeout,
                   InterruptedException
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)
            throws Exception,
                   org.jgroups.util.TimedWriter.Timeout,
                   InterruptedException
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)
            throws Exception,
                   org.jgroups.util.TimedWriter.Timeout,
                   InterruptedException


Copyright B) 2001,2002 www.jgroups.com . All Rights Reserved.