org.apache.zookeeper.server.ZooKeeperThread类的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(116)

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

ZooKeeperThread介绍

[英]This is the main class for catching all the uncaught exceptions thrown by the threads.
[中]这是捕获线程抛出的所有未捕获异常的主类。

代码示例

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

@Override
  public void uncaughtException(Thread t, Throwable e) {
    handleException(t.getName(), e);
  }
};

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

public ZooKeeperThread(String threadName) {
  super(threadName);
  setUncaughtExceptionHandler(uncaughtExceptionalHandler);
}

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

@Override
public synchronized void start() {
  if (!getView().containsKey(myid)) {
    throw new RuntimeException("My id " + myid + " not in the peer list");
   }
  loadDataBase();
  startServerCnxnFactory();
  try {
    adminServer.start();
  } catch (AdminServerException e) {
    LOG.warn("Problem starting AdminServer", e);
    System.out.println(e);
  }
  startLeaderElection();
  super.start();
}

代码示例来源:origin: org.apache.zookeeper/zookeeper

@Override
public void configure(InetSocketAddress addr, int maxcc) throws IOException {
  configureSaslLogin();
  thread = new ZooKeeperThread(this, "NIOServerCxn.Factory:" + addr);
  thread.setDaemon(true);
  maxClientCnxns = maxcc;
  this.ss = ServerSocketChannel.open();
  ss.socket().setReuseAddress(true);
  LOG.info("binding to port " + addr);
  ss.socket().bind(addr);
  ss.configureBlocking(false);
  ss.register(selector, SelectionKey.OP_ACCEPT);
}

代码示例来源:origin: org.apache.zookeeper/zookeeper

@Override
public synchronized void start() {
  loadDataBase();
  cnxnFactory.start();        
  startLeaderElection();
  super.start();
}

代码示例来源:origin: org.apache.zookeeper/zookeeper

Messenger(int threads, DatagramSocket s) {
  mySocket = s;
  ackset =  Collections.<Long>newSetFromMap(new ConcurrentHashMap<Long, Boolean>());
  challengeMap = new ConcurrentHashMap<Long, Long>();
  challengeMutex = new ConcurrentHashMap<Long, Semaphore>();
  ackMutex = new ConcurrentHashMap<Long, Semaphore>();
  addrChallengeMap = new ConcurrentHashMap<InetSocketAddress, ConcurrentHashMap<Long, Long>>();
  lastProposedLeader = 0;
  lastProposedZxid = 0;
  lastEpoch = 0;
  for (int i = 0; i < threads; ++i) {
    Thread t = new ZooKeeperThread(new WorkerSender(3),
        "WorkerSender Thread: " + (i + 1));
    t.setDaemon(true);
    t.start();
  }
  for (QuorumServer server : self.getVotingView().values()) {
    InetSocketAddress saddr = new InetSocketAddress(server.addr
        .getAddress(), port);
    addrChallengeMap.put(saddr, new ConcurrentHashMap<Long, Long>());
  }
  Thread t = new ZooKeeperThread(new WorkerReceiver(s, this),
      "WorkerReceiver-" + s.getRemoteSocketAddress());
  t.start();
}

代码示例来源:origin: jboss-fuse/fabric8

@Override
public synchronized void start() {
  loadDataBase();
  cnxnFactory.start();        
  startLeaderElection();
  super.start();
}

代码示例来源:origin: org.apache.zookeeper/zookeeper

public ZooKeeperThread(Runnable thread, String threadName) {
  super(thread, threadName);
  setUncaughtExceptionHandler(uncaughtExceptionalHandler);
}

代码示例来源:origin: org.apache.zookeeper/zookeeper

@Override
  public void uncaughtException(Thread t, Throwable e) {
    handleException(t.getName(), e);
  }
};

代码示例来源:origin: org.apache.zookeeper/zookeeper

public ZooKeeperThread(String threadName) {
  super(threadName);
  setUncaughtExceptionHandler(uncaughtExceptionalHandler);
}

相关文章