You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2016/11/02 15:51:55 UTC

svn commit: r1767712 - /sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/Poller.java

Author: rombert
Date: Wed Nov  2 15:51:55 2016
New Revision: 1767712

URL: http://svn.apache.org/viewvc?rev=1767712&view=rev
Log:
SLING-6112 - Make Sling IDE independent of m2e-tycho

Make the Poller timeout configurable.

Modified:
    sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/Poller.java

Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/Poller.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/Poller.java?rev=1767712&r1=1767711&r2=1767712&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/Poller.java (original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/Poller.java Wed Nov  2 15:51:55 2016
@@ -28,10 +28,20 @@ public class Poller {
 
     private static final long DEFAULT_POLL_WAIT_MILLIS = 5000;
     private static final long DEFAULT_DELAY_MILLIS = 100;
+    
+    private long timeoutMillis;
+    
+    public Poller() {
+        this(DEFAULT_POLL_WAIT_MILLIS);
+    }
+    
+    public Poller(long timeoutMillis) {
+        this.timeoutMillis = timeoutMillis;
+    }
 
     public void pollUntilSuccessful(Runnable r) throws InterruptedException {
 
-        long cutoff = System.currentTimeMillis() + DEFAULT_POLL_WAIT_MILLIS;
+        long cutoff = System.currentTimeMillis() + timeoutMillis;
 
         Throwable lastError = null;
 
@@ -54,7 +64,7 @@ public class Poller {
                 }
 
                 throw new AssertionFailedError("Runnable " + r + " did not succeed in the allocated "
-                        + DEFAULT_POLL_WAIT_MILLIS + " ms");
+                        + timeoutMillis + " ms");
             }
 
             Thread.sleep(DEFAULT_DELAY_MILLIS);