Experimental: Support Gradle --parallel
This should be treated as experimental but with these changes it seems to build ok. BUILD SUCCESSFUL Total time: 5 mins 15.533 secs It turns out that our sporadic Redis problems were fixed in a later version of Jedis. The problem was that the `connection.subscribe()` exited immediately. When I started adding debug logic, the problem went away (because I was using a newer versio of Jedis). spring-data-redis 1.5.2 is updated to work with the 2.7.3 version of Jedis. Polishing
This commit is contained in:
committed by
Artem Bilan
parent
b57018b78b
commit
75a7b63350
@@ -49,6 +49,8 @@ import org.springframework.web.socket.client.WebSocketClient;
|
||||
*/
|
||||
public final class ClientWebSocketContainer extends IntegrationWebSocketContainer implements SmartLifecycle {
|
||||
|
||||
private static final int DEFAULT_CONNECTION_TIMEOUT = 10;
|
||||
|
||||
private final WebSocketHttpHeaders headers = new WebSocketHttpHeaders();
|
||||
|
||||
private final ConnectionManagerSupport connectionManager;
|
||||
@@ -59,6 +61,8 @@ public final class ClientWebSocketContainer extends IntegrationWebSocketContaine
|
||||
|
||||
private volatile Throwable openConnectionException;
|
||||
|
||||
private volatile int connectionTimeout = DEFAULT_CONNECTION_TIMEOUT;
|
||||
|
||||
public ClientWebSocketContainer(WebSocketClient client, String uriTemplate, Object... uriVariables) {
|
||||
Assert.notNull(client, "'client' must not be null");
|
||||
this.connectionManager = new IntegrationWebSocketConnectionManager(client, uriTemplate, uriVariables);
|
||||
@@ -84,6 +88,15 @@ public final class ClientWebSocketContainer extends IntegrationWebSocketContaine
|
||||
this.headers.putAll(headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the connection timeout in seconds; default: 10.
|
||||
* @param connectionTimeout the timeout in seconds.
|
||||
* @since 4.2
|
||||
*/
|
||||
public void setConnectionTimeout(int connectionTimeout) {
|
||||
this.connectionTimeout = connectionTimeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the {@link #clientSession} {@link WebSocketSession}.
|
||||
* Independently of provided argument, this method always returns only the
|
||||
@@ -95,7 +108,7 @@ public final class ClientWebSocketContainer extends IntegrationWebSocketContaine
|
||||
public WebSocketSession getSession(String sessionId) {
|
||||
if (this.isRunning()) {
|
||||
try {
|
||||
this.connectionLatch.await(10, TimeUnit.SECONDS);
|
||||
this.connectionLatch.await(this.connectionTimeout, TimeUnit.SECONDS);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
logger.error("'clientSession' has not been established during 'openConnection'");
|
||||
|
||||
@@ -66,6 +66,7 @@ public class ClientWebSocketContainerTests {
|
||||
|
||||
TestWebSocketListener messageListener = new TestWebSocketListener();
|
||||
container.setMessageListener(messageListener);
|
||||
container.setConnectionTimeout(30);
|
||||
|
||||
container.start();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user