@SuppressWarnings("unchecked") protected <T> List<T> callMethodOnPartition(String methodName, Object[] args, Class<?>[] types) throws Exception { GroupRpcDispatcher dispatcher = this.partition; return (List<T>) dispatcher.callMethodOnCluster(this.name, methodName, args, types, true); }
public String getGroupName() { return rpcDispatcher.getGroupName(); }
public void start() throws Exception { this.me = this.rpcDispatcher.getClusterNode(); this.localHandler.setLocalNode(this.me); this.rpcTarget = new RpcTarget(this); this.rpcDispatcher.registerRPCHandler(this.serviceHAName, this.rpcTarget); this.membershipNotifier.registerGroupMembershipListener(this); List<ClusterNode> allMembers = new ArrayList<ClusterNode>(); for (ClusterNode node : this.rpcDispatcher.getClusterNodes()) { allMembers.add(node); } membershipChanged(new ArrayList<ClusterNode>(), allMembers, allMembers); }
List<RemoteLockResponse> rsps = rpcDispatcher.callMethodOnCluster(getServiceHAName(), "remoteLock", new Object[]{lockId, me, new Long(left)}, REMOTE_LOCK_TYPES, RemoteLockResponse.class, true, null, rpcDispatcher.getMethodCallTimeout(), false);
public void stop() throws Exception { if (this.rpcTarget != null) { this.rpcDispatcher.unregisterRPCHandler(this.serviceHAName, this.rpcTarget); this.rpcTarget = null; this.membershipNotifier.unregisterGroupMembershipListener(this); List<ClusterNode> dead = new ArrayList<ClusterNode>(members); List<ClusterNode> empty = new ArrayList<ClusterNode>(); membershipChanged(dead, empty, empty); this.me = null; } }
if (!rpcDispatcher.isConsistentWith(membershipNotifier))
/** Back out of a failed attempt by the local node to lock */ private void cleanup(Serializable categoryName, ClusterLockState category) { try { rpcDispatcher.callMethodOnCluster(getServiceHAName(), "releaseRemoteLock", new Object[]{categoryName, me}, RELEASE_REMOTE_LOCK_TYPES, true); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException("Failed releasing remote lock", e); } finally { if (category.state.compareAndSet(ClusterLockState.State.REMOTE_LOCKING, ClusterLockState.State.UNLOCKED) == false) { category.state.compareAndSet(ClusterLockState.State.LOCAL_LOCKING, ClusterLockState.State.UNLOCKED); } } }
getGroupRpcDispatcher().callMethodOnCluster(getServiceHAName(), "releaseRemoteLock", new Object[]{lockId, myself}, RELEASE_REMOTE_LOCK_TYPES, true);