From: <tho...@us...> - 2013-10-11 15:20:54
|
Revision: 7450 http://bigdata.svn.sourceforge.net/bigdata/?rev=7450&view=rev Author: thompsonbry Date: 2013-10-11 15:20:47 +0000 (Fri, 11 Oct 2013) Log Message: ----------- Removed the lock from AbstractQuorum.getClient() and getMember(). Added a sleep before retry in the ErrorTask when spinning until zk is reconnected for doServiceLeave(). Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/quorum/AbstractQuorum.java branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/java/com/bigdata/journal/jini/ha/HAJournalServer.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-10-11 15:18:36 UTC (rev 7449) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/quorum/AbstractQuorum.java 2013-10-11 15:20:47 UTC (rev 7450) @@ -436,6 +436,7 @@ * and {@link QuorumWatcher} are created, and asynchronous discovery is * initialized for the {@link QuorumWatcher}. */ + @Override public void start(final C client) { if (client == null) throw new IllegalArgumentException(); @@ -505,6 +506,15 @@ } + /** + * Ensure that any guarded regions are interrupted. + */ + public void interruptAll() { + + threadGuard.interruptAll(); + + } + @Override public void terminate() { boolean interrupted = false; @@ -513,7 +523,7 @@ /* * Ensure that any guarded regions are interrupted. */ - threadGuard.interruptAll(); + interruptAll(); if (client == null) { // No client is attached. return; @@ -676,6 +686,7 @@ * inconsistent since the internal lock required for a consistent view is * NOT acquired. */ + @Override public String toString() { /* * Note: This must run w/o the lock to avoid deadlocks so there may be @@ -720,21 +731,23 @@ } } + @Override public C getClient() { - lock.lock(); - try { +// lock.lock(); +// try { final C client = this.client; if (client == null) throw new IllegalStateException(); return client; - } finally { - lock.unlock(); - } +// } finally { +// lock.unlock(); +// } } + @Override public QuorumMember<S> getMember() { - lock.lock(); - try { +// lock.lock(); +// try { final C client = this.client; if (client == null) throw new IllegalStateException(); @@ -742,9 +755,9 @@ return (QuorumMember<S>) client; } throw new UnsupportedOperationException(); - } finally { - lock.unlock(); - } +// } finally { +// lock.unlock(); +// } } /** @@ -785,6 +798,7 @@ * @throws IllegalStateException * if the quorum is not running. */ + @Override public QuorumActor<S, C> getActor() { lock.lock(); try { @@ -814,6 +828,7 @@ } } + @Override final public void addListener(final QuorumListener listener) { if (listener == null) throw new IllegalArgumentException(); @@ -822,6 +837,7 @@ listeners.add(listener); } + @Override final public void removeListener(final QuorumListener listener) { if (listener == null) throw new IllegalArgumentException(); @@ -830,6 +846,7 @@ listeners.remove(listener); } + @Override final public int replicationFactor() { // Note: [k] is final. @@ -837,18 +854,21 @@ } + @Override public final boolean isQuorum(final int njoined) { return njoined >= kmeet; } + @Override final public boolean isHighlyAvailable() { return replicationFactor() > 1; } + @Override final public long lastValidToken() { lock.lock(); try { @@ -858,6 +878,7 @@ } } + @Override final public UUID[] getMembers() { lock.lock(); try { @@ -867,6 +888,7 @@ } } + @Override final public Map<Long, UUID[]> getVotes() { lock.lock(); try { @@ -889,6 +911,7 @@ } } + @Override final public Long getCastVote(final UUID serviceId) { lock.lock(); try { @@ -908,6 +931,7 @@ } } + @Override public Long getCastVoteIfConsensus(final UUID serviceId) { lock.lock(); try { @@ -971,6 +995,7 @@ return -1; } + @Override final public UUID[] getJoined() { lock.lock(); try { @@ -980,6 +1005,7 @@ } } + @Override final public UUID[] getPipeline() { lock.lock(); try { @@ -989,6 +1015,7 @@ } } + @Override final public UUID getLastInPipeline() { lock.lock(); try { @@ -1003,6 +1030,7 @@ } } + @Override final public UUID[] getPipelinePriorAndNext(final UUID serviceId) { if (serviceId == null) throw new IllegalArgumentException(); @@ -1030,6 +1058,7 @@ } } + @Override final public UUID getLeaderId() { UUID leaderId = null; final long tmp; @@ -1060,6 +1089,7 @@ return leaderId; } + @Override final public long token() { // Note: volatile read. return token; @@ -1079,6 +1109,7 @@ } + @Override final public void assertLeader(final long token) { if (token == NO_QUORUM) { // The quorum was not met when the client obtained that token. @@ -1102,12 +1133,14 @@ assertQuorum(token); } + @Override final public boolean isQuorumMet() { return token != NO_QUORUM; } + @Override final public boolean isQuorumFullyMet(final long token) { lock.lock(); @@ -1140,6 +1173,7 @@ * This watches the current token and will return as soon as the token is * valid. */ + @Override final public long awaitQuorum() throws InterruptedException, AsynchronousQuorumCloseException { lock.lock(); @@ -1155,6 +1189,7 @@ } } + @Override final public long awaitQuorum(final long timeout, final TimeUnit units) throws InterruptedException, TimeoutException, AsynchronousQuorumCloseException { @@ -1181,6 +1216,7 @@ } } + @Override final public void awaitBreak() throws InterruptedException, AsynchronousQuorumCloseException { lock.lock(); @@ -1196,6 +1232,7 @@ } } + @Override final public void awaitBreak(final long timeout, final TimeUnit units) throws InterruptedException, TimeoutException, AsynchronousQuorumCloseException { Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/java/com/bigdata/journal/jini/ha/HAJournalServer.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/java/com/bigdata/journal/jini/ha/HAJournalServer.java 2013-10-11 15:18:36 UTC (rev 7449) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/java/com/bigdata/journal/jini/ha/HAJournalServer.java 2013-10-11 15:20:47 UTC (rev 7450) @@ -1919,6 +1919,7 @@ } catch (RuntimeException re) { if (InnerCause.isInnerCause(re, KeeperException.class)) { + Thread.sleep(250/* ms */); // Retry. continue; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |