You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/10/26 20:10:39 UTC
[15/15] incubator-geode git commit: Allow sample rate of MAX_VALUE
and add awaitInitialization method
Allow sample rate of MAX_VALUE and add awaitInitialization method
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/64ef1ddc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/64ef1ddc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/64ef1ddc
Branch: refs/heads/feature/GEODE-2012
Commit: 64ef1ddcb4a9ece397e76fa77e439753d7ba4d61
Parents: 3b2f128
Author: Kirk Lund <kl...@apache.org>
Authored: Thu Oct 20 12:26:13 2016 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Wed Oct 26 10:19:14 2016 -0700
----------------------------------------------------------------------
.../internal/statistics/HostStatSampler.java | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/64ef1ddc/geode-core/src/main/java/org/apache/geode/internal/statistics/HostStatSampler.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/statistics/HostStatSampler.java b/geode-core/src/main/java/org/apache/geode/internal/statistics/HostStatSampler.java
index 020b5ab..2ec32e7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/statistics/HostStatSampler.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/statistics/HostStatSampler.java
@@ -269,8 +269,10 @@ public abstract class HostStatSampler
synchronized(HostStatSampler.class) {
if (statThread != null) {
try {
- int msToWait = getSampleRate() + 100;
- statThread.join(msToWait);
+ if (getSampleRate() < Integer.MAX_VALUE) {
+ int msToWait = getSampleRate() + 100;
+ statThread.join(msToWait);
+ }
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}
@@ -366,9 +368,18 @@ public abstract class HostStatSampler
* @since GemFire 7.0
*/
public final boolean waitForInitialization(long ms) throws InterruptedException {
- return this.statSamplerInitializedLatch.await(ms);
+ return awaitInitialization(ms, TimeUnit.MILLISECONDS);
}
-
+
+ /**
+ * Awaits the initialization of special statistics.
+ *
+ * @see #initSpecialStats
+ */
+ public final boolean awaitInitialization(final long timeout, final TimeUnit unit) throws InterruptedException {
+ return this.statSamplerInitializedLatch.await(timeout, unit);
+ }
+
public final void changeArchive(File newFile) {
this.sampleCollector.changeArchive(newFile, NanoTimer.getTime());
}