diff options
author | Thomas Becker | 2012-07-31 11:51:19 +0000 |
---|---|---|
committer | Thomas Becker | 2012-07-31 11:51:19 +0000 |
commit | 377065fae7d4977899ea9c922c20e45c8bab3769 (patch) | |
tree | 362a0de98f99dcc3e4bef1314ef941e894821ba1 | |
parent | 01529ba12894b476f13dbe02598ff660976caa9c (diff) | |
download | org.eclipse.jetty.project-377065fae7d4977899ea9c922c20e45c8bab3769.tar.gz org.eclipse.jetty.project-377065fae7d4977899ea9c922c20e45c8bab3769.tar.xz org.eclipse.jetty.project-377065fae7d4977899ea9c922c20e45c8bab3769.zip |
interims changes
-rw-r--r-- | jetty-io/pom.xml | 10 | ||||
-rw-r--r-- | jetty-io/src/main/java/org/eclipse/jetty/io/WriteFlusher.java | 47 | ||||
-rw-r--r-- | jetty-io/src/main/java/org/eclipse/jetty/io/WriteFlusherTest.java | 18 |
3 files changed, 75 insertions, 0 deletions
diff --git a/jetty-io/pom.xml b/jetty-io/pom.xml index fb0997f6e0..76dde2062b 100644 --- a/jetty-io/pom.xml +++ b/jetty-io/pom.xml @@ -21,6 +21,16 @@ <artifactId>jetty-test-helper</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> </dependencies> <build> <plugins> diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/WriteFlusher.java b/jetty-io/src/main/java/org/eclipse/jetty/io/WriteFlusher.java index 30f7275f1d..868846ce64 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/WriteFlusher.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/WriteFlusher.java @@ -36,6 +36,53 @@ abstract public class WriteFlusher _endp=endp; } + private enum State + { + IDLE, + WRITING, + CLOSED + } + + private abstract class WriteFlusherState + { + private State _state; + private ByteBuffer[] _buffers; + private Object _context; + private Callback<Object> _callback; + + private WriteFlusherState(State state, ByteBuffer[] buffers, Object context, Callback<Object> callback) + { + _state = state; + _buffers = buffers; + _context = context; + _callback = callback; + } + } + + private class WriteFlusherIdleState extends WriteFlusherState + { + private WriteFlusherIdleState() + { + super(null,null,null,null); + } + } + + private class WriteFlusherWritingState extends WriteFlusherState + { + private WriteFlusherWritingState(State state, ByteBuffer[] buffers, Object context, Callback<Object> callback) + { + super(state, buffers, context, callback); + } + } + + private class WriteFlusherClosingState extends WriteFlusherState + { + private WriteFlusherClosingState() + { + super(null,null,null,null); + } + } + /* ------------------------------------------------------------ */ public synchronized <C> void write(C context, Callback<C> callback, ByteBuffer... buffers) { diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/WriteFlusherTest.java b/jetty-io/src/main/java/org/eclipse/jetty/io/WriteFlusherTest.java new file mode 100644 index 0000000000..e49693d700 --- /dev/null +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/WriteFlusherTest.java @@ -0,0 +1,18 @@ +//======================================================================== +//Copyright 2012 Mort Bay Consulting Pty. Ltd. +//------------------------------------------------------------------------ +//All rights reserved. This program and the accompanying materials +//are made available under the terms of the Eclipse Public License v1.0 +//and Apache License v2.0 which accompanies this distribution. +//The Eclipse Public License is available at +//http://www.eclipse.org/legal/epl-v10.html +//The Apache License v2.0 is available at +//http://www.opensource.org/licenses/apache2.0.php +//You may elect to redistribute this code under either of these licenses. +//======================================================================== +package org.eclipse.jetty.io; + +@RunWith(Mockit) +public class WriteFlusherTest +{ +} |