Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimone Bordet2014-02-17 15:57:50 +0000
committerSimone Bordet2014-02-18 17:31:48 +0000
commit8e5c06b95ca000b915755362b7224168e48d0893 (patch)
tree6ed5837e7abb3851171b4fb407457f1159a68f67 /jetty-websocket/websocket-api/src
parentf092561a8aba2b3d60c45878afa9fd35acd0785b (diff)
downloadorg.eclipse.jetty.project-8e5c06b95ca000b915755362b7224168e48d0893.tar.gz
org.eclipse.jetty.project-8e5c06b95ca000b915755362b7224168e48d0893.tar.xz
org.eclipse.jetty.project-8e5c06b95ca000b915755362b7224168e48d0893.zip
428232 - Rework batch mode / buffering in websocket.
Refactored OutgoingFrames.outgoingFrame() to take an additional parameter, FlushMode. This is in preparation for handling this new parameter in FrameFlusher.
Diffstat (limited to 'jetty-websocket/websocket-api/src')
-rw-r--r--jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/Session.java5
-rw-r--r--jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/OutgoingFrames.java44
2 files changed, 37 insertions, 12 deletions
diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/Session.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/Session.java
index b4ccd28123..be7e03f148 100644
--- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/Session.java
+++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/Session.java
@@ -175,4 +175,9 @@ public interface Session extends Closeable
* @return the suspend token suitable for resuming the reading of data on the connection.
*/
SuspendToken suspend();
+
+ /**
+ * @return true if this session is batching network data, false if it flushes it immediately.
+ */
+ boolean isBatching();
}
diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/OutgoingFrames.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/OutgoingFrames.java
index d0f1fe869b..6cf9c70150 100644
--- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/OutgoingFrames.java
+++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/extensions/OutgoingFrames.java
@@ -21,21 +21,41 @@ package org.eclipse.jetty.websocket.api.extensions;
import org.eclipse.jetty.websocket.api.WriteCallback;
/**
- * Interface for dealing with frames outgoing to the network (eventually)
+ * Interface for dealing with frames outgoing to (eventually) the network layer.
*/
public interface OutgoingFrames
{
/**
- * A frame, and optional callback, intended for the network.
- * <p>
- * Note: the frame can undergo many transformations in the various layers and extensions present in the implementation.
- * <p>
- * If you are implementing a mutation, you are obliged to handle the incoming WriteCallback appropriately.
- *
- * @param frame
- * the frame to eventually write to the network.
- * @param callback
- * the optional callback to use for success/failure of the network write operation. Can be null.
+ * A frame, and optional callback, intended for the network layer.
+ * <p/>
+ * Note: the frame can undergo many transformations in the various
+ * layers and extensions present in the implementation.
+ * <p/>
+ * If you are implementing a mutation, you are obliged to handle
+ * the incoming WriteCallback appropriately.
+ *
+ * @param frame the frame to eventually write to the network layer.
+ * @param callback the callback to notify when the frame is written.
+ * @param flushMode the flush mode required by the sender.
*/
- void outgoingFrame(Frame frame, WriteCallback callback);
+ void outgoingFrame(Frame frame, WriteCallback callback, FlushMode flushMode);
+
+ /**
+ * The possible flush modes when invoking {@link #outgoingFrame(Frame, org.eclipse.jetty.websocket.api.WriteCallback, org.eclipse.jetty.websocket.api.extensions.OutgoingFrames.FlushMode)}.
+ */
+ public enum FlushMode
+ {
+ /**
+ * Implementers of {@link #outgoingFrame(Frame, org.eclipse.jetty.websocket.api.WriteCallback, org.eclipse.jetty.websocket.api.extensions.OutgoingFrames.FlushMode)}
+ * are free to decide whether to flush or not the given frame
+ * to the network layer.
+ */
+ AUTO,
+
+ /**
+ * Implementers of {@link #outgoingFrame(Frame, org.eclipse.jetty.websocket.api.WriteCallback, org.eclipse.jetty.websocket.api.extensions.OutgoingFrames.FlushMode)}
+ * must flush the given frame to the network layer.
+ */
+ FLUSH
+ }
}

Back to the top