org.javagroups.util
Class TimedWriter
java.lang.Object
|
+--org.javagroups.util.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 |
java.net.Socket |
createSocket(java.net.InetAddress local,
java.net.InetAddress remote,
int port,
long timeout)
Tries to create a socket to remote_peer:remote_port. |
static void |
main(java.lang.String[] args)
|
void |
write(java.io.OutputStream out,
byte[] buf,
long timeout)
Writes data to an output stream. |
void |
write(java.io.OutputStream out,
int i,
long timeout)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TimedWriter
public TimedWriter()
write
public void write(java.io.OutputStream out,
byte[] buf,
long timeout)
throws java.lang.Exception,
org.javagroups.util.TimedWriter.Timeout,
java.lang.InterruptedException
- Writes data to an output stream. If the method does not return within timeout milliseconds,
a Timeout exception will be thrown.
java.lang.Exception
org.javagroups.util.TimedWriter.Timeout
java.lang.InterruptedException
write
public void write(java.io.OutputStream out,
int i,
long timeout)
throws java.lang.Exception,
org.javagroups.util.TimedWriter.Timeout,
java.lang.InterruptedException
java.lang.Exception
org.javagroups.util.TimedWriter.Timeout
java.lang.InterruptedException
createSocket
public java.net.Socket createSocket(java.net.InetAddress local,
java.net.InetAddress remote,
int port,
long timeout)
throws java.lang.Exception,
org.javagroups.util.TimedWriter.Timeout,
java.lang.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.
java.lang.Exception
org.javagroups.util.TimedWriter.Timeout
java.lang.InterruptedException
main
public static void main(java.lang.String[] args)
Copyright ? 2001,2002 www.javagroups.com . All Rights Reserved.