本文整理了Java中hudson.remoting.Channel.getCloseRequestCause()
方法的一些代码示例,展示了Channel.getCloseRequestCause()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Channel.getCloseRequestCause()
方法的具体详情如下:
包路径:hudson.remoting.Channel
类名称:Channel
方法名:getCloseRequestCause
[英]Gets cause of the close request.
[中]获取关闭请求的原因。
代码示例来源:origin: jenkinsci/jenkins
@Override
public Channel getOpenChannelOrFail() throws ChannelClosedException {
final Channel ch = getChannelOrFail();
if (ch.isClosingOrClosed()) { // TODO: Since Remoting 2.33, we still need to explicitly declare minimum Remoting version
throw new ChannelClosedException(new IllegalStateException("The associated channel " + ch + " is closing down or has closed down", ch.getCloseRequestCause()));
}
return ch;
}
}
代码示例来源:origin: jenkinsci/remoting
@Override
public void checkIfCanBeExecutedOnChannel(Channel channel) throws IOException {
// Default check for all requests
super.checkIfCanBeExecutedOnChannel(channel);
// We also do not want to run UserRequests when the channel is being closed
if (channel.isClosingOrClosed()) {
throw new ChannelClosedException("The request cannot be executed on channel " + channel + ". "
+ "The channel is closing down or has closed down", channel.getCloseRequestCause());
}
}
}
代码示例来源:origin: jenkinsci/remoting
@Override
public void checkIfCanBeExecutedOnChannel(Channel channel) throws IOException {
// Default check for all requests
super.checkIfCanBeExecutedOnChannel(channel);
// We also do not want to run UserRequests when the channel is being closed
if (channel.isClosingOrClosed()) {
throw new ChannelClosedException("The request cannot be executed on channel " + channel + ". "
+ "The channel is closing down or has closed down", channel.getCloseRequestCause());
}
}
代码示例来源:origin: jenkinsci/remoting
/**
* Gets an open channel, which is ready to accept commands.
*
* It is a convenience method for cases, when a callable needs to invoke call backs on the master.
* In such case the requests will be likely failed by {@linkplain UserRequest} logic anyway, but it is better to fail fast.
*
* @return Channel instance
* @throws ChannelStateException The channel is closing down or has been closed.
* Also happens if the channel is not associated with the thread at all.
* @since TODO
*/
@Nonnull
default Channel getOpenChannelOrFail() throws ChannelStateException {
final Channel ch = getChannelOrFail();
if (ch.isClosingOrClosed()) {
throw new ChannelClosedException(ch, "The associated channel " + ch + " is closing down or has closed down", ch.getCloseRequestCause());
}
return ch;
}
}
代码示例来源:origin: jenkinsci/remoting
+ "The channel is closing down or has closed down", getCloseRequestCause());
代码示例来源:origin: jenkinsci/remoting
/**
* {@inheritDoc}
*/
public <V,T extends Throwable>
Future<V> callAsync(final Callable<V,T> callable) throws IOException {
if (isClosingOrClosed()) {
// No reason to even try performing a user request
throw new ChannelClosedException("Remote call on " + name + " failed. "
+ "The channel is closing down or has closed down", getCloseRequestCause());
}
final Future<UserRequest.ResponseToUserRequest<V, T>> f = new UserRequest<V, T>(this, callable).callAsync(this);
return new FutureAdapter<V, UserRequest.ResponseToUserRequest<V, T>>(f) {
@Override
protected V adapt(UserRequest.ResponseToUserRequest<V, T> r) throws ExecutionException {
try {
return r.retrieve(Channel.this, UserRequest.getClassLoader(callable));
} catch (Throwable t) {// really means catch(T t)
throw new ExecutionException(t);
}
}
};
}
内容来源于网络,如有侵权,请联系作者删除!