You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by la...@apache.org on 2017/04/11 22:02:01 UTC
geode git commit: GEODE-2745:
WaitUntilBucketRegionQueueFlushedCallable gets
BucketRegionQueue.latestQueuedKey in constructor vs. setting when callable
invoked. [Forced Update!]
Repository: geode
Updated Branches:
refs/heads/feature/GEODE-2745 ba3b28adc -> 332df0905 (forced update)
GEODE-2745: WaitUntilBucketRegionQueueFlushedCallable gets BucketRegionQueue.latestQueuedKey in constructor vs. setting when callable invoked.
- Added getter in BucketRegionQueue for latestQueuedKey
- WaitUntilBucketRegionQueueFlushedCallable constructor now gets/maintains the BucketRegionQueue.latestQueuedKey
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/332df090
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/332df090
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/332df090
Branch: refs/heads/feature/GEODE-2745
Commit: 332df09059f4d5a3a1626b80340559c0717ae63f
Parents: 799548e
Author: Lynn Hughes-Godfrey <lh...@pivotal.io>
Authored: Fri Apr 7 11:57:16 2017 -0700
Committer: Lynn Hughes-Godfrey <lh...@pivotal.io>
Committed: Tue Apr 11 14:57:46 2017 -0700
----------------------------------------------------------------------
.../geode/internal/cache/BucketRegionQueue.java | 14 +++++++++-----
...tUntilParallelGatewaySenderFlushedCoordinator.java | 5 ++++-
2 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/332df090/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegionQueue.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegionQueue.java b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegionQueue.java
index 3259752..7a21d12 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegionQueue.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegionQueue.java
@@ -464,21 +464,25 @@ public class BucketRegionQueue extends AbstractBucketRegionQueue {
this.latestAcknowledgedKey.set(key);
}
- public boolean waitUntilFlushed(long timeout, TimeUnit unit) throws InterruptedException {
+ public long getLatestQueuedKey() {
+ return this.latestQueuedKey.get();
+ }
+
+ public boolean waitUntilFlushed(long latestQueuedKey, long timeout, TimeUnit unit)
+ throws InterruptedException {
long then = System.currentTimeMillis();
if (logger.isDebugEnabled()) {
- logger.debug("BucketRegionQueue: waitUntilFlushed bucket=" + getId() + "; timeout=" + timeout
- + "; unit=" + unit);
+ logger.debug("BucketRegionQueue: waitUntilFlushed bucket=" + getId() + "; latestQueuedKey="
+ + latestQueuedKey + "; timeout=" + timeout + "; unit=" + unit);
}
boolean result = false;
// Wait until latestAcknowledgedKey > latestQueuedKey or the queue is empty
if (this.initialized) {
- long latestQueuedKeyToCheck = this.latestQueuedKey.get();
long nanosRemaining = unit.toNanos(timeout);
long endTime = System.nanoTime() + nanosRemaining;
while (nanosRemaining > 0) {
try {
- if (latestAcknowledgedKey.get() > latestQueuedKeyToCheck || isEmpty()) {
+ if (latestAcknowledgedKey.get() > latestQueuedKey || isEmpty()) {
result = true;
break;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/332df090/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/WaitUntilParallelGatewaySenderFlushedCoordinator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/WaitUntilParallelGatewaySenderFlushedCoordinator.java b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/WaitUntilParallelGatewaySenderFlushedCoordinator.java
index c5945a6..1388dd0 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/WaitUntilParallelGatewaySenderFlushedCoordinator.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/WaitUntilParallelGatewaySenderFlushedCoordinator.java
@@ -100,6 +100,8 @@ public class WaitUntilParallelGatewaySenderFlushedCoordinator
private BucketRegionQueue brq;
+ private long latestQueuedKey;
+
private long timeout;
private TimeUnit unit;
@@ -107,13 +109,14 @@ public class WaitUntilParallelGatewaySenderFlushedCoordinator
public WaitUntilBucketRegionQueueFlushedCallable(BucketRegionQueue brq, long timeout,
TimeUnit unit) {
this.brq = brq;
+ this.latestQueuedKey = brq.getLatestQueuedKey();
this.timeout = timeout;
this.unit = unit;
}
@Override
public Boolean call() throws Exception {
- return this.brq.waitUntilFlushed(this.timeout, this.unit);
+ return this.brq.waitUntilFlushed(this.latestQueuedKey, this.timeout, this.unit);
}
@Override