aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Becker2013-07-17 12:09:00 (EDT)
committerThomas Becker2013-07-17 12:09:11 (EDT)
commita1789c8f7cfeb95840fae125438f55664f0c3e66 (patch)
tree5937f2cf5795ac51778473d8702027d1128e512f
parent2e1ad360ae4f2b442046b2b634c1c614ff18154e (diff)
downloadorg.eclipse.jetty.project-a1789c8f7cfeb95840fae125438f55664f0c3e66.zip
org.eclipse.jetty.project-a1789c8f7cfeb95840fae125438f55664f0c3e66.tar.gz
org.eclipse.jetty.project-a1789c8f7cfeb95840fae125438f55664f0c3e66.tar.bz2
412840 remove Future in SPDYClient.connect() and return Session instead in blocking version
-rw-r--r--jetty-spdy/spdy-client/src/main/java/org/eclipse/jetty/spdy/client/SPDYClient.java8
-rw-r--r--jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/SPDYProxyEngine.java2
-rw-r--r--jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/http/AbstractHTTPSPDYTest.java3
-rw-r--r--jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToHTTPLoadTest.java2
-rw-r--r--jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToHTTPTest.java18
-rw-r--r--jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToSPDYLoadTest.java2
-rw-r--r--jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToSPDYTest.java14
-rw-r--r--jetty-spdy/spdy-server/src/test/java/org/eclipse/jetty/spdy/server/AbstractTest.java3
-rw-r--r--jetty-spdy/spdy-server/src/test/java/org/eclipse/jetty/spdy/server/IdleTimeoutTest.java6
-rw-r--r--jetty-spdy/spdy-server/src/test/java/org/eclipse/jetty/spdy/server/SettingsTest.java2
10 files changed, 29 insertions, 31 deletions
diff --git a/jetty-spdy/spdy-client/src/main/java/org/eclipse/jetty/spdy/client/SPDYClient.java b/jetty-spdy/spdy-client/src/main/java/org/eclipse/jetty/spdy/client/SPDYClient.java
index 364db9c..9b062d8 100644
--- a/jetty-spdy/spdy-client/src/main/java/org/eclipse/jetty/spdy/client/SPDYClient.java
+++ b/jetty-spdy/spdy-client/src/main/java/org/eclipse/jetty/spdy/client/SPDYClient.java
@@ -27,8 +27,8 @@ import java.util.Collections;
import java.util.List;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
-import java.util.concurrent.Future;
import javax.net.ssl.SSLEngine;
import org.eclipse.jetty.io.ByteBufferPool;
@@ -112,13 +112,13 @@ public class SPDYClient
*
* @param address the address to connect to
* @param listener the session listener that will be notified of session events
- * @return a {@link Future} that provides a {@link Session} when connected
+ * @return a {@link Session} when connected
*/
- public Future<Session> connect(SocketAddress address, SessionFrameListener listener)
+ public Session connect(SocketAddress address, SessionFrameListener listener) throws ExecutionException, InterruptedException
{
FuturePromise<Session> promise = new FuturePromise<>();
connect(address, listener, promise);
- return promise;
+ return promise.get();
}
/**
diff --git a/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/SPDYProxyEngine.java b/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/SPDYProxyEngine.java
index 5fe7909..51a8d31 100644
--- a/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/SPDYProxyEngine.java
+++ b/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/SPDYProxyEngine.java
@@ -178,7 +178,7 @@ public class SPDYProxyEngine extends ProxyEngine implements StreamFrameListener
if (session == null)
{
SPDYClient client = factory.newSPDYClient(version);
- session = client.connect(address, sessionListener).get(getConnectTimeout(), TimeUnit.MILLISECONDS);
+ session = client.connect(address, sessionListener);
LOG.debug("Proxy session connected to {}", address);
Session existing = serverSessions.putIfAbsent(host, session);
if (existing != null)
diff --git a/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/http/AbstractHTTPSPDYTest.java b/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/http/AbstractHTTPSPDYTest.java
index fab4631..66b140a 100644
--- a/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/http/AbstractHTTPSPDYTest.java
+++ b/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/http/AbstractHTTPSPDYTest.java
@@ -22,7 +22,6 @@ import java.net.InetSocketAddress;
import java.util.Arrays;
import java.util.Collection;
import java.util.concurrent.Executor;
-import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.HttpConfiguration;
@@ -122,7 +121,7 @@ public abstract class AbstractHTTPSPDYTest
clientFactory = newSPDYClientFactory(threadPool);
clientFactory.start();
}
- return clientFactory.newSPDYClient(version).connect(socketAddress, listener).get(5, TimeUnit.SECONDS);
+ return clientFactory.newSPDYClient(version).connect(socketAddress, listener);
}
protected SPDYClient.Factory newSPDYClientFactory(Executor threadPool)
diff --git a/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToHTTPLoadTest.java b/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToHTTPLoadTest.java
index 6c2e210..080f9ae 100644
--- a/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToHTTPLoadTest.java
+++ b/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToHTTPLoadTest.java
@@ -231,7 +231,7 @@ public class ProxySPDYToHTTPLoadTest
{
try
{
- Session client = factory.newSPDYClient(version).connect(proxyAddress, null).get(15, TimeUnit.SECONDS);
+ Session client = factory.newSPDYClient(version).connect(proxyAddress, null);
for (int i = 0; i < requestsPerClient; i++)
{
sendSingleClientRequest(proxyAddress, client, serverIdentificationString, serverHost);
diff --git a/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToHTTPTest.java b/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToHTTPTest.java
index 556c148..f6eeffb 100644
--- a/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToHTTPTest.java
+++ b/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToHTTPTest.java
@@ -169,7 +169,7 @@ public class ProxySPDYToHTTPTest
InetSocketAddress proxyAddress = startProxy(startServer(new TestServerHandler(header, null)), 30000, 30000);
- Session client = factory.newSPDYClient(version).connect(proxyAddress, null).get(5, TimeUnit.SECONDS);
+ Session client = factory.newSPDYClient(version).connect(proxyAddress, null);
final CountDownLatch replyLatch = new CountDownLatch(1);
@@ -202,7 +202,7 @@ public class ProxySPDYToHTTPTest
InetSocketAddress proxyAddress = startProxy(startServer(new TestServerHandler(header, data)), 30000, 30000);
- Session client = factory.newSPDYClient(version).connect(proxyAddress, null).get(5, TimeUnit.SECONDS);
+ Session client = factory.newSPDYClient(version).connect(proxyAddress, null);
final CountDownLatch replyLatch = new CountDownLatch(1);
final CountDownLatch dataLatch = new CountDownLatch(1);
@@ -275,7 +275,7 @@ public class ProxySPDYToHTTPTest
{
resetLatch.countDown();
}
- }).get(5, TimeUnit.SECONDS);
+ });
Fields headers = SPDYTestUtils.createHeaders("localhost", proxyAddress.getPort(), version, "GET", "/");
headers.put("connection", "close");
@@ -309,7 +309,7 @@ public class ProxySPDYToHTTPTest
final CountDownLatch replyLatch = new CountDownLatch(1);
- Session client = factory.newSPDYClient(version).connect(proxyAddress, null).get(5, TimeUnit.SECONDS);
+ Session client = factory.newSPDYClient(version).connect(proxyAddress, null);
Fields headers = SPDYTestUtils.createHeaders("localhost", proxyAddress.getPort(), version, "GET", "/");
client.syn(new SynInfo(headers, true), new StreamFrameListener.Adapter()
@@ -335,7 +335,7 @@ public class ProxySPDYToHTTPTest
InetSocketAddress proxyAddress = startProxy(startServer(new TestServerHandler(header, null)), 30000, 30000);
- Session client = factory.newSPDYClient(version).connect(proxyAddress, null).get(5, TimeUnit.SECONDS);
+ Session client = factory.newSPDYClient(version).connect(proxyAddress, null);
final CountDownLatch replyLatch = new CountDownLatch(1);
final CountDownLatch dataLatch = new CountDownLatch(1);
@@ -383,7 +383,7 @@ public class ProxySPDYToHTTPTest
InetSocketAddress proxyAddress = startProxy(startServer(new TestServerHandler(header, null)), 30000, 30000);
- Session client = factory.newSPDYClient(version).connect(proxyAddress, null).get(5, TimeUnit.SECONDS);
+ Session client = factory.newSPDYClient(version).connect(proxyAddress, null);
final CountDownLatch replyLatch = new CountDownLatch(1);
final CountDownLatch dataLatch = new CountDownLatch(1);
@@ -439,7 +439,7 @@ public class ProxySPDYToHTTPTest
{
goAwayLatch.countDown();
}
- }).get(5, TimeUnit.SECONDS);
+ });
Fields headers = SPDYTestUtils.createHeaders("localhost", proxyAddress.getPort(), version, "POST", "/");
((StdErrLog)Log.getLogger(HttpChannel.class)).setHideStacks(true);
@@ -470,7 +470,7 @@ public class ProxySPDYToHTTPTest
}
}), 30000, timeout);
- Session client = factory.newSPDYClient(version).connect(proxyAddress, null).get(5, TimeUnit.SECONDS);
+ Session client = factory.newSPDYClient(version).connect(proxyAddress, null);
final CountDownLatch replyLatch = new CountDownLatch(1);
@@ -510,7 +510,7 @@ public class ProxySPDYToHTTPTest
{
pingLatch.countDown();
}
- }).get(5, TimeUnit.SECONDS);
+ });
client.ping(new PingInfo(5, TimeUnit.SECONDS));
diff --git a/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToSPDYLoadTest.java b/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToSPDYLoadTest.java
index 4992c7a..9ec5cc5 100644
--- a/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToSPDYLoadTest.java
+++ b/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToSPDYLoadTest.java
@@ -202,7 +202,7 @@ public class ProxySPDYToSPDYLoadTest
{
try
{
- Session client = factory.newSPDYClient(version).connect(proxyAddress, null).get(5, TimeUnit.SECONDS);
+ Session client = factory.newSPDYClient(version).connect(proxyAddress, null);
for (int i = 0; i < requestsPerClient; i++)
{
sendSingleClientRequest(proxyAddress, client, serverIdentificationString, serverHost);
diff --git a/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToSPDYTest.java b/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToSPDYTest.java
index 064f556..f2266e7 100644
--- a/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToSPDYTest.java
+++ b/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToSPDYTest.java
@@ -169,7 +169,7 @@ public class ProxySPDYToSPDYTest
}));
proxyConnector.addConnectionFactory(proxyConnector.getConnectionFactory("spdy/" + version));
- Session client = factory.newSPDYClient(version).connect(proxyAddress, null).get(5, TimeUnit.SECONDS);
+ Session client = factory.newSPDYClient(version).connect(proxyAddress, null);
final CountDownLatch replyLatch = new CountDownLatch(1);
Fields headers = SPDYTestUtils.createHeaders("localhost", proxyAddress.getPort(), version, "GET", "/");
@@ -215,7 +215,7 @@ public class ProxySPDYToSPDYTest
{
resetLatch.countDown();
}
- }).get(5, TimeUnit.SECONDS);
+ });
Fields headers = SPDYTestUtils.createHeaders("localhost", proxyAddress.getPort(), version, "GET", "/");
headers.put(header, "bar");
@@ -247,7 +247,7 @@ public class ProxySPDYToSPDYTest
}));
proxyConnector.addConnectionFactory(proxyConnector.getConnectionFactory("spdy/" + version));
- Session client = factory.newSPDYClient(version).connect(proxyAddress, null).get(5, TimeUnit.SECONDS);
+ Session client = factory.newSPDYClient(version).connect(proxyAddress, null);
final CountDownLatch replyLatch = new CountDownLatch(1);
final CountDownLatch dataLatch = new CountDownLatch(1);
@@ -318,7 +318,7 @@ public class ProxySPDYToSPDYTest
final CountDownLatch pushSynLatch = new CountDownLatch(1);
final CountDownLatch pushDataLatch = new CountDownLatch(1);
- Session client = factory.newSPDYClient(version).connect(proxyAddress, null).get(5, TimeUnit.SECONDS);
+ Session client = factory.newSPDYClient(version).connect(proxyAddress, null);
Fields headers = new Fields();
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + proxyAddress.getPort());
@@ -417,7 +417,7 @@ public class ProxySPDYToSPDYTest
final CountDownLatch pushSynLatch = new CountDownLatch(3);
final CountDownLatch pushDataLatch = new CountDownLatch(3);
- Session client = factory.newSPDYClient(version).connect(proxyAddress, null).get(5, TimeUnit.SECONDS);
+ Session client = factory.newSPDYClient(version).connect(proxyAddress, null);
Fields headers = new Fields();
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + proxyAddress.getPort());
@@ -516,7 +516,7 @@ public class ProxySPDYToSPDYTest
{
pingLatch.countDown();
}
- }).get(5, TimeUnit.SECONDS);
+ });
client.ping(new PingInfo(5, TimeUnit.SECONDS));
@@ -552,7 +552,7 @@ public class ProxySPDYToSPDYTest
{
resetLatch.countDown();
}
- }).get(5, TimeUnit.SECONDS);
+ });
Fields headers = new Fields();
headers.put(HTTPSPDYHeader.HOST.name(version), "localhost:" + proxyAddress.getPort());
diff --git a/jetty-spdy/spdy-server/src/test/java/org/eclipse/jetty/spdy/server/AbstractTest.java b/jetty-spdy/spdy-server/src/test/java/org/eclipse/jetty/spdy/server/AbstractTest.java
index cdbe2ba..829ceb9 100644
--- a/jetty-spdy/spdy-server/src/test/java/org/eclipse/jetty/spdy/server/AbstractTest.java
+++ b/jetty-spdy/spdy-server/src/test/java/org/eclipse/jetty/spdy/server/AbstractTest.java
@@ -21,7 +21,6 @@ package org.eclipse.jetty.spdy.server;
import java.net.InetSocketAddress;
import java.util.concurrent.Executor;
-import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.server.ConnectionFactory;
import org.eclipse.jetty.server.Server;
@@ -114,7 +113,7 @@ public abstract class AbstractTest
clientFactory.start();
}
- return clientFactory.newSPDYClient(version).connect(socketAddress, listener).get(5, TimeUnit.SECONDS);
+ return clientFactory.newSPDYClient(version).connect(socketAddress, listener);
}
protected SPDYClient.Factory newSPDYClientFactory(Executor threadPool)
diff --git a/jetty-spdy/spdy-server/src/test/java/org/eclipse/jetty/spdy/server/IdleTimeoutTest.java b/jetty-spdy/spdy-server/src/test/java/org/eclipse/jetty/spdy/server/IdleTimeoutTest.java
index 708e6dc..0291fd3 100644
--- a/jetty-spdy/spdy-server/src/test/java/org/eclipse/jetty/spdy/server/IdleTimeoutTest.java
+++ b/jetty-spdy/spdy-server/src/test/java/org/eclipse/jetty/spdy/server/IdleTimeoutTest.java
@@ -173,7 +173,7 @@ public class IdleTimeoutTest extends AbstractTest
clientFactory.start();
SPDYClient client = clientFactory.newSPDYClient(SPDY.V2);
client.setIdleTimeout(idleTimeout);
- Session session = client.connect(address, null).get(5, TimeUnit.SECONDS);
+ Session session = client.connect(address, null);
session.syn(new SynInfo(new Fields(), true), null);
@@ -199,7 +199,7 @@ public class IdleTimeoutTest extends AbstractTest
clientFactory.start();
SPDYClient client = clientFactory.newSPDYClient(SPDY.V2);
client.setIdleTimeout(idleTimeout);
- Session session = client.connect(address, null).get(5, TimeUnit.SECONDS);
+ Session session = client.connect(address, null);
session.syn(new SynInfo(new Fields(), true), null);
@@ -232,7 +232,7 @@ public class IdleTimeoutTest extends AbstractTest
clientFactory.start();
SPDYClient client = clientFactory.newSPDYClient(SPDY.V2);
client.setIdleTimeout(idleTimeout);
- Session session = client.connect(address, null).get(5, TimeUnit.SECONDS);
+ Session session = client.connect(address, null);
final CountDownLatch replyLatch = new CountDownLatch(1);
session.syn(new SynInfo(new Fields(), true), new StreamFrameListener.Adapter()
diff --git a/jetty-spdy/spdy-server/src/test/java/org/eclipse/jetty/spdy/server/SettingsTest.java b/jetty-spdy/spdy-server/src/test/java/org/eclipse/jetty/spdy/server/SettingsTest.java
index 3f7963b..692109a 100644
--- a/jetty-spdy/spdy-server/src/test/java/org/eclipse/jetty/spdy/server/SettingsTest.java
+++ b/jetty-spdy/spdy-server/src/test/java/org/eclipse/jetty/spdy/server/SettingsTest.java
@@ -159,7 +159,7 @@ public class SettingsTest extends AbstractTest
Session sessionV2 = startClient(address, null);
sessionV2.settings(settingsInfo);
- Session sessionV3 = clientFactory.newSPDYClient(SPDY.V3).connect(address, null).get(5, TimeUnit.SECONDS);
+ Session sessionV3 = clientFactory.newSPDYClient(SPDY.V3).connect(address, null);
sessionV3.settings(settingsInfo);
Assert.assertTrue(settingsLatch.await(5, TimeUnit.SECONDS));