gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-16 04:36:40 27 4
gpt4 key购买 nike

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

ZMQ.context介绍

[英]Create a new Context.
[中]创造一个新的环境。

代码示例

代码示例来源:origin: alibaba/mdrill

public static Context context(int threads) {
  try {
    return ZMQ.context(threads);
  } catch (UnsatisfiedLinkError e) {
    LOG.error("context", e);
  }
  return null;
}

代码示例来源:origin: twosigma/beakerx

public KernelSocketsZMQ(KernelFunctionality kernel, Config configuration, SocketCloseAction closeAction) {
 this.closeAction = closeAction;
 this.kernel = kernel;
 this.hmac = new HashedMessageAuthenticationCode(configuration.getKey());
 this.context = ZMQ.context(1);
 configureSockets(configuration);
}

代码示例来源:origin: apache/ignite

ctx = ZMQ.context(ioThreads);

代码示例来源:origin: org.opendaylight.netide/shim

public void Start() {
  context = ZMQ.context(1);
  thread = new Thread(this);
  thread.setName("ZeroMQBasedConnector Receive Loop");
  thread.start();
}

代码示例来源:origin: benmfaul/XRTB

/**
 * A Topic handler with no publishing (just subscribes)
 * @param binding String.  The binding for the 
 * @param addresses List. My TCP address and topics for listening.
 * @throws Exception
 */
public RTopic(List<String> addresses) throws Exception {
  mapper.setSerializationInclusion(Include.NON_NULL);
  mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  
  context = ZMQ.context(1);	
  subscriber = new MSubscriber(this,addresses);
}

代码示例来源:origin: benmfaul/XRTB

public RTopic(String address) throws Exception {
  context = ZMQ.context(1);
  
  mapper.setSerializationInclusion(Include.NON_NULL);
  mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  
  if (address.contains("&")) {
    String [] parts = address.split("&");
    subscriber = new Subscriber(this,parts[0]);
    subscriber.subscribe(parts[1]);
  } else
    subscriber = new Subscriber(this,address);
}
/**

代码示例来源:origin: apache/apex-malhar

@Override
public void setup(Context.OperatorContext ctx)
{
 context = ZMQ.context(1);
 sock = context.socket(ZMQ.PULL);
 sock.connect(zmqAddress);
}

代码示例来源:origin: JuliaComputing/JuliaDT

public void connect() {
 context = ZMQ.context(1);
 requester = context.socket(ZMQ.REQ);
 requester.connect("tcp://" + host + ":" + port);
}

代码示例来源:origin: org.apache.apex/malhar-contrib

@Override
public void setup(Context.OperatorContext ctx)
{
 context = ZMQ.context(1);
 sock = context.socket(ZMQ.PULL);
 sock.connect(zmqAddress);
}

代码示例来源:origin: openimaj/openimaj

@Override
public void prepare() {
  ZMQ.Context context = ZMQ.context(1);
  publisher = context.socket(ZMQ.PUB);
  publisher.bind("tcp://*:5563");
}

代码示例来源:origin: benmfaul/XRTB

public Publisher(String binding, String topicName) throws Exception {
  mapper.setSerializationInclusion(Include.NON_NULL);
  mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  
  context = ZMQ.context(1);
  publisher = context.socket(ZMQ.PUB);
  publisher.bind(binding);
  Thread.sleep(100);
  //System.out.println("Starting Publisher..");
  publisher.setIdentity("B".getBytes());
  publisher.setLinger(5000);
  publisher.setHWM(0);
  this.topicName = topicName;
}

代码示例来源:origin: apache/apex-malhar

@Override
public void setup(OperatorContext ctx)
{
 logger.debug("O/P setup");
 context = ZMQ.context(1);
 publisher = context.socket(ZMQ.PUB);
 publisher.bind(url);
 syncservice = context.socket(ZMQ.REP);
 syncservice.bind(syncUrl);
}

代码示例来源:origin: org.apache.apex/malhar-contrib

@Override
public void setup(OperatorContext ctx)
{
 logger.debug("O/P setup");
 context = ZMQ.context(1);
 publisher = context.socket(ZMQ.PUB);
 publisher.bind(url);
 syncservice = context.socket(ZMQ.REP);
 syncservice.bind(syncUrl);
}

代码示例来源:origin: org.apache.apex/malhar-contrib

@Override
public void setup(OperatorContext ctx)
{
 context = ZMQ.context(1);
 subscriber = context.socket(ZMQ.SUB);
 subscriber.connect(url);
 subscriber.subscribe(filter.getBytes());
 syncclient = context.socket(ZMQ.REQ);
 syncclient.connect(syncUrl);
 syncclient.send("".getBytes(), 0);
}

代码示例来源:origin: apache/apex-malhar

@Override
public void setup(OperatorContext ctx)
{
 context = ZMQ.context(1);
 subscriber = context.socket(ZMQ.SUB);
 subscriber.connect(url);
 subscriber.subscribe(filter.getBytes());
 syncclient = context.socket(ZMQ.REQ);
 syncclient.connect(syncUrl);
 syncclient.send("".getBytes(), 0);
}

代码示例来源:origin: bmwcarit/barefoot

public StatePublisher(int port) {
  context = ZMQ.context(1);
  socket = context.socket(ZMQ.PUB);
  socket.bind("tcp://*:" + port);
  this.setDaemon(true);
  this.start();
}

代码示例来源:origin: com.carecon.fabric3/fabric3-binding-zeromq

@Init
public void init() {
  // Windows requires the ZMQ library to be loaded as the JZMQ library is linked to it and Windows is unable to resolve it relative to the JZMQ library
  // System.loadLibrary("zmq");
  loadLibrary(hostInfo);
  context = ZMQ.context(1);
  controlSocket = context.socket(ZMQ.PUB);
  controlSocket.bind("inproc://fabric3");
}

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

@Init
public void init() {
  // Windows requires the ZMQ library to be loaded as the JZMQ library is linked to it and Windows is unable to resolve it relative to the JZMQ library
  // System.loadLibrary("zmq");
  ZMQLibraryInitializer.loadLibrary(hostInfo);
  context = ZMQ.context(1);
  controlSocket = context.socket(ZMQ.PUB);
  controlSocket.bind("inproc://fabric3");
}

代码示例来源:origin: io.github.cloudiator.axe/axe-aggregator-common

private void initZeroMq() {
  context = ZMQ.context(threadNum);
  socket = context.socket(ZMQ.PUSH);
  socket.connect("tcp://" + getServername() + ":" + getPort());
}

代码示例来源:origin: apache/apex-malhar

public void setup()
{
 context = ZMQ.context(1);
 logger.debug("Publishing on ZeroMQ");
 publisher = context.socket(ZMQ.PUB);
 publisher.bind(pubAddr);
 syncservice = context.socket(ZMQ.REP);
 syncservice.bind(syncAddr);
}

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