Skip to content

Commit

Permalink
Issue #3730 - EventDriverFactory and SessionFactory setters
Browse files Browse the repository at this point in the history
Signed-off-by: Joakim Erdfelt <[email protected]>
  • Loading branch information
joakime committed Dec 19, 2019
1 parent 26fde02 commit c2c2c56
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,12 @@ protected ClientContainer(final WebSocketContainerScope scope, final HttpClient
*/
public ClientContainer(WebSocketClient client)
{
Objects.requireNonNull(client, "WebSocketClient");
this.scopeDelegate = client;
this.client = client;
addBean(this.client);
this.client.setEventDriverFactory(new JsrEventDriverFactory(scopeDelegate));
this.client.setSessionFactory(new JsrSessionFactory(this));
this.internalClient = false;

this.endpointClientMetadataCache = new ConcurrentHashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
// WebSocket Specifics
private final WebSocketPolicy policy;
private final WebSocketExtensionFactory extensionRegistry;
private final EventDriverFactory eventDriverFactory;
private final SessionFactory sessionFactory;
private final SessionTracker sessionTracker = new SessionTracker();
private final List<WebSocketSessionListener> sessionListeners = new ArrayList<>();
private EventDriverFactory eventDriverFactory;
private SessionFactory sessionFactory;

// defaults to true for backwards compatibility
private boolean stopAtShutdown = true;
Expand Down Expand Up @@ -379,6 +379,16 @@ public Future<Session> connect(Object websocket, URI toUri, ClientUpgradeRequest
return wsReq.sendAsync();
}

public void setEventDriverFactory(EventDriverFactory eventDriverFactory)
{
this.eventDriverFactory = eventDriverFactory;
}

public void setSessionFactory(SessionFactory sessionFactory)
{
this.sessionFactory = sessionFactory;
}

@Override
protected void doStart() throws Exception
{
Expand Down

0 comments on commit c2c2c56

Please sign in to comment.