diff --git a/build.gradle b/build.gradle index 1a5ca9bd1a..3b74c54a2c 100644 --- a/build.gradle +++ b/build.gradle @@ -4,14 +4,14 @@ buildscript { } dependencies { classpath 'io.spring.gradle:dependency-management-plugin:1.0.2.RELEASE' - classpath 'io.spring.gradle:spring-io-plugin:0.0.7.RELEASE' + classpath 'io.spring.gradle:spring-io-plugin:0.0.8.RELEASE' classpath 'io.spring.gradle:docbook-reference-plugin:0.3.1' classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.0' } } plugins { - id 'org.sonarqube' version '2.1' + id 'org.sonarqube' version '2.5' } description = 'Spring Integration' @@ -193,7 +193,7 @@ subprojects { subproject -> reports { xml.enabled false csv.enabled false - html.destination "${buildDir}/reports/jacoco/html" + html.destination file("${buildDir}/reports/jacoco/html") } } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 80454fc961..aff21d8acc 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3349043ec6..630a0d1bc1 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Apr 26 10:11:04 EDT 2017 +#Fri Jun 23 15:29:14 EDT 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-bin.zip diff --git a/gradlew b/gradlew index 4453ccea33..cccdd3d517 100755 --- a/gradlew +++ b/gradlew @@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS="" # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -155,7 +155,7 @@ if $cygwin ; then fi # Escape application args -save ( ) { +save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } diff --git a/spring-integration-stomp/src/main/java/org/springframework/integration/stomp/AbstractStompSessionManager.java b/spring-integration-stomp/src/main/java/org/springframework/integration/stomp/AbstractStompSessionManager.java index f65341243a..92e410b421 100644 --- a/spring-integration-stomp/src/main/java/org/springframework/integration/stomp/AbstractStompSessionManager.java +++ b/spring-integration-stomp/src/main/java/org/springframework/integration/stomp/AbstractStompSessionManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2016 the original author or authors. + * Copyright 2015-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -198,39 +198,35 @@ public abstract class AbstractStompSessionManager implements StompSessionManager } return; } - final CountDownLatch latch = new CountDownLatch(1); - this.stompSessionListenableFuture.addCallback(new ListenableFutureCallback() { + final CountDownLatch connectLatch = new CountDownLatch(1); + this.stompSessionListenableFuture.addCallback( + stompSession -> { + if (AbstractStompSessionManager.this.logger.isDebugEnabled()) { + AbstractStompSessionManager.this.logger.debug("onSuccess"); + } + AbstractStompSessionManager.this.connected = true; + AbstractStompSessionManager.this.connecting = false; + stompSession.setAutoReceipt(isAutoReceiptEnabled()); + if (AbstractStompSessionManager.this.applicationEventPublisher != null) { + AbstractStompSessionManager.this.applicationEventPublisher.publishEvent( + new StompSessionConnectedEvent(this)); + } + AbstractStompSessionManager.this.reconnectFuture = null; + connectLatch.countDown(); - @Override - public void onFailure(Throwable e) { - if (AbstractStompSessionManager.this.logger.isDebugEnabled()) { - AbstractStompSessionManager.this.logger.debug("onFailure", e); - } - latch.countDown(); - if (epoch == AbstractStompSessionManager.this.epoch.get()) { - scheduleReconnect(e); - } - } + }, + e -> { + if (AbstractStompSessionManager.this.logger.isDebugEnabled()) { + AbstractStompSessionManager.this.logger.debug("onFailure", e); + } + connectLatch.countDown(); + if (epoch == AbstractStompSessionManager.this.epoch.get()) { + scheduleReconnect(e); + } + }); - @Override - public void onSuccess(StompSession stompSession) { - if (AbstractStompSessionManager.this.logger.isDebugEnabled()) { - AbstractStompSessionManager.this.logger.debug("onSuccess"); - } - AbstractStompSessionManager.this.connected = true; - AbstractStompSessionManager.this.connecting = false; - stompSession.setAutoReceipt(isAutoReceiptEnabled()); - if (AbstractStompSessionManager.this.applicationEventPublisher != null) { - AbstractStompSessionManager.this.applicationEventPublisher.publishEvent( - new StompSessionConnectedEvent(this)); - } - AbstractStompSessionManager.this.reconnectFuture = null; - latch.countDown(); - } - - }); try { - if (!latch.await(10, TimeUnit.SECONDS)) { + if (!connectLatch.await(30, TimeUnit.SECONDS)) { this.logger.error("No response to connection attempt"); if (epoch == this.epoch.get()) { scheduleReconnect(null); @@ -261,7 +257,7 @@ public abstract class AbstractStompSessionManager implements StompSessionManager if (this.stompClient.getTaskScheduler() != null) { this.reconnectFuture = this.stompClient.getTaskScheduler() - .schedule((Runnable) () -> connect(), new Date(System.currentTimeMillis() + this.recoveryInterval)); + .schedule(this::connect, new Date(System.currentTimeMillis() + this.recoveryInterval)); } else { this.logger.info("For automatic reconnection the 'stompClient' should be configured with a TaskScheduler."); diff --git a/spring-integration-stomp/src/test/java/org/springframework/integration/stomp/client/StompServerIntegrationTests.java b/spring-integration-stomp/src/test/java/org/springframework/integration/stomp/client/StompServerIntegrationTests.java index 2b111faec4..d098a34a73 100644 --- a/spring-integration-stomp/src/test/java/org/springframework/integration/stomp/client/StompServerIntegrationTests.java +++ b/spring-integration-stomp/src/test/java/org/springframework/integration/stomp/client/StompServerIntegrationTests.java @@ -118,9 +118,13 @@ public class StompServerIntegrationTests extends LogAdjustingTestSupport { MessageChannel stompOutputChannel1 = context1.getBean("stompOutputChannel", MessageChannel.class); MessageChannel stompOutputChannel2 = context2.getBean("stompOutputChannel", MessageChannel.class); - Message eventMessage = stompEvents1.receive(10000); + Message eventMessage; + do { + eventMessage = stompEvents1.receive(10000); + } + while (eventMessage != null && !(eventMessage.getPayload() instanceof StompSessionConnectedEvent)); + assertNotNull(eventMessage); - assertThat(eventMessage.getPayload(), instanceOf(StompSessionConnectedEvent.class)); eventMessage = stompEvents1.receive(10000); assertNotNull(eventMessage);