Package org.jgroups.util
Class TimedWriter
java.lang.Object
org.jgroups.util.TimedWriter
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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateSocket
(InetAddress local, InetAddress remote, int port, long timeout) Tries to create a socket to remote_peer:remote_port.static void
void
write
(OutputStream out, byte[] buf, long timeout) Writes data to an output stream.void
write
(OutputStream out, int i, long timeout)
-
Constructor Details
-
TimedWriter
public TimedWriter()
-
-
Method Details
-
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.- Throws:
Exception
org.jgroups.util.TimedWriter.Timeout
InterruptedException
-
write
public void write(OutputStream out, int i, long timeout) throws Exception, org.jgroups.util.TimedWriter.Timeout, InterruptedException - Throws:
Exception
org.jgroups.util.TimedWriter.Timeout
InterruptedException
-
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.- Throws:
Exception
org.jgroups.util.TimedWriter.Timeout
InterruptedException
-
main
-