/** * @return the set of clustered object names */ public Set<String> getObjectNames() { return clientClusterViewCache.getObjectNames(); }
@Override public void stopping() { refreshed = false; providerServerRefs = null; clientClusterViewCache.clear(); clientClusterViewProvider = null; }
private void setConfiguration(final IUpdatedClientConfig updatedClientConfig) { ((IClientConfig) getConfig()).setUpdatedConfig(updatedClientConfig); }
/** * Updates informations about clustering for every watched objects. * @throws ClientClusterViewManagerException if the update failed * @throws RemoteException */ public void updateClusterView() throws ClientClusterViewManagerException, RemoteException { pullAndUpdateConfiguration(); // Update list of node for each clustered RMI object for(String objectName : getNamesOfWatchedObject()) { try { pullAndUpdateObjectInfos(objectName); } catch (ObjectNotFoundException e) { LOGGER.error("The object with name {0} is unknown", objectName, e); throw new ClientClusterViewManagerException( "The object with name " + objectName + " is unknown", e); } } pullAndUpdateLoadFactors(); }
/** * Returns the class that defines the strategy for an object with the given name. * @param objectName a name of object * @return the class that defines the strategy for an object with the given name * @throws ObjectNotFoundException if none object has the given name * @throws ClientClusterViewManagerException if the class of strategy of the object with the given name cannot be downloaded */ public Class<? extends IStrategy<?>> getStrategyClass(final String objectName) throws ObjectNotFoundException, ClientClusterViewManagerException { synchronized (clientClusterViewCache) { String classname = getStrategyClassName(objectName); Class<? extends IStrategy<?>> strategy = clientClusterViewCache.getStrategyClass(classname); if(strategy == null) { try { strategy = pullStrategyClass(objectName); } catch (Exception e) { LOGGER.error("Cannot set the class of strategy for {0}", objectName, e); throw new ClientClusterViewManagerException("Cannot set the class of strategy for " + objectName, e); } clientClusterViewCache.setStrategyClass(classname, strategy); } return strategy; } }
/** * Returns the class that defines the policy for an object with the given name. * @param objectName a name of object * @return the class that defines the policy for an object with the given name * @throws ObjectNotFoundException if none object has the given name * @throws ClientClusterViewManagerException if the class of policy of the object with the given name cannot be downloaded */ public Class<? extends IPolicy<?>> getPolicyClass(final String objectName) throws ObjectNotFoundException, ClientClusterViewManagerException { synchronized (clientClusterViewCache) { String classname = getPolicyClassName(objectName); Class<? extends IPolicy<?>> policy = clientClusterViewCache.getPolicyClass(classname); if(policy == null) { try { policy = pullPolicyClass(objectName); } catch (Exception e) { LOGGER.error("Cannot set the class of policy for {0}", objectName, e); throw new ClientClusterViewManagerException("Cannot set the class of policy for " + objectName, e); } clientClusterViewCache.setPolicyClass(classname, policy); } return policy; } }
/** * Pulls and updates the CMI references for the object with the given name. * @param objectName a name of object * @throws RemoteException * @throws ObjectNotFoundException */ private void pullAndUpdateCMIReferences(final String objectName) throws RemoteException, ObjectNotFoundException { // Update the list of nodes for this RMI object Collection<CMIReference> cmiReferences = clientClusterViewProvider.getCMIReferences(objectName, protocol); // Update the load-factor of each server for(CMIReference cmiRef : cmiReferences) { pullAndUpdateMissingLoadFactor(cmiRef.getServerRef()); } clientClusterViewCache.getClusteredObject(objectName).setCMIReferences(cmiReferences); }
private void pullAddUpdateReplicationInfos(final String objectName) throws RemoteException, ObjectNotFoundException { clientClusterViewCache.getClusteredObject(objectName).setReplicated( clientClusterViewProvider.isReplicated(objectName)); }
public boolean isProxyEnabled(final String objectName) throws ObjectNotFoundException { try { return clientClusterViewCache.getClusteredObject(objectName).isProxyEnabled(); } catch (NullPointerException e) { LOGGER.error("Object is unknown: {0}", objectName); throw new ObjectNotFoundException("Object is unknown: " + objectName); } }
/** * Return classnames of the application exceptions. * @param objectName a name of object * @return classnames of the application exceptions * @throws ObjectNotFoundException if none object has the given name */ public Set<String> getApplicationExceptionNames(final String objectName) throws ObjectNotFoundException{ try { return clientClusterViewCache.getClusteredObject(objectName).getApplicationExceptionNames(); } catch (NullPointerException e) { LOGGER.error("Object is unknown: {0}", objectName); throw new ObjectNotFoundException("Object is unknown: " + objectName); } }
/** * Returns the name of cluster for the object with the given name. * @param objectName a name of object * @return the name of cluster for a object with the given name * @throws ObjectNotFoundException if none object has the given name */ public String getClusterName(final String objectName) throws ObjectNotFoundException { try { return clientClusterViewCache.getClusteredObject(objectName).getClusterName(); } catch (NullPointerException e) { LOGGER.error("Object is unknown: {0}", objectName); throw new ObjectNotFoundException("Object is unknown: " + objectName); } }
/** * Returns the interface of an object bound with the given name. * @param objectName a name of object * @return the interface of an object bound with the given name * @throws ObjectNotFoundException if none object has the given name */ public Class<?> getInterface(final String objectName) throws ObjectNotFoundException { try { return clientClusterViewCache.getClusteredObject(objectName).getItfClass(); } catch (NullPointerException e) { LOGGER.error("Object is unknown: {0}", objectName); throw new ObjectNotFoundException("Object is unknown: " + objectName); } }
/** * Returns the interface of an object bound with the given name. * @param objectName a name of object * @return the interface of an object bound with the given name * @throws ObjectNotFoundException if none object has the given name */ public Class<? extends EJBObject> getRemoteClass(final String objectName) throws ObjectNotFoundException { try { return clientClusterViewCache.getClusteredObject(objectName).getBusinessClass(); } catch (NullPointerException e) { LOGGER.error("Object is unknown: {0}", objectName); throw new ObjectNotFoundException("Object is unknown: " + objectName); } }
/** * Return true if the object with the given name is stateful. * @param objectName a name of object * @return true if the object with the given name is stateful * @throws ObjectNotFoundException if none object has the given name */ public boolean hasState(final String objectName) throws ObjectNotFoundException { try { return clientClusterViewCache.getClusteredObject(objectName).isStateful(); } catch (NullPointerException e) { LOGGER.error("Object is unknown: {0}", objectName); throw new ObjectNotFoundException("Object is unknown: " + objectName); } }
/** * Return true if the object with the given name is replicated for high-availability. * @param objectName a name of object * @return true if the object with the given name is replicated for high-availability * @throws ObjectNotFoundException if none object has the given name */ public boolean isReplicated(final String objectName) throws ObjectNotFoundException { try { return clientClusterViewCache.getClusteredObject(objectName).isReplicated(); } catch (NullPointerException e) { LOGGER.error("Object is unknown: {0}", objectName); throw new ObjectNotFoundException("Object is unknown: " + objectName); } }
/** * Returns a list of CMIReference for an object with the given name and protocol. * @param objectName a name of object * @param protocolName a name of protocol * @return a list of CMIReference for an object with the given name and protocol * @throws ObjectNotFoundException if none object has the given name for the given protocol */ public List<CMIReference> getCMIReferences(final String objectName, final String protocolName) throws ObjectNotFoundException { try { return clientClusterViewCache.getClusteredObject(objectName).getCMIReferences(); } catch (NullPointerException e) { LOGGER.error("Object is unknown: {0}", objectName); throw new ObjectNotFoundException("Object is unknown: " + objectName); } }
/** * Returns the properties of the LB policy for an object with the given name. * @param objectName a name of object * @return the properties of the policy for an object with the given name * @throws ObjectNotFoundException if none object has the given name */ public Map<String, Object> getPropertiesForPolicy(final String objectName) throws ObjectNotFoundException { try { return clientClusterViewCache.getClusteredObject(objectName).getPolicyData().getProperties(); } catch (NullPointerException e) { LOGGER.error("Object is unknown: {0}", objectName); throw new ObjectNotFoundException("Object is unknown: " + objectName); } }
public ClientClusteredObjectView addClusteredObject(final String clusterName, final boolean proxyEnabled, final String objectName, final String itfName, final String businessName, final boolean stateful, final Set<String> applicationExceptionNames ) { ClientClusteredObjectView clusteredObjectView = objects.get(objectName); if(clusteredObjectView == null) { clusteredObjectView = new ClientClusteredObjectView(clusterName, proxyEnabled, objectName, itfName, businessName, stateful, applicationExceptionNames); objects.put(objectName, clusteredObjectView); } return clusteredObjectView; }
/** * Returns the load-factor for the server with the given address. * @param serverRef a reference on a server * @return the load-factor for the server with the given address */ public int getLoadFactor(final ServerRef serverRef) { return clientClusterViewCache.getLoadFactor(serverRef); }
private void pullAndUpdateConfiguration() throws RemoteException { long configDate = clientClusterViewProvider.getDateOfConfiguration(); if(configDate > this.configDate) { setConfiguration(clientClusterViewProvider.getConfiguration()); this.configDate = configDate; } }