Issue #207 - correcting lifecycle of WebSocketSession and EndpointFunctions
This commit is contained in:
parent
34f0007153
commit
0e9841a3cc
|
@ -116,5 +116,6 @@ public abstract class ConnectPromise extends FuturePromise<Session> implements R
|
|||
public void setSession(WebSocketSession session)
|
||||
{
|
||||
this.session = session;
|
||||
this.client.addManaged(session);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -320,7 +320,6 @@ public class UpgradeConnection extends AbstractConnection implements Connection.
|
|||
|
||||
// Wire up Session <-> Connection
|
||||
connection.addListener(session);
|
||||
connectPromise.setSession(session);
|
||||
|
||||
// Initialize / Negotiate Extensions
|
||||
ExtensionStack extensionStack = new ExtensionStack(connectPromise.getClient().getExtensionFactory());
|
||||
|
@ -338,7 +337,9 @@ public class UpgradeConnection extends AbstractConnection implements Connection.
|
|||
extensionStack.setNextOutgoing(connection);
|
||||
|
||||
session.addManaged(extensionStack);
|
||||
connectPromise.getClient().addManaged(session);
|
||||
|
||||
// let waiting client know about session
|
||||
connectPromise.setSession(session);
|
||||
|
||||
// Now swap out the connection
|
||||
endp.upgrade(connection);
|
||||
|
|
|
@ -174,8 +174,8 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Rem
|
|||
LOG.debug("Using RemoteEndpointFactory: {}", remoteEndpointFactory);
|
||||
|
||||
this.endpointFunctions = newEndpointFunctions(this.endpoint);
|
||||
addBean(this.endpointFunctions);
|
||||
|
||||
addManaged(this.endpointFunctions);
|
||||
|
||||
super.doStart();
|
||||
}
|
||||
|
||||
|
|
|
@ -110,8 +110,8 @@ public class CommonEndpointFunctions<T extends Session> extends AbstractLifeCycl
|
|||
@Override
|
||||
protected void doStart() throws Exception
|
||||
{
|
||||
super.doStart();
|
||||
discoverEndpointFunctions(this.endpoint);
|
||||
super.doStart();
|
||||
}
|
||||
|
||||
protected void discoverEndpointFunctions(Object endpoint)
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.eclipse.jetty.websocket.common.function;
|
|||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.eclipse.jetty.util.component.LifeCycle;
|
||||
import org.eclipse.jetty.websocket.api.extensions.Frame;
|
||||
import org.eclipse.jetty.websocket.common.CloseInfo;
|
||||
|
||||
|
@ -28,7 +29,7 @@ import org.eclipse.jetty.websocket.common.CloseInfo;
|
|||
*
|
||||
* @param <T> the Session object
|
||||
*/
|
||||
public interface EndpointFunctions<T>
|
||||
public interface EndpointFunctions<T> extends LifeCycle
|
||||
{
|
||||
void onOpen(T session);
|
||||
|
||||
|
|
Loading…
Reference in New Issue