diff options
author | Eike Stepper | 2008-05-26 09:34:33 +0000 |
---|---|---|
committer | Eike Stepper | 2008-05-26 09:34:33 +0000 |
commit | c83c69b216397ccf75fe4f2b1d7831657b805d00 (patch) | |
tree | 1098b38605671db2ffe186db08c2878baa4ce72f /plugins/org.eclipse.net4j.http/src | |
parent | c1aab93f030fd781801c4452f6a24ac97fcc84a7 (diff) | |
download | cdo-c83c69b216397ccf75fe4f2b1d7831657b805d00.tar.gz cdo-c83c69b216397ccf75fe4f2b1d7831657b805d00.tar.xz cdo-c83c69b216397ccf75fe4f2b1d7831657b805d00.zip |
[232648] Provide an HTTPConnector
https://bugs.eclipse.org/bugs/show_bug.cgi?id=232648
Diffstat (limited to 'plugins/org.eclipse.net4j.http/src')
2 files changed, 16 insertions, 12 deletions
diff --git a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPClientConnector.java b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPClientConnector.java index d9842262bc..39ef49d799 100644 --- a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPClientConnector.java +++ b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPClientConnector.java @@ -58,7 +58,7 @@ public class HTTPClientConnector extends HTTPConnector protected void work(WorkContext context) throws Exception { boolean moreBuffers = tryBuffersRequest(); - context.nextWork(moreBuffers ? 0 : 100); + context.nextWork(moreBuffers ? 0 : 1000); } }; @@ -233,12 +233,12 @@ public class HTTPClientConnector extends HTTPConnector return false; } - requesting = true; - } + if (getOutputQueue().isEmpty() && System.currentTimeMillis() - lastRequest < pollInterval) + { + return false; + } - if (getOutputQueue().isEmpty() || System.currentTimeMillis() - lastRequest < pollInterval) - { - return false; + requesting = true; } try diff --git a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPConnector.java b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPConnector.java index d26b776195..7d208b978f 100644 --- a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPConnector.java +++ b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPConnector.java @@ -33,8 +33,6 @@ import java.util.concurrent.ConcurrentLinkedQueue; */ public abstract class HTTPConnector extends Connector implements IHTTPConnector { - public static final short NO_MORE_BUFFERS = -1; - private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, HTTPConnector.class); private String connectorID; @@ -111,6 +109,7 @@ public abstract class HTTPConnector extends Connector implements IHTTPConnector break; } + out.writeBoolean(true); IBuffer buffer = queuedBuffer.getBuffer(); short channelIndex = buffer.getChannelIndex(); out.writeShort(channelIndex); @@ -135,15 +134,21 @@ public abstract class HTTPConnector extends Connector implements IHTTPConnector markLastTraffic(); } while (writeMoreBuffers()); - out.writeShort(NO_MORE_BUFFERS); + out.writeBoolean(false); return !outputQueue.isEmpty(); } public void readInputBuffers(ExtendedDataInputStream in) throws IOException { - short channelIndex = in.readShort(); - while (channelIndex != NO_MORE_BUFFERS) + for (;;) { + boolean moreBuffers = in.readBoolean(); + if (!moreBuffers) + { + break; + } + + short channelIndex = in.readShort(); HTTPChannel channel = (HTTPChannel)getChannel(channelIndex); if (channel == null) { @@ -166,7 +171,6 @@ public abstract class HTTPConnector extends Connector implements IHTTPConnector System.out.println("READ BUFFER"); handleInputBuffer(channel, bufferCount, buffer); markLastTraffic(); - channelIndex = in.readShort(); } } |