/** * Removes the local node from the distributed registry of nodes providing * the service. After this call, the HATarget can still be queried for * view change, etc. but the local node's instance of the service is no * longer registered with the cluster. * <p> * <strong>NOTE:</strong> Calling this method does not cause * {@link #invocationsAllowed()} to return <code>false</code>. Use * {@link #destroy()} unless your application needs to separately control * the two aspects of shutting down a clustered service. */ public void disable() { try { if (this.partition != null) { log.debug ("Disabled called on HATarget"); this.partition.getDistributedReplicantManager().remove (this.replicantName); } } catch (Exception e) { log.error("failed to disable", e); } }
List<ModClusterServiceDRMEntry> lookupDRMEntries() { DistributedReplicantManager drm = this.getHAPartition().getDistributedReplicantManager(); @SuppressWarnings("unchecked") List<CachableMarshalledValue> values = (List<CachableMarshalledValue>) drm.lookupReplicants(this.getHAServiceKey()); if (values == null) return null; List<ModClusterServiceDRMEntry> entries = new ArrayList<ModClusterServiceDRMEntry>(values.size()); for (CachableMarshalledValue value: values) { entries.add(this.extractDRMEntry(value)); } return entries; }
/** * Unregister's with the partition's {@link DistributedReplicantManager}. */ protected void cleanExistenceInCurrentHAPartition() { if (this.partition != null) { try { DistributedReplicantManager drm = partition.getDistributedReplicantManager(); drm.unregisterListener(this.replicantName, this); drm.remove(this.replicantName); } catch (Exception e) { log.error("failed to clean existence in current ha partition", e); } } }
protected boolean isDRMMasterReplica() { DistributedReplicantManager drm = this.getHAPartition().getDistributedReplicantManager(); return drm.isMasterReplica(this.getHAServiceKey()); }
protected void unregisterDRMListener() throws Exception { DistributedReplicantManager drm = this.partition.getDistributedReplicantManager(); String key = this.getHAServiceKey(); // remove replicant node drm.remove(key); // unregister drm.unregisterListener(key, this); }
protected List<ClusterNode> getElectionCandidates() { return this.getHAPartition().getDistributedReplicantManager().lookupReplicantsNodes(this.getHAServiceKey()); }
/** * Associates this target with the given partition, registering * with the partition's {@link DistributedReplicantManager}. * * @param partition the partition * @throws Exception */ protected void updateHAPartition(HAPartition partition) throws Exception { cleanExistenceInCurrentHAPartition(); this.partition = partition; DistributedReplicantManager drm = partition.getDistributedReplicantManager(); drm.registerListener(this.replicantName, this); drm.add(this.replicantName, this.target); }
DistributedReplicantManager drm = partition.getDistributedReplicantManager(); List<ClusterNode> nodes = drm.lookupReplicantsNodes(getServiceHAName()); ClusterNode coord = (nodes != null && nodes.size() > 0 ? nodes.get(0) : null);
protected void registerDRMListener() throws Exception { if (log.isDebugEnabled()) { log.debug("HAServiceImpl.registerDRMListener for service=" + getHAServiceKey()); } DistributedReplicantManager drm = this.partition.getDistributedReplicantManager(); String key = this.getHAServiceKey(); drm.registerListener(key, this); // this ensures that the DRM knows that this node has the MBean deployed drm.add(key, this.getReplicant()); }
ModClusterServiceDRMEntry lookupLocalDRMEntry() { DistributedReplicantManager drm = this.getHAPartition().getDistributedReplicantManager(); return this.extractDRMEntry((CachableMarshalledValue) drm.lookupLocalReplicant(this.getHAServiceKey())); }
/** * Remove the service from active operation. * * @throws Exception */ public void stop() throws Exception { DistributedReplicantManager drm = partition.getDistributedReplicantManager(); drm.unregisterListener(getServiceHAName(), drmListener); drm.remove(getServiceHAName()); coordinator = false; partition.unregisterRPCHandler(getServiceHAName(), rpcTarget); synchronized (liveServers) { liveServers.clear(); } synchronized (unresolvedRemoteDependencies) { unresolvedRemoteDependencies.clear(); } }
void updateLocalDRM(ModClusterServiceDRMEntry entry) { DistributedReplicantManager drm = this.getHAPartition().getDistributedReplicantManager(); try { drm.add(this.getHAServiceKey(), this.createReplicant(entry)); } catch (Exception e) { throw Utils.convertToUnchecked(e); } }
@Override public void startService() throws Exception { if (this.partition == null) throw new IllegalStateException("HAPartition property must be set before starting InvalidationBridge service"); this.RPC_HANDLER_NAME = "DCacheBridge-" + this.bridgeName; DistributedReplicantManager drm = this.partition.getDistributedReplicantManager(); DistributedState ds = this.partition.getDistributedStateService(); drm.add(this.RPC_HANDLER_NAME, ""); drm.registerListener(this.RPC_HANDLER_NAME, this); ds.registerDSListenerEx(this.RPC_HANDLER_NAME, this); this.partition.registerRPCHandler(this.RPC_HANDLER_NAME, this); // we now publish the list of caches we have access to if (this.invalMgr == null) { throw new IllegalStateException("Failed to find an InvalidationManagerMBean, ensure one is injected"); } this.publishLocalInvalidationGroups(); this.updatedBridgedInvalidationGroupsInfo(); this.invalidationSubscription = this.invalMgr.registerBridgeListener(this); }
public void shutdown() throws Exception { DistributedReplicantManager drm = this.partition.getDistributedReplicantManager(); drm.unregisterListener(getServiceHAName(), drmListener); drm.remove(getServiceHAName()); this.partition.unregisterRPCHandler(getServiceHAName(), rpcTarget); this.lockSupport.stop(); this.contentManager = null; this.initialized = false; }
@Override public void stopService() { DistributedReplicantManager drm = this.partition.getDistributedReplicantManager(); DistributedState ds = this.partition.getDistributedStateService(); try { this.partition.unregisterRPCHandler(this.RPC_HANDLER_NAME, this); ds.unregisterDSListenerEx(this.RPC_HANDLER_NAME, this); drm.unregisterListener(this.RPC_HANDLER_NAME, this); drm.remove(this.RPC_HANDLER_NAME); this.invalidationSubscription.unregister(); ds.remove(this.RPC_HANDLER_NAME, this.partition.getNodeName(), true); // this.invalMgr = null; // partition = null; this.invalidationSubscription = null; this.RPC_HANDLER_NAME = null; this.localGroups = null; this.bridgedGroups = new Vector<String>(); } catch (Exception e) { this.log.info("Problem while shuting down invalidation cache bridge", e); } }
protected void startService() throws Exception this.drm = partition.getDistributedReplicantManager();
DistributedReplicantManager drm = this.partition.getDistributedReplicantManager(); drm.add(getServiceHAName(), this.partition.getClusterNode()); this.serviceView = drm.lookupReplicantsNodes(getServiceHAName());
private void executePull(SynchronizationId<?> id, SynchronizationWriteAction<?> action) throws Exception List<ClusterNode> peers = this.partition.getDistributedReplicantManager().lookupReplicantsNodes(getServiceHAName()); peers.remove(this.partition.getClusterNode());
/** * Bring the service into active operation. * * @throws Exception */ public void start() throws Exception { partition.registerRPCHandler(getServiceHAName(), rpcTarget); DistributedReplicantManager drm = partition.getDistributedReplicantManager(); drm.add(getServiceHAName(), partition.getClusterNode()); coordinator = drm.isMasterReplica(getServiceHAName()); drm.registerListener(getServiceHAName(), drmListener); statusCheck(); }
DistributedReplicantManager drm = this.getHAPartition().getDistributedReplicantManager();