diff --git a/android/Pubnub-Android-3.5.5.jar b/android/Pubnub-Android-3.5.5.jar index 47c08026a..e0b84bfa6 100644 Binary files a/android/Pubnub-Android-3.5.5.jar and b/android/Pubnub-Android-3.5.5.jar differ diff --git a/android/Pubnub-Android-Debug-3.5.5.jar b/android/Pubnub-Android-Debug-3.5.5.jar index 08e867abc..b78447cfa 100644 Binary files a/android/Pubnub-Android-Debug-3.5.5.jar and b/android/Pubnub-Android-Debug-3.5.5.jar differ diff --git a/android/examples/PubnubExample/libs/Pubnub-Android-3.5.5.jar b/android/examples/PubnubExample/libs/Pubnub-Android-3.5.5.jar index 47c08026a..e0b84bfa6 100644 Binary files a/android/examples/PubnubExample/libs/Pubnub-Android-3.5.5.jar and b/android/examples/PubnubExample/libs/Pubnub-Android-3.5.5.jar differ diff --git a/android/examples/SubscribeAtBoot/libs/Pubnub-Android-3.5.5.jar b/android/examples/SubscribeAtBoot/libs/Pubnub-Android-3.5.5.jar index 47c08026a..e0b84bfa6 100644 Binary files a/android/examples/SubscribeAtBoot/libs/Pubnub-Android-3.5.5.jar and b/android/examples/SubscribeAtBoot/libs/Pubnub-Android-3.5.5.jar differ diff --git a/blackberry/Pubnub-BlackBerry-3.5.5.jar b/blackberry/Pubnub-BlackBerry-3.5.5.jar index 44cf69d9c..b3012cbbb 100644 Binary files a/blackberry/Pubnub-BlackBerry-3.5.5.jar and b/blackberry/Pubnub-BlackBerry-3.5.5.jar differ diff --git a/blackberry/Pubnub-BlackBerry-Debug-3.5.5.jar b/blackberry/Pubnub-BlackBerry-Debug-3.5.5.jar index eb5930672..393fe31b9 100644 Binary files a/blackberry/Pubnub-BlackBerry-Debug-3.5.5.jar and b/blackberry/Pubnub-BlackBerry-Debug-3.5.5.jar differ diff --git a/codenameone/Pubnub-CodeNameOne-3.5.5.cn1lib b/codenameone/Pubnub-CodeNameOne-3.5.5.cn1lib index 9f6fe8491..520d1196b 100644 Binary files a/codenameone/Pubnub-CodeNameOne-3.5.5.cn1lib and b/codenameone/Pubnub-CodeNameOne-3.5.5.cn1lib differ diff --git a/codenameone/src/com/pubnub/api/SubscribeWorker.java b/codenameone/src/com/pubnub/api/SubscribeWorker.java index c67b1d3d8..aeead6794 100644 --- a/codenameone/src/com/pubnub/api/SubscribeWorker.java +++ b/codenameone/src/com/pubnub/api/SubscribeWorker.java @@ -13,6 +13,11 @@ class SubscribeWorker extends AbstractSubscribeWorker { maxRetries, retryInterval, headers); } + SubscribeWorker(Vector _requestQueue, int connectionTimeout, + int requestTimeout, int maxRetries, int retryInterval, int windowInterval, Hashtable headers) { + super(_requestQueue, connectionTimeout, requestTimeout, + maxRetries, retryInterval, windowInterval, headers); + } void process(HttpRequest hreq) { HttpResponse hresp = null; int currentRetryAttempt = (hreq.isDar())?1:maxRetries; @@ -24,6 +29,12 @@ void process(HttpRequest hreq) { return; } } + if (!hreq.isSubzero() && windowInterval != 0) { + try { + Thread.sleep(windowInterval); + } catch (InterruptedException e) { + } + } hreq.setWorker(this); while (!_die && currentRetryAttempt <= maxRetries) { try { diff --git a/j2me/Pubnub-MicroEdition-3.5.5.jar b/j2me/Pubnub-MicroEdition-3.5.5.jar index abf62a09a..181a73c4f 100644 Binary files a/j2me/Pubnub-MicroEdition-3.5.5.jar and b/j2me/Pubnub-MicroEdition-3.5.5.jar differ diff --git a/j2me/src1/com/pubnub/api/SubscribeWorker.java b/j2me/src1/com/pubnub/api/SubscribeWorker.java index 4139f75e7..d83faf446 100644 --- a/j2me/src1/com/pubnub/api/SubscribeWorker.java +++ b/j2me/src1/com/pubnub/api/SubscribeWorker.java @@ -13,11 +13,23 @@ class SubscribeWorker extends AbstractSubscribeWorker { maxRetries, retryInterval, headers); } + SubscribeWorker(Vector _requestQueue, int connectionTimeout, + int requestTimeout, int maxRetries, int retryInterval, int windowInterval, Hashtable headers) { + super(_requestQueue, connectionTimeout, requestTimeout, + maxRetries, retryInterval, windowInterval, headers); + } + void process(HttpRequest hreq) { HttpResponse hresp = null; int currentRetryAttempt = (hreq.isDar())?1:maxRetries; log.verbose("disconnectAndResubscribe is " + hreq.isDar()); boolean sleep = false; + if (!hreq.isSubzero() && windowInterval != 0) { + try { + Thread.sleep(windowInterval); + } catch (InterruptedException e) { + } + } while (!_die && currentRetryAttempt <= maxRetries) { if (sleep) { try { diff --git a/java/Pubnub-StandardEdition-3.5.5.jar b/java/Pubnub-StandardEdition-3.5.5.jar index 0a330285e..102fbe072 100644 Binary files a/java/Pubnub-StandardEdition-3.5.5.jar and b/java/Pubnub-StandardEdition-3.5.5.jar differ diff --git a/java/doc/allclasses-frame.html b/java/doc/allclasses-frame.html index 29141644f..9f642ef2a 100644 --- a/java/doc/allclasses-frame.html +++ b/java/doc/allclasses-frame.html @@ -2,12 +2,12 @@
- + int
getWindowInterval()
+
+ void
hereNow(java.lang.String channel,
Callback callback)
@@ -773,6 +781,14 @@ void
setWindowInterval(int windowInterval)
+
+ void
shutdown()
+public void setWindowInterval(int windowInterval)+
+
windowInterval
- Window Interval in milliseconds@@ -1697,6 +1726,20 @@
++getWindowInterval
++public int getWindowInterval()++
+- Returns current window interval for subscribe +
+
- +
+ +
+- Returns:
- Current Window Interval in milliseconds
+setMaxRetries
diff --git a/java/doc/com/pubnub/api/PubnubError.html b/java/doc/com/pubnub/api/PubnubError.html index 2b44d939a..4e3b42a9f 100644 --- a/java/doc/com/pubnub/api/PubnubError.html +++ b/java/doc/com/pubnub/api/PubnubError.html @@ -2,12 +2,12 @@ - +PubnubError - + diff --git a/java/doc/com/pubnub/api/PubnubException.html b/java/doc/com/pubnub/api/PubnubException.html index d88222bac..2837b999a 100644 --- a/java/doc/com/pubnub/api/PubnubException.html +++ b/java/doc/com/pubnub/api/PubnubException.html @@ -2,12 +2,12 @@ - +PubnubException - + diff --git a/java/doc/com/pubnub/api/PubnubUtil.html b/java/doc/com/pubnub/api/PubnubUtil.html index 2cd864be0..3a35291b1 100644 --- a/java/doc/com/pubnub/api/PubnubUtil.html +++ b/java/doc/com/pubnub/api/PubnubUtil.html @@ -2,12 +2,12 @@ - +PubnubUtil - + diff --git a/java/doc/com/pubnub/api/package-frame.html b/java/doc/com/pubnub/api/package-frame.html index 3333a85f0..85ace0cff 100644 --- a/java/doc/com/pubnub/api/package-frame.html +++ b/java/doc/com/pubnub/api/package-frame.html @@ -2,12 +2,12 @@ - +com.pubnub.api - + diff --git a/java/doc/com/pubnub/api/package-summary.html b/java/doc/com/pubnub/api/package-summary.html index 994def430..889ac4ce6 100644 --- a/java/doc/com/pubnub/api/package-summary.html +++ b/java/doc/com/pubnub/api/package-summary.html @@ -2,12 +2,12 @@ - +com.pubnub.api - + diff --git a/java/doc/com/pubnub/api/package-tree.html b/java/doc/com/pubnub/api/package-tree.html index b95a02842..92c0f95a7 100644 --- a/java/doc/com/pubnub/api/package-tree.html +++ b/java/doc/com/pubnub/api/package-tree.html @@ -2,12 +2,12 @@ - +com.pubnub.api Class Hierarchy - + diff --git a/java/doc/constant-values.html b/java/doc/constant-values.html index 2c75ccb3b..e86db3ab7 100644 --- a/java/doc/constant-values.html +++ b/java/doc/constant-values.html @@ -2,12 +2,12 @@ - +Constant Field Values - + diff --git a/java/doc/deprecated-list.html b/java/doc/deprecated-list.html index 3a7e0255f..03e6c1258 100644 --- a/java/doc/deprecated-list.html +++ b/java/doc/deprecated-list.html @@ -2,12 +2,12 @@ - +Deprecated List - + diff --git a/java/doc/help-doc.html b/java/doc/help-doc.html index 0180a66a1..831a76e75 100644 --- a/java/doc/help-doc.html +++ b/java/doc/help-doc.html @@ -2,12 +2,12 @@ - +API Help - + diff --git a/java/doc/index-all.html b/java/doc/index-all.html index db4cf8e0f..c26d430ce 100644 --- a/java/doc/index-all.html +++ b/java/doc/index-all.html @@ -2,12 +2,12 @@ - +Index - + diff --git a/java/doc/index.html b/java/doc/index.html index 995219bde..7df6f3997 100644 --- a/java/doc/index.html +++ b/java/doc/index.html @@ -2,7 +2,7 @@ - +Generated Documentation (Untitled) diff --git a/java/doc/overview-tree.html b/java/doc/overview-tree.html index c03bf944b..3dc00b1d7 100644 --- a/java/doc/overview-tree.html +++ b/java/doc/overview-tree.html @@ -2,12 +2,12 @@ - +Class Hierarchy - + diff --git a/java/doc/serialized-form.html b/java/doc/serialized-form.html index 731ea1947..94405747d 100644 --- a/java/doc/serialized-form.html +++ b/java/doc/serialized-form.html @@ -2,12 +2,12 @@ - +Serialized Form - + diff --git a/java/examples/src/com/pubnub/examples/PubnubDemoConsole.java b/java/examples/src/com/pubnub/examples/PubnubDemoConsole.java index 5e1279573..256612f9e 100644 --- a/java/examples/src/com/pubnub/examples/PubnubDemoConsole.java +++ b/java/examples/src/com/pubnub/examples/PubnubDemoConsole.java @@ -316,37 +316,41 @@ public void startDemo() { setRetryInterval(retryInterval); break; case 15: + int windowInterval = getIntFromConsole("Window Interval"); + setWindowInterval(windowInterval); + break; + case 16: int subscribeTimeout = getIntFromConsole("Subscribe Timeout ( in milliseconds) "); setSubscribeTimeout(subscribeTimeout); break; - case 16: + case 17: int nonSubscribeTimeout = getIntFromConsole("Non Subscribe Timeout ( in milliseconds) "); setNonSubscribeTimeout(nonSubscribeTimeout); break; - case 17: + case 18: notifyUser("Set/Unset Auth Key: Enter blank for unsetting key"); String authKey = getStringFromConsole("Auth Key"); pubnub.setAuthKey(authKey); break; - case 18: + case 19: pamGrant(); break; - case 19: + case 20: pamRevoke(); break; - case 20: + case 21: pamAudit(); break; - case 21: + case 22: pubnub.setOrigin(getStringFromConsole("Origin")); break; - case 22: + case 23: pubnub.setDomain(getStringFromConsole("Domain")); break; - case 23: + case 24: pubnub.setCacheBusting(true); break; - case 24: + case 25: pubnub.setCacheBusting(false); break; default: @@ -500,6 +504,10 @@ private void setMaxRetries(int maxRetries) { private void setRetryInterval(int retryInterval) { pubnub.setRetryInterval(retryInterval); } + + private void setWindowInterval(int windowInterval) { + pubnub.setWindowInterval(windowInterval); + } private void setSubscribeTimeout(int subscribeTimeout) { pubnub.setSubscribeTimeout(subscribeTimeout); @@ -526,16 +534,17 @@ private void displayMenuOptions() { notifyUser("ENTER 12 FOR Toggle Resume On Reconnect ( current: " + pubnub.getResumeOnReconnect() + " )"); notifyUser("ENTER 13 FOR Setting MAX Retries ( current: " + pubnub.getMaxRetries() + " )"); notifyUser("ENTER 14 FOR Setting Retry Interval ( current: " + pubnub.getRetryInterval() + " milliseconds )"); - notifyUser("ENTER 15 FOR Setting Subscribe Timeout ( current: " + pubnub.getSubscribeTimeout() + " milliseconds )"); - notifyUser("ENTER 16 FOR Setting Non Subscribe Timeout ( current: " + pubnub.getNonSubscribeTimeout() + " milliseconds )"); - notifyUser("ENTER 17 FOR Setting/Unsetting auth key ( current: " + pubnub.getAuthKey() + " )"); - notifyUser("ENTER 18 FOR PAM grant"); - notifyUser("ENTER 19 FOR PAM revoke"); - notifyUser("ENTER 20 FOR PAM Audit"); - notifyUser("ENTER 21 FOR Setting Origin ( current: " + pubnub.getOrigin() + " )"); - notifyUser("ENTER 22 FOR Setting Domain ( current: "+ pubnub.getDomain() + " )"); - notifyUser("ENTER 23 FOR Enabling Cache Busting ( current: " + pubnub.getCacheBusting() + " )"); - notifyUser("ENTER 24 FOR Disabling Cache Busting ( current: " + pubnub.getCacheBusting() + " )"); + notifyUser("ENTER 15 FOR Setting Window Interval ( current: " + pubnub.getWindowInterval() + " milliseconds )"); + notifyUser("ENTER 16 FOR Setting Subscribe Timeout ( current: " + pubnub.getSubscribeTimeout() + " milliseconds )"); + notifyUser("ENTER 17 FOR Setting Non Subscribe Timeout ( current: " + pubnub.getNonSubscribeTimeout() + " milliseconds )"); + notifyUser("ENTER 18 FOR Setting/Unsetting auth key ( current: " + pubnub.getAuthKey() + " )"); + notifyUser("ENTER 19 FOR PAM grant"); + notifyUser("ENTER 20 FOR PAM revoke"); + notifyUser("ENTER 21 FOR PAM Audit"); + notifyUser("ENTER 22 FOR Setting Origin ( current: " + pubnub.getOrigin() + " )"); + notifyUser("ENTER 23 FOR Setting Domain ( current: "+ pubnub.getDomain() + " )"); + notifyUser("ENTER 24 FOR Enabling Cache Busting ( current: " + pubnub.getCacheBusting() + " )"); + notifyUser("ENTER 25 FOR Disabling Cache Busting ( current: " + pubnub.getCacheBusting() + " )"); notifyUser("\nENTER 0 to display this menu"); } diff --git a/java/jars/Pubnub-UnitTests-3.5.5.jar b/java/jars/Pubnub-UnitTests-3.5.5.jar index 4ade421be..5dd58b89b 100644 Binary files a/java/jars/Pubnub-UnitTests-3.5.5.jar and b/java/jars/Pubnub-UnitTests-3.5.5.jar differ diff --git a/java/jars/PubnubDemoConsole.jar b/java/jars/PubnubDemoConsole.jar index 70d3b2706..0ad27e5dd 100644 Binary files a/java/jars/PubnubDemoConsole.jar and b/java/jars/PubnubDemoConsole.jar differ diff --git a/java/jars/PubnubExample.jar b/java/jars/PubnubExample.jar index 5690dc835..e8360c9e8 100644 Binary files a/java/jars/PubnubExample.jar and b/java/jars/PubnubExample.jar differ diff --git a/java/src1/com/pubnub/api/SubscribeWorker.java b/java/src1/com/pubnub/api/SubscribeWorker.java index 10199faa5..d0e338ba6 100644 --- a/java/src1/com/pubnub/api/SubscribeWorker.java +++ b/java/src1/com/pubnub/api/SubscribeWorker.java @@ -10,9 +10,9 @@ class SubscribeWorker extends AbstractSubscribeWorker { private Exception excp = null; SubscribeWorker(Vector _requestQueue, int connectionTimeout, - int requestTimeout, int maxRetries, int retryInterval, Hashtable headers) { + int requestTimeout, int maxRetries, int retryInterval, int windowInterval, Hashtable headers) { super(_requestQueue, connectionTimeout, requestTimeout, - maxRetries, retryInterval, headers); + maxRetries, retryInterval, windowInterval, headers); } void process(HttpRequest hreq) { @@ -27,6 +27,12 @@ void process(HttpRequest hreq) { } } hreq.setWorker(this); + if (!hreq.isSubzero() && windowInterval != 0) { + try { + Thread.sleep(windowInterval); + } catch (InterruptedException e) { + } + } boolean sleep = false; while (!_die && currentRetryAttempt <= maxRetries) { if (sleep) { diff --git a/java/srcPubnubApi/com/pubnub/api/PubnubCore.java b/java/srcPubnubApi/com/pubnub/api/PubnubCore.java index 1ba9ddd38..33f36f9c4 100644 --- a/java/srcPubnubApi/com/pubnub/api/PubnubCore.java +++ b/java/srcPubnubApi/com/pubnub/api/PubnubCore.java @@ -84,6 +84,16 @@ public boolean isResumeOnReconnect() { public void setRetryInterval(int retryInterval) { subscribeManager.setRetryInterval(retryInterval); } + + /** + * This method sets window interval for subscribe. + * + * @param windowInterval + * Window Interval in milliseconds + */ + public void setWindowInterval(int windowInterval) { + subscribeManager.setWindowInterval(windowInterval); + } /** * Returns current retry interval for subscribe @@ -92,6 +102,14 @@ public void setRetryInterval(int retryInterval) { public int getRetryInterval() { return subscribeManager.retryInterval; } + + /** + * Returns current window interval for subscribe + * @return Current Window Interval in milliseconds + */ + public int getWindowInterval() { + return subscribeManager.windowInterval; + } /** * This methods sets maximum number of retries for subscribe. Pubnub API @@ -1286,7 +1304,6 @@ private void _subscribe_base(boolean fresh, boolean dar, Worker worker) { PubnubUtil.urlEncode(channelString), "0", _timetoken }; - Hashtable params = PubnubUtil.hashtableClone(this.params); params.put("uuid", UUID); log.verbose("Subscribing with timetoken : " + _timetoken); diff --git a/java/srcPubnubApi/com/pubnub/api/RequestManager.java b/java/srcPubnubApi/com/pubnub/api/RequestManager.java index 8ce4febbf..005010e15 100644 --- a/java/srcPubnubApi/com/pubnub/api/RequestManager.java +++ b/java/srcPubnubApi/com/pubnub/api/RequestManager.java @@ -237,6 +237,7 @@ abstract class AbstractSubscribeManager extends RequestManager { protected volatile int maxRetries = 5; protected volatile int retryInterval = 5000; + protected volatile int windowInterval = 0; public AbstractSubscribeManager(String name, int connectionTimeout, int requestTimeout) { @@ -246,7 +247,7 @@ public AbstractSubscribeManager(String name, int connectionTimeout, public Worker getWorker() { return new SubscribeWorker(_waiting, connectionTimeout, requestTimeout, - maxRetries, retryInterval, headers); + maxRetries, retryInterval, windowInterval, headers); } public void setMaxRetries(int maxRetries) { @@ -262,6 +263,13 @@ public void setRetryInterval(int retryInterval) { ((SubscribeWorker) _workers[i]).setRetryInterval(retryInterval); } } + + public void setWindowInterval(int windowInterval) { + this.windowInterval = windowInterval; + for (int i = 0; i < _workers.length; i++) { + ((SubscribeWorker) _workers[i]).setWindowInterval(windowInterval); + } + } public void setConnectionTimeout(int timeout) { this.connectionTimeout = timeout; @@ -309,6 +317,7 @@ public void setRequestTimeout(int timeout) { abstract class AbstractSubscribeWorker extends Worker { protected volatile int maxRetries = 5; protected volatile int retryInterval = 5000; + protected volatile int windowInterval = 0; AbstractSubscribeWorker(Vector _requestQueue, int connectionTimeout, int requestTimeout, int maxRetries, int retryInterval, Hashtable headers) { @@ -316,6 +325,14 @@ abstract class AbstractSubscribeWorker extends Worker { this.maxRetries = maxRetries; this.retryInterval= retryInterval; } + + AbstractSubscribeWorker(Vector _requestQueue, int connectionTimeout, + int requestTimeout, int maxRetries, int retryInterval, int windowInterval, Hashtable headers) { + super(_requestQueue, connectionTimeout, requestTimeout, headers); + this.maxRetries = maxRetries; + this.retryInterval= retryInterval; + this.windowInterval = windowInterval; + } public void setMaxRetries(int maxRetries) { this.maxRetries = maxRetries; @@ -324,5 +341,9 @@ public void setMaxRetries(int maxRetries) { public void setRetryInterval(int retryInterval) { this.retryInterval = retryInterval; } + + public void setWindowInterval(int windowInterval) { + this.windowInterval = windowInterval; + } }