public void setPassword(String passWord) { ((ZKBackend) getBackend()).setPassword(passWord); }
/** * {@inheritDoc} */ @Override public synchronized void connect() throws InterruptedException, ServiceLocatorException { getBackend().connect(); }
/** * {@inheritDoc} */ @Override public synchronized void disconnect() throws InterruptedException, ServiceLocatorException { getBackend().disconnect(); }
/** * Specify the time this client waits {@link #connect() for a connection to * get established}. * * @param timeout timeout in milliseconds, must be greater than zero */ public void setConnectionTimeout(int timeout) { ((ZKBackend) getBackend()).setConnectionTimeout(timeout); if (LOG.isLoggable(Level.FINE)) { LOG.fine("Locator connection timeout set to: " + timeout); } }
/** * Specify the time this client waits {@link #connect() for a connection to * get established}. * * @param timeout timeout in milliseconds, must be greater than zero */ public void setConnectionTimeout(int timeout) { ((ZKBackend) getBackend()).setConnectionTimeout(timeout); if (LOG.isLoggable(Level.FINE)) { LOG.fine("Locator connection timeout set to: " + timeout); } }
public void setName(String name) { ((ZKBackend) getBackend()).setUserName(name); if (LOG.isLoggable(Level.FINE)) { LOG.fine("User name set to: " + name); } }
public void setName(String name) { ((ZKBackend) getBackend()).setUserName(name); if (LOG.isLoggable(Level.FINE)) { LOG.fine("User name set to: " + name); } }
/** * {@inheritDoc} */ @Override public synchronized void connect() throws InterruptedException, ServiceLocatorException { getBackend().connect(); }
/** * {@inheritDoc} */ @Override public synchronized void disconnect() throws InterruptedException, ServiceLocatorException { getBackend().disconnect(); }
public void setPassword(String passWord) { ((ZKBackend) getBackend()).setPassword(passWord); }
/** * Specify the time out of the session established at the server. The * session is kept alive by requests sent by this client object. If the * session is idle for a period of time that would timeout the session, the * client will send a PING request to keep the session alive. * * @param timeout timeout in milliseconds, must be greater than zero and less * than 60000. */ public void setSessionTimeout(int timeout) { ((ZKBackend) getBackend()).setSessionTimeout(timeout); if (LOG.isLoggable(Level.FINE)) { LOG.fine("Locator session timeout set to: " + timeout); } }
/** * Specify the time out of the session established at the server. The * session is kept alive by requests sent by this client object. If the * session is idle for a period of time that would timeout the session, the * client will send a PING request to keep the session alive. * * @param timeout timeout in milliseconds, must be greater than zero and less * than 60000. */ public void setSessionTimeout(int timeout) { ((ZKBackend) getBackend()).setSessionTimeout(timeout); if (LOG.isLoggable(Level.FINE)) { LOG.fine("Locator session timeout set to: " + timeout); } }
/** * Specify the endpoints of all the instances belonging to the service * locator ensemble this object might potentially be talking to when * {@link #connect() connecting}. The object will one by one pick an * endpoint (the order is non-deterministic) to connect to the service * locator until a connection is established. * * @param endpoints comma separated list of endpoints,each corresponding to a * service locator instance. Each endpoint is specified as a * host:port pair. At least one endpoint must be specified. Valid * exmaples are: "127.0.0.1:2181" or * "sl1.example.com:3210, sl2.example.com:3210, sl3.example.com:3210" */ public void setLocatorEndpoints(String endpoints) { ((ZKBackend) getBackend()).setLocatorEndpoints(endpoints); if (LOG.isLoggable(Level.FINE)) { LOG.fine("Locator endpoints set to " + endpoints); } }
/** * Specify the endpoints of all the instances belonging to the service * locator ensemble this object might potentially be talking to when * {@link #connect() connecting}. The object will one by one pick an * endpoint (the order is non-deterministic) to connect to the service * locator until a connection is established. * * @param endpoints comma separated list of endpoints,each corresponding to a * service locator instance. Each endpoint is specified as a * host:port pair. At least one endpoint must be specified. Valid * exmaples are: "127.0.0.1:2181" or * "sl1.example.com:3210, sl2.example.com:3210, sl3.example.com:3210" */ public void setLocatorEndpoints(String endpoints) { ((ZKBackend) getBackend()).setLocatorEndpoints(endpoints); if (LOG.isLoggable(Level.FINE)) { LOG.fine("Locator endpoints set to " + endpoints); } }
/** * {@inheritDoc} */ @Override public List<QName> getServices() throws InterruptedException, ServiceLocatorException { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Getting all services..."); } RootNode rootNode = getBackend().connect(); return rootNode.getServiceNames(); }
/** * {@inheritDoc} */ @Override public List<QName> getServices() throws InterruptedException, ServiceLocatorException { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Getting all services..."); } RootNode rootNode = getBackend().connect(); return rootNode.getServiceNames(); }
/** * {@inheritDoc} */ @Override public synchronized void removeEndpoint(QName serviceName, String endpoint) throws ServiceLocatorException, InterruptedException { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Removing endpoint " + endpoint + " for service " + serviceName + "..."); } RootNode rootNode = getBackend().connect(); ServiceNode serviceNode = rootNode.getServiceNode(serviceName); EndpointNode endpointNode = serviceNode.getEndPoint(endpoint); endpointNode.ensureRemoved(); }
/** * {@inheritDoc} */ @Override public synchronized void removeEndpoint(QName serviceName, String endpoint) throws ServiceLocatorException, InterruptedException { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Removing endpoint " + endpoint + " for service " + serviceName + "..."); } RootNode rootNode = getBackend().connect(); ServiceNode serviceNode = rootNode.getServiceNode(serviceName); EndpointNode endpointNode = serviceNode.getEndPoint(endpoint); endpointNode.ensureRemoved(); }
@Override public synchronized void performCollection() { LOG.fine("Performing expired endpoint collection."); Date now = new Date(); try { RootNode root = getBackend().connect(); List<QName> svcs = root.getServiceNames(); for (QName svc : svcs) { ServiceNode svcNode = root.getServiceNode(svc); List<EndpointNode> epts = svcNode.getEndPoints(); for (EndpointNode ept : epts) { Date expTime = ept.getExpiryTime(); if (expTime != null && expTime.before(now)) { unregisterEndpoint(svc, ept.getEndpointName()); } } } } catch (Exception e) { throw new RuntimeException(e); } }
/** * {@inheritDoc} */ @Override public SLEndpoint getEndpoint(final QName serviceName, final String endpoint) throws ServiceLocatorException, InterruptedException { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Get endpoint information for endpoint " + endpoint + " within service " + serviceName + "..."); } RootNode rootNode = getBackend().connect(); ServiceNode serviceNode = rootNode.getServiceNode(serviceName); EndpointNode endpointNode = serviceNode.getEndPoint(endpoint); if (endpointNode.exists()) { byte[] content = endpointNode.getContent(); final boolean isLive = endpointNode.isLive(); return transformer.toSLEndpoint(serviceName, content, isLive); } else { return null; } }