public abstract class ConnectionManagerSupport extends java.lang.Object implements SmartLifecycle
autoStartup property is set
to true, or if set to false, the start() and #stop methods can
be invoked manually.| Constructor and Description |
|---|
ConnectionManagerSupport(java.lang.String uriTemplate,
java.lang.Object... uriVariables) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
closeConnection() |
int |
getPhase()
Return the phase in which this endpoint connection factory will be auto-connected
and stopped.
|
protected java.net.URI |
getUri() |
boolean |
isAutoStartup()
Return the value for the 'autoStartup' property.
|
protected abstract boolean |
isConnected() |
boolean |
isRunning()
Return whether this ConnectionManager has been started.
|
protected abstract void |
openConnection() |
void |
setAutoStartup(boolean autoStartup)
Set whether to auto-connect to the remote endpoint after this connection manager
has been initialized and the Spring context has been refreshed.
|
void |
setPhase(int phase)
Specify the phase in which a connection should be established to the remote
endpoint and subsequently closed.
|
void |
start()
Start the WebSocket connection.
|
protected void |
startInternal() |
void |
stop()
Stop this component, typically in a synchronous fashion, such that the component is
fully stopped upon return of this method.
|
void |
stop(java.lang.Runnable callback)
Indicates that a Lifecycle component must stop if it is currently running.
|
protected void |
stopInternal() |
protected final Log logger
public ConnectionManagerSupport(java.lang.String uriTemplate,
java.lang.Object... uriVariables)
protected java.net.URI getUri()
public void setAutoStartup(boolean autoStartup)
Default is "false".
public boolean isAutoStartup()
isAutoStartup in interface SmartLifecycleLifecycle.start(),
Phased.getPhase(),
LifecycleProcessor.onRefresh(),
ConfigurableApplicationContext.refresh()public void setPhase(int phase)
public int getPhase()
public final void start()
start in interface LifecycleSmartLifecycle.isAutoStartup()protected void startInternal()
public final void stop()
LifecycleSmartLifecycle
and its stop(Runnable) variant when asynchronous stop behavior is necessary.
Note that this stop notification is not guaranteed to come before destruction: On
regular shutdown, Lifecycle beans will first receive a stop notification before
the general destruction callbacks are being propagated; however, on hot refresh during a
context's lifetime or on aborted refresh attempts, only destroy methods will be called.
Should not throw an exception if the component isn't started yet.
In the case of a container, this will propagate the stop signal to all components that apply.
stop in interface LifecycleSmartLifecycle.stop(Runnable),
DisposableBean.destroy()public final void stop(java.lang.Runnable callback)
SmartLifecycleThe provided callback is used by the LifecycleProcessor to support
an ordered, and potentially concurrent, shutdown of all components having a
common shutdown order value. The callback must be executed after
the SmartLifecycle component does indeed stop.
The LifecycleProcessor will call only this variant of the
stop method; i.e. Lifecycle.stop() will not be called for
SmartLifecycle implementations unless explicitly delegated to within
the implementation of this method.
stop in interface SmartLifecycleLifecycle.stop(),
Phased.getPhase()protected void stopInternal()
throws java.lang.Exception
java.lang.Exceptionpublic boolean isRunning()
protected abstract void openConnection()
protected abstract void closeConnection()
throws java.lang.Exception
java.lang.Exceptionprotected abstract boolean isConnected()