gpt4 book ai didi

org.zeromq.ZContext.destroySocket()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 00:44:49 28 4
gpt4 key购买 nike

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

ZContext.destroySocket介绍

[英]Destroys managed socket within this context and remove from sockets list
[中]销毁此上下文中的托管套接字并从套接字列表中删除

代码示例

代码示例来源:origin: fbacchella/LogHub

public void close(Socket socket) {
  try {
    logger.debug("close socket {}: {}", socket, socket);
    socket.setLinger(0);
    context.destroySocket(socket);
  } catch (ZMQException|zmq.ZError.IOException|zmq.ZError.CtxTerminatedException|zmq.ZError.InstantiationException e) {
    ZMQHelper.logZMQException(logger, "close " + socket, e);
  } catch (java.nio.channels.ClosedSelectorException e) {
    logger.debug("in close: " + e);
  } catch (Exception e) {
    logger.error("in close: " + e);
  } finally {
  }
}

代码示例来源:origin: org.zeromq/jeromq

/**
 * Destructor.  Call this to gracefully terminate context and close any managed 0MQ sockets
 */
public void destroy()
{
  for (Socket socket : sockets) {
    destroySocket(socket);
  }
  sockets.clear();
  // Only terminate context if we are on the main thread
  if (isMain() && context != null) {
    context.term();
    context = null;
  }
}

代码示例来源:origin: org.zeromq/jeromq

@Override
  public boolean destroyed(ZContext ctx, Socket pipe, ZPoller poller)
  {
    if (capture != null) {
      ctx.destroySocket(capture);
    }
    state.alive = false;
    if (!state.restart) {
      status().send(pipe);
    }
    return state.restart;
  }
}

代码示例来源:origin: org.zeromq/jeromq

@Override
public boolean renews()
{
  // close every managed sockets
  Iterator<Socket> iter = sockets.iterator();
  while (iter.hasNext()) {
    final Socket socket = iter.next();
    iter.remove();
    if (socket != null) {
      poller.unregister(socket);
      context.destroySocket(socket);
      // call back the actor to inform that a socket has been closed.
      actor.closed(socket);
    }
  }
  // let the actor decide if the stage restarts a new double
  return actor.destroyed(context, pipe, poller);
}

代码示例来源:origin: org.projectreactor/reactor-net

@Override
public void run() {
  if (closed) {
    return;
  }
  if (null == zmq) {
    zmq = new ZContext(ioThreadCount);
    shutdownCtx = true;
  }
  socket = zmq.createSocket(socketType);
  socket.setIdentity(id.toString().getBytes());
  configure(socket);
  pollin = new ZMQ.PollItem(socket, ZMQ.Poller.POLLIN);
  if (log.isTraceEnabled()) {
    zloop.verbose(true);
  }
  zloop.addPoller(pollin, inputHandler, null);
  start(socket);
  zloop.start();
  zmq.destroySocket(socket);
}

代码示例来源:origin: io.projectreactor/reactor-net

@Override
public void run() {
  try {
    if (closed) {
      return;
    }
    if (null == zmq) {
      zmq = new ZContext(ioThreadCount);
      shutdownCtx = true;
    }
    socket = zmq.createSocket(socketType);
    socket.setIdentity(id.toString().getBytes());
    configure(socket);
    pollin = new ZMQ.PollItem(socket, ZMQ.Poller.POLLIN);
    if (log.isDebugEnabled()) {
      zloop.verbose(true);
    }
    zloop.addPoller(pollin, inputHandler, null);
    start(socket);
    zloop.start();
    zmq.destroySocket(socket);
  } catch (Exception e) {
    b.onError(e);
  }
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com