401177 - Make org.eclipse.jetty.websocket.api.WebSocketAdapter threadsafe
+ Making some subtle changes to address thread safety of the WebSocketAdapter
This commit is contained in:
parent
ea0996f63a
commit
246db2b08d
|
@ -25,11 +25,12 @@ package org.eclipse.jetty.websocket.api;
|
|||
*/
|
||||
public class WebSocketAdapter implements WebSocketListener
|
||||
{
|
||||
private Session session;
|
||||
private volatile Session session;
|
||||
|
||||
public RemoteEndpoint getRemote()
|
||||
{
|
||||
return session.getRemote();
|
||||
Session sess = this.session;
|
||||
return sess == null?null:session.getRemote();
|
||||
}
|
||||
|
||||
public Session getSession()
|
||||
|
@ -39,12 +40,14 @@ public class WebSocketAdapter implements WebSocketListener
|
|||
|
||||
public boolean isConnected()
|
||||
{
|
||||
return (session != null) && (session.isOpen());
|
||||
Session sess = this.session;
|
||||
return (sess != null) && (sess.isOpen());
|
||||
}
|
||||
|
||||
public boolean isNotConnected()
|
||||
{
|
||||
return (session == null) || (!session.isOpen());
|
||||
Session sess = this.session;
|
||||
return (sess == null) || (!sess.isOpen());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue