Removing WebSocketClient.getConnection() as inappropriate

This commit is contained in:
Joakim Erdfelt 2012-11-07 11:00:46 -07:00
parent 4a8a1228fc
commit 802e97e6fb
3 changed files with 5 additions and 15 deletions

View File

@ -24,7 +24,6 @@ import java.net.URI;
import org.eclipse.jetty.util.FutureCallback; import org.eclipse.jetty.util.FutureCallback;
import org.eclipse.jetty.websocket.api.UpgradeRequest; import org.eclipse.jetty.websocket.api.UpgradeRequest;
import org.eclipse.jetty.websocket.api.UpgradeResponse; import org.eclipse.jetty.websocket.api.UpgradeResponse;
import org.eclipse.jetty.websocket.api.WebSocketConnection;
import org.eclipse.jetty.websocket.api.WebSocketPolicy; import org.eclipse.jetty.websocket.api.WebSocketPolicy;
import org.eclipse.jetty.websocket.client.masks.Masker; import org.eclipse.jetty.websocket.client.masks.Masker;
import org.eclipse.jetty.websocket.common.events.EventDriver; import org.eclipse.jetty.websocket.common.events.EventDriver;
@ -33,8 +32,6 @@ public interface WebSocketClient
{ {
public FutureCallback<UpgradeResponse> connect(URI websocketUri) throws IOException; public FutureCallback<UpgradeResponse> connect(URI websocketUri) throws IOException;
public WebSocketConnection getConnection();
public WebSocketClientFactory getFactory(); public WebSocketClientFactory getFactory();
public Masker getMasker(); public Masker getMasker();

View File

@ -79,11 +79,10 @@ public class ConnectionManager extends ContainerLifeCycle
return new InetSocketAddress(uri.getHost(),port); return new InetSocketAddress(uri.getHost(),port);
} }
private final Queue<WebSocketClient> clients = new ConcurrentLinkedQueue<>(); private final Queue<DefaultWebSocketClient> clients = new ConcurrentLinkedQueue<>();
private final WebSocketClientSelectorManager selector; private final WebSocketClientSelectorManager selector;
public ConnectionManager(ByteBufferPool bufferPool, Executor executor, Scheduler scheduler, SslContextFactory sslContextFactory, public ConnectionManager(ByteBufferPool bufferPool, Executor executor, Scheduler scheduler, SslContextFactory sslContextFactory, WebSocketPolicy policy)
WebSocketPolicy policy)
{ {
// TODO: configure connect timeout // TODO: configure connect timeout
selector = new WebSocketClientSelectorManager(bufferPool,executor,scheduler,policy); selector = new WebSocketClientSelectorManager(bufferPool,executor,scheduler,policy);
@ -91,14 +90,14 @@ public class ConnectionManager extends ContainerLifeCycle
addBean(selector); addBean(selector);
} }
public void addClient(WebSocketClient client) public void addClient(DefaultWebSocketClient client)
{ {
clients.add(client); clients.add(client);
} }
private void closeConnections() private void closeConnections()
{ {
for (WebSocketClient client : clients) for (DefaultWebSocketClient client : clients)
{ {
if (client.getConnection() != null) if (client.getConnection() != null)
{ {
@ -144,7 +143,7 @@ public class ConnectionManager extends ContainerLifeCycle
super.doStop(); super.doStop();
} }
public Collection<WebSocketClient> getClients() public Collection<DefaultWebSocketClient> getClients()
{ {
return Collections.unmodifiableCollection(clients); return Collections.unmodifiableCollection(clients);
} }

View File

@ -139,12 +139,6 @@ public class DefaultWebSocketClient extends FutureCallback<UpgradeResponse> impl
return upgradeRequest; return upgradeRequest;
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.jetty.websocket.client.internal.WebSocketClient#getConnection()
*/
@Override
public WebSocketConnection getConnection() public WebSocketConnection getConnection()
{ {
return this.connection; return this.connection;