Package com.alibaba.wasp

Examples of com.alibaba.wasp.ServerName


   *           e
   */
  public void connect(final boolean reload) throws IOException {
    if (server == null || reload) {
      List<ServerName> sns = fserverTracker.getOnlineServers();
      ServerName sn = sns.get(rand.nextInt(sns.size()));
      this.server = connection.getClient(sn.getHostname(), sn.getPort());
    }
  }
View Full Code Here


      final EntityGroupTransaction egTransition,
      final EntityGroupInfo entityGroupInfo, int expectedVersion)
      throws KeeperException {
    EventType et = egTransition.getEventType();
    // Get ServerName. Could not be null.
    ServerName sn = egTransition.getServerName();
    String encodedEntityGroupName = entityGroupInfo.getEncodedName();
    LOG.info("Processing entityGroup "
        + entityGroupInfo.getEntityGroupNameAsString() + " in state " + et);

    if (entityGroupStates.isEntityGroupInTransition(encodedEntityGroupName)) {
View Full Code Here

      int expectedVersion) {
    if (egTransition == null) {
      LOG.warn("Unexpected NULL input " + egTransition);
      return;
    }
    final ServerName sn = egTransition.getServerName();
    // Check if this is a special HBCK transition
    if (sn.equals(HBCK_CODE_SERVERNAME)) {
      handleHBCK(egTransition);
      return;
    }
    final long createTime = egTransition.getCreateTime();
    final byte[] entityGroupName = egTransition.getEntityGroupName();
View Full Code Here

            } else {
              LOG.debug("The znode of entityGroup "
                  + entityGroupInfo.getEntityGroupNameAsString()
                  + " has been deleted.");
              if (egState.isOpened()) {
                ServerName serverName = egState.getServerName();
                entityGroupOnline(entityGroupInfo, serverName);
                LOG.info("The master has opened the entityGroup "
                    + entityGroupInfo.getEntityGroupNameAsString()
                    + " that was online on " + serverName);
                if (getZKTable().isDisablingOrDisabledTable(
View Full Code Here

   */
  private void unassign(final EntityGroupInfo entityGroup,
      final EntityGroupState state, final int versionOfClosingNode,
      final ServerName dest, final boolean transitionInZK) {
    // Send CLOSE RPC
    ServerName server = state.getServerName();
    // ClosedEntityGrouphandler can remove the server from this.entityGroups
    if (!serverManager.isServerOnline(server)) {
      // delete the node. if no node exists need not bother.
      deleteClosingOrClosedNode(entityGroup);
      entityGroupOffline(entityGroup);
View Full Code Here

        Pair<EntityGroupInfo, ServerName> entityGroup = EntityGroupInfo
            .getEntityGroupInfoAndServerName(result);
        if (entityGroup == null)
          continue;
        EntityGroupInfo entityGroupInfo = entityGroup.getFirst();
        ServerName entityGroupLocation = entityGroup.getSecond();
        if (entityGroupInfo == null)
          continue;
        entityGroupStates.createEntityGroupState(entityGroupInfo);
        String tableName = entityGroupInfo.getTableNameAsString();
        if (entityGroupLocation == null) {
View Full Code Here

      Map<ServerName, List<EntityGroupInfo>> deadServers, List<String> nodes)
      throws IOException, KeeperException {
    if (deadServers != null) {
      for (Map.Entry<ServerName, List<EntityGroupInfo>> server : deadServers
          .entrySet()) {
        ServerName serverName = server.getKey();
        if (!serverManager.isServerDead(serverName)) {
          serverManager.expireServer(serverName); // Let SSH do entityGroup
                                                  // re-assign
        }
      }
View Full Code Here

    } catch (DeserializationException e) {
      server.abort("Exception parsing unassigned node for entityGroup="
          + egInfo.getEncodedName(), e);
    }

    ServerName addressFromZK = rt != null ? rt.getServerName() : null;
    if (addressFromZK != null) {
      // if we get something from ZK, we will use the data
      boolean matchZK = (addressFromZK != null && addressFromZK
          .equals(serverName));
      LOG.debug("based on ZK, current entityGroup="
          + egInfo.getEntityGroupNameAsString() + " is on server="
          + addressFromZK + " server being checked=: " + serverName);
      return matchZK;
    }

    ServerName addressFromAM = entityGroupStates
        .getFServerOfEntityGroup(egInfo);
    boolean matchAM = (addressFromAM != null && addressFromAM
        .equals(serverName));
    LOG.debug("based on AM, current entityGroup="
        + egInfo.getEntityGroupNameAsString() + " is on server="
        + (addressFromAM != null ? addressFromAM : "null")
        + " server being checked: " + serverName);
View Full Code Here

    // Clean out any existing assignment plans for this server
    synchronized (this.entityGroupPlans) {
      for (Iterator<Map.Entry<String, EntityGroupPlan>> i = this.entityGroupPlans
          .entrySet().iterator(); i.hasNext();) {
        Map.Entry<String, EntityGroupPlan> e = i.next();
        ServerName otherSn = e.getValue().getDestination();
        // The name will be null if the entityGroup is planned for a random
        // assign.
        if (otherSn != null && otherSn.equals(sn)) {
          // Use iterator's remove else we'll get CME
          i.remove();
        }
      }
    }
View Full Code Here

        .newBuilder();
    builder.setEntityGroup(buildEntityGroupSpecifier(
        EntityGroupSpecifierType.ENCODED_ENTITYGROUP_NAME,
        encodedEntityGroupName));
    if (destServerName != null) {
      builder.setDestServerName(ProtobufUtil.toServerName(new ServerName(Bytes
          .toString(destServerName))));
    }
    return builder.build();
  }
View Full Code Here

TOP

Related Classes of com.alibaba.wasp.ServerName

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.