Issue #3730 - EventDriverFactory and SessionFactory setters

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2019-12-19 13:46:12 -06:00
parent 26fde02c55
commit c2c2c56a02
No known key found for this signature in database
GPG Key ID: 2D0E1FB8FE4B68B4
2 changed files with 16 additions and 2 deletions

View File

@ -183,8 +183,12 @@ public class ClientContainer extends ContainerLifeCycle implements WebSocketCont
*/
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<>();

View File

@ -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;
@ -379,6 +379,16 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
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
{