Skip to content

Commit

Permalink
changed the sleep conditions in subscribe worker
Browse files Browse the repository at this point in the history
  • Loading branch information
Devendra committed Jul 8, 2013
1 parent e404d40 commit f6eef49
Show file tree
Hide file tree
Showing 28 changed files with 52 additions and 45 deletions.
Binary file modified android/Pubnub-Android-3.5.2.jar
Binary file not shown.
Binary file modified android/examples/PubnubExample/libs/Pubnub-Android-3.5.2.jar
Binary file not shown.
Binary file modified android/examples/SubscribeAtBoot/libs/Pubnub-Android-3.5.2.jar
Binary file not shown.
Binary file modified blackberry/Pubnub-BlackBerry-3.5.2.jar
Binary file not shown.
Binary file modified j2me/Pubnub-MicroEdition-3.5.2.jar
Binary file not shown.
Binary file modified java/Pubnub-StandardEdition-3.5.2.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions java/doc/allclasses-frame.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Sun Jul 07 00:29:20 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Mon Jul 08 17:20:03 IST 2013 -->
<TITLE>
All Classes
</TITLE>

<META NAME="date" CONTENT="2013-07-07">
<META NAME="date" CONTENT="2013-07-08">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/allclasses-noframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Sun Jul 07 00:29:20 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Mon Jul 08 17:20:03 IST 2013 -->
<TITLE>
All Classes
</TITLE>

<META NAME="date" CONTENT="2013-07-07">
<META NAME="date" CONTENT="2013-07-08">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/com/pubnub/api/Callback.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Sun Jul 07 00:29:17 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Mon Jul 08 17:20:02 IST 2013 -->
<TITLE>
Callback
</TITLE>

<META NAME="date" CONTENT="2013-07-07">
<META NAME="date" CONTENT="2013-07-08">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/com/pubnub/api/Pubnub.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Sun Jul 07 00:29:17 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Mon Jul 08 17:20:03 IST 2013 -->
<TITLE>
Pubnub
</TITLE>

<META NAME="date" CONTENT="2013-07-07">
<META NAME="date" CONTENT="2013-07-08">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/com/pubnub/api/PubnubError.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Sun Jul 07 00:29:18 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Mon Jul 08 17:20:03 IST 2013 -->
<TITLE>
PubnubError
</TITLE>

<META NAME="date" CONTENT="2013-07-07">
<META NAME="date" CONTENT="2013-07-08">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/com/pubnub/api/PubnubException.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Sun Jul 07 00:29:19 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Mon Jul 08 17:20:03 IST 2013 -->
<TITLE>
PubnubException
</TITLE>

<META NAME="date" CONTENT="2013-07-07">
<META NAME="date" CONTENT="2013-07-08">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/com/pubnub/api/PubnubUtil.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Sun Jul 07 00:29:19 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Mon Jul 08 17:20:03 IST 2013 -->
<TITLE>
PubnubUtil
</TITLE>

<META NAME="date" CONTENT="2013-07-07">
<META NAME="date" CONTENT="2013-07-08">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/com/pubnub/api/package-frame.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Sun Jul 07 00:29:19 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Mon Jul 08 17:20:03 IST 2013 -->
<TITLE>
com.pubnub.api
</TITLE>

<META NAME="date" CONTENT="2013-07-07">
<META NAME="date" CONTENT="2013-07-08">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/com/pubnub/api/package-summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Sun Jul 07 00:29:19 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Mon Jul 08 17:20:03 IST 2013 -->
<TITLE>
com.pubnub.api
</TITLE>

<META NAME="date" CONTENT="2013-07-07">
<META NAME="date" CONTENT="2013-07-08">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/com/pubnub/api/package-tree.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Sun Jul 07 00:29:20 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Mon Jul 08 17:20:03 IST 2013 -->
<TITLE>
com.pubnub.api Class Hierarchy
</TITLE>

<META NAME="date" CONTENT="2013-07-07">
<META NAME="date" CONTENT="2013-07-08">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/constant-values.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Sun Jul 07 00:29:20 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Mon Jul 08 17:20:03 IST 2013 -->
<TITLE>
Constant Field Values
</TITLE>

<META NAME="date" CONTENT="2013-07-07">
<META NAME="date" CONTENT="2013-07-08">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/deprecated-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Sun Jul 07 00:29:20 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Mon Jul 08 17:20:03 IST 2013 -->
<TITLE>
Deprecated List
</TITLE>

<META NAME="date" CONTENT="2013-07-07">
<META NAME="date" CONTENT="2013-07-08">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/help-doc.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Sun Jul 07 00:29:20 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Mon Jul 08 17:20:04 IST 2013 -->
<TITLE>
API Help
</TITLE>

<META NAME="date" CONTENT="2013-07-07">
<META NAME="date" CONTENT="2013-07-08">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/index-all.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Sun Jul 07 00:29:20 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Mon Jul 08 17:20:03 IST 2013 -->
<TITLE>
Index
</TITLE>

<META NAME="date" CONTENT="2013-07-07">
<META NAME="date" CONTENT="2013-07-08">

<LINK REL ="stylesheet" TYPE="text/css" HREF="./stylesheet.css" TITLE="Style">

Expand Down
2 changes: 1 addition & 1 deletion java/doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Sun Jul 07 00:29:20 IST 2013-->
<!-- Generated by javadoc on Mon Jul 08 17:20:03 IST 2013-->
<TITLE>
Generated Documentation (Untitled)
</TITLE>
Expand Down
4 changes: 2 additions & 2 deletions java/doc/overview-tree.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Sun Jul 07 00:29:20 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Mon Jul 08 17:20:03 IST 2013 -->
<TITLE>
Class Hierarchy
</TITLE>

<META NAME="date" CONTENT="2013-07-07">
<META NAME="date" CONTENT="2013-07-08">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions java/doc/serialized-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_37) on Sun Jul 07 00:29:20 IST 2013 -->
<!-- Generated by javadoc (build 1.6.0_37) on Mon Jul 08 17:20:03 IST 2013 -->
<TITLE>
Serialized Form
</TITLE>

<META NAME="date" CONTENT="2013-07-07">
<META NAME="date" CONTENT="2013-07-08">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

Expand Down
Binary file modified java/jars/Pubnub-UnitTests-3.5.2.jar
Binary file not shown.
Binary file modified java/jars/PubnubDemoConsole.jar
Binary file not shown.
Binary file modified java/jars/PubnubExample.jar
Binary file not shown.
12 changes: 7 additions & 5 deletions java/src1/com/pubnub/api/SubscribeWorker.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ void process(HttpRequest hreq) {
}
hreq.setWorker(this);
while (!_die && currentRetryAttempt <= maxRetries) {
if ( currentRetryAttempt > 1 ) {
try {
Thread.sleep(retryInterval);
} catch (InterruptedException e) {
}
}
try {
log.debug(hreq.getUrl());
hresp = httpclient.fetch(hreq.getUrl(), hreq.getHeaders());
Expand Down Expand Up @@ -55,7 +61,7 @@ void process(HttpRequest hreq) {
case PNERR_FORBIDDEN:
case PNERR_UNAUTHORIZED:
log.verbose("Authentication Failure : " + e.toString());
currentRetryAttempt++;
currentRetryAttempt = maxRetries + 1;
break;
default:
log.verbose("Retry Attempt : " + ((currentRetryAttempt == maxRetries)?"last":currentRetryAttempt)
Expand All @@ -71,10 +77,6 @@ void process(HttpRequest hreq) {
currentRetryAttempt++;
}

try {
Thread.sleep(retryInterval);
} catch (InterruptedException e) {
}
}
if (!_die) {
if (hresp == null) {
Expand Down
19 changes: 12 additions & 7 deletions scala/src/com/pubnub/examples/PubnubDevConsole.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.pubnub.examples
//package com.pubnub.examples

import com.pubnub.api._
import java.util._
import org.json._
import java.lang.Integer

object PubnubDevConsole {
var pub_key = ""
Expand Down Expand Up @@ -105,6 +106,10 @@ object PubnubDevConsole {
override def errorCallback(channel: String, error: PubnubError) {
notifyUser("SUBSCRIBE : ERROR on channel " + channel
+ " : " + error.toString())
error.errorCode match {
case PubnubError.PNERR_FORBIDDEN => { pubnub.unsubscribe(channel); println("forbidden");}
case PubnubError.PNERR_UNAUTHORIZED => {pubnub.unsubscribe(channel); println("unauthorized");}
}
}
})

Expand Down Expand Up @@ -198,9 +203,9 @@ object PubnubDevConsole {

}
}
def detailedHistory(channel: String) {
def history(channel: String) {

pubnub.detailedHistory(channel, 2, new Callback() {
pubnub.history(channel, 2, new Callback() {
override def successCallback(channel: String, message: Object) {
notifyUser("DETAILED HISTORY : " + message)
}
Expand Down Expand Up @@ -312,7 +317,7 @@ object PubnubDevConsole {
if (sec_key.length() == 0)
sec_key = getStringFromConsole("Secret Key", true)

if (cip_key.length() == 0)
if (cip_key.trim().length() == 0)
cip_key = getStringFromConsole("Cipher Key", true)

pubnub = new Pubnub(pub_key, sub_key, sec_key, cip_key, SSL)
Expand Down Expand Up @@ -342,7 +347,7 @@ object PubnubDevConsole {
presence(channelName)
case 4 =>
channelName = getStringFromConsole("Channel Name")
detailedHistory(channelName)
history(channelName)
case 5 =>
channelName = getStringFromConsole("Channel Name")
hereNow(channelName)
Expand Down Expand Up @@ -408,7 +413,7 @@ object PubnubDevConsole {
+ pubnub.getCurrentlySubscribedChannelNames() + ")")
println("ENTER 2 FOR Publish")
println("ENTER 3 FOR Presence")
println("ENTER 4 FOR Detailed History")
println("ENTER 4 FOR History")
println("ENTER 5 FOR Here_Now")
println("ENTER 6 FOR Unsubscribe")
println("ENTER 7 FOR Presence-Unsubscribe")
Expand Down Expand Up @@ -443,4 +448,4 @@ object PubnubDevConsole {
startDemo
pubnub.shutdown()
}
}
}

0 comments on commit f6eef49

Please sign in to comment.