gpt4 book ai didi

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

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

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

ZMQException.<init>介绍

暂无

代码示例

代码示例来源:origin: zeromq/jzmq

/**
 * Bind to network interface to a random port. Start listening for new connections.
 * 
 * @param addr the endpoint to bind to.
 * @param min_port The minimum port in the range of ports to try.
 * @param max_port The maximum port in the range of ports to try.
 * @param max_tries The number of attempt to bind.
 */
public int bindToRandomPort(String addr, int min_port, int max_port, int max_tries) {
  int port;
  Random rand = new Random();
  for (int i = 0; i < max_tries; i++) {
    port = rand.nextInt(max_port - min_port + 1) + min_port;
    try {
      bind(String.format("%s:%s", addr, port));
      return port;
    } catch (ZMQException e) {
      if (e.getErrorCode() != ZMQ.EADDRINUSE()) {
        throw e;
      }
      continue;
    }
  }
  throw new ZMQException("Could not bind socket to random port.", (int) ZMQ.EADDRINUSE());
}

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

private void mayRaise()
{
  final int errno = socketBase.errno();
  if (errno != 0 && errno != ZError.EAGAIN) {
    throw new ZMQException(errno);
  }
}

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

private void mayRaise()
{
  int errno = base.errno();
  if (errno != 0 && errno != zmq.ZError.EAGAIN) {
    throw new ZMQException(errno);
  }
}

代码示例来源:origin: tlrx/transport-zeromq

public ZMQRestResponse process(ZMQRestRequest request){
  
  final CountDownLatch latch = new CountDownLatch(1);
  final AtomicReference<ZMQRestResponse> ref = new AtomicReference<ZMQRestResponse>();
  
  this.restController.dispatchRequest(request, new RestChannel() {
    
    @Override
    public void sendResponse(RestResponse response) {
      try {
        if(logger.isTraceEnabled()){
          logger.info("Response to ØMQ client: {}", new String(response.content()));	
        }
        ref.set(convert(response));
      } catch (IOException e) {
        // ignore
      }
      latch.countDown();
    }
  });
  
  try {
    latch.await();
    return ref.get();
  } catch (Exception e) {
    throw new ZMQException("failed to generate response", 0);
  }
}

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

/**
 * Bind to network interface to a random port. Start listening for new
 * connections.
 *
 * @param addr
 *            the endpoint to bind to.
 * @param min
 *            The minimum port in the range of ports to try.
 * @param max
 *            The maximum port in the range of ports to try.
 */
public int bindToRandomPort(String addr, int min, int max)
{
  int port;
  Random rand = new Random();
  //            int port = min;
  //            while (port <= max) {
  for (int i = 0; i < 100; i++) { // hardcoded to 100 tries. should this be parametrised
    port = rand.nextInt(max - min + 1) + min;
    if (base.bind(String.format("%s:%s", addr, port))) {
      return port;
    }
    //                port++;
  }
  throw new ZMQException("Could not bind socket to random port.", ZError.EADDRINUSE);
}

代码示例来源:origin: org.zeromq/zeromq-scala-binding

private void raiseZMQException() {
 int errno = zmq.zmq_errno();
 String reason = zmq.zmq_strerror(errno);
 throw new ZMQException(reason, errno);
}

代码示例来源:origin: org.zeromq/zeromq-scala-binding_2.10

private void raiseZMQException() {
 int errno = zmq.zmq_errno();
 String reason = zmq.zmq_strerror(errno);
 throw new ZMQException(reason, errno);
}

代码示例来源:origin: org.spark-project.zeromq/zeromq-scala-binding_2.10

private void raiseZMQException() {
 int errno = zmq.zmq_errno();
 String reason = zmq.zmq_strerror(errno);
 throw new ZMQException(reason, errno);
}

代码示例来源:origin: org.spark-project.zeromq/zeromq-scala-binding

private void raiseZMQException() {
 int errno = zmq.zmq_errno();
 String reason = zmq.zmq_strerror(errno);
 throw new ZMQException(reason, errno);
}

代码示例来源:origin: stackoverflow.com

throw new ZMQException(errno);

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