Package org.apache.zookeeper.Watcher.Event

Examples of org.apache.zookeeper.Watcher.Event.EventType


   * is called it means either our master has died, or a new one has come up.
   * Either way we need to update our knowledge of the master.
   * @param event WatchedEvent from ZooKeeper.
   */
  public void process(WatchedEvent event) {
    EventType type = event.getType();
    KeeperState state = event.getState();
    LOG.info("Got ZooKeeper event, state: " + state + ", type: " +
      type + ", path: " + event.getPath());

    // Ignore events if we're shutting down.
View Full Code Here


  /**
   * @see org.apache.zookeeper.Watcher#process(org.apache.zookeeper.WatchedEvent)
   */
  @Override
  public synchronized void process (WatchedEvent event) {
    EventType type = event.getType();
    LOG.debug(("Got event " + type + " with path " + event.getPath()));
    if (type.equals(EventType.NodeDeleted)) {
      if (event.getPath().equals(this.zookeeper.clusterStateZNode)) {
        LOG.info("Cluster shutdown while waiting, shutting down" +
          " this master.");
        this.requestShutdown.set(true);
      } else {
        LOG.debug("Master address ZNode deleted, notifying waiting masters");
        notifyAll();
      }
    } else if(type.equals(EventType.NodeCreated) &&
        event.getPath().equals(this.zookeeper.clusterStateZNode)) {
      LOG.debug("Resetting watch on cluster state node.");
      this.zookeeper.setClusterStateWatch();
    }
  }
View Full Code Here

   *   - WATCHES the following events: NodeCreated, NodeDataChanged, NodeChildrenChanged
   *   - IGNORES the following events: None, NodeDeleted
   */
  @Override
  public synchronized void process(WatchedEvent event) {
    EventType type = event.getType();
    LOG.debug("ZK-EVENT-PROCESS: Got zkEvent " + type +
              " state:" + event.getState() +
              " path:" + event.getPath());

    // Handle the ignored events
    if(type.equals(EventType.None)       ||
       type.equals(EventType.NodeDeleted)) {
      return;
    }

    // check if the path is for the UNASSIGNED directory we care about
    if(event.getPath() == null ||
       !event.getPath().startsWith(zkWrapper.getZNodePathForHBase(
           zkWrapper.getRegionInTransitionZNode()))) {
      return;
    }

    try
    {
      /*
       * If a node is created in the UNASSIGNED directory in zookeeper, then:
       *   1. watch its updates (this is an unassigned region).
       *   2. read to see what its state is and handle as needed (state may have
       *      changed before we started watching it)
       */
      if(type.equals(EventType.NodeCreated)) {
        zkWrapper.watchZNode(event.getPath());
        handleRegionStateInZK(event.getPath());
      }
      /*
       * Data on some node has changed. Read to see what the state is and handle
       * as needed.
       */
      else if(type.equals(EventType.NodeDataChanged)) {
        handleRegionStateInZK(event.getPath());
      }
      /*
       * If there were some nodes created then watch those nodes
       */
      else if(type.equals(EventType.NodeChildrenChanged)) {
        List<ZNodePathAndData> newZNodes =
            zkWrapper.watchAndGetNewChildren(event.getPath());
        for(ZNodePathAndData zNodePathAndData : newZNodes) {
          LOG.debug("Handling updates for znode: " + zNodePathAndData.getzNodePath());
          handleRegionStateInZK(zNodePathAndData.getzNodePath(),
View Full Code Here

   * is called it means either our master has died, or a new one has come up.
   * Either way we need to update our knowledge of the master.
   * @param event WatchedEvent from ZooKeeper.
   */
  public void process(WatchedEvent event) {
    EventType type = event.getType();
    KeeperState state = event.getState();
    LOG.info("Got ZooKeeper event, state: " + state + ", type: " +
      type + ", path: " + event.getPath());

    // Ignore events if we're shutting down.
View Full Code Here

    public void process(WatchedEvent event) {
      if (log.isTraceEnabled())
        log.trace(event);
     
      final String zPath = event.getPath();
      final EventType zType = event.getType();
     
      String tablesPrefix = ZooUtil.getRoot(instance) + Constants.ZTABLES;
      String tableId = null;
     
      if (zPath != null && zPath.startsWith(tablesPrefix + "/")) {
View Full Code Here

        this.awaitedTypes = awaitedTypes;
    }

    public void process(WatchedEvent event) {
        this.event = event;
        EventType received = event.getType();
        if (LOG.isDebugEnabled()) {
            LOG.debug(format("Recieved event of type %s for node '%s'", received, event.getPath()));
        }

        for (EventType watched : awaitedTypes) {
View Full Code Here

          LOG.warn("Input args is invalid, args length:"
              + args.length);
          return null;
        }

        EventType zkEventTypes = (EventType) args[0];
        String path = (String) args[1];

        List<String> toks = PathUtils.tokenize_path(path);
        int size = toks.size();
        if (size >= 1) {
View Full Code Here

TOP

Related Classes of org.apache.zookeeper.Watcher.Event.EventType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.