summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-05-26 05:34:33 (EDT)
committerEike Stepper2008-05-26 05:34:33 (EDT)
commitc83c69b216397ccf75fe4f2b1d7831657b805d00 (patch)
tree1098b38605671db2ffe186db08c2878baa4ce72f
parentc1aab93f030fd781801c4452f6a24ac97fcc84a7 (diff)
downloadcdo-c83c69b216397ccf75fe4f2b1d7831657b805d00.zip
cdo-c83c69b216397ccf75fe4f2b1d7831657b805d00.tar.gz
cdo-c83c69b216397ccf75fe4f2b1d7831657b805d00.tar.bz2
[232648] Provide an HTTPConnector
https://bugs.eclipse.org/bugs/show_bug.cgi?id=232648
-rw-r--r--plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPClientConnector.java12
-rw-r--r--plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPConnector.java16
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 d984226..39ef49d 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 d26b776..7d208b9 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();
}
}