/** * Destroy the linked cluster view manager. */ public synchronized void destroy() { if(clusterViewManager != null) { clusterViewManager.destroy(); this.clusterViewManager = null; } }
/** * Get a reference to the first component matching the interface. * @param <Comp> The interface type. * @param itf The interface class. * @return The component. */ public <Comp extends Component> Comp getComponent(final Class<Comp> itf) { return clusterViewManager.getComponent(itf); }
@Override public String toString() { return "DistributedObjectInfo=[" + super.toString() + ",lbPolicyData=" + policyData + ",filters= " + filters + ",replicated=" + replicated + ",poolConfiguration=" + poolConfiguration + "]"; }
public synchronized final void stop() { if(getState().equals(State.STARTED) || getState().equals(State.AVAILABLE)) { setState(State.STOPPING); stopping(); if(getConfig().isAdminEnabled()) { // Unregister the CMI MBean try { MBeanUtils.unregisterCMIMBean(); } catch (CMIMBeanConfigException e) { LOGGER.error("Cannot unregister CMIMBean", e); } } setState(State.STOPPED); LOGGER.info("Cluster view manager stopped."); } }
@SuppressWarnings("unchecked") @Override protected CMIReferenceable<T> getCMIReferenceable(final CMIReference cmiReference) throws Exception { return (CMIReferenceable<T>) clusterViewManager.getPool(objectName).get(cmiReference); }
public Thread newThread(final Runnable r) { return newThread(r, null); }
/** * Returns true if the object with the given name has a pool of CMIReferenceable. * @param objectName a name of object * @return true if the object with the given name has a pool of CMIReferenceable */ protected final boolean hasPool(final String objectName) { localObjectData.putIfAbsent(objectName, new LocalObjectData(objectName)); return localObjectData.get(objectName).getPool() != null; }
/** * @return the protocols registered in the manager */ public Set<String> getProtocols() { return clusterViewManager.getProtocols(); }
/** * Associates a name of object with a pool of CMIReferenceable. * @param objectName a name of object * @param pool a pool of CMIReferenceable */ public final void setPool(final String objectName, final Pool<CMIReferenceable<?>, CMIReference> pool) { localObjectData.putIfAbsent(objectName, new LocalObjectData(objectName)); localObjectData.get(objectName).setPool(pool); }
/** * Returns the instance of LB policy associated with the given name of object. * @param objectName a name of object * @return the instance of LB policy associated with the given name of object */ public final IPolicy<CMIReference> getPolicy(final String objectName) { localObjectData.putIfAbsent(objectName, new LocalObjectData(objectName)); return localObjectData.get(objectName).getPolicy(); }
/** * Associates a name of of object with an instance of LB policy. * @param objectName a name of object * @param lbPolicy an instance of LB policy to associate with the given object */ private void setPolicy(final String objectName, final IPolicy<CMIReference> lbPolicy) { localObjectData.putIfAbsent(objectName, new LocalObjectData(objectName)); localObjectData.get(objectName).setPolicy(lbPolicy); }
/** * Returns the time between each update of the cluster view by clients. * @return the time between each update of the cluster view by clients */ public Integer getDelayToRefresh() { return clusterViewManager.getDelayToRefresh(); }
/** * @return the set of clustered object names */ public Set<String> getObjectNames() { return clusterViewManager.getObjectNames(); }
public void destroy() { stop(); destroyed = true; }
/** * @param manager */ private void unregisterClusterViewManager(final ClusterViewManager manager) { this.service.unregisterDispatcher(manager.getCMIManagedObjectId()); this.objects.remove(manager); }
private void registerCMIManagedObject() { dispatcher = clusterViewManager.getEventDispatcher(); if(dispatcher != null) { cmiManagedObjectId = "/cmi/" + objectName + "/" + protocolName + "/" + id++; // Register to event component. CMIEventComponent eventComponent = getComponent(CMIEventComponent.class); if (eventComponent != null) { eventComponent.registerCMIManagedObject(this, this.dispatcher); } } }
/** * Updates a policy of load-balancing for a object with the given name. * @param objectName a name of object * @throws ObjectNotFoundException if none object has the given name * @throws PolicyFactoryException if the policy cannot be updated */ protected final void updatePolicy(final String objectName) throws ObjectNotFoundException, PolicyFactoryException { LOGGER.debug("Updating policy for {0}", objectName); PolicyFactory<CMIReference> policyFactory = new PolicyFactory<CMIReference>(this); IPolicy<CMIReference> policy = policyFactory.getPolicy(objectName); setPolicy(objectName, policy); }
public ImmutableClusteredObjectInfos getImmutableInfos() { return new ImmutableClusteredObjectInfos(getClusterName(), isProxyEnabled(), getObjectName(), getItfName(), getBusinessName(), isStateful(), getApplicationExceptionNames()); }
@Override protected void onFinallyHook(final String objectName, final CMIReferenceable<T> cmiReferenceable) { try { clusterViewManager.getPool(objectName).release(cmiReferenceable); } catch (Exception e) { logger.debug("Cannot release the reference {0}", cmiReferenceable, e); } }
/** * Returns a pool of CMIReferenceable for an object with the given name. * @param objectName a name of object * @return a pool of CMIReferenceable for an object with the given name */ public final Pool<CMIReferenceable<?>, CMIReference> getPool(final String objectName) { localObjectData.putIfAbsent(objectName, new LocalObjectData(objectName)); return localObjectData.get(objectName).getPool(); }