hudson.remoting.Channel.getCloseRequestCause()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(288)

本文整理了Java中hudson.remoting.Channel.getCloseRequestCause()方法的一些代码示例,展示了Channel.getCloseRequestCause()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Channel.getCloseRequestCause()方法的具体详情如下:
包路径:hudson.remoting.Channel
类名称:Channel
方法名:getCloseRequestCause

Channel.getCloseRequestCause介绍

[英]Gets cause of the close request.
[中]获取关闭请求的原因。

代码示例

代码示例来源:origin: jenkinsci/jenkins

  1. @Override
  2. public Channel getOpenChannelOrFail() throws ChannelClosedException {
  3. final Channel ch = getChannelOrFail();
  4. if (ch.isClosingOrClosed()) { // TODO: Since Remoting 2.33, we still need to explicitly declare minimum Remoting version
  5. throw new ChannelClosedException(new IllegalStateException("The associated channel " + ch + " is closing down or has closed down", ch.getCloseRequestCause()));
  6. }
  7. return ch;
  8. }
  9. }

代码示例来源:origin: jenkinsci/remoting

  1. @Override
  2. public void checkIfCanBeExecutedOnChannel(Channel channel) throws IOException {
  3. // Default check for all requests
  4. super.checkIfCanBeExecutedOnChannel(channel);
  5. // We also do not want to run UserRequests when the channel is being closed
  6. if (channel.isClosingOrClosed()) {
  7. throw new ChannelClosedException("The request cannot be executed on channel " + channel + ". "
  8. + "The channel is closing down or has closed down", channel.getCloseRequestCause());
  9. }
  10. }
  11. }

代码示例来源:origin: jenkinsci/remoting

  1. @Override
  2. public void checkIfCanBeExecutedOnChannel(Channel channel) throws IOException {
  3. // Default check for all requests
  4. super.checkIfCanBeExecutedOnChannel(channel);
  5. // We also do not want to run UserRequests when the channel is being closed
  6. if (channel.isClosingOrClosed()) {
  7. throw new ChannelClosedException("The request cannot be executed on channel " + channel + ". "
  8. + "The channel is closing down or has closed down", channel.getCloseRequestCause());
  9. }
  10. }

代码示例来源:origin: jenkinsci/remoting

  1. /**
  2. * Gets an open channel, which is ready to accept commands.
  3. *
  4. * It is a convenience method for cases, when a callable needs to invoke call backs on the master.
  5. * In such case the requests will be likely failed by {@linkplain UserRequest} logic anyway, but it is better to fail fast.
  6. *
  7. * @return Channel instance
  8. * @throws ChannelStateException The channel is closing down or has been closed.
  9. * Also happens if the channel is not associated with the thread at all.
  10. * @since TODO
  11. */
  12. @Nonnull
  13. default Channel getOpenChannelOrFail() throws ChannelStateException {
  14. final Channel ch = getChannelOrFail();
  15. if (ch.isClosingOrClosed()) {
  16. throw new ChannelClosedException(ch, "The associated channel " + ch + " is closing down or has closed down", ch.getCloseRequestCause());
  17. }
  18. return ch;
  19. }
  20. }

代码示例来源:origin: jenkinsci/remoting

  1. + "The channel is closing down or has closed down", getCloseRequestCause());

代码示例来源:origin: jenkinsci/remoting

  1. /**
  2. * {@inheritDoc}
  3. */
  4. public <V,T extends Throwable>
  5. Future<V> callAsync(final Callable<V,T> callable) throws IOException {
  6. if (isClosingOrClosed()) {
  7. // No reason to even try performing a user request
  8. throw new ChannelClosedException("Remote call on " + name + " failed. "
  9. + "The channel is closing down or has closed down", getCloseRequestCause());
  10. }
  11. final Future<UserRequest.ResponseToUserRequest<V, T>> f = new UserRequest<V, T>(this, callable).callAsync(this);
  12. return new FutureAdapter<V, UserRequest.ResponseToUserRequest<V, T>>(f) {
  13. @Override
  14. protected V adapt(UserRequest.ResponseToUserRequest<V, T> r) throws ExecutionException {
  15. try {
  16. return r.retrieve(Channel.this, UserRequest.getClassLoader(callable));
  17. } catch (Throwable t) {// really means catch(T t)
  18. throw new ExecutionException(t);
  19. }
  20. }
  21. };
  22. }

相关文章