Return-Path:
Delivered-To: apmail-directory-commits-archive@www.apache.org
Received: (qmail 29401 invoked from network); 5 Nov 2006 19:37:12 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2)
by minotaur.apache.org with SMTP; 5 Nov 2006 19:37:12 -0000
Received: (qmail 14080 invoked by uid 500); 5 Nov 2006 19:37:24 -0000
Delivered-To: apmail-directory-commits-archive@directory.apache.org
Received: (qmail 14045 invoked by uid 500); 5 Nov 2006 19:37:24 -0000
Mailing-List: contact commits-help@directory.apache.org; run by ezmlm
Precedence: bulk
List-Help:
List-Unsubscribe:
List-Post:
List-Id:
Reply-To: dev@directory.apache.org
Delivered-To: mailing list commits@directory.apache.org
Received: (qmail 14034 invoked by uid 99); 5 Nov 2006 19:37:23 -0000
Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133)
by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Nov 2006 11:37:23 -0800
X-ASF-Spam-Status: No, hits=-9.4 required=10.0
tests=ALL_TRUSTED,NO_REAL_NAME
X-Spam-Check-By: apache.org
Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3)
by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Nov 2006 11:37:10 -0800
Received: by eris.apache.org (Postfix, from userid 65534)
id 1A7DE1A9846; Sun, 5 Nov 2006 11:36:44 -0800 (PST)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r471502 [1/2] - in /directory/branches/mina/1.2:
core/src/main/java/org/apache/mina/common/
core/src/main/java/org/apache/mina/common/support/
core/src/main/java/org/apache/mina/filter/
core/src/main/java/org/apache/mina/filter/codec/ core/...
Date: Sun, 05 Nov 2006 19:36:43 -0000
To: commits@directory.apache.org
From: proyal@apache.org
X-Mailer: svnmailer-1.1.0
Message-Id: <20061105193644.1A7DE1A9846@eris.apache.org>
X-Virus-Checked: Checked by ClamAV on apache.org
Author: proyal
Date: Sun Nov 5 11:36:41 2006
New Revision: 471502
URL: http://svn.apache.org/viewvc?view=rev&rev=471502
Log:
Remove mina's Queue, use java.util.Queue. Replace synchronization with a concurrent implementation.
Removed:
directory/branches/mina/1.2/core/src/main/java/org/apache/mina/util/BlockingQueue.java
directory/branches/mina/1.2/core/src/main/java/org/apache/mina/util/Queue.java
directory/branches/mina/1.2/core/src/test/java/org/apache/mina/util/QueueTest.java
Modified:
directory/branches/mina/1.2/core/src/main/java/org/apache/mina/common/IoServiceConfig.java
directory/branches/mina/1.2/core/src/main/java/org/apache/mina/common/support/BaseIoServiceConfig.java
directory/branches/mina/1.2/core/src/main/java/org/apache/mina/filter/StreamWriteFilter.java
directory/branches/mina/1.2/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
directory/branches/mina/1.2/core/src/main/java/org/apache/mina/filter/codec/support/SimpleProtocolDecoderOutput.java
directory/branches/mina/1.2/core/src/main/java/org/apache/mina/filter/codec/support/SimpleProtocolEncoderOutput.java
directory/branches/mina/1.2/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
directory/branches/mina/1.2/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java
directory/branches/mina/1.2/core/src/main/java/org/apache/mina/transport/socket/nio/SocketFilterChain.java
directory/branches/mina/1.2/core/src/main/java/org/apache/mina/transport/socket/nio/SocketIoProcessor.java
directory/branches/mina/1.2/core/src/main/java/org/apache/mina/transport/socket/nio/SocketSessionImpl.java
directory/branches/mina/1.2/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java
directory/branches/mina/1.2/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnectorDelegate.java
directory/branches/mina/1.2/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramFilterChain.java
directory/branches/mina/1.2/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java
directory/branches/mina/1.2/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeFilterChain.java
directory/branches/mina/1.2/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeSessionImpl.java
directory/branches/mina/1.2/core/src/main/java/org/apache/mina/util/ExpiringMap.java
directory/branches/mina/1.2/core/src/test/java/org/apache/mina/filter/StreamWriteFilterTest.java
directory/branches/mina/1.2/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineDecoderTest.java
directory/branches/mina/1.2/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineEncoderTest.java
directory/branches/mina/1.2/example/src/main/java/org/apache/mina/example/httpserver/codec/HttpRequestDecoder.java
directory/branches/mina/1.2/filter-ssl/src/main/java/org/apache/mina/filter/support/SSLHandler.java
Modified: directory/branches/mina/1.2/core/src/main/java/org/apache/mina/common/IoServiceConfig.java
URL: http://svn.apache.org/viewvc/directory/branches/mina/1.2/core/src/main/java/org/apache/mina/common/IoServiceConfig.java?view=diff&rev=471502&r1=471501&r2=471502
==============================================================================
--- directory/branches/mina/1.2/core/src/main/java/org/apache/mina/common/IoServiceConfig.java (original)
+++ directory/branches/mina/1.2/core/src/main/java/org/apache/mina/common/IoServiceConfig.java Sun Nov 5 11:36:41 2006
@@ -6,32 +6,32 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
- *
+ * under the License.
+ *
*/
package org.apache.mina.common;
/**
* A configuration which is used to configure {@link IoService}.
- *
+ *
* @author The Apache Directory Project (mina-dev@directory.apache.org)
* @version $Rev$, $Date$
*/
-public interface IoServiceConfig
+public interface IoServiceConfig extends Cloneable
{
/**
* Resturns the default configuration of the new {@link IoSession}s.
*/
IoSessionConfig getSessionConfig();
-
+
/**
* Returns the {@link IoFilterChainBuilder} which will modify the
* {@link IoFilterChain} of all {@link IoSession}s which is created
@@ -39,7 +39,7 @@
* The default value is an empty {@link DefaultIoFilterChainBuilder}.
*/
IoFilterChainBuilder getFilterChainBuilder();
-
+
/**
* Sets the {@link IoFilterChainBuilder} which will modify the
* {@link IoFilterChain} of all {@link IoSession}s which is created
@@ -48,7 +48,7 @@
* an empty {@link DefaultIoFilterChainBuilder}.
*/
void setFilterChainBuilder( IoFilterChainBuilder builder );
-
+
/**
* A shortcut for ( ( DefaultIoFilterChainBuilder ) {@link #getFilterChainBuilder()} ).
* Please note that the returned object is not a real {@link IoFilterChain}
@@ -60,7 +60,7 @@
* not a {@link DefaultIoFilterChainBuilder}
*/
DefaultIoFilterChainBuilder getFilterChain();
-
+
/**
* Returns the default {@link ThreadModel} of the {@link IoService}.
* The default value is a {@link ExecutorThreadModel}() whose service name is
@@ -69,7 +69,7 @@
* {@link ExecutorThreadModel#getInstance(String)}.
*/
ThreadModel getThreadModel();
-
+
/**
* Sets the default {@link ThreadModel} of the {@link IoService}.
* If you specify null, this property will be set to the
@@ -80,9 +80,10 @@
* {@link ExecutorThreadModel#getInstance(String)}.
*/
void setThreadModel( ThreadModel threadModel );
-
+
/**
* Returns a deep clone of this configuration.
*/
+ @SuppressWarnings({"CloneDoesntDeclareCloneNotSupportedException", "override"})
Object clone();
}
Modified: directory/branches/mina/1.2/core/src/main/java/org/apache/mina/common/support/BaseIoServiceConfig.java
URL: http://svn.apache.org/viewvc/directory/branches/mina/1.2/core/src/main/java/org/apache/mina/common/support/BaseIoServiceConfig.java?view=diff&rev=471502&r1=471501&r2=471502
==============================================================================
--- directory/branches/mina/1.2/core/src/main/java/org/apache/mina/common/support/BaseIoServiceConfig.java (original)
+++ directory/branches/mina/1.2/core/src/main/java/org/apache/mina/common/support/BaseIoServiceConfig.java Sun Nov 5 11:36:41 2006
@@ -6,16 +6,16 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
- *
+ * under the License.
+ *
*/
package org.apache.mina.common.support;
@@ -29,7 +29,7 @@
/**
* A base implementation of {@link IoServiceConfig}.
- *
+ *
* @author The Apache Directory Project (mina-dev@directory.apache.org)
* @version $Rev$, $Date$
*/
@@ -39,17 +39,17 @@
* Current filter chain builder.
*/
private IoFilterChainBuilder filterChainBuilder = new DefaultIoFilterChainBuilder();
-
+
/**
* The default thread model.
*/
private final ThreadModel defaultThreadModel = ExecutorThreadModel.getInstance("AnonymousIoService");
-
+
/**
* Current thread model.
*/
private ThreadModel threadModel = defaultThreadModel;
-
+
public BaseIoServiceConfig()
{
super();
@@ -68,7 +68,7 @@
}
filterChainBuilder = builder;
}
-
+
public DefaultIoFilterChainBuilder getFilterChain()
{
if( filterChainBuilder instanceof DefaultIoFilterChainBuilder )
@@ -81,7 +81,7 @@
"Current filter chain builder is not a DefaultIoFilterChainBuilder." );
}
}
-
+
public ThreadModel getThreadModel()
{
return threadModel;
@@ -97,7 +97,9 @@
}
this.threadModel = threadModel;
}
-
+
+ @SuppressWarnings({"CloneDoesntDeclareCloneNotSupportedException"})
+ @Override
public Object clone()
{
BaseIoServiceConfig ret;
@@ -109,20 +111,21 @@
{
throw ( InternalError ) new InternalError().initCause( e );
}
-
+
// Try to clone the chain builder.
try
{
- Method cloneMethod = this.filterChainBuilder.getClass().getMethod( "clone", null );
+ Method cloneMethod = this.filterChainBuilder.getClass().getMethod( "clone" );
if( cloneMethod.isAccessible() )
{
- ret.filterChainBuilder = ( IoFilterChainBuilder ) cloneMethod.invoke( this.filterChainBuilder, null );
+ ret.filterChainBuilder = ( IoFilterChainBuilder ) cloneMethod.invoke( this.filterChainBuilder );
}
}
catch( Exception e )
{
+ // uncloneable
}
-
+
return ret;
}
}
Modified: directory/branches/mina/1.2/core/src/main/java/org/apache/mina/filter/StreamWriteFilter.java
URL: http://svn.apache.org/viewvc/directory/branches/mina/1.2/core/src/main/java/org/apache/mina/filter/StreamWriteFilter.java?view=diff&rev=471502&r1=471501&r2=471502
==============================================================================
--- directory/branches/mina/1.2/core/src/main/java/org/apache/mina/filter/StreamWriteFilter.java (original)
+++ directory/branches/mina/1.2/core/src/main/java/org/apache/mina/filter/StreamWriteFilter.java Sun Nov 5 11:36:41 2006
@@ -6,50 +6,51 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
- *
+ * under the License.
+ *
*/
package org.apache.mina.filter;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
import org.apache.mina.common.ByteBuffer;
import org.apache.mina.common.IoFilterAdapter;
import org.apache.mina.common.IoSession;
import org.apache.mina.common.WriteFuture;
-import org.apache.mina.util.Queue;
/**
* Filter implementation which makes it possible to write {@link InputStream}
- * objects directly using {@link IoSession#write(Object)}. When an
+ * objects directly using {@link IoSession#write(Object)}. When an
* {@link InputStream} is written to a session this filter will read the bytes
* from the stream into {@link ByteBuffer} objects and write those buffers
* to the next filter. When end of stream has been reached this filter will
* call {@link NextFilter#messageSent(IoSession, Object)} using the original
- * {@link InputStream} written to the session and notifies
- * {@link org.apache.mina.common.WriteFuture} on the
+ * {@link InputStream} written to the session and notifies
+ * {@link org.apache.mina.common.WriteFuture} on the
* original {@link org.apache.mina.common.IoFilter.WriteRequest}.
- *
+ *
* This filter will ignore written messages which aren't {@link InputStream}
* instances. Such messages will be passed to the next filter directly.
*
- *
+ *
* NOTE: this filter does not close the stream after all data from stream
* has been written. The {@link org.apache.mina.common.IoHandler} should take
- * care of that in its
- * {@link org.apache.mina.common.IoHandler#messageSent(IoSession, Object)}
+ * care of that in its
+ * {@link org.apache.mina.common.IoHandler#messageSent(IoSession, Object)}
* callback.
*
- *
+ *
* @author The Apache Directory Project (mina-dev@directory.apache.org)
* @version $Rev$, $Date$
*/
@@ -69,32 +70,33 @@
protected static final String INITIAL_WRITE_FUTURE = StreamWriteFilter.class.getName() + ".future";
private int writeBufferSize = DEFAULT_STREAM_BUFFER_SIZE;
-
- public void filterWrite( NextFilter nextFilter, IoSession session,
- WriteRequest writeRequest ) throws Exception
+
+ @Override
+ public void filterWrite( NextFilter nextFilter, IoSession session,
+ WriteRequest writeRequest ) throws Exception
{
// If we're already processing a stream we need to queue the WriteRequest.
if( session.getAttribute( CURRENT_STREAM ) != null )
{
- Queue queue = ( Queue ) session.getAttribute( WRITE_REQUEST_QUEUE );
+ Queue queue = ( Queue ) session.getAttribute( WRITE_REQUEST_QUEUE );
if( queue == null )
{
- queue = new Queue();
+ queue = new ConcurrentLinkedQueue( );
session.setAttribute( WRITE_REQUEST_QUEUE, queue );
}
- queue.push( writeRequest );
+ queue.add( writeRequest );
return;
}
-
+
Object message = writeRequest.getMessage();
-
+
if( message instanceof InputStream )
{
-
+
InputStream inputStream = ( InputStream ) message;
-
+
ByteBuffer byteBuffer = getNextByteBuffer( inputStream );
- if ( byteBuffer == null )
+ if( byteBuffer == null )
{
// End of stream reached.
writeRequest.getFuture().setWritten( true );
@@ -104,7 +106,7 @@
{
session.setAttribute( CURRENT_STREAM, inputStream );
session.setAttribute( INITIAL_WRITE_FUTURE, writeRequest.getFuture() );
-
+
nextFilter.filterWrite( session, new WriteRequest( byteBuffer ) );
}
@@ -115,10 +117,11 @@
}
}
+ @Override
public void messageSent( NextFilter nextFilter, IoSession session, Object message ) throws Exception
{
InputStream inputStream = ( InputStream ) session.getAttribute( CURRENT_STREAM );
-
+
if( inputStream == null )
{
nextFilter.messageSent( session, message );
@@ -126,25 +129,25 @@
else
{
ByteBuffer byteBuffer = getNextByteBuffer( inputStream );
-
- if( byteBuffer == null )
+
+ if( byteBuffer == null )
{
// End of stream reached.
session.removeAttribute( CURRENT_STREAM );
WriteFuture writeFuture = ( WriteFuture ) session.removeAttribute( INITIAL_WRITE_FUTURE );
-
+
// Write queued WriteRequests.
- Queue queue = ( Queue ) session.removeAttribute( WRITE_REQUEST_QUEUE );
+ Queue extends WriteRequest> queue = ( Queue extends WriteRequest> ) session.removeAttribute( WRITE_REQUEST_QUEUE );
if( queue != null )
{
- WriteRequest wr = ( WriteRequest ) queue.pop();
+ WriteRequest wr = queue.poll();
while( wr != null )
{
filterWrite( nextFilter, session, wr );
- wr = ( WriteRequest ) queue.pop();
+ wr = queue.poll();
}
}
-
+
writeFuture.setWritten( true );
nextFilter.messageSent( session, inputStream );
}
@@ -155,32 +158,30 @@
}
}
- private ByteBuffer getNextByteBuffer( InputStream is ) throws IOException
+ private ByteBuffer getNextByteBuffer( InputStream is ) throws IOException
{
byte[] bytes = new byte[ writeBufferSize ];
-
+
int off = 0;
int n = 0;
- while( off < bytes.length &&
- ( n = is.read( bytes, off, bytes.length - off ) ) != -1 )
+ while( off < bytes.length &&
+ ( n = is.read( bytes, off, bytes.length - off ) ) != -1 )
{
off += n;
}
-
+
if( n == -1 && off == 0 )
{
return null;
}
- ByteBuffer buffer = ByteBuffer.wrap( bytes, 0, off );
-
- return buffer;
+ return ByteBuffer.wrap( bytes, 0, off );
}
/**
- * Returns the size of the write buffer in bytes. Data will be read from the
+ * Returns the size of the write buffer in bytes. Data will be read from the
* stream in chunks of this size and then written to the next filter.
- *
+ *
* @return the write buffer size.
*/
public int getWriteBufferSize()
@@ -189,9 +190,9 @@
}
/**
- * Sets the size of the write buffer in bytes. Data will be read from the
+ * Sets the size of the write buffer in bytes. Data will be read from the
* stream in chunks of this size and then written to the next filter.
- *
+ *
* @throws IllegalArgumentException if the specified size is < 1.
*/
public void setWriteBufferSize( int writeBufferSize )
@@ -202,6 +203,6 @@
}
this.writeBufferSize = writeBufferSize;
}
-
-
+
+
}
Modified: directory/branches/mina/1.2/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
URL: http://svn.apache.org/viewvc/directory/branches/mina/1.2/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java?view=diff&rev=471502&r1=471501&r2=471502
==============================================================================
--- directory/branches/mina/1.2/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java (original)
+++ directory/branches/mina/1.2/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java Sun Nov 5 11:36:41 2006
@@ -6,16 +6,16 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
- *
+ * under the License.
+ *
*/
package org.apache.mina.filter.codec;
@@ -35,7 +35,7 @@
* An {@link IoFilter} which translates binary or protocol specific data into
* message object and vice versa using {@link ProtocolCodecFactory},
* {@link ProtocolEncoder}, or {@link ProtocolDecoder}.
- *
+ *
* @author The Apache Directory Project (mina-dev@directory.apache.org)
* @version $Rev$, $Date$
*/
@@ -43,12 +43,12 @@
{
public static final String ENCODER = ProtocolCodecFilter.class.getName() + ".encoder";
public static final String DECODER = ProtocolCodecFilter.class.getName() + ".decoder";
-
+
private static final Class[] EMPTY_PARAMS = new Class[0];
private static final ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap( new byte[0] );
private final ProtocolCodecFactory factory;
-
+
public ProtocolCodecFilter( ProtocolCodecFactory factory )
{
if( factory == null )
@@ -57,7 +57,7 @@
}
this.factory = factory;
}
-
+
public ProtocolCodecFilter( final ProtocolEncoder encoder, final ProtocolDecoder decoder )
{
if( encoder == null )
@@ -68,7 +68,7 @@
{
throw new NullPointerException( "decoder" );
}
-
+
this.factory = new ProtocolCodecFactory()
{
public ProtocolEncoder getEncoder()
@@ -82,7 +82,7 @@
}
};
}
-
+
public ProtocolCodecFilter( final Class encoderClass, final Class decoderClass )
{
if( encoderClass == null )
@@ -117,7 +117,7 @@
{
throw new IllegalArgumentException( "decoderClass doesn't have a public default constructor." );
}
-
+
this.factory = new ProtocolCodecFactory()
{
public ProtocolEncoder getEncoder() throws Exception
@@ -132,6 +132,7 @@
};
}
+ @Override
public void onPreAdd( IoFilterChain parent, String name, NextFilter nextFilter ) throws Exception
{
if( parent.contains( ProtocolCodecFilter.class ) )
@@ -140,6 +141,7 @@
}
}
+ @Override
public void messageReceived( NextFilter nextFilter, IoSession session, Object message ) throws Exception
{
if( !( message instanceof ByteBuffer ) )
@@ -151,7 +153,7 @@
ByteBuffer in = ( ByteBuffer ) message;
ProtocolDecoder decoder = getDecoder( session );
ProtocolDecoderOutput decoderOut = getDecoderOut( session, nextFilter );
-
+
try
{
decoder.decode( session, in, decoderOut );
@@ -185,6 +187,7 @@
}
}
+ @Override
public void messageSent( NextFilter nextFilter, IoSession session, Object message ) throws Exception
{
if( message instanceof HiddenByteBuffer )
@@ -200,7 +203,8 @@
nextFilter.messageSent( session, ( ( MessageByteBuffer ) message ).message );
}
-
+
+ @Override
public void filterWrite( NextFilter nextFilter, IoSession session, WriteRequest writeRequest ) throws Exception
{
Object message = writeRequest.getMessage();
@@ -212,7 +216,7 @@
ProtocolEncoder encoder = getEncoder( session );
ProtocolEncoderOutputImpl encoderOut = getEncoderOut( session, nextFilter, writeRequest );
-
+
try
{
encoder.encode( session, message, encoderOut );
@@ -245,7 +249,8 @@
}
}
}
-
+
+ @Override
public void sessionClosed( NextFilter nextFilter, IoSession session ) throws Exception
{
// Call finishDecode() first when a connection is closed.
@@ -276,7 +281,7 @@
decoderOut.flush();
}
-
+
nextFilter.sessionClosed( session );
}
@@ -290,12 +295,12 @@
}
return encoder;
}
-
+
private ProtocolEncoderOutputImpl getEncoderOut( IoSession session, NextFilter nextFilter, WriteRequest writeRequest )
{
return new ProtocolEncoderOutputImpl( session, nextFilter, writeRequest );
}
-
+
private ProtocolDecoder getDecoder( IoSession session ) throws Exception
{
ProtocolDecoder decoder = ( ProtocolDecoder ) session.getAttribute( DECODER );
@@ -306,12 +311,12 @@
}
return decoder;
}
-
+
private ProtocolDecoderOutput getDecoderOut( IoSession session, NextFilter nextFilter )
{
return new SimpleProtocolDecoderOutput( session, nextFilter );
}
-
+
private void disposeEncoder( IoSession session )
{
ProtocolEncoder encoder = ( ProtocolEncoder ) session.removeAttribute( ENCODER );
@@ -361,41 +366,44 @@
super( buf );
}
}
-
+
private static class MessageByteBuffer extends ByteBufferProxy
{
private final Object message;
-
+
private MessageByteBuffer( Object message )
{
super( EMPTY_BUFFER );
this.message = message;
}
+ @Override
public void acquire()
{
// no-op since we are wraping a zero-byte buffer, this instance is to just curry the message
}
+ @Override
public void release()
{
// no-op since we are wraping a zero-byte buffer, this instance is to just curry the message
}
}
-
+
private static class ProtocolEncoderOutputImpl extends SimpleProtocolEncoderOutput
{
private final IoSession session;
private final NextFilter nextFilter;
private final WriteRequest writeRequest;
-
- public ProtocolEncoderOutputImpl( IoSession session, NextFilter nextFilter, WriteRequest writeRequest )
+
+ ProtocolEncoderOutputImpl( IoSession session, NextFilter nextFilter, WriteRequest writeRequest )
{
this.session = session;
this.nextFilter = nextFilter;
this.writeRequest = writeRequest;
}
+ @Override
protected WriteFuture doFlush( ByteBuffer buf )
{
WriteFuture future = new DefaultWriteFuture( session );
Modified: directory/branches/mina/1.2/core/src/main/java/org/apache/mina/filter/codec/support/SimpleProtocolDecoderOutput.java
URL: http://svn.apache.org/viewvc/directory/branches/mina/1.2/core/src/main/java/org/apache/mina/filter/codec/support/SimpleProtocolDecoderOutput.java?view=diff&rev=471502&r1=471501&r2=471502
==============================================================================
--- directory/branches/mina/1.2/core/src/main/java/org/apache/mina/filter/codec/support/SimpleProtocolDecoderOutput.java (original)
+++ directory/branches/mina/1.2/core/src/main/java/org/apache/mina/filter/codec/support/SimpleProtocolDecoderOutput.java Sun Nov 5 11:36:41 2006
@@ -6,28 +6,30 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
- *
+ * under the License.
+ *
*/
package org.apache.mina.filter.codec.support;
-import org.apache.mina.common.IoSession;
+import java.util.ArrayList;
+import java.util.List;
+
import org.apache.mina.common.IoFilter.NextFilter;
+import org.apache.mina.common.IoSession;
import org.apache.mina.common.support.BaseIoSession;
import org.apache.mina.filter.codec.ProtocolDecoderOutput;
-import org.apache.mina.util.Queue;
/**
* A {@link ProtocolDecoderOutput} based on queue.
- *
+ *
* @author The Apache Directory Project (mina-dev@directory.apache.org)
* @version $Rev$, $Date$
*
@@ -36,17 +38,17 @@
{
private final NextFilter nextFilter;
private final IoSession session;
- private final Queue messageQueue = new Queue();
-
+ private final List