Skip to content

Commit

Permalink
PubNub SDK v5.0.0 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
client-engineering-bot committed May 12, 2021
1 parent cef9c0d commit f6c9190
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 27 deletions.
11 changes: 9 additions & 2 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: java
version: 4.36.0
version: 5.0.0
schema: 1
scm: github.com/pubnub/java
files:
- build/libs/pubnub-gson-4.36.0-all.jar
- build/libs/pubnub-gson-5.0.0-all.jar
sdks:
-
type: library
Expand Down Expand Up @@ -234,6 +234,13 @@ sdks:
is-required: Required

changelog:
- version: v5.0.0
date: 2021-05-12
changes:
- type: feature
text: "Now random initialisation vector used when encryption enabled is now default behaviour."
- type: bug
text: "There were some non daemon threads running in background preventing VM from exiting. Now they are daemon threads."
- version: v4.36.0
date: 2021-04-08
changes:
Expand Down
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
## [v5.0.0](https://github.com/pubnub/java/releases/tag/v5.0.0)
May-12-2021

[Full Changelog](https://github.com/pubnub/java/compare/v4.36.0...v5.0.0)

- 🌟️ Now random initialisation vector used when encryption enabled is now default behaviour.
- 🐛 There were some non daemon threads running in background preventing VM from exiting. Now they are daemon threads.

## [v4.36.0](https://github.com/pubnub/java/releases/tag/v4.36.0)
April-08-2021

[Full Changelog](https://github.com/pubnub/java/compare/v4.35.0...v4.36.0)

- 🌟️ New way of controlling Presence by Heartbeat calls for purpose of usage with dedicated server configuration (ACL). This feature can be used only with additional support from PubNub.

## [v4.33.3](https://github.com/pubnub/java/releases/tag/v4.33.3)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ You will need the publish and subscribe keys to authenticate your app. Get your
<dependency>
<groupId>com.pubnub</groupId>
<artifactId>pubnub-gson</artifactId>
<version>4.36.0</version>
<version>5.0.0</version>
</dependency>
```

* for Gradle, add the following dependency in your `gradle.build`:
```groovy
compile group: 'com.pubnub', name: 'pubnub-gson', version: '4.36.0'
compile group: 'com.pubnub', name: 'pubnub-gson', version: '5.0.0'
```

2. Configure your keys:
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {
}
group = 'com.pubnub'

version = '4.36.0'
version = '5.0.0'

description = """"""

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/pubnub/api/PNConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public PNConfiguration() {
dedupOnSubscribe = false;
suppressLeaveEvents = false;
maximumMessagesCacheSize = DEFAULT_DEDUPE_SIZE;
useRandomInitializationVector = false;
useRandomInitializationVector = true;
fileMessagePublishRetryLimit = FILE_MESSAGE_PUBLISH_RETRY_LIMIT;
managePresenceListManually = false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/pubnub/api/PubNub.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public class PubNub {
private static final int TIMESTAMP_DIVIDER = 1000;
private static final int MAX_SEQUENCE = 65535;

private static final String SDK_VERSION = "4.36.0";
private static final String SDK_VERSION = "5.0.0";
private final ListenerManager listenerManager;
private final StateManager stateManager;

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/pubnub/api/builder/PubNubErrorBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public final class PubNubErrorBuilder {
/**
* Subscribe Timeout .
*/
public static final int PNERR_HTTP_SUBSCRIBE_TIMEOUT = 130;
public static final int PNERR_HTTP_SOCKET_TIMEOUT = 130;

/**
* Invalid arguments provided to API
Expand Down Expand Up @@ -509,9 +509,9 @@ public final class PubNubErrorBuilder {
.message("Page Not Found Please verify if network is reachable. Please contact support with error details.")
.build();

public static final PubNubError PNERROBJ_SUBSCRIBE_TIMEOUT = PubNubError.builder()
.errorCode(PNERR_HTTP_SUBSCRIBE_TIMEOUT)
.message("Subscribe Timeout.")
public static final PubNubError PNERROBJ_SOCKET_TIMEOUT = PubNubError.builder()
.errorCode(PNERR_HTTP_SOCKET_TIMEOUT)
.message("Socket Timeout.")
.build();

public static final PubNubError PNERROBJ_INVALID_ARGUMENTS = PubNubError.builder()
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/pubnub/api/endpoints/Endpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public void onFailure(Call<Input> performedCall, Throwable throwable) {
pubnubException.pubnubError(PubNubErrorBuilder.PNERROBJ_CONNECT_EXCEPTION);
pnStatusCategory = PNStatusCategory.PNUnexpectedDisconnectCategory;
} catch (SocketTimeoutException socketTimeoutException) {
pubnubException.pubnubError(PubNubErrorBuilder.PNERROBJ_SUBSCRIBE_TIMEOUT);
pubnubException.pubnubError(PubNubErrorBuilder.PNERROBJ_SOCKET_TIMEOUT);
pnStatusCategory = PNStatusCategory.PNTimeoutCategory;
} catch (Throwable throwable1) {
pubnubException.pubnubError(PubNubErrorBuilder.PNERROBJ_HTTP_ERROR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public void onFailure(@NotNull Call<Void> performedCall, @NotNull Throwable thro
pubnubException.pubnubError(PubNubErrorBuilder.PNERROBJ_CONNECT_EXCEPTION);
pnStatusCategory = PNStatusCategory.PNUnexpectedDisconnectCategory;
} catch (SocketTimeoutException socketTimeoutException) {
pubnubException.pubnubError(PubNubErrorBuilder.PNERROBJ_SUBSCRIBE_TIMEOUT);
pubnubException.pubnubError(PubNubErrorBuilder.PNERROBJ_SOCKET_TIMEOUT);
pnStatusCategory = PNStatusCategory.PNTimeoutCategory;
} catch (Throwable throwable1) {
pubnubException.pubnubError(PubNubErrorBuilder.PNERROBJ_HTTP_ERROR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void scheduleDelayedReconnection() {
return;
}

timer = new Timer();
timer = new Timer("Delayed Reconnection Manager timer", true);
timer.schedule(new TimerTask() {
@Override
public void run() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private void registerHeartbeatTimer() {
return;
}

timer = new Timer();
timer = new Timer("Reconnection Manager timer", true);

timer.schedule(new TimerTask() {
@Override
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/pubnub/api/managers/RetrofitManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,5 +228,8 @@ public void destroy(boolean force) {
if (this.subscriptionClientInstance != null) {
closeExecutor(this.subscriptionClientInstance, force);
}
if (this.noSignatureClientInstance != null) {
closeExecutor(this.noSignatureClientInstance, force);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ public void onMaxReconnectionExhaustion() {
consumerThread = new Thread(new SubscribeMessageWorker(
this.pubnub, listenerManager, messageQueue, duplicationManager));
consumerThread.setName("Subscription Manager Consumer Thread");
consumerThread.setDaemon(true);
consumerThread.start();
}
}
Expand Down Expand Up @@ -213,7 +214,7 @@ private synchronized void registerHeartbeatTimer(PubSubOperation pubSubOperation
return;
}

timer = new Timer();
timer = new Timer("Subscription Manager Heartbeat Timer", true);
timer.schedule(new TimerTask() {
@Override
public void run() {
Expand All @@ -240,7 +241,7 @@ private synchronized void cancelDelayedLoopIterationForTemporaryUnavailableChann
private void scheduleDelayedLoopIterationForTemporaryUnavailableChannels() {
cancelDelayedLoopIterationForTemporaryUnavailableChannels();

temporaryUnavailableChannelsDelayer = new Timer();
temporaryUnavailableChannelsDelayer = new Timer("Subscription Manager TMP Unavailable Channel Delayer", true);
temporaryUnavailableChannelsDelayer.schedule(new TimerTask() {
@Override
public void run() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private void startCleanUpTimer() {
long interval = CLEAN_UP_INTERVAL * CLEAN_UP_INTERVAL_MULTIPLIER;

stopCleanUpTimer();
this.timer = new Timer();
this.timer = new Timer("Telemetry Manager timer", true);
this.timer.schedule(new TimerTask() {
@Override
public void run() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ public class SubscribeMessageWorker implements Runnable {
private LinkedBlockingQueue<SubscribeMessage> queue;
private DuplicationManager duplicationManager;

private boolean isRunning;

public SubscribeMessageWorker(PubNub pubnubInstance,
ListenerManager listenerManagerInstance,
LinkedBlockingQueue<SubscribeMessage> queueInstance,
Expand All @@ -76,13 +74,11 @@ public void run() {


private void takeMessage() {
this.isRunning = true;

while (this.isRunning) {
while (!Thread.interrupted()) {
try {
this.processIncomingPayload(this.queue.take());
} catch (InterruptedException e) {
this.isRunning = false;
Thread.currentThread().interrupt();
log.trace("take message interrupted", e);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/com/pubnub/api/PubNubTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public void beforeEach() throws IOException {
pnConfiguration = new PNConfiguration();
pnConfiguration.setSubscribeKey("demo");
pnConfiguration.setPublishKey("demo");
pnConfiguration.setUseRandomInitializationVector(false);
}

@After
Expand Down Expand Up @@ -98,7 +99,7 @@ public void getVersionAndTimeStamp() {
pubnub = new PubNub(pnConfiguration);
String version = pubnub.getVersion();
int timeStamp = pubnub.getTimestamp();
Assert.assertEquals("4.36.0", version);
Assert.assertEquals("5.0.0", version);
Assert.assertTrue(timeStamp > 0);
}

Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/pubnub/api/endpoints/TestHarness.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ protected PubNub createPubNubInstance() {
pnConfiguration.setPublishKey("myPublishKey");
pnConfiguration.setUuid("myUUID");
pnConfiguration.setLogVerbosity(PNLogVerbosity.BODY);
pnConfiguration.setUseRandomInitializationVector(false);

class MockedTimePubNub extends PubNub {

Expand Down

0 comments on commit f6c9190

Please sign in to comment.