Matching coding style; block potential race condition
Signed-off-by: Lucas Fairchild-Madar <lfairchildmadar@flightstats.com>
This commit is contained in:
parent
7d1d7a9724
commit
84ff1e3a66
|
@ -704,15 +704,17 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
|
||||||
* @see Runtime#addShutdownHook(Thread)
|
* @see Runtime#addShutdownHook(Thread)
|
||||||
* @see ShutdownThread
|
* @see ShutdownThread
|
||||||
*/
|
*/
|
||||||
public void setStopAtShutdown(boolean stop)
|
public synchronized void setStopAtShutdown(boolean stop)
|
||||||
{
|
{
|
||||||
if (stop)
|
if (stop)
|
||||||
{
|
{
|
||||||
if (!stopAtShutdown && isStarted() && !ShutdownThread.isRegistered(this)) {
|
if (!stopAtShutdown && isStarted() && !ShutdownThread.isRegistered(this))
|
||||||
|
{
|
||||||
ShutdownThread.register(this);
|
ShutdownThread.register(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
ShutdownThread.deregister(this);
|
ShutdownThread.deregister(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue