Add a timed join() method to Channel, update Exec example

This commit is contained in:
Shikhar Bhushan
2011-02-12 20:23:58 +00:00
parent 75caa8bcf3
commit da2cec8fa2
3 changed files with 11 additions and 0 deletions

View File

@@ -272,6 +272,11 @@ public abstract class AbstractChannel
close.await();
}
public void join(int timeout, TimeUnit unit)
throws ConnectionException {
close.await(timeout, unit);
}
protected synchronized void sendClose()
throws TransportException {
try {

View File

@@ -23,6 +23,7 @@ import net.schmizz.sshj.transport.TransportException;
import java.io.Closeable;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.concurrent.TimeUnit;
/** A channel is the basic medium for application-layer data on top of an SSH transport. */
public interface Channel
@@ -138,4 +139,7 @@ public interface Channel
void join()
throws ConnectionException;
void join(int timeout, TimeUnit unit)
throws ConnectionException;
}