mirror of
https://github.com/jetty/jetty.project.git
synced 2025-03-03 12:29:31 +00:00
Preserve delayed initialization semantics
Signed-off-by: Lucas Fairchild-Madar <lfairchildmadar@flightstats.com>
This commit is contained in:
parent
b680d1deea
commit
7d1d7a9724
@ -381,37 +381,21 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("connect websocket {} to {}",websocket,toUri);
|
||||
|
||||
init();
|
||||
|
||||
WebSocketUpgradeRequest wsReq = new WebSocketUpgradeRequest(this,httpClient,request);
|
||||
|
||||
wsReq.setUpgradeListener(upgradeListener);
|
||||
return wsReq.sendAsync();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doStart() throws Exception
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Starting {}",this);
|
||||
|
||||
if (isStopAtShutdown()) {
|
||||
ShutdownThread.register(this);
|
||||
}
|
||||
|
||||
super.doStart();
|
||||
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Started {}",this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doStop() throws Exception
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Stopping {}",this);
|
||||
|
||||
if (isStopAtShutdown()) {
|
||||
ShutdownThread.deregister(this);
|
||||
}
|
||||
|
||||
super.doStop();
|
||||
|
||||
@ -569,6 +553,14 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
|
||||
return httpClient.getSslContextFactory();
|
||||
}
|
||||
|
||||
private synchronized void init() throws IOException
|
||||
{
|
||||
if (isStopAtShutdown() && !ShutdownThread.isRegistered(this))
|
||||
{
|
||||
ShutdownThread.register(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method for new ConnectionManager
|
||||
*
|
||||
@ -716,7 +708,7 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
|
||||
{
|
||||
if (stop)
|
||||
{
|
||||
if (!stopAtShutdown && isStarted()) {
|
||||
if (!stopAtShutdown && isStarted() && !ShutdownThread.isRegistered(this)) {
|
||||
ShutdownThread.register(this);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user