SmartLifecycle default methods for auto-startup in default phase
Issue: SPR-17188
This commit is contained in:
@@ -42,7 +42,7 @@ public abstract class ConnectionManagerSupport implements SmartLifecycle {
|
||||
|
||||
private boolean autoStartup = false;
|
||||
|
||||
private int phase = Integer.MAX_VALUE;
|
||||
private int phase = DEFAULT_PHASE;
|
||||
|
||||
private volatile boolean running = false;
|
||||
|
||||
|
||||
@@ -254,16 +254,6 @@ public class SubProtocolWebSocketHandler
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isAutoStartup() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPhase() {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void start() {
|
||||
Assert.isTrue(this.defaultProtocolHandler != null || !this.protocolHandlers.isEmpty(), "No handlers");
|
||||
|
||||
@@ -79,7 +79,7 @@ public class WebSocketStompClient extends StompClientSupport implements SmartLif
|
||||
|
||||
private boolean autoStartup = true;
|
||||
|
||||
private int phase = Integer.MAX_VALUE;
|
||||
private int phase = DEFAULT_PHASE;
|
||||
|
||||
private volatile boolean running = false;
|
||||
|
||||
@@ -194,12 +194,6 @@ public class WebSocketStompClient extends StompClientSupport implements SmartLif
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(Runnable callback) {
|
||||
stop();
|
||||
callback.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRunning() {
|
||||
return this.running;
|
||||
@@ -396,7 +390,10 @@ public class WebSocketStompClient extends StompClientSupport implements SmartLif
|
||||
}
|
||||
|
||||
private void updateLastWriteTime() {
|
||||
this.lastWriteTime = (this.lastWriteTime != -1 ? System.currentTimeMillis() : -1);
|
||||
long lastWriteTime = this.lastWriteTime;
|
||||
if (lastWriteTime != -1) {
|
||||
this.lastWriteTime = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -46,15 +46,6 @@ public class WebSocketHandlerMapping extends SimpleUrlHandlerMapping implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoStartup() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPhase() {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
@@ -80,12 +71,6 @@ public class WebSocketHandlerMapping extends SimpleUrlHandlerMapping implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(Runnable callback) {
|
||||
stop();
|
||||
callback.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRunning() {
|
||||
return this.running;
|
||||
|
||||
Reference in New Issue
Block a user