org.apache.activemq.leveldb.replicated.groups.ZKClient类的使用及代码示例

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

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

ZKClient介绍

暂无

代码示例

代码示例来源:origin: org.apache.activemq/activemq-osgi

public void testGenerateConnectionLoss() throws Exception {
  waitForConnected();
  Object clientCnxnSocket  = getField(_zk, "_zk", "cnxn", "sendThread", "clientCnxnSocket");
  callMethod(clientCnxnSocket, "testableCloseSocket");
}

代码示例来源:origin: org.apache.activemq/activemq-leveldb-store

public String create(String path, byte[] data, CreateMode createMode) throws InterruptedException, KeeperException {
  return getZk().create(adjustPath(path), data, getNodeACLs(path), createMode);
}

代码示例来源:origin: org.apache.activemq/activemq-osgi

protected void doStart() throws InvalidSyntaxException, ConfigurationException, UnsupportedEncodingException {
  connect();
}

代码示例来源:origin: org.apache.activemq/activemq-all

public Stat createOrSetByteWithParents(String path, byte[] data, List<ACL> acl, CreateMode createMode) throws InterruptedException, KeeperException {
  if (exists(path) != null) {
    return setByteData(path, data);
  }
  try {
    createBytesNodeWithParents(path, data, acl, createMode);
    return null;
  } catch(KeeperException.NodeExistsException e) {
    // this should not happen very often (race condition)
    return setByteData(path, data);
  }
}

代码示例来源:origin: org.apache.activemq/activemq-osgi

public Stat createOrSetWithParents(String path, String data, CreateMode createMode) throws InterruptedException, KeeperException {
  return createOrSetWithParents(path, toByteData(data), createMode);
}

代码示例来源:origin: org.apache.activemq/activemq-leveldb-store

private List<ACL> getNodeACLs(String path) {
  String acl = doGetNodeACLs(adjustPath(path));
  if (acl == null) {
    throw new IllegalStateException("Could not find matching ACLs for " + path);
  }
  return parseACLs(acl);
}

代码示例来源:origin: org.apache.activemq/activemq-all

public String create(String path, String data, CreateMode createMode) throws InterruptedException, KeeperException {
  return create(path, toByteData(data), createMode);
}

代码示例来源:origin: org.apache.activemq/activemq-all

public String createWithParents(String path, byte[] data, CreateMode createMode) throws InterruptedException, KeeperException {
  createParents(path);
  return create(path, data, createMode);
}

代码示例来源:origin: org.apache.activemq/activemq-all

public void process(WatchedEvent event) {
  if (event.getState() != null) {
    LOG.debug("event: {}", event.getState());
    synchronized (_lock) {
      switch(event.getState())
      {
        case SyncConnected:
          changeState(State.CONNECTED);
          break;
        case Disconnected:
          if(_state != State.NONE) {
            changeState(State.RECONNECTING);
          }
          break;
        case Expired:
          // when expired, the zookeeper object is invalid and we need to recreate a new one
          _zk = null;
          LOG.warn("Expiration detected: trying to restart...");
          tryConnect();
          break;
        default:
          LOG.warn("unprocessed event state: {}", event.getState());
      }
    }
  }
}

代码示例来源:origin: org.apache.activemq/activemq-all

if (_zk != null) {
  try {
    changeState(State.NONE);
    _zk.close();
    Thread th = getSendThread();
    if (th != null) {
      th.join(1000);

代码示例来源:origin: org.apache.activemq/activemq-partition

protected void zkConnect() throws Exception {
  zk_client = new ZKClient(plugin().getZkAddress(), Timespan.parse(plugin().getZkSessionTmeout()), null);
  if( plugin().getZkPassword()!=null ) {
    zk_client.setPassword(plugin().getZkPassword());
  }
  zk_client.start();
  zk_client.waitForConnected(Timespan.parse("30s"));
}

代码示例来源:origin: org.apache.activemq/activemq-leveldb-store

public void waitForConnected() throws InterruptedException, TimeoutException {
  waitForConnected(null);
}

代码示例来源:origin: org.apache.activemq/activemq-all

public void connect() throws UnsupportedEncodingException {
  synchronized (_lock) {
    changeState(State.CONNECTING);
    _zk = _factory.createZooKeeper(this);
    if (password != null) {
      _zk.addAuthInfo("digest", ("fabric:" + password).getBytes("UTF-8"));
    }
  }
}

代码示例来源:origin: org.apache.activemq/activemq-all

@Override
public org.linkedin.zookeeper.client.IZKClient chroot(String path) {
  return new ChrootedZKClient(this, adjustPath(path));
}

代码示例来源:origin: org.apache.activemq/activemq-leveldb-store

public String create(String path, CreateMode createMode) throws InterruptedException, KeeperException {
  return create(path, (byte[]) null, createMode);
}

代码示例来源:origin: org.apache.activemq/activemq-all

@Override
public void run() {
  Map<Object, Boolean> history = new IdentityHashMap<Object, Boolean>();
  LOG.info("Starting StateChangeDispatcher");
  while (_running.get()) {
    Boolean isConnectedEvent;
    try {
      isConnectedEvent = _events.take();
    } catch (InterruptedException e) {
      continue;
    }
    if (!_running.get() || isConnectedEvent == null) {
      continue;
    }
    Map<Object, Boolean> newHistory = callListeners(history, isConnectedEvent);
    // we save which event each listener has seen last
    // we don't update the map in place because we need to get rid of unregistered listeners
    history = newHistory;
  }
  LOG.info("StateChangeDispatcher terminated.");
}

代码示例来源:origin: org.apache.activemq/activemq-osgi

public Stat createOrSetByteWithParents(String path, byte[] data, List<ACL> acl, CreateMode createMode) throws InterruptedException, KeeperException {
  if (exists(path) != null) {
    return setByteData(path, data);
  }
  try {
    createBytesNodeWithParents(path, data, acl, createMode);
    return null;
  } catch(KeeperException.NodeExistsException e) {
    // this should not happen very often (race condition)
    return setByteData(path, data);
  }
}

代码示例来源:origin: org.apache.activemq/activemq-all

private List<ACL> getNodeACLs(String path) {
  String acl = doGetNodeACLs(adjustPath(path));
  if (acl == null) {
    throw new IllegalStateException("Could not find matching ACLs for " + path);
  }
  return parseACLs(acl);
}

代码示例来源:origin: org.apache.activemq/activemq-all

public Stat createOrSetWithParents(String path, String data, CreateMode createMode) throws InterruptedException, KeeperException {
  return createOrSetWithParents(path, toByteData(data), createMode);
}

代码示例来源:origin: org.apache.activemq/activemq-leveldb-store

public String create(String path, String data, CreateMode createMode) throws InterruptedException, KeeperException {
  return create(path, toByteData(data), createMode);
}

相关文章