org.glassfish.grizzly.Transport.shutdownNow()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(1.4k)|赞(0)|评价(0)|浏览(97)

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

Transport.shutdownNow介绍

[英]Forcibly stops the transport and closes all connections.
[中]强制停止传输并关闭所有连接。

代码示例

代码示例来源:origin: javaee/grizzly

private void stopClientTransport() throws IOException {
  if (clientTransport != null) {
    final Transport localTransport = clientTransport;
    clientTransport = null;
    
    try {
      localTransport.shutdownNow();
    } catch (IOException ignored) {
    }
  }
}

代码示例来源:origin: javaee/grizzly

/**
   * Stops the server.
   */
  public void stop() throws IOException {
    if (!isRunning) {
      return;
    }
    
    final Transport localTransport = transport;
    transport = null;

    localTransport.shutdownNow();
  }
}

代码示例来源:origin: eclipse-ee4j/tyrus

@Override
  public void close() {
    super.close();
    try {
      if (sharedTransport) {
        connection.close();
      } else {
        connection.getTransport().shutdownNow();
      }
    } catch (IOException e) {
      Logger.getLogger(GrizzlyClientFilter.class.getName())
         .log(Level.INFO, "Exception thrown during shutdown.", e);
    }
  }
};

代码示例来源:origin: org.glassfish.tyrus/tyrus-container-grizzly-client

@Override
  public void close() {
    super.close();
    try {
      if (sharedTransport) {
        connection.close();
      } else {
        connection.getTransport().shutdownNow();
      }
    } catch (IOException e) {
      Logger.getLogger(GrizzlyClientFilter.class.getName())
         .log(Level.INFO, "Exception thrown during shutdown.", e);
    }
  }
};

相关文章