org.eclipse.californium.core.network.Endpoint.destroy()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(124)

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

Endpoint.destroy介绍

[英]Destroys this endpoint and all its components. A destroyed endpoint cannot be started again.
[中]销毁此终结点及其所有组件。无法再次启动已销毁的终结点。

代码示例

代码示例来源:origin: org.eclipse.californium/californium-core

  1. /**
  2. * Reset default endpoints. Destroy all default endpoints.
  3. */
  4. public static void reset() {
  5. EndpointManager it = getEndpointManager();
  6. if (it.default_endpoint != null) {
  7. it.default_endpoint.destroy();
  8. it.default_endpoint = null;
  9. }
  10. if (it.default_secure_endpoint != null) {
  11. it.default_secure_endpoint.destroy();
  12. it.default_secure_endpoint = null;
  13. }
  14. }

代码示例来源:origin: eclipse/californium

  1. /**
  2. * Reset default endpoints. Destroy all default endpoints and clear their
  3. * set.
  4. */
  5. public static void reset() {
  6. EndpointManager it = getEndpointManager();
  7. if (it.default_endpoint != null) {
  8. it.default_endpoint.destroy();
  9. it.default_endpoint = null;
  10. }
  11. if (it.default_secure_endpoint != null) {
  12. it.default_secure_endpoint.destroy();
  13. it.default_secure_endpoint = null;
  14. }
  15. if (it.default_tcp_endpoint != null) {
  16. it.default_tcp_endpoint.destroy();
  17. it.default_tcp_endpoint = null;
  18. }
  19. if (it.default_secure_tpc_endpoint != null) {
  20. it.default_secure_tpc_endpoint.destroy();
  21. it.default_secure_tpc_endpoint = null;
  22. }
  23. }

代码示例来源:origin: org.eclipse.californium/californium-core

  1. /**
  2. * Destroys the server, i.e., unbinds from all ports and frees all system resources.
  3. */
  4. @Override
  5. public void destroy() {
  6. LOGGER.info("Destroy server");
  7. for (Endpoint ep:endpoints)
  8. ep.destroy();
  9. executor.shutdown(); // cannot be started again
  10. try {
  11. boolean succ = executor.awaitTermination(5, TimeUnit.SECONDS);
  12. if (!succ)
  13. LOGGER.warning("Server executor did not shutdown in time");
  14. } catch (InterruptedException e) {
  15. LOGGER.log(Level.WARNING, "Exception while terminating server executor", e);
  16. }
  17. }

代码示例来源:origin: eclipse/californium

  1. } finally {
  2. for (Endpoint ep : endpoints) {
  3. ep.destroy();

代码示例来源:origin: org.eclipse.californium/californium-core

  1. /**
  2. * Configures a new default endpoint. Any old default endpoint is destroyed.
  3. * @param endpoint the new default endpoint
  4. */
  5. public void setDefaultEndpoint(Endpoint endpoint) {
  6. if (this.default_endpoint!=null) {
  7. this.default_endpoint.destroy();
  8. }
  9. LOGGER.config(endpoint.getAddress()+" becomes default endpoint");
  10. this.default_endpoint = endpoint;
  11. if (!this.default_endpoint.isStarted()) {
  12. try {
  13. default_endpoint.start();
  14. } catch (IOException e) {
  15. LOGGER.log(Level.SEVERE, "Could not start new default endpoint", e);
  16. }
  17. }
  18. }

代码示例来源:origin: org.eclipse.californium/californium-core

  1. /**
  2. * Configures a new default secure endpoint. Any old default endpoint is destroyed.
  3. * @param endpoint the new default endpoint
  4. */
  5. public void setDefaultSecureEndpoint(Endpoint endpoint) {
  6. if (this.default_secure_endpoint!=null) {
  7. this.default_secure_endpoint.destroy();
  8. }
  9. this.default_secure_endpoint = endpoint;
  10. if (!this.default_secure_endpoint.isStarted()) {
  11. try {
  12. default_secure_endpoint.start();
  13. LOGGER.log(Level.INFO, "Started new default secure endpoint " + default_secure_endpoint.getAddress());
  14. } catch (IOException e) {
  15. LOGGER.log(Level.SEVERE, "Could not start new default secure endpoint", e);
  16. }
  17. }
  18. }

代码示例来源:origin: eclipse/californium

  1. /**
  2. * Configures a new default secure endpoint. Any old default endpoint is
  3. * destroyed.
  4. *
  5. * @param endpoint
  6. * the new default endpoint
  7. */
  8. public synchronized void setDefaultSecureEndpoint(Endpoint endpoint) {
  9. if (this.default_secure_endpoint != null) {
  10. this.default_secure_endpoint.destroy();
  11. }
  12. this.default_secure_endpoint = endpoint;
  13. if (!this.default_secure_endpoint.isStarted()) {
  14. try {
  15. default_secure_endpoint.start();
  16. LOGGER.log(Level.INFO, "Started new default secure endpoint {0}", default_secure_endpoint.getAddress());
  17. } catch (IOException e) {
  18. LOGGER.log(Level.SEVERE, "Could not start new default secure endpoint", e);
  19. }
  20. }
  21. }

代码示例来源:origin: eclipse/californium

  1. /**
  2. * Configures a new default endpoint. Any old default endpoint is destroyed.
  3. *
  4. * @param endpoint
  5. * the new default endpoint
  6. */
  7. public synchronized void setDefaultEndpoint(Endpoint endpoint) {
  8. if (this.default_endpoint != null) {
  9. this.default_endpoint.destroy();
  10. }
  11. LOGGER.log(Level.CONFIG, "{0} becomes default endpoint", endpoint.getAddress());
  12. this.default_endpoint = endpoint;
  13. if (!this.default_endpoint.isStarted()) {
  14. try {
  15. default_endpoint.start();
  16. } catch (IOException e) {
  17. LOGGER.log(Level.SEVERE, "Could not start new default endpoint", e);
  18. }
  19. }
  20. }

代码示例来源:origin: eclipse/californium

  1. /**
  2. * Configures a new secure tcp endpoint to use by default. Any old tcp
  3. * endpoint is destroyed.
  4. *
  5. * @param endpoint
  6. * the new default secure tcp endpoint.
  7. */
  8. public synchronized void setTcpEndpoint(Endpoint endpoint) {
  9. if (this.default_tcp_endpoint != null) {
  10. this.default_tcp_endpoint.destroy();
  11. }
  12. LOGGER.log(Level.CONFIG, "{0} becomes tcp endpoint", endpoint.getAddress());
  13. this.default_tcp_endpoint = endpoint;
  14. if (!this.default_tcp_endpoint.isStarted()) {
  15. try {
  16. default_tcp_endpoint.start();
  17. } catch (IOException e) {
  18. LOGGER.log(Level.SEVERE, "Could not start new tcp endpoint", e);
  19. }
  20. }
  21. }

代码示例来源:origin: eclipse/californium

  1. /**
  2. * Configures a new secure tcp endpoint to use by default. Any old tcp
  3. * endpoint is destroyed.
  4. *
  5. * @param endpoint
  6. * the new default secure tcp endpoint.
  7. */
  8. public synchronized void setSecureTcpEndpoint(Endpoint endpoint) {
  9. if (this.default_secure_tpc_endpoint != null) {
  10. this.default_secure_tpc_endpoint.destroy();
  11. }
  12. LOGGER.log(Level.CONFIG, "{0} becomes secure tcp endpoint", endpoint.getAddress());
  13. this.default_secure_tpc_endpoint = endpoint;
  14. if (!this.default_secure_tpc_endpoint.isStarted()) {
  15. try {
  16. default_secure_tpc_endpoint.start();
  17. } catch (IOException e) {
  18. LOGGER.log(Level.SEVERE, "Could not start new secure tcp endpoint", e);
  19. }
  20. }
  21. }

代码示例来源:origin: eclipse/californium

  1. @After
  2. public void destroyClient() throws Exception {
  3. clientEndpoint.destroy();
  4. }

代码示例来源:origin: eclipse/californium

  1. @After
  2. public void shutdownServer() {
  3. if (server != null) {
  4. server.destroy();
  5. }
  6. if (client != null) {
  7. client.destroy();
  8. }
  9. System.out.println(System.lineSeparator() + "End " + getClass().getSimpleName());
  10. }

代码示例来源:origin: eclipse/californium

  1. @After
  2. public void shutdownServer() {
  3. System.out.println();
  4. server.destroy();
  5. clientEndpoint.destroy();
  6. middle.stop();
  7. System.out.printf("End %s", getClass().getSimpleName());
  8. }

代码示例来源:origin: eclipse/californium

  1. @After
  2. public void shutdownEndpoints() {
  3. client.destroy();
  4. server.destroy();
  5. }

代码示例来源:origin: eclipse/californium

  1. @After
  2. public void shutdownEndpoints() {
  3. client.destroy();
  4. server.destroy();
  5. }

相关文章