Package org.apache.accumulo.core.util

Examples of org.apache.accumulo.core.util.ServerServices


      try {
        String path = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZGC_LOCK;
        List<String> locks = zk.getChildren(path, null);
        if (locks != null && locks.size() > 0) {
          Collections.sort(locks);
          InetSocketAddress address = new ServerServices(new String(zk.getData(path + "/" + locks.get(0), null, null))).getAddress(Service.GC_CLIENT);
          GCMonitorService.Iface client = ThriftUtil.getClient(new GCMonitorService.Client.Factory(), address, ServerConfiguration.getSystemConfiguration());
          try {
            result = client.getStatus(null, SecurityConstants.getSystemCredentials());
          } finally {
            ThriftUtil.returnClient(client);
View Full Code Here


      }
    };
   
    while (true) {
      lock = new ZooLock(path);
      if (lock.tryLock(lockWatcher, new ServerServices(address, Service.GC_CLIENT).toString().getBytes())) {
        break;
      }
      UtilWaitThread.sleep(1000);
    }
  }
View Full Code Here

            }
          });
        }
      };
     
      byte[] lockContent = new ServerServices(getClientAddressString(), Service.TSERV_CLIENT).toString().getBytes();
      for (int i = 0; i < 120 / 5; i++) {
        zoo.putPersistentData(zPath, new byte[0], NodeExistsPolicy.SKIP);
       
        if (tabletServerLock.tryLock(lw, lockContent)) {
          log.debug("Obtained tablet server lock " + tabletServerLock.getLockPath());
View Full Code Here

            // Yep: hold onto the information about this server
            Stat stat = new Stat();
            byte[] lockData = ZooLock.getLockData(lockPath, stat);
            String lockString = new String(lockData == null ? new byte[] {} : lockData);
            if (lockString.length() > 0 && !lockString.equals("master")) {
              ServerServices services = new ServerServices(new String(lockData));
              InetSocketAddress client = services.getAddress(ServerServices.Service.TSERV_CLIENT);
              InetSocketAddress addr = AddressUtil.parseAddress(server, Property.TSERV_CLIENTPORT);
              TServerConnection conn = new TServerConnection(addr);
              instance = new TServerInstance(client, stat.getEphemeralOwner());
              info = new TServerInfo(lock, instance, conn, watcher);
              current.put(server, info);
View Full Code Here

            }
          });
        }
      };
     
      byte[] lockContent = new ServerServices(getClientAddressString(), Service.TSERV_CLIENT).toString().getBytes();
      for (int i = 0; i < 120 / 5; i++) {
        ZooUtil.putPersistentData(zPath, new byte[0], NodeExistsPolicy.SKIP);
       
        if (tabletServerLock.tryLock(lw, lockContent)) {
          log.debug("Obtained tablet server lock " + tabletServerLock.getLockPath());
View Full Code Here

   
    // add tservers
    for (String tserver : getZooCache(instance).getChildren(ZooUtil.getRoot(instance) + Constants.ZTSERVERS)) {
      byte[] data = ZooLock.getLockData(getZooCache(instance), ZooUtil.getRoot(instance) + Constants.ZTSERVERS + "/" + tserver);
      if (data != null && !new String(data).equals("master"))
        servers.add(new ThriftTransportKey(new ServerServices(new String(data)).getAddressString(Service.TSERV_CLIENT), instance.getConfiguration().getPort(
            Property.TSERV_CLIENTPORT), instance.getConfiguration().getTimeInMillis(Property.GENERAL_RPC_TIMEOUT)));
    }
   
    // add masters
    for (String master : instance.getMasterLocations())
View Full Code Here

      }
    };
   
    while (true) {
      lock = new ZooLock(path);
      if (lock.tryLock(lockWatcher, new ServerServices(address, Service.GC_CLIENT).toString().getBytes())) {
        break;
      }
      UtilWaitThread.sleep(1000);
    }
  }
View Full Code Here

            }
          });
        }
      };
     
      byte[] lockContent = new ServerServices(getClientAddressString(), Service.TSERV_CLIENT).toString().getBytes();
      for (int i = 0; i < 120 / 5; i++) {
        zoo.putPersistentData(zPath, new byte[0], NodeExistsPolicy.SKIP);
       
        if (tabletServerLock.tryLock(lw, lockContent)) {
          log.debug("Obtained tablet server lock " + tabletServerLock.getLockPath());
View Full Code Here

          if (info == null) {
            // Yep: hold onto the information about this server
            byte[] lockData = ZooLock.getLockData(lockPath);
            String lockString = new String(lockData == null ? new byte[] {} : lockData);
            if (lockString.length() > 0 && !lockString.equals("master")) {
              ServerServices services = new ServerServices(new String(lockData));
              InetSocketAddress client = services.getAddress(ServerServices.Service.TSERV_CLIENT);
              InetSocketAddress addr = AddressUtil.parseAddress(server, Property.TSERV_CLIENTPORT);
              TServerConnection conn = new TServerConnection(addr);
              instance = new TServerInstance(client, lock.getSessionId());
              info = new TServerInfo(lock, instance, conn, watcher);
              current.put(server, info);
View Full Code Here

      try {
        String path = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZGC_LOCK;
        List<String> locks = zk.getChildren(path, null);
        if (locks != null && locks.size() > 0) {
          Collections.sort(locks);
          InetSocketAddress address = new ServerServices(new String(zk.getData(path + "/" + locks.get(0), null, null))).getAddress(Service.GC_CLIENT);
          GCMonitorService.Iface client = ThriftUtil.getClient(new GCMonitorService.Client.Factory(), address, AccumuloConfiguration.getSystemConfiguration());
          try {
            result = client.getStatus(null, SecurityConstants.systemCredentials);
          } finally {
            ThriftUtil.returnClient(client);
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.util.ServerServices

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.