Package com.alibaba.wasp

Examples of com.alibaba.wasp.ServerName


        byte[] infoValue = r.getValue(FConstants.CATALOG_FAMILY,
            FConstants.EGINFO);
        byte[] locationValue = r.getValue(FConstants.CATALOG_FAMILY,
            FConstants.EGLOCATION);
        EntityGroupInfo key = EntityGroupInfo.parseFromOrNull(infoValue);
        ServerName value = ServerName.convert(locationValue);
        entityGroups.put(key, value);
      }
      for (int i = 0; i < egis.size(); i++) {
        ServerName sn = entityGroups.get(egis.get(i));
        assertEquals(sn.compareTo(egLocations[i]), 0);
      }

      // scanEntityGroupLocation
      byte[] row = Bytes.toBytes("20001");
      EntityGroupLocation egLocation = fMetaService.scanEntityGroupLocation(
View Full Code Here


        TEST_UTIL.getConfiguration().get(HConstants.ZOOKEEPER_QUORUM));
    TEST_UTIL.getConfiguration().set(FConstants.ZOOKEEPER_CLIENT_PORT,
        TEST_UTIL.getConfiguration().get(HConstants.ZOOKEEPER_CLIENT_PORT));
    FMaster hm = new FMaster(conf);

    ServerName sm = hm.getServerName();
    InetSocketAddress isa = new InetSocketAddress(sm.getHostname(),
        sm.getPort());
    int i = 0;
    // retry the RPC a few times; we have seen SocketTimeoutExceptions if we
    // try to connect too soon. Retry on SocketTimeoutException.
    while (i < 20) {
      try {
View Full Code Here

        list.size());
    for (ServerAndLoad sl : list) {
      map.put(sl.getServerName(), sl);
    }
    for (EntityGroupPlan plan : plans) {
      ServerName source = plan.getSource();
      updateLoad(map, source, -1);
      ServerName destination = plan.getDestination();
      updateLoad(map, destination, +1);
    }
    result.clear();
    result.addAll(map.values());
    return result;
View Full Code Here

  private Queue<ServerName> serverQueue = new LinkedList<ServerName>();

  protected ServerAndLoad randomServer(final int numEntityGroupsPerServer) {
    if (!this.serverQueue.isEmpty()) {
      ServerName sn = this.serverQueue.poll();
      return new ServerAndLoad(sn, numEntityGroupsPerServer);
    }
    String host = "srv" + rand.nextInt(100000);
    int port = rand.nextInt(60000);
    long startCode = rand.nextLong();
    ServerName sn = new ServerName(host, port, startCode);
    return new ServerAndLoad(sn, numEntityGroupsPerServer);
  }
View Full Code Here

    // not yet run, or from a server whose fail we are currently processing.
    // Test its host+port combo is present in serverAddresstoServerInfo. If it
    // is, reject the server and trigger its expiration. The next time it comes
    // in, it should have been removed from serverAddressToServerInfo and queued
    // for processing by ProcessServerShutdown.
    ServerName sn = new ServerName(ia.getHostName(), port, serverStartcode);
    checkClockSkew(sn, serverCurrentTime);
    checkIsDead(sn, "STARTUP");
    checkAlreadySameHostPort(sn);
    recordNewServer(sn, ServerLoad.EMPTY_SERVERLOAD);
    return sn;
View Full Code Here

   * @param serverName
   * @throws com.alibaba.wasp.PleaseHoldException
   */
  void checkAlreadySameHostPort(final ServerName serverName)
      throws PleaseHoldException {
    ServerName existingServer = ServerName.findServerWithSameHostnamePort(
        getOnlineServersList(), serverName);
    if (existingServer != null) {
      String message = "Server serverName=" + serverName
          + " rejected; we already have " + existingServer.toString()
          + " registered with same hostname and port";
      LOG.info(message);
      if (existingServer.getStartcode() < serverName.getStartcode()) {
        LOG.info("Triggering server recovery; existingServer " + existingServer
            + " looks stale, new server:" + serverName);
        expireServer(existingServer);
      }
      // master has completed the initialization
View Full Code Here

  /**
   * To clear any dead server with same host name and port of any online server
   */
  void clearDeadServersWithSameHostNameAndPortOfOnlineServer() {
    ServerName sn = null;
    for (ServerName serverName : getOnlineServersList()) {
      while ((sn = ServerName.findServerWithSameHostnamePort(this.deadservers,
          serverName)) != null) {
        this.deadservers.remove(sn);
      }
View Full Code Here

            this.watcher.getMasterAddressZNode());
        if (bytes == null) {
          msg = ("A master was detected, but went down before its address "
              + "could be read.  Attempting to become the next active master");
        } else {
          ServerName currentMaster;
          try {
            currentMaster = ServerName.parseFrom(bytes);
          } catch (DeserializationException e) {
            LOG.warn("Failed parse", e);
            // Hopefully next time around we won't fail the parse. Dangerous.
View Full Code Here

  }

  public void stop() {
    try {
      // If our address is in ZK, delete it on our way out
      ServerName activeMaster = null;
      try {
        activeMaster = MasterAddressTracker.getMasterAddress(this.watcher);
      } catch (IOException e) {
        LOG.warn("Failed get of master address: " + e.toString());
      }
      if (activeMaster != null && activeMaster.equals(this.sn)) {
        ZKUtil.deleteNode(watcher, watcher.getMasterAddressZNode());
        // We may have failed to delete the znode at the previous step, but
        // we delete the file anyway: a second attempt to delete the znode is
        // likely to fail again.
        ZNodeClearer.deleteMyEphemeralNodeOnDisk();
View Full Code Here

   */
  public synchronized EntityGroupState updateEntityGroupState(
      final EntityGroupInfo egi, final EntityGroupState.State state) {
    EntityGroupState entityGroupState = entityGroupStates.get(egi
        .getEncodedName());
    ServerName serverName = (entityGroupState == null || state == EntityGroupState.State.CLOSED || state == EntityGroupState.State.OFFLINE) ? null
        : entityGroupState.getServerName();
    return updateEntityGroupState(egi, state, serverName);
  }
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.