mirror of
https://github.com/LamGC/Oracle-Sentry.git
synced 2025-04-29 14:17:34 +00:00
feat: CommandExecSession 的 waitFor(long) 方法支持通过返回值传递是否超时.
现在 waitFor(long) 方法在超过指定时间返回后, 将会通过 boolean 返回值告诉调用方是否超时. 详细信息见 Javadoc.
This commit is contained in:
parent
d6738d635c
commit
b8b2268d2e
@ -54,9 +54,11 @@ public final class CommandExecSession implements Closeable {
|
||||
/**
|
||||
* 等待程序执行完毕.
|
||||
* @param timeout 超时时间, 0 为无限等待(单位: 毫秒).
|
||||
* @return 如果在超时时间内返回, 返回 {@code true}, 超时返回 {@code false}.
|
||||
*/
|
||||
public void waitFor(long timeout) {
|
||||
channelExec.waitFor(EnumSet.of(ClientChannelEvent.EXIT_STATUS, ClientChannelEvent.EXIT_SIGNAL), timeout);
|
||||
public boolean waitFor(long timeout) {
|
||||
return !channelExec.waitFor(EnumSet.of(ClientChannelEvent.EXIT_STATUS, ClientChannelEvent.EXIT_SIGNAL), timeout)
|
||||
.contains(ClientChannelEvent.TIMEOUT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user