From: <tho...@us...> - 2013-12-09 15:26:25
|
Revision: 7621 http://bigdata.svn.sourceforge.net/bigdata/?rev=7621&view=rev Author: thompsonbry Date: 2013-12-09 15:26:17 +0000 (Mon, 09 Dec 2013) Log Message: ----------- Modified forceRemoveService() to use the runActorTask() pattern for better code compatibility and forward support for timeouts on actor actors. See #779. Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/quorum/AbstractQuorum.java branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/quorum/QuorumActor.java branches/MGC_1_3_0/bigdata/src/java/com/bigdata/quorum/AbstractQuorum.java branches/MGC_1_3_0/bigdata/src/java/com/bigdata/quorum/QuorumActor.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/quorum/AbstractQuorum.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/quorum/AbstractQuorum.java 2013-12-09 15:13:30 UTC (rev 7620) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/quorum/AbstractQuorum.java 2013-12-09 15:26:17 UTC (rev 7621) @@ -2343,22 +2343,25 @@ * that will force them to fail rather than block forever. This will * then force the service into an error state if its QuorumActor can not * carry out the requested action within a specified timeout. - * - * @throws InterruptedException */ @Override - final public void forceRemoveService(final UUID psid) - throws InterruptedException { - lock.lockInterruptibly(); - try { + final public void forceRemoveService(final UUID psid) { + runActorTask(new ForceRemoveServiceTask(psid)); + } + + private class ForceRemoveServiceTask extends ActorTask { + private final UUID psid; + ForceRemoveServiceTask(final UUID psid) { + this.psid = psid; + } + @Override + protected void doAction() throws InterruptedException { log.warn("Forcing remove of service" + ": thisService=" + serviceId + ", otherServiceId=" + psid); doMemberRemove(psid); doWithdrawVote(psid); doPipelineRemove(psid); doServiceLeave(psid); - } finally { - lock.unlock(); } } Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/quorum/QuorumActor.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/quorum/QuorumActor.java 2013-12-09 15:13:30 UTC (rev 7620) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/quorum/QuorumActor.java 2013-12-09 15:26:17 UTC (rev 7621) @@ -219,8 +219,7 @@ * * @param serviceId * The UUID of the service to be removed. - * @throws InterruptedException */ - public void forceRemoveService(UUID serviceId) throws InterruptedException; + public void forceRemoveService(UUID serviceId); } Modified: branches/MGC_1_3_0/bigdata/src/java/com/bigdata/quorum/AbstractQuorum.java =================================================================== --- branches/MGC_1_3_0/bigdata/src/java/com/bigdata/quorum/AbstractQuorum.java 2013-12-09 15:13:30 UTC (rev 7620) +++ branches/MGC_1_3_0/bigdata/src/java/com/bigdata/quorum/AbstractQuorum.java 2013-12-09 15:26:17 UTC (rev 7621) @@ -2343,25 +2343,28 @@ * that will force them to fail rather than block forever. This will * then force the service into an error state if its QuorumActor can not * carry out the requested action within a specified timeout. - * - * @throws InterruptedException */ @Override - final public void forceRemoveService(final UUID psid) - throws InterruptedException { - lock.lockInterruptibly(); - try { + final public void forceRemoveService(final UUID psid) { + runActorTask(new ForceRemoveServiceTask(psid)); + } + + private class ForceRemoveServiceTask extends ActorTask { + private final UUID psid; + ForceRemoveServiceTask(final UUID psid) { + this.psid = psid; + } + @Override + protected void doAction() throws InterruptedException { log.warn("Forcing remove of service" + ": thisService=" + serviceId + ", otherServiceId=" + psid); doMemberRemove(psid); doWithdrawVote(psid); doPipelineRemove(psid); doServiceLeave(psid); - } finally { - lock.unlock(); } } - + /** * Invoked when our client will become the leader to (a) reorganize the * write pipeline such that our client is the first service in the write Modified: branches/MGC_1_3_0/bigdata/src/java/com/bigdata/quorum/QuorumActor.java =================================================================== --- branches/MGC_1_3_0/bigdata/src/java/com/bigdata/quorum/QuorumActor.java 2013-12-09 15:13:30 UTC (rev 7620) +++ branches/MGC_1_3_0/bigdata/src/java/com/bigdata/quorum/QuorumActor.java 2013-12-09 15:26:17 UTC (rev 7621) @@ -219,8 +219,7 @@ * * @param serviceId * The UUID of the service to be removed. - * @throws InterruptedException */ - public void forceRemoveService(UUID serviceId) throws InterruptedException; + public void forceRemoveService(UUID serviceId); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |