Examples of ZooKeeperServer


Examples of com.linkedin.d2.balancer.servers.ZooKeeperServer

      ZooKeeperEphemeralStore<UriProperties> uriStore = new ZooKeeperEphemeralStore<UriProperties>(serverConn, new UriPropertiesJsonSerializer(), new UriPropertiesMerger(), ZKFSUtil.uriPath(BASE_PATH));
      callback = new FutureCallback<None>();
      uriStore.start(callback);
      callback.get(30, TimeUnit.SECONDS);

      ZooKeeperServer server = new ZooKeeperServer(uriStore);
      callback = new FutureCallback<None>();
      Map<Integer, PartitionData> partitionDataMap = new HashMap<Integer, PartitionData>();
      partitionDataMap.put(DefaultPartitionAccessor.DEFAULT_PARTITION_ID, new PartitionData(1.0));
      server.markUp(TEST_CLUSTER_NAME, URI.create("http://test.uri"), partitionDataMap, callback);
      callback.get(30, TimeUnit.SECONDS);

      URIRequest request = new URIRequest("d2://" + TEST_SERVICE_NAME + "/foo");
      TransportClient client = balancer.getClient(request, new RequestContext());
View Full Code Here

Examples of org.apache.hdt.core.internal.model.ZooKeeperServer

  /**
   * @param zkServerName
   * @param uri
   */
  public ZooKeeperServer createServer(String zkServerName, String zkServerLocation) {
    ZooKeeperServer zkServer = HadoopFactory.eINSTANCE.createZooKeeperServer();
    zkServer.setName(zkServerName);
    zkServer.setUri(zkServerLocation);
    getServers().add(zkServer);
    HadoopManager.INSTANCE.saveServers();
    return zkServer;
  }
View Full Code Here

Examples of org.apache.hdt.core.internal.model.ZooKeeperServer

      @SuppressWarnings("rawtypes")
      Iterator itr = sSelection.iterator();
      while (itr.hasNext()) {
        Object object = itr.next();
        if (object instanceof ZooKeeperServer) {
          ZooKeeperServer r = (ZooKeeperServer) object;
          if (logger.isDebugEnabled())
            logger.debug("Deleting: " + r);
          try {
            ZooKeeperManager.INSTANCE.disconnect(r);
          } finally {
View Full Code Here

Examples of org.apache.hdt.core.internal.model.ZooKeeperServer

      Iterator itr = sSelection.iterator();
      while (itr.hasNext()) {
        Object object = itr.next();
        enabled = false;
        if (object instanceof ZooKeeperServer) {
          ZooKeeperServer server = (ZooKeeperServer) object;
          enabled = server != null;
        } else if (object instanceof ZNode) {
          ZNode zkn = (ZNode) object;
          enabled = zkn != null;
        }
View Full Code Here

Examples of org.apache.hdt.core.internal.model.ZooKeeperServer

      @SuppressWarnings("rawtypes")
      Iterator itr = sSelection.iterator();
      while (itr.hasNext()) {
        Object object = itr.next();
        if (object instanceof ZooKeeperServer) {
          ZooKeeperServer zks = (ZooKeeperServer) object;
          enabled = zks.getStatusCode() == ServerStatus.CONNECTED_VALUE;
        } else
          enabled = object instanceof ZNode;
      }
    } else
      enabled = false;
View Full Code Here

Examples of org.apache.hdt.core.internal.model.ZooKeeperServer

   * .Object, org.eclipse.jface.viewers.IDecoration)
   */
  @Override
  public void decorate(Object element, IDecoration decoration) {
    if (element instanceof ZooKeeperServer) {
      ZooKeeperServer zks = (ZooKeeperServer) element;

      // Image decorations
      if (zks.getStatusCode() == ServerStatus.DISCONNECTED_VALUE)
        decoration.addOverlay(org.apache.hdt.ui.Activator.IMAGE_OFFLINE_OVR);
      else
        decoration.addOverlay(org.apache.hdt.ui.Activator.IMAGE_ONLINE_OVR);

      // Text decorations
      decoration.addSuffix("  " + zks.getUri());
    } else if (element instanceof ZNode) {
      ZNode zkn = (ZNode) element;
      if (zkn.getVersion() > -1) {
        decoration.addSuffix("  [v=" + zkn.getVersion() + "]");
      }
View Full Code Here

Examples of org.apache.hdt.core.internal.model.ZooKeeperServer

      @SuppressWarnings("rawtypes")
      Iterator itr = sSelection.iterator();
      while (itr.hasNext()) {
        Object object = itr.next();
        if (object instanceof ZooKeeperServer) {
          ZooKeeperServer r = (ZooKeeperServer) object;
          if(logger.isDebugEnabled())
            logger.debug("Reconnecting: "+r);
          ZooKeeperManager.INSTANCE.reconnect(r);
          if(logger.isDebugEnabled())
            logger.debug("Reconnected: "+r);
View Full Code Here

Examples of org.apache.hdt.core.internal.model.ZooKeeperServer

      @SuppressWarnings("rawtypes")
      Iterator itr = sSelection.iterator();
      while (itr.hasNext()) {
        Object object = itr.next();
        if (object instanceof ZooKeeperServer) {
          ZooKeeperServer server = (ZooKeeperServer) object;
          try {
            enabled = server == null ? false : server.getStatusCode() == ServerStatus.DISCONNECTED_VALUE;
          } catch (Throwable t) {
            enabled = false;
          }
        } else
          enabled = false;
View Full Code Here

Examples of org.apache.hdt.core.internal.model.ZooKeeperServer

  }

  @Override
  public String getText(Object element) {
    if (element instanceof ZooKeeperServer) {
      ZooKeeperServer zks = (ZooKeeperServer) element;
      return zks.getName();
    }
    if (element instanceof ZNode)
      return ((ZNode) element).getNodeName();
    return null;
  }
View Full Code Here

Examples of org.apache.hdt.core.internal.model.ZooKeeperServer

      @SuppressWarnings("rawtypes")
      Iterator itr = sSelection.iterator();
      while (itr.hasNext()) {
        Object object = itr.next();
        if (object instanceof ZooKeeperServer) {
          ZooKeeperServer r = (ZooKeeperServer) object;
          if(logger.isDebugEnabled())
            logger.debug("Disconnecting: "+r);
          ZooKeeperManager.INSTANCE.disconnect(r);
          if(logger.isDebugEnabled())
            logger.debug("Disconnected: "+r);
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.