Codota Logo
org.apache.zookeeper
Code IndexAdd Codota to your IDE (free)

How to use org.apache.zookeeper

Best Java code snippets using org.apache.zookeeper (Showing top 20 results out of 2,205)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Gson g =
  • Codota Iconnew Gson()
  • Codota IconGsonBuilder gsonBuilder;gsonBuilder.create()
  • Codota Iconnew GsonBuilder().create()
  • Smart code suggestions by Codota
}
origin: apache/zookeeper

private void cleanAndNotifyState() {
  cleanup();
  if (state.isAlive()) {
    eventThread.queueEvent(new WatchedEvent(Event.EventType.None,
        Event.KeeperState.Disconnected, null));
  }
  clientCnxnSocket.updateNow();
  clientCnxnSocket.updateLastSendAndHeard();
}
origin: apache/zookeeper

void queueEvent(String clientPath, int err,
    Set<Watcher> materializedWatchers, EventType eventType) {
  KeeperState sessionState = KeeperState.SyncConnected;
  if (KeeperException.Code.SESSIONEXPIRED.intValue() == err
      || KeeperException.Code.CONNECTIONLOSS.intValue() == err) {
    sessionState = Event.KeeperState.Disconnected;
  }
  WatchedEvent event = new WatchedEvent(eventType, sessionState,
      clientPath);
  eventThread.queueEvent(event, materializedWatchers);
}
origin: apache/zookeeper

/** 
 * Returns the local address to which the socket is bound.
 * THIS METHOD IS EXPECTED TO BE USED FOR TESTING ONLY!!!
 *
 * @since 3.3.0
 * 
 * @return ip address of the remote side of the connection or null if
 *         not connected
 */
protected SocketAddress testableLocalSocketAddress() {
  return cnxn.sendThread.getClientCnxnSocket().getLocalSocketAddress();
}
origin: apache/zookeeper

public void testRoundTrip() throws IOException {
  MultiResponse response = new MultiResponse();
  response.add(new OpResult.CheckResult());
  response.add(new OpResult.CreateResult("foo-bar"));
  response.add(new OpResult.DeleteResult());
  Stat s = new Stat();
  s.setCzxid(546);
  response.add(new OpResult.SetDataResult(s));
  MultiResponse decodedResponse = codeDecode(response);
  Assert.assertEquals(response, decodedResponse);
  Assert.assertEquals(response.hashCode(), decodedResponse.hashCode());
}
origin: apache/zookeeper

  public boolean execute() throws KeeperException,
    InterruptedException {
    zookeeper.delete(id, -1);   
    return Boolean.TRUE;
  }
};
origin: apache/zookeeper

  @Override
  public void injectSessionExpiration() {
    LOG.info("injectSessionExpiration() called");

    clientCnxn.eventThread.queueEvent(new WatchedEvent(
        Watcher.Event.EventType.None,
        Watcher.Event.KeeperState.Expired, null));
    clientCnxn.eventThread.queueEventOfDeath();
    clientCnxn.state = ZooKeeper.States.CLOSED;
    clientCnxn.sendThread.getClientCnxnSocket().onClosing();
  }
}
origin: apache/zookeeper

  public void process(WatchedEvent event) {
    if (getPrintWatches()) {
      ZooKeeperMain.printMessage("WATCHER::");
      ZooKeeperMain.printMessage(event.toString());
    }
  }
}
origin: apache/zookeeper

private Create(String path, byte[] data, List<ACL> acl, int flags) {
  super(getOpcode(CreateMode.fromFlag(flags, CreateMode.PERSISTENT)), path);
  this.data = data;
  this.acl = acl;
  this.flags = flags;
}
origin: apache/zookeeper

public void start() {
  sendThread.start();
  eventThread.start();
}
origin: apache/zookeeper

private static int checkAndIncVersion(int currentVersion, int expectedVersion, String path)
    throws KeeperException.BadVersionException {
  if (expectedVersion != -1 && expectedVersion != currentVersion) {
    throw new KeeperException.BadVersionException(path);
  }
  return currentVersion + 1;
}
origin: apache/zookeeper

private Create(String path, byte[] data, List<ACL> acl, CreateMode createMode) {
  super(getOpcode(createMode), path);
  this.data = data;
  this.acl = acl;
  this.flags = createMode.toFlag();
}
origin: apache/zookeeper

/**
 * Get the name of the server principal for a SASL client.
 * @param addr the address of the host.
 * @param clientConfig the configuration for the client.
 * @return the name of the principal.
 */
static String getServerPrincipal(InetSocketAddress addr, ZKClientConfig clientConfig) {
  return getServerPrincipal(new WrapperInetSocketAddress(addr), clientConfig);
}
origin: apache/zookeeper

public void saslCompleted() {
  sendThread.getClientCnxnSocket().saslCompleted();
}
origin: apache/zookeeper

/**
 * The session password for this ZooKeeper client instance. The value
 * returned is not valid until the client connects to a server and may
 * change after a re-connect.
 *
 * This method is NOT thread safe
 *
 * @return current session password
 */
public byte[] getSessionPasswd() {
  return cnxn.getSessionPasswd();
}
origin: apache/zookeeper

/**
 * The Asynchronous version of getConfig. 
 * 
 * @see #getData(String, boolean, Stat)
 */
public void getConfig(boolean watch, DataCallback cb, Object ctx) {
  getConfig(watch ? watchManager.defaultWatcher : null, cb, ctx);
}
origin: apache/zookeeper

  @Override
  public String toString() {
    return "EndOfStreamException: " + getMessage();
  }
}
origin: apache/zookeeper

/**
 * Constructs a delete operation.  Arguments are as for the ZooKeeper method of the same name.
 * @see ZooKeeper#delete(String, int)
 *
 * @param path
 *                the path of the node to be deleted.
 * @param version
 *                the expected node version.
 */
public static Op delete(String path, int version) {
  return new Delete(path, version);
}
origin: apache/zookeeper

  @Override
  Op withChroot(String path) {
    return new Check(path, version);
  }
}
origin: apache/zookeeper

  @Override
  Op withChroot(String path) {
    return new SetData(path, data, version);
  }
}
origin: apache/zookeeper

@Override
protected TestableZooKeeper createClient(String hp)
throws IOException, InterruptedException
{
  MyWatcher watcher = new MyWatcher();
  return createClient(watcher, hp);
}
org.apache.zookeeper

Most used classes

  • ZooKeeper
    This is the main class of ZooKeeper client library. To use a ZooKeeper service, an application must
  • Stat
  • WatchedEvent
    A WatchedEvent represents a change on the ZooKeeper that a Watcher is able to respond to. The Watche
  • KeeperException
  • KeeperException$Code
    Codes which represent the various KeeperException types. This enum replaces the deprecated earlier s
  • Id,
  • ACL,
  • ServerConfig,
  • QuorumPeerConfig,
  • NIOServerCnxnFactory,
  • ZooKeeper$States,
  • ZooKeeperServerMain,
  • Watcher,
  • ServerCnxnFactory,
  • KeeperException$NoNodeException,
  • Watcher$Event$EventType,
  • FileTxnSnapLog,
  • Watcher$Event$KeeperState,
  • PathUtils
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now