Jetty9 - Removed "async" from class/method names.

This commit is contained in:
Simone Bordet 2012-08-07 17:30:15 +02:00
parent 2816187e0d
commit c4912f4a1d
6 changed files with 26 additions and 41 deletions

View File

@ -87,8 +87,8 @@ public class NextProtoNegoClientConnection extends AbstractConnection implements
{ {
// Server does not support NPN, but this is a SPDY client, so hardcode SPDY // Server does not support NPN, but this is a SPDY client, so hardcode SPDY
EndPoint endPoint = getEndPoint(); EndPoint endPoint = getEndPoint();
Connection connection = client.getDefaultAsyncConnectionFactory().newConnection(channel, endPoint, attachment); Connection connection = client.getDefaultConnectionFactory().newConnection(channel, endPoint, attachment);
client.replaceAsyncConnection(endPoint, connection); client.replaceConnection(endPoint, connection);
completed = true; completed = true;
} }
@ -99,8 +99,8 @@ public class NextProtoNegoClientConnection extends AbstractConnection implements
if (protocol == null) if (protocol == null)
return null; return null;
EndPoint endPoint = getEndPoint(); EndPoint endPoint = getEndPoint();
Connection connection = client.getAsyncConnectionFactory(protocol).newConnection(channel, endPoint, attachment); Connection connection = client.getConnectionFactory(protocol).newConnection(channel, endPoint, attachment);
client.replaceAsyncConnection(endPoint, connection); client.replaceConnection(endPoint, connection);
completed = true; completed = true;
return protocol; return protocol;
} }

View File

@ -93,9 +93,9 @@ public class NextProtoNegoServerConnection extends AbstractConnection implements
@Override @Override
public void protocolSelected(String protocol) public void protocolSelected(String protocol)
{ {
ConnectionFactory ConnectionFactory = connector.getConnectionFactory(protocol); ConnectionFactory connectionFactory = connector.getConnectionFactory(protocol);
EndPoint endPoint = getEndPoint(); EndPoint endPoint = getEndPoint();
Connection connection = ConnectionFactory.newConnection(channel, endPoint, connector); Connection connection = connectionFactory.newConnection(channel, endPoint, connector);
connector.replaceConnection(endPoint, connection); connector.replaceConnection(endPoint, connection);
completed = true; completed = true;
} }

View File

@ -52,7 +52,7 @@ import org.eclipse.jetty.util.thread.QueuedThreadPool;
public class SPDYClient public class SPDYClient
{ {
private final Map<String, ConnectionFactory> factories = new ConcurrentHashMap<>(); private final Map<String, ConnectionFactory> factories = new ConcurrentHashMap<>();
private final ConnectionFactory defaultAsyncConnectionFactory = new ClientSPDYAsyncConnectionFactory(); private final ConnectionFactory defaultConnectionFactory = new ClientSPDYConnectionFactory();
private final short version; private final short version;
private final Factory factory; private final Factory factory;
private volatile SocketAddress bindAddress; private volatile SocketAddress bindAddress;
@ -142,7 +142,7 @@ public class SPDYClient
return null; return null;
} }
public ConnectionFactory getAsyncConnectionFactory(String protocol) public ConnectionFactory getConnectionFactory(String protocol)
{ {
for (Map.Entry<String, ConnectionFactory> entry : factories.entrySet()) for (Map.Entry<String, ConnectionFactory> entry : factories.entrySet())
{ {
@ -157,19 +157,19 @@ public class SPDYClient
return null; return null;
} }
public void putAsyncConnectionFactory(String protocol, ConnectionFactory factory) public void putConnectionFactory(String protocol, ConnectionFactory factory)
{ {
factories.put(protocol, factory); factories.put(protocol, factory);
} }
public ConnectionFactory removeAsyncConnectionFactory(String protocol) public ConnectionFactory removeConnectionFactory(String protocol)
{ {
return factories.remove(protocol); return factories.remove(protocol);
} }
public ConnectionFactory getDefaultAsyncConnectionFactory() public ConnectionFactory getDefaultConnectionFactory()
{ {
return defaultAsyncConnectionFactory; return defaultConnectionFactory;
} }
protected SSLEngine newSSLEngine(SslContextFactory sslContextFactory, SocketChannel channel) protected SSLEngine newSSLEngine(SslContextFactory sslContextFactory, SocketChannel channel)
@ -186,7 +186,7 @@ public class SPDYClient
return FlowControlStrategyFactory.newFlowControlStrategy(version); return FlowControlStrategyFactory.newFlowControlStrategy(version);
} }
public void replaceAsyncConnection(EndPoint endPoint, Connection connection) public void replaceConnection(EndPoint endPoint, Connection connection)
{ {
Connection oldConnection = endPoint.getConnection(); Connection oldConnection = endPoint.getConnection();
endPoint.setConnection(connection); endPoint.setConnection(connection);
@ -202,33 +202,21 @@ public class SPDYClient
private final Executor threadPool; private final Executor threadPool;
private final SslContextFactory sslContextFactory; private final SslContextFactory sslContextFactory;
private final SelectorManager selector; private final SelectorManager selector;
private final long defaultTimeout = 30000;
private final long idleTimeout; private final long idleTimeout;
//TODO: Replace with Builder?!
public Factory() public Factory()
{ {
this(null, null, 30000); this(null, null);
} }
public Factory(SslContextFactory sslContextFactory) public Factory(SslContextFactory sslContextFactory)
{ {
this(null, sslContextFactory, 30000); this(null, sslContextFactory);
}
public Factory(SslContextFactory sslContextFactory, long idleTimeout)
{
this(null, sslContextFactory, idleTimeout);
} }
public Factory(Executor threadPool) public Factory(Executor threadPool)
{ {
this(threadPool, null, 30000); this(threadPool, null);
}
public Factory(Executor threadPool, long idleTimeout)
{
this(threadPool, null, idleTimeout);
} }
public Factory(Executor threadPool, SslContextFactory sslContextFactory) public Factory(Executor threadPool, SslContextFactory sslContextFactory)
@ -251,7 +239,7 @@ public class SPDYClient
selector = new ClientSelectorManager(); selector = new ClientSelectorManager();
addBean(selector); addBean(selector);
factories.put("spdy/2", new ClientSPDYAsyncConnectionFactory()); factories.put("spdy/2", new ClientSPDYConnectionFactory());
} }
public SPDYClient newSPDYClient(short version) public SPDYClient newSPDYClient(short version)
@ -315,9 +303,8 @@ public class SPDYClient
long clientIdleTimeout = attachment.client.getIdleTimeout(); long clientIdleTimeout = attachment.client.getIdleTimeout();
if (clientIdleTimeout < 0) if (clientIdleTimeout < 0)
clientIdleTimeout = idleTimeout; clientIdleTimeout = idleTimeout;
EndPoint result = new SelectChannelEndPoint(channel, selectSet, key, scheduler, clientIdleTimeout);
return result; return new SelectChannelEndPoint(channel, selectSet, key, scheduler, clientIdleTimeout);
} }
@Override @Override
@ -358,7 +345,7 @@ public class SPDYClient
} }
else else
{ {
ConnectionFactory connectionFactory = new ClientSPDYAsyncConnectionFactory(); ConnectionFactory connectionFactory = new ClientSPDYConnectionFactory();
Connection connection = connectionFactory.newConnection(channel, endPoint, attachment); Connection connection = connectionFactory.newConnection(channel, endPoint, attachment);
endPoint.setConnection(connection); endPoint.setConnection(connection);
return connection; return connection;
@ -402,7 +389,7 @@ public class SPDYClient
} }
} }
private static class ClientSPDYAsyncConnectionFactory implements ConnectionFactory private static class ClientSPDYConnectionFactory implements ConnectionFactory
{ {
@Override @Override
public Connection newConnection(SocketChannel channel, EndPoint endPoint, Object attachment) public Connection newConnection(SocketChannel channel, EndPoint endPoint, Object attachment)
@ -416,7 +403,6 @@ public class SPDYClient
Generator generator = new Generator(factory.bufferPool, compressionFactory.newCompressor()); Generator generator = new Generator(factory.bufferPool, compressionFactory.newCompressor());
SPDYConnection connection = new ClientSPDYConnection(endPoint, factory.bufferPool, parser, factory); SPDYConnection connection = new ClientSPDYConnection(endPoint, factory.bufferPool, parser, factory);
endPoint.setConnection(connection);
FlowControlStrategy flowControlStrategy = client.newFlowControlStrategy(); FlowControlStrategy flowControlStrategy = client.newFlowControlStrategy();

View File

@ -53,8 +53,8 @@ public class SPDYServerConnector extends SelectChannelConnector
super(server, sslContextFactory); super(server, sslContextFactory);
this.listener = listener; this.listener = listener;
setInitialWindowSize(65536); setInitialWindowSize(65536);
putConnectionFactory("spdy/3", new ServerSPDYAsyncConnectionFactory(SPDY.V3, getByteBufferPool(), getExecutor(), getScheduler(), listener)); putConnectionFactory("spdy/3", new ServerSPDYConnectionFactory(SPDY.V3, getByteBufferPool(), getExecutor(), getScheduler(), listener));
putConnectionFactory("spdy/2", new ServerSPDYAsyncConnectionFactory(SPDY.V2, getByteBufferPool(), getExecutor(), getScheduler(), listener)); putConnectionFactory("spdy/2", new ServerSPDYConnectionFactory(SPDY.V2, getByteBufferPool(), getExecutor(), getScheduler(), listener));
setDefaultConnectionFactory(getConnectionFactory("spdy/2")); setDefaultConnectionFactory(getConnectionFactory("spdy/2"));
} }

View File

@ -25,7 +25,7 @@ import org.eclipse.jetty.spdy.api.server.ServerSessionFrameListener;
import org.eclipse.jetty.spdy.generator.Generator; import org.eclipse.jetty.spdy.generator.Generator;
import org.eclipse.jetty.spdy.parser.Parser; import org.eclipse.jetty.spdy.parser.Parser;
public class ServerSPDYAsyncConnectionFactory implements ConnectionFactory public class ServerSPDYConnectionFactory implements ConnectionFactory
{ {
private final ByteBufferPool bufferPool; private final ByteBufferPool bufferPool;
private final Executor threadPool; private final Executor threadPool;
@ -33,12 +33,12 @@ public class ServerSPDYAsyncConnectionFactory implements ConnectionFactory
private final short version; private final short version;
private final ServerSessionFrameListener listener; private final ServerSessionFrameListener listener;
public ServerSPDYAsyncConnectionFactory(short version, ByteBufferPool bufferPool, Executor threadPool, ScheduledExecutorService scheduler) public ServerSPDYConnectionFactory(short version, ByteBufferPool bufferPool, Executor threadPool, ScheduledExecutorService scheduler)
{ {
this(version, bufferPool, threadPool, scheduler, null); this(version, bufferPool, threadPool, scheduler, null);
} }
public ServerSPDYAsyncConnectionFactory(short version, ByteBufferPool bufferPool, Executor threadPool, ScheduledExecutorService scheduler, ServerSessionFrameListener listener) public ServerSPDYConnectionFactory(short version, ByteBufferPool bufferPool, Executor threadPool, ScheduledExecutorService scheduler, ServerSessionFrameListener listener)
{ {
this.version = version; this.version = version;
this.bufferPool = bufferPool; this.bufferPool = bufferPool;
@ -63,7 +63,6 @@ public class ServerSPDYAsyncConnectionFactory implements ConnectionFactory
ServerSessionFrameListener listener = provideServerSessionFrameListener(endPoint, attachment); ServerSessionFrameListener listener = provideServerSessionFrameListener(endPoint, attachment);
SPDYConnection connection = new ServerSPDYConnection(endPoint, bufferPool, parser, listener, connector); SPDYConnection connection = new ServerSPDYConnection(endPoint, bufferPool, parser, listener, connector);
endPoint.setConnection(connection);
FlowControlStrategy flowControlStrategy = connector.newFlowControlStrategy(version); FlowControlStrategy flowControlStrategy = connector.newFlowControlStrategy(version);

View File

@ -61,7 +61,7 @@ public abstract class AbstractTest
connector = newSPDYServerConnector(listener); connector = newSPDYServerConnector(listener);
if (listener == null) if (listener == null)
listener = connector.getServerSessionFrameListener(); listener = connector.getServerSessionFrameListener();
connector.setDefaultConnectionFactory(new ServerSPDYAsyncConnectionFactory(version, connector.getByteBufferPool(), connector.getExecutor(), connector.getScheduler(), listener)); connector.setDefaultConnectionFactory(new ServerSPDYConnectionFactory(version, connector.getByteBufferPool(), connector.getExecutor(), connector.getScheduler(), listener));
connector.setPort(0); connector.setPort(0);
server.addConnector(connector); server.addConnector(connector);
server.start(); server.start();