Package com.alibaba.wasp

Examples of com.alibaba.wasp.EntityGroupTransaction.toByteArray()


    LOG.debug(zkw.prefix("Creating unassigned node for "
        + entityGroup.getEncodedName() + " in OFFLINE state"));
    EntityGroupTransaction rt = EntityGroupTransaction.createEntityGroupTransition(event,
        entityGroup.getEntityGroupName(), serverName);
    String node = getNodeName(zkw, entityGroup.getEncodedName());
    ZKUtil.createAndWatch(zkw, node, rt.toByteArray());
  }

  /**
   * Creates an unassigned node in the OFFLINE state for the specified
   * entityGroup.
 
View Full Code Here


    LOG.debug(zkw.prefix("Async create of unassigned node for "
        + entityGroup.getEncodedName() + " with OFFLINE state"));
    EntityGroupTransaction rt = EntityGroupTransaction.createEntityGroupTransition(
        EventType.M_ZK_ENTITYGROUP_OFFLINE, entityGroup.getEntityGroupName(), serverName);
    String node = getNodeName(zkw, entityGroup.getEncodedName());
    ZKUtil.asyncCreate(zkw, node, rt.toByteArray(), cb, ctx);
  }

  /**
   * Creates or force updates an unassigned node to the OFFLINE state for the
   * specified entityGroup.
View Full Code Here

    LOG.debug(zkw.prefix("Creating (or updating) unassigned node for "
        + entityGroup.getEncodedName() + " with OFFLINE state"));
    EntityGroupTransaction rt = EntityGroupTransaction.createEntityGroupTransition(
        EventType.M_ZK_ENTITYGROUP_OFFLINE, entityGroup.getEntityGroupName(), serverName,
        HConstants.EMPTY_BYTE_ARRAY);
    byte[] data = rt.toByteArray();
    String node = getNodeName(zkw, entityGroup.getEncodedName());
    zkw.sync(node);
    int version = ZKUtil.checkExists(zkw, node);
    if (version == -1) {
      return ZKUtil.createAndWatch(zkw, node, data);
View Full Code Here

        + entityGroup.getEncodedName() + " in a CLOSING state"));
    EntityGroupTransaction rt = EntityGroupTransaction.createEntityGroupTransition(
        EventType.M_ZK_ENTITYGROUP_CLOSING, entityGroup.getEntityGroupName(), serverName,
        HConstants.EMPTY_BYTE_ARRAY);
    String node = getNodeName(zkw, entityGroup.getEncodedName());
    return ZKUtil.createAndWatch(zkw, node, rt.toByteArray());
  }

  /**
   * Transitions an existing unassigned node for the specified entityGroup which
   * is currently in the CLOSING state to be in the CLOSED state.
View Full Code Here

    // Write new data, ensuring data has not changed since we last read it
    try {
      rt = EntityGroupTransaction.createEntityGroupTransition(endState,
          entityGroup.getEntityGroupName(), serverName, payload);
      if (!ZKUtil.setData(zkw, node, rt.toByteArray(), stat.getVersion())) {
        LOG.warn(zkw.prefix("Attempt to transition the "
            + "unassigned node for " + encoded + " from " + beginState + " to "
            + endState + " failed, "
            + "the node existed and was in the expected state but then when "
            + "setting data we got a version mismatch"));
View Full Code Here

    EntityGroupTransaction data = EntityGroupTransaction
        .createEntityGroupTransition(
            EventHandler.EventType.FSERVER_ZK_ENTITYGROUP_SPLITTING,
            entityGroup.getEntityGroupName(), serverName);
    String node = ZKAssign.getNodeName(zkw, entityGroup.getEncodedName());
    if (!ZKUtil.createEphemeralNodeAndWatch(zkw, node, data.toByteArray())) {
      throw new IOException("Failed create of ephemeral " + node);
    }
    // Transition node from SPLITTING to SPLITTING and pick up version so we
    // can be sure this znode is ours; version is needed deleting.
    return transitionNodeSplitting(zkw, entityGroup, serverName, -1);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.