Skip to content

Commit

Permalink
chore(deps): update dependency de.gdata:vaas to v8.2.3 (#521)
Browse files Browse the repository at this point in the history
* chore(deps): update dependency de.gdata:vaas to v8.2.3

* testing the local build with the example

* bugfix: cancel the timer on close not the task

* downgrade the example because 8.2.3 has a bug

---------

Co-authored-by: Renovate Bot <[email protected]>
  • Loading branch information
ata-no-one and Renovate Bot authored Jul 25, 2024
1 parent 0b02a8a commit b3a3d75
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 8 deletions.
79 changes: 79 additions & 0 deletions java/build.local.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
plugins {
id 'java'
id 'java-library'
id 'maven-publish'
id 'signing'
}

group = 'de.gdata'
version = '0.0.0'

repositories {
mavenCentral()
}

java {
withJavadocJar()
withSourcesJar()
}

dependencies {
implementation 'org.projectlombok:lombok:1.18.34'
implementation 'com.google.code.gson:gson:2.11.0'
implementation 'org.java-websocket:Java-WebSocket:1.5.7'
implementation 'org.jetbrains:annotations:24.1.0'
implementation 'io.github.cdimascio:dotenv-java:3.0.1'
testImplementation 'org.testng:testng:7.10.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.10.3'


compileOnly 'org.projectlombok:lombok:1.18.34'
annotationProcessor 'org.projectlombok:lombok:1.18.34'

testCompileOnly 'org.projectlombok:lombok:1.18.34'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.34'
}

test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"

showExceptions true
exceptionFormat "full"
showCauses true
showStackTraces true
}
}

tasks.register('testWithoutErrorLogProducer', Test) {
useJUnitPlatform {
excludeTags 'ErrorLogProducer'
}
testLogging {
events "passed", "skipped", "failed"

showExceptions true
exceptionFormat "full"
showCauses true
showStackTraces true
}
}

publishing { publications {
mavenJava(MavenPublication) {
from components.java
groupId = 'de.gdata'
artifactId = 'vaas' // Ersetzen Sie dies durch die ID Ihres Artifacts
version = '8-future'
}
}
repositories {
maven {
name = 'local'
url = uri('file://workspaces/vaas/java/build/repos')
}
}
}
2 changes: 1 addition & 1 deletion java/examples/VaasExample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repositories {

dependencies {
implementation 'org.slf4j:slf4j-nop:2.0.13'
implementation 'de.gdata:vaas:8.2.1'
implementation 'de.gdata:vaas:8.2.2'
}

task fileScan(type: JavaExec) {
Expand Down
33 changes: 33 additions & 0 deletions java/examples/VaasExample/build.local.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
plugins {
id 'java'
}

group 'de.gdata.vaasexample'
version '1.0-SNAPSHOT'

repositories {
maven {
url 'file://workspaces/vaas/java/build/repos'
}
mavenCentral()
}

dependencies {
implementation 'org.slf4j:slf4j-nop:2.0.13'
implementation 'de.gdata:vaas:8-future'
}

task fileScan(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
mainClass = 'de.gdata.vaasexample.Main'
}

task urlScan(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
mainClass = 'de.gdata.vaasexample.UrlScan'
}

task authentication(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
mainClass = 'de.gdata.vaasexample.Authentication'
}
12 changes: 5 additions & 7 deletions java/src/main/java/de/gdata/vaas/WebSocketClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ public class WebSocketClient extends org.java_websocket.client.WebSocketClient {
@Getter
private String sessionId = null;

private static final Timer timer = new Timer();
private TimerTask pingTask;
private final Timer timer = new Timer();

public WebSocketClient(VaasConfig config, String token) {
super(config.getUrl());
Expand Down Expand Up @@ -109,14 +108,14 @@ private void completeRequestResponseExceptionally(String requestId, Error error)

@Override
public void onOpen(ServerHandshake handshakeData) {
pingTask = new TimerTask() {
var pingTask = new TimerTask() {
@Override
public void run() {
ping();
}
};

timer.scheduleAtFixedRate(pingTask, 20000, 20000);
this.timer.scheduleAtFixedRate(pingTask, 20000, 20000);
}

public void ping() {
Expand All @@ -135,9 +134,8 @@ public void onClose(int code, String reason, boolean remote) {
response.completeExceptionally(new VaasConnectionClosedException());
}
}
if (pingTask != null) {
pingTask.cancel();
pingTask = null;
if (this.timer != null) {
this.timer.cancel();
}
}

Expand Down

0 comments on commit b3a3d75

Please sign in to comment.