Author: proyal
Date: Mon Sep  3 21:56:34 2007
New Revision: 572522

URL: http://svn.apache.org/viewvc?rev=572522&view=rev
Log:
Use Queue.add() and not Queue.offer() as it will notify us via runtime 
exception if the add-to-queue fails.

Modified:
    
mina/trunk/core/src/main/java/org/apache/mina/filter/codec/AbstractProtocolDecoderOutput.java
    
mina/trunk/core/src/main/java/org/apache/mina/filter/codec/AbstractProtocolEncoderOutput.java
    
mina/trunk/core/src/main/java/org/apache/mina/filter/executor/ExecutorFilter.java
    mina/trunk/core/src/main/java/org/apache/mina/filter/reqres/Request.java
    mina/trunk/core/src/main/java/org/apache/mina/filter/ssl/SSLHandler.java
    
mina/trunk/core/src/main/java/org/apache/mina/filter/stream/StreamWriteFilter.java
    
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java
    
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnector.java
    
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramFilterChain.java
    
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
    
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java
    
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/SocketIoProcessor.java
    
mina/trunk/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeFilterChain.java
    
mina/trunk/core/src/test/java/org/apache/mina/filter/stream/StreamWriteFilterTest.java
    
mina/trunk/transport-serial/src/main/java/org/apache/mina/transport/serial/SerialFilterChain.java

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/filter/codec/AbstractProtocolDecoderOutput.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/codec/AbstractProtocolDecoderOutput.java?rev=572522&r1=572521&r2=572522&view=diff
==============================================================================
--- 
mina/trunk/core/src/main/java/org/apache/mina/filter/codec/AbstractProtocolDecoderOutput.java
 (original)
+++ 
mina/trunk/core/src/main/java/org/apache/mina/filter/codec/AbstractProtocolDecoderOutput.java
 Mon Sep  3 21:56:34 2007
@@ -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;
 
@@ -24,17 +24,16 @@
 
 /**
  * A [EMAIL PROTECTED] ProtocolDecoderOutput} based on queue.
- * 
+ *
  * @author The Apache MINA Project ([EMAIL PROTECTED])
  * @version $Rev$, $Date$
- *
  */
 public abstract class AbstractProtocolDecoderOutput implements 
ProtocolDecoderOutput {
     private final Queue<Object> messageQueue = new LinkedList<Object>();
 
     public AbstractProtocolDecoderOutput() {
     }
-    
+
     public Queue<Object> getMessageQueue() {
         return messageQueue;
     }
@@ -44,6 +43,6 @@
             throw new NullPointerException("message");
         }
 
-        messageQueue.offer(message);
+        messageQueue.add(message);
     }
 }

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/filter/codec/AbstractProtocolEncoderOutput.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/codec/AbstractProtocolEncoderOutput.java?rev=572522&r1=572521&r2=572522&view=diff
==============================================================================
--- 
mina/trunk/core/src/main/java/org/apache/mina/filter/codec/AbstractProtocolEncoderOutput.java
 (original)
+++ 
mina/trunk/core/src/main/java/org/apache/mina/filter/codec/AbstractProtocolEncoderOutput.java
 Mon Sep  3 21:56:34 2007
@@ -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;
 
@@ -43,7 +43,7 @@
 
     public void write(ByteBuffer buf) {
         if (buf.hasRemaining()) {
-            bufferQueue.offer(buf);
+            bufferQueue.add(buf);
         } else {
             throw new IllegalArgumentException(
                     "buf is empty. Forgot to call flip()?");
@@ -51,7 +51,6 @@
     }
 
     public void mergeAll() {
-        int sum = 0;
         final int size = bufferQueue.size();
 
         if (size < 2) {
@@ -60,6 +59,7 @@
         }
 
         // Get the size of merged BB
+        int sum = 0;
         for (ByteBuffer b : bufferQueue) {
             sum += b.remaining();
         }
@@ -68,7 +68,7 @@
         ByteBuffer newBuf = ByteBuffer.allocate(sum);
 
         // and merge all.
-        for (;;) {
+        for (; ;) {
             ByteBuffer buf = bufferQueue.poll();
             if (buf == null) {
                 break;
@@ -79,6 +79,6 @@
 
         // Push the new buffer finally.
         newBuf.flip();
-        bufferQueue.offer(newBuf);
+        bufferQueue.add(newBuf);
     }
 }

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/filter/executor/ExecutorFilter.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/executor/ExecutorFilter.java?rev=572522&r1=572521&r2=572522&view=diff
==============================================================================
--- 
mina/trunk/core/src/main/java/org/apache/mina/filter/executor/ExecutorFilter.java
 (original)
+++ 
mina/trunk/core/src/main/java/org/apache/mina/filter/executor/ExecutorFilter.java
 Mon Sep  3 21:56:34 2007
@@ -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.executor;
 
@@ -34,18 +34,18 @@
  * A filter that forwards I/O events to [EMAIL PROTECTED] Executor} to enforce 
a certain
  * thread model while maintaining the event order.
  * You can apply various thread model by inserting this filter to the [EMAIL 
PROTECTED] IoFilterChain}.
- * <p>
+ * <p/>
  * Please note that this filter doesn't manage the life cycle of the underlying
  * [EMAIL PROTECTED] Executor}.  You have to destroy or stop it by yourself.
- * <p>
+ * <p/>
  * This filter maintains the order of events per session and thus make sure
  * only one thread per session executes the event.  For example, let's assume
  * that messageReceived, messageSent, and sessionClosed events are fired.
  * <ul>
  * <li>All event handler methods are called exclusively.
- *     (e.g. messageReceived and messageSent can't be invoked at the same 
time.)</li>
+ * (e.g. messageReceived and messageSent can't be invoked at the same 
time.)</li>
  * <li>The event order is never mixed up.
- *     (e.g. messageReceived is always invoked before sessionClosed or 
messageSent.)</li>
+ * (e.g. messageReceived is always invoked before sessionClosed or 
messageSent.)</li>
  * </ul>
  * If you don't need to maintain the order of events per session, please use
  * [EMAIL PROTECTED] UnorderedExecutorFilter}.
@@ -57,7 +57,7 @@
     private final Logger logger = LoggerFactory.getLogger(getClass());
 
     public ExecutorFilter() {
-        super(  IoEventType.SESSION_OPENED,
+        super(IoEventType.SESSION_OPENED,
                 IoEventType.SESSION_IDLE,
                 IoEventType.SESSION_CLOSED,
                 IoEventType.MESSAGE_RECEIVED,
@@ -89,7 +89,7 @@
 
         boolean execute;
         synchronized (buf.eventQueue) {
-            buf.eventQueue.offer(event);
+            buf.eventQueue.add(event);
             if (buf.processingCompleted) {
                 buf.processingCompleted = false;
                 execute = true;

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/filter/reqres/Request.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/reqres/Request.java?rev=572522&r1=572521&r2=572522&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/filter/reqres/Request.java 
(original)
+++ mina/trunk/core/src/main/java/org/apache/mina/filter/reqres/Request.java 
Mon Sep  3 21:56:34 2007
@@ -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.reqres;
 
@@ -26,7 +26,6 @@
 import java.util.concurrent.TimeUnit;
 
 /**
- * 
  * @author The Apache MINA Project ([EMAIL PROTECTED])
  * @version $Rev$, $Date$
  */
@@ -52,7 +51,7 @@
     }
 
     public Request(Object id, Object message, boolean useResponseQueue,
-            long timeoutMillis) {
+                   long timeoutMillis) {
         this(id, message, useResponseQueue, timeoutMillis,
                 TimeUnit.MILLISECONDS);
     }
@@ -62,7 +61,7 @@
     }
 
     public Request(Object id, Object message, boolean useResponseQueue,
-            long timeout, TimeUnit unit) {
+                   long timeout, TimeUnit unit) {
         if (id == null) {
             throw new NullPointerException("id");
         }
@@ -135,7 +134,7 @@
 
     public Response awaitResponseUninterruptibly()
             throws RequestTimeoutException {
-        for (;;) {
+        for (; ;) {
             try {
                 return awaitResponse();
             } catch (InterruptedException e) {
@@ -171,7 +170,7 @@
 
     private void signal0(Object answer) {
         if (useResponseQueue) {
-            responses.offer(answer);
+            responses.add(answer);
         }
     }
 

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/filter/ssl/SSLHandler.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/ssl/SSLHandler.java?rev=572522&r1=572521&r2=572522&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/filter/ssl/SSLHandler.java 
(original)
+++ mina/trunk/core/src/main/java/org/apache/mina/filter/ssl/SSLHandler.java 
Mon Sep  3 21:56:34 2007
@@ -19,32 +19,31 @@
  */
 package org.apache.mina.filter.ssl;
 
-import java.net.InetSocketAddress;
-import java.nio.ByteBuffer;
-import java.util.LinkedList;
-import java.util.Queue;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLEngine;
 import javax.net.ssl.SSLEngineResult;
 import javax.net.ssl.SSLException;
 import javax.net.ssl.SSLHandshakeException;
 import javax.net.ssl.SSLSession;
+import java.net.InetSocketAddress;
+import java.nio.ByteBuffer;
+import java.util.LinkedList;
+import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
 
 import org.apache.mina.common.DefaultWriteFuture;
 import org.apache.mina.common.DefaultWriteRequest;
 import org.apache.mina.common.IoEventType;
+import org.apache.mina.common.IoFilter.NextFilter;
 import org.apache.mina.common.IoFilterEvent;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.common.IoSessionLogger;
 import org.apache.mina.common.WriteFuture;
 import org.apache.mina.common.WriteRequest;
-import org.apache.mina.common.IoFilter.NextFilter;
 
 /**
  * A helper class using the SSLEngine API to decrypt/encrypt data.
- * <p>
+ * <p/>
  * Each connection has a SSLEngine that is used through the lifetime of the 
connection.
  * We allocate byte buffers for use as the outbound and inbound network 
buffers.
  * These buffers handle all of the intermediary data for the SSL connection. 
To make things easy,
@@ -63,7 +62,7 @@
     private final Queue<IoFilterEvent> preHandshakeEventQueue = new 
LinkedList<IoFilterEvent>();
 
     private final Queue<IoFilterEvent> filterWriteEventQueue = new 
ConcurrentLinkedQueue<IoFilterEvent>();
-    
+
     private final Queue<IoFilterEvent> messageReceivedEventQueue = new 
ConcurrentLinkedQueue<IoFilterEvent>();
 
     private SSLEngine sslEngine;
@@ -94,7 +93,7 @@
     private SSLEngineResult.HandshakeStatus handshakeStatus;
 
     private boolean initialHandshakeComplete;
-    
+
     /**
      * Handshake complete?
      */
@@ -231,8 +230,8 @@
     }
 
     public void schedulePreHandshakeWriteRequest(NextFilter nextFilter,
-            WriteRequest writeRequest) {
-        preHandshakeEventQueue.offer(new IoFilterEvent(nextFilter,
+                                                 WriteRequest writeRequest) {
+        preHandshakeEventQueue.add(new IoFilterEvent(nextFilter,
                 IoEventType.WRITE, session, writeRequest));
     }
 
@@ -249,16 +248,12 @@
         }
     }
 
-    public void scheduleFilterWrite(NextFilter nextFilter,
-            WriteRequest writeRequest) {
-        filterWriteEventQueue.offer(new IoFilterEvent(nextFilter,
-                IoEventType.WRITE, session, writeRequest));
+    public void scheduleFilterWrite(NextFilter nextFilter, WriteRequest 
writeRequest) {
+        filterWriteEventQueue.add(new IoFilterEvent(nextFilter, 
IoEventType.WRITE, session, writeRequest));
     }
 
-    public void scheduleMessageReceived(NextFilter nextFilter,
-            Object message) {
-        messageReceivedEventQueue.offer(new IoFilterEvent(nextFilter,
-                IoEventType.MESSAGE_RECEIVED, session, message));
+    public void scheduleMessageReceived(NextFilter nextFilter, Object message) 
{
+        messageReceivedEventQueue.add(new IoFilterEvent(nextFilter, 
IoEventType.MESSAGE_RECEIVED, session, message));
     }
 
     public void flushScheduledEvents() {
@@ -268,7 +263,7 @@
         }
 
         IoFilterEvent e;
-        
+
         // We need synchronization here inevitably because filterWrite can be
         // called simultaneously and cause 'bad record MAC' integrity error.
         synchronized (this) {
@@ -287,11 +282,11 @@
      * Buffer.
      * Decrytpted data reurned by getAppBuffer(), if any.
      *
-     * @param buf buffer to decrypt
+     * @param buf        buffer to decrypt
+     * @param nextFilter Next filter in chain
      * @throws SSLException on errors
      */
-    public void messageReceived(NextFilter nextFilter, ByteBuffer buf)
-            throws SSLException {
+    public void messageReceived(NextFilter nextFilter, ByteBuffer buf) throws 
SSLException {
         if (buf.limit() > inNetBuffer.remaining()) {
             // We have to expand inNetBuffer
             inNetBuffer = SSLByteBufferUtil.expandBuffer(inNetBuffer,
@@ -394,7 +389,6 @@
      *
      * @return <tt>true</tt> if shutdown process is started.
      *         <tt>false</tt> if shutdown process is already finished.
-     *
      * @throws SSLException on errors
      */
     public boolean closeOutbound() throws SSLException {
@@ -430,22 +424,22 @@
     }
 
     /**
-     * @param status
+     * @param res
      * @throws SSLException
      */
     private void checkStatus(SSLEngineResult res)
             throws SSLException {
-        
+
         SSLEngineResult.Status status = res.getStatus();
-        
+
         /*
-         * The status may be:
-         * OK - Normal operation
-         * OVERFLOW - Should never happen since the application buffer is
-         *      sized to hold the maximum packet size.
-         * UNDERFLOW - Need to read more data from the socket. It's normal.
-         * CLOSED - The other peer closed the socket. Also normal.
-         */
+        * The status may be:
+        * OK - Normal operation
+        * OVERFLOW - Should never happen since the application buffer is
+        *      sized to hold the maximum packet size.
+        * UNDERFLOW - Need to read more data from the socket. It's normal.
+        * CLOSED - The other peer closed the socket. Also normal.
+        */
         if (status != SSLEngineResult.Status.OK
                 && status != SSLEngineResult.Status.CLOSED
                 && status != SSLEngineResult.Status.BUFFER_UNDERFLOW) {
@@ -463,7 +457,7 @@
             IoSessionLogger.debug(session, " doHandshake()");
         }
 
-        for (;;) {
+        for (; ;) {
             if (handshakeStatus == SSLEngineResult.HandshakeStatus.FINISHED) {
                 session.setAttribute(SSLFilter.SSL_SESSION, sslEngine
                         .getSession());
@@ -606,9 +600,9 @@
 
         // prepare to be written again
         inNetBuffer.compact();
-        
+
         checkStatus(res);
-        
+
         renegotiateIfNeeded(nextFilter, res);
     }
 
@@ -631,7 +625,7 @@
                 && res.getStatus() == SSLEngineResult.Status.OK
                 && inNetBuffer.hasRemaining()) {
             res = unwrap0();
-            
+
             // prepare to be written again
             inNetBuffer.compact();
 
@@ -670,8 +664,8 @@
             }
         } while (res.getStatus() == SSLEngineResult.Status.OK
                 && (handshakeComplete && res.getHandshakeStatus() == 
SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING
-                        || res.getHandshakeStatus() == 
SSLEngineResult.HandshakeStatus.NEED_UNWRAP));
-        
+                || res.getHandshakeStatus() == 
SSLEngineResult.HandshakeStatus.NEED_UNWRAP));
+
         return res;
     }
 

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/filter/stream/StreamWriteFilter.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/stream/StreamWriteFilter.java?rev=572522&r1=572521&r2=572522&view=diff
==============================================================================
--- 
mina/trunk/core/src/main/java/org/apache/mina/filter/stream/StreamWriteFilter.java
 (original)
+++ 
mina/trunk/core/src/main/java/org/apache/mina/filter/stream/StreamWriteFilter.java
 Mon Sep  3 21:56:34 2007
@@ -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.stream;
 
@@ -32,26 +32,26 @@
 
 /**
  * Filter implementation which makes it possible to write [EMAIL PROTECTED] 
InputStream}
- * objects directly using [EMAIL PROTECTED] IoSession#write(Object)}. When an 
+ * objects directly using [EMAIL PROTECTED] IoSession#write(Object)}. When an
  * [EMAIL PROTECTED] InputStream} is written to a session this filter will 
read the bytes
  * from the stream into [EMAIL PROTECTED] ByteBuffer} objects and write those 
buffers
  * to the next filter. When end of stream has been reached this filter will
- * call [EMAIL PROTECTED] NextFilter#messageSent(IoSession, WriteRequest)} 
using the original
- * [EMAIL PROTECTED] InputStream} written to the session and notifies 
- * [EMAIL PROTECTED] org.apache.mina.common.WriteFuture} on the 
+ * call [EMAIL PROTECTED] NextFilter#messageSent(IoSession,WriteRequest)} 
using the original
+ * [EMAIL PROTECTED] InputStream} written to the session and notifies
+ * [EMAIL PROTECTED] org.apache.mina.common.WriteFuture} on the
  * original [EMAIL PROTECTED] org.apache.mina.common.WriteRequest}.
- * <p>
+ * <p/>
  * This filter will ignore written messages which aren't [EMAIL PROTECTED] 
InputStream}
  * instances. Such messages will be passed to the next filter directly.
  * </p>
- * <p>
+ * <p/>
  * NOTE: this filter does not close the stream after all data from stream
  * has been written. The [EMAIL PROTECTED] org.apache.mina.common.IoHandler} 
should take
- * care of that in its 
- * [EMAIL PROTECTED] org.apache.mina.common.IoHandler#messageSent(IoSession, 
Object)} 
+ * care of that in its
+ * [EMAIL PROTECTED] 
org.apache.mina.common.IoHandler#messageSent(IoSession,Object)}
  * callback.
  * </p>
- * 
+ *
  * @author The Apache MINA Project ([EMAIL PROTECTED])
  * @version $Rev$, $Date$
  */
@@ -80,7 +80,7 @@
 
     @Override
     public void filterWrite(NextFilter nextFilter, IoSession session,
-            WriteRequest writeRequest) throws Exception {
+                            WriteRequest writeRequest) throws Exception {
         // If we're already processing a stream we need to queue the 
WriteRequest.
         if (session.getAttribute(CURRENT_STREAM) != null) {
             Queue<WriteRequest> queue = getWriteRequestQueue(session);
@@ -88,7 +88,7 @@
                 queue = new LinkedList<WriteRequest>();
                 session.setAttribute(WRITE_REQUEST_QUEUE, queue);
             }
-            queue.offer(writeRequest);
+            queue.add(writeRequest);
             return;
         }
 
@@ -123,7 +123,7 @@
 
     @Override
     public void messageSent(NextFilter nextFilter, IoSession session,
-            WriteRequest writeRequest) throws Exception {
+                            WriteRequest writeRequest) throws Exception {
         InputStream inputStream = (InputStream) session
                 .getAttribute(CURRENT_STREAM);
 
@@ -178,9 +178,9 @@
     }
 
     /**
-     * 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() {
@@ -188,9 +188,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 &lt; 1.
      */
     public void setWriteBufferSize(int writeBufferSize) {

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java?rev=572522&r1=572521&r2=572522&view=diff
==============================================================================
--- 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java
 (original)
+++ 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java
 Mon Sep  3 21:56:34 2007
@@ -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.transport.socket.nio;
 
@@ -37,17 +37,17 @@
 import org.apache.mina.common.ExpiringIoSessionRecycler;
 import org.apache.mina.common.IoAcceptor;
 import org.apache.mina.common.IoServiceListenerSupport;
-import org.apache.mina.common.TransportMetadata;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.common.IoSessionRecycler;
 import org.apache.mina.common.RuntimeIOException;
+import org.apache.mina.common.TransportMetadata;
 import org.apache.mina.common.WriteRequest;
 import org.apache.mina.util.NamePreservingRunnable;
 import org.apache.mina.util.NewThreadExecutor;
 
 /**
  * [EMAIL PROTECTED] IoAcceptor} for datagram transport (UDP/IP).
- * 
+ *
  * @author The Apache MINA Project ([EMAIL PROTECTED])
  * @version $Rev$, $Date$
  */
@@ -74,7 +74,7 @@
     private final Queue<DatagramSessionImpl> flushingSessions = new 
ConcurrentLinkedQueue<DatagramSessionImpl>();
 
     private Worker worker;
-    
+
     /**
      * Creates a new instance.
      */
@@ -129,7 +129,7 @@
         RegistrationRequest request = new RegistrationRequest();
 
         startupWorker();
-        registerQueue.offer(request);
+        registerQueue.add(request);
         selector.wakeup();
 
         synchronized (request) {
@@ -154,7 +154,7 @@
         CancellationRequest request = new CancellationRequest();
 
         startupWorker();
-        cancelQueue.offer(request);
+        cancelQueue.add(request);
         selector.wakeup();
 
         synchronized (request) {
@@ -228,7 +228,7 @@
 
     /**
      * Sets the [EMAIL PROTECTED] IoSessionRecycler} for this service.
-     * 
+     *
      * @param sessionRecycler <tt>null</tt> to use the default recycler
      */
     public void setSessionRecycler(IoSessionRecycler sessionRecycler) {
@@ -270,14 +270,14 @@
     }
 
     private void scheduleFlush(DatagramSessionImpl session) {
-        flushingSessions.offer(session);
+        flushingSessions.add(session);
     }
 
     private class Worker implements Runnable {
         public void run() {
             Thread.currentThread().setName("DatagramAcceptor-" + id);
 
-            for (;;) {
+            for (; ;) {
                 try {
                     int nKeys = selector.select();
 
@@ -356,7 +356,7 @@
     }
 
     private void flushSessions() {
-        for (;;) {
+        for (; ;) {
             DatagramSessionImpl session = flushingSessions.poll();
             if (session == null) {
                 break;
@@ -388,35 +388,35 @@
         int writtenBytes = 0;
         int maxWrittenBytes = session.getConfig().getSendBufferSize() << 1;
         try {
-            for (;;) {
+            for (; ;) {
                 WriteRequest req;
                 synchronized (writeRequestQueue) {
                     req = writeRequestQueue.peek();
                 }
-    
+
                 if (req == null) {
                     break;
                 }
-    
+
                 ByteBuffer buf = (ByteBuffer) req.getMessage();
                 if (buf.remaining() == 0) {
                     // pop and fire event
                     synchronized (writeRequestQueue) {
                         writeRequestQueue.poll();
                     }
-    
+
                     session.increaseWrittenMessages();
                     buf.reset();
                     ((DatagramFilterChain) session.getFilterChain())
                             .fireMessageSent(session, req);
                     continue;
                 }
-    
+
                 SocketAddress destination = req.getDestination();
                 if (destination == null) {
                     destination = session.getRemoteAddress();
                 }
-    
+
                 int localWrittenBytes = ch.send(buf.buf(), destination);
                 if (localWrittenBytes == 0 || writtenBytes >= maxWrittenBytes) 
{
                     // Kernel buffer is full or wrote too much
@@ -424,12 +424,12 @@
                     break;
                 } else {
                     key.interestOps(key.interestOps() & 
(~SelectionKey.OP_WRITE));
-    
+
                     // pop and fire event
                     synchronized (writeRequestQueue) {
                         writeRequestQueue.poll();
                     }
-    
+
                     writtenBytes += localWrittenBytes;
                     session.increaseWrittenMessages();
                     buf.reset();
@@ -446,7 +446,7 @@
             return;
         }
 
-        for (;;) {
+        for (; ;) {
             RegistrationRequest req = registerQueue.poll();
             if (req == null) {
                 break;
@@ -492,7 +492,7 @@
     }
 
     private void cancelKeys() {
-        for (;;) {
+        for (; ;) {
             CancellationRequest request = cancelQueue.poll();
             if (request == null) {
                 break;

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnector.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnector.java?rev=572522&r1=572521&r2=572522&view=diff
==============================================================================
--- 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnector.java
 (original)
+++ 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnector.java
 Mon Sep  3 21:56:34 2007
@@ -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.transport.socket.nio;
 
@@ -37,16 +37,16 @@
 import org.apache.mina.common.DefaultConnectFuture;
 import org.apache.mina.common.ExceptionMonitor;
 import org.apache.mina.common.IoConnector;
-import org.apache.mina.common.TransportMetadata;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.common.RuntimeIOException;
+import org.apache.mina.common.TransportMetadata;
 import org.apache.mina.common.WriteRequest;
 import org.apache.mina.util.NamePreservingRunnable;
 import org.apache.mina.util.NewThreadExecutor;
 
 /**
  * [EMAIL PROTECTED] IoConnector} for datagram transport (UDP/IP).
- * 
+ *
  * @author The Apache MINA Project ([EMAIL PROTECTED])
  * @version $Rev$, $Date$
  */
@@ -112,7 +112,7 @@
 
     @Override
     protected ConnectFuture doConnect(SocketAddress remoteAddress,
-            SocketAddress localAddress) {
+                                      SocketAddress localAddress) {
         DatagramChannel ch = null;
         boolean initialized = false;
         try {
@@ -150,7 +150,7 @@
         RegistrationRequest request = new RegistrationRequest(ch);
 
         startupWorker();
-        registerQueue.offer(request);
+        registerQueue.add(request);
         selector.wakeup();
 
         return request;
@@ -165,7 +165,7 @@
 
     void closeSession(DatagramSessionImpl session) {
         startupWorker();
-        cancelQueue.offer(session);
+        cancelQueue.add(session);
         selector.wakeup();
     }
 
@@ -178,7 +178,7 @@
     }
 
     private void scheduleFlush(DatagramSessionImpl session) {
-        flushingSessions.offer(session);
+        flushingSessions.add(session);
     }
 
     void updateTrafficMask(DatagramSessionImpl session) {
@@ -191,11 +191,11 @@
     }
 
     private void scheduleTrafficControl(DatagramSessionImpl session) {
-        trafficControllingSessions.offer(session);
+        trafficControllingSessions.add(session);
     }
 
     private void doUpdateTrafficMask() {
-        for (;;) {
+        for (; ;) {
             DatagramSessionImpl session = trafficControllingSessions.poll();
             if (session == null) {
                 break;
@@ -203,7 +203,7 @@
 
             SelectionKey key = session.getSelectionKey();
             // Retry later if session is not yet fully initialized.
-            // (In case that Session.suspend??() or session.resume??() is 
+            // (In case that Session.suspend??() or session.resume??() is
             // called before addSession() is processed)
             if (key == null) {
                 scheduleTrafficControl(session);
@@ -235,7 +235,7 @@
         public void run() {
             Thread.currentThread().setName("DatagramConnector-" + id);
 
-            for (;;) {
+            for (; ;) {
                 try {
                     int nKeys = selector.select();
 
@@ -310,7 +310,7 @@
     }
 
     private void flushSessions() {
-        for (;;) {
+        for (; ;) {
             DatagramSessionImpl session = flushingSessions.poll();
             if (session == null) {
                 break;
@@ -342,29 +342,29 @@
         int writtenBytes = 0;
         int maxWrittenBytes = session.getConfig().getSendBufferSize() << 1;
         try {
-            for (;;) {
+            for (; ;) {
                 WriteRequest req;
                 synchronized (writeRequestQueue) {
                     req = writeRequestQueue.peek();
                 }
-    
+
                 if (req == null) {
                     break;
                 }
-    
+
                 ByteBuffer buf = (ByteBuffer) req.getMessage();
                 if (buf.remaining() == 0) {
                     // pop and fire event
                     synchronized (writeRequestQueue) {
                         writeRequestQueue.poll();
                     }
-    
+
                     session.increaseWrittenMessages();
                     buf.reset();
                     session.getFilterChain().fireMessageSent(session, req);
                     continue;
                 }
-    
+
                 int localWrittenBytes = ch.write(buf.buf());
                 if (localWrittenBytes == 0 || writtenBytes >= maxWrittenBytes) 
{
                     // Kernel buffer is full or wrote too much
@@ -372,12 +372,12 @@
                     break;
                 } else {
                     key.interestOps(key.interestOps() & 
(~SelectionKey.OP_WRITE));
-    
+
                     // pop and fire event
                     synchronized (writeRequestQueue) {
                         writeRequestQueue.poll();
                     }
-    
+
                     writtenBytes += localWrittenBytes;
                     session.increaseWrittenMessages();
                     buf.reset();
@@ -390,7 +390,7 @@
     }
 
     private void registerNew() {
-        for (;;) {
+        for (; ;) {
             RegistrationRequest req = registerQueue.poll();
             if (req == null) {
                 break;
@@ -433,7 +433,7 @@
     }
 
     private void cancelKeys() {
-        for (;;) {
+        for (; ;) {
             DatagramSessionImpl session = cancelQueue.poll();
             if (session == null) {
                 break;

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramFilterChain.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramFilterChain.java?rev=572522&r1=572521&r2=572522&view=diff
==============================================================================
--- 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramFilterChain.java
 (original)
+++ 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramFilterChain.java
 Mon Sep  3 21:56:34 2007
@@ -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.transport.socket.nio;
 
@@ -30,7 +30,7 @@
 
 /**
  * An [EMAIL PROTECTED] IoFilterChain} for datagram transport (UDP/IP).
- * 
+ *
  * @author The Apache MINA Project ([EMAIL PROTECTED])
  */
 class DatagramFilterChain extends AbstractIoFilterChain {
@@ -47,7 +47,7 @@
 
         int writeRequestQueueSize;
         synchronized (writeRequestQueue) {
-            writeRequestQueue.offer(writeRequest);
+            writeRequestQueue.add(writeRequest);
             writeRequestQueueSize = writeRequestQueue.size();
         }
 

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java?rev=572522&r1=572521&r2=572522&view=diff
==============================================================================
--- 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
 (original)
+++ 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
 Mon Sep  3 21:56:34 2007
@@ -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.transport.socket.nio;
 
@@ -45,7 +45,7 @@
 
 /**
  * [EMAIL PROTECTED] IoAcceptor} for socket transport (TCP/IP).  This class
- * handles incoming TCP/IP based socket connections.   
+ * handles incoming TCP/IP based socket connections.
  *
  * @author The Apache MINA Project ([EMAIL PROTECTED])
  * @version $Rev: 389042 $, $Date: 2006-03-27 07:49:41Z $
@@ -92,11 +92,10 @@
     }
 
     /**
-     * Creates an acceptor with a processing thread count set to the 
+     * Creates an acceptor with a processing thread count set to the
      * number of available processors + 1 and the submitted executor
-     * 
-     * @param executor 
-     *         Executor to use for launching threads
+     *
+     * @param executor Executor to use for launching threads
      */
     public SocketAcceptor(Executor executor) {
         this(Runtime.getRuntime().availableProcessors() + 1, executor);
@@ -106,7 +105,7 @@
      * Create an acceptor with the desired number of processing threads
      *
      * @param processorCount Number of processing threads
-     * @param executor Executor to use for launching threads
+     * @param executor       Executor to use for launching threads
      */
     public SocketAcceptor(int processorCount, Executor executor) {
         super(new DefaultSocketSessionConfig());
@@ -251,11 +250,11 @@
     protected void doBind() throws IOException {
         RegistrationRequest request = new RegistrationRequest();
 
-        // adds the Registration request to the queue for the Workers 
+        // adds the Registration request to the queue for the Workers
         // to handle
-        registerQueue.offer(request);
+        registerQueue.add(request);
 
-        // creates an instance of a Worker and has the local 
+        // creates an instance of a Worker and has the local
         // executor kick it off.
         startupWorker();
 
@@ -290,7 +289,7 @@
     }
 
     /**
-     * This method is called by the doBind() and doUnbind() 
+     * This method is called by the doBind() and doUnbind()
      * methods.  If the worker object is not null, presumably
      * the acceptor is starting up, then the worker object will
      * be created and kicked off by the executor.  If the worker
@@ -312,7 +311,7 @@
     protected void doUnbind() {
         CancellationRequest request = new CancellationRequest();
 
-        cancelQueue.offer(request);
+        cancelQueue.add(request);
         startupWorker();
         selector.wakeup();
 
@@ -341,7 +340,7 @@
         public void run() {
             Thread.currentThread().setName(SocketAcceptor.this.threadName);
 
-            for (;;) {
+            for (; ;) {
                 try {
                     // gets the number of keys that are ready to go
                     int nKeys = selector.select();
@@ -383,12 +382,11 @@
         /**
          * This method will process new sessions for the Worker class.  All
          * keys that have had their status updates as per the 
Selector.selectedKeys()
-         * method will be processed here.  Only keys that are ready to accept 
-         * connections are handled here.  
-         * 
+         * method will be processed here.  Only keys that are ready to accept
+         * connections are handled here.
+         * <p/>
          * Session objects are created by making new instances of 
SocketSessionImpl
          * and passing the session object to the SocketIoProcessor class.
-         *
          */
         private void processSessions(Set<SelectionKey> keys) throws 
IOException {
             Iterator<SelectionKey> it = keys.iterator();
@@ -412,15 +410,15 @@
 
                 boolean success = false;
                 try {
-                    // Create a new session object.  This class extends 
+                    // Create a new session object.  This class extends
                     // BaseIoSession and is custom for socket-based sessions.
                     SocketSessionImpl session = new SocketSessionImpl(
                             SocketAcceptor.this, nextProcessor(), ch);
-                    
-                    // build the list of filters for this session.  
+
+                    // build the list of filters for this session.
                     getFilterChainBuilder().buildFilterChain(
                             session.getFilterChain());
-                    
+
                     // add the session to the SocketIoProcessor
                     session.getIoProcessor().addNew(session);
                     success = true;
@@ -445,7 +443,7 @@
 
     /**
      * Sets up the socket communications.  Sets items such as:
-     * 
+     * <p/>
      * Blocking
      * Reuse address
      * Receive buffer size
@@ -453,7 +451,7 @@
      * Registers OP_ACCEPT for selector
      */
     private void registerNew() {
-        for (;;) {
+        for (; ;) {
             RegistrationRequest req = registerQueue.poll();
             if (req == null) {
                 break;
@@ -506,7 +504,7 @@
      * the doUnbind() method.
      */
     private void cancelKeys() {
-        for (;;) {
+        for (; ;) {
             CancellationRequest request = cancelQueue.poll();
             if (request == null) {
                 break;

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java?rev=572522&r1=572521&r2=572522&view=diff
==============================================================================
--- 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java
 (original)
+++ 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java
 Mon Sep  3 21:56:34 2007
@@ -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.transport.socket.nio;
 
@@ -25,14 +25,13 @@
 import java.nio.channels.SelectionKey;
 import java.nio.channels.Selector;
 import java.nio.channels.SocketChannel;
-import java.util.Iterator;
 import java.util.Queue;
 import java.util.Set;
 import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.concurrent.Executor;
 
-import org.apache.mina.common.AbstractIoFilterChain;
 import org.apache.mina.common.AbstractIoConnector;
+import org.apache.mina.common.AbstractIoFilterChain;
 import org.apache.mina.common.ConnectFuture;
 import org.apache.mina.common.DefaultConnectFuture;
 import org.apache.mina.common.ExceptionMonitor;
@@ -78,7 +77,7 @@
     private int workerTimeout = 60; // 1 min.
 
     /**
-     * Create a connector with a single processing thread using a 
NewThreadExecutor 
+     * Create a connector with a single processing thread using a 
NewThreadExecutor
      */
     public SocketConnector() {
         this(1, new NewThreadExecutor());
@@ -88,7 +87,7 @@
      * Create a connector with the desired number of processing threads
      *
      * @param processorCount Number of processing threads
-     * @param executor Executor to use for launching threads
+     * @param executor       Executor to use for launching threads
      */
     public SocketConnector(int processorCount, Executor executor) {
         super(new DefaultSocketSessionConfig());
@@ -155,7 +154,7 @@
 
     @Override
     protected ConnectFuture doConnect(SocketAddress remoteAddress,
-            SocketAddress localAddress) {
+                                      SocketAddress localAddress) {
         SocketChannel ch = null;
         boolean success = false;
         try {
@@ -190,7 +189,7 @@
         ConnectionRequest request = new ConnectionRequest(ch);
         startupWorker();
 
-        connectQueue.offer(request);
+        connectQueue.add(request);
         selector.wakeup();
 
         return request;
@@ -206,7 +205,7 @@
     }
 
     private void registerNew() {
-        for (;;) {
+        for (; ;) {
             ConnectionRequest req = connectQueue.poll();
             if (req == null) {
                 break;
@@ -222,11 +221,7 @@
     }
 
     private void processSessions(Set<SelectionKey> keys) {
-        Iterator<SelectionKey> it = keys.iterator();
-
-        while (it.hasNext()) {
-            SelectionKey key = it.next();
-
+        for (SelectionKey key : keys) {
             if (!key.isConnectable()) {
                 continue;
             }
@@ -258,11 +253,8 @@
 
     private void processTimedOutSessions(Set<SelectionKey> keys) {
         long currentTime = System.currentTimeMillis();
-        Iterator<SelectionKey> it = keys.iterator();
-
-        while (it.hasNext()) {
-            SelectionKey key = it.next();
 
+        for (SelectionKey key : keys) {
             if (!key.isValid()) {
                 continue;
             }
@@ -317,7 +309,7 @@
         public void run() {
             Thread.currentThread().setName(SocketConnector.this.threadName);
 
-            for (;;) {
+            for (; ;) {
                 try {
                     int nKeys = selector.select(1000);
 

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/SocketIoProcessor.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/SocketIoProcessor.java?rev=572522&r1=572521&r2=572522&view=diff
==============================================================================
--- 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/SocketIoProcessor.java
 (original)
+++ 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/SocketIoProcessor.java
 Mon Sep  3 21:56:34 2007
@@ -88,7 +88,7 @@
     }
 
     void addNew(SocketSessionImpl session) {
-        newSessions.offer(session);
+        newSessions.add(session);
 
         startupWorker();
     }
@@ -121,7 +121,7 @@
     }
 
     private void scheduleRemove(SocketSessionImpl session) {
-        removingSessions.offer(session);
+        removingSessions.add(session);
     }
 
     private boolean scheduleFlush(SocketSessionImpl session) {
@@ -135,7 +135,7 @@
     }
 
     private void scheduleTrafficControl(SocketSessionImpl session) {
-        trafficControllingSessions.offer(session);
+        trafficControllingSessions.add(session);
     }
 
     private void doAddNew() {

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeFilterChain.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeFilterChain.java?rev=572522&r1=572521&r2=572522&view=diff
==============================================================================
--- 
mina/trunk/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeFilterChain.java
 (original)
+++ 
mina/trunk/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeFilterChain.java
 Mon Sep  3 21:56:34 2007
@@ -50,7 +50,7 @@
     }
 
     private void pushEvent(Event e) {
-        eventQueue.offer(e);
+        eventQueue.add(e);
         if (flushEnabled) {
             flushEvents();
         }
@@ -73,7 +73,7 @@
             if (sessionOpened && s.getTrafficMask().isReadable() && 
s.getLock().tryLock()) {
                 try {
                     if (!s.getTrafficMask().isReadable()) {
-                        s.pendingDataQueue.offer(data);
+                        s.pendingDataQueue.add(data);
                     } else {
                         int byteCount = 1;
                         if (data instanceof ByteBuffer) {
@@ -194,7 +194,7 @@
 
                 flushPendingDataQueues(s);
             } else {
-                s.pendingDataQueue.offer(writeRequest);
+                s.pendingDataQueue.add(writeRequest);
             }
         } else {
             writeRequest.getFuture().setWritten(false);

Modified: 
mina/trunk/core/src/test/java/org/apache/mina/filter/stream/StreamWriteFilterTest.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/test/java/org/apache/mina/filter/stream/StreamWriteFilterTest.java?rev=572522&r1=572521&r2=572522&view=diff
==============================================================================
--- 
mina/trunk/core/src/test/java/org/apache/mina/filter/stream/StreamWriteFilterTest.java
 (original)
+++ 
mina/trunk/core/src/test/java/org/apache/mina/filter/stream/StreamWriteFilterTest.java
 Mon Sep  3 21:56:34 2007
@@ -275,9 +275,9 @@
                 new DefaultWriteRequest(new Object(), new DummyWriteFuture()),
                 new DefaultWriteRequest(new Object(), new DummyWriteFuture()) 
};
         Queue<WriteRequest> queue = new LinkedList<WriteRequest>();
-        queue.offer(wrs[0]);
-        queue.offer(wrs[1]);
-        queue.offer(wrs[2]);
+        queue.add(wrs[0]);
+        queue.add(wrs[1]);
+        queue.add(wrs[2]);
         InputStream stream = new ByteArrayInputStream(BUF);
 
         /*

Modified: 
mina/trunk/transport-serial/src/main/java/org/apache/mina/transport/serial/SerialFilterChain.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/transport-serial/src/main/java/org/apache/mina/transport/serial/SerialFilterChain.java?rev=572522&r1=572521&r2=572522&view=diff
==============================================================================
--- 
mina/trunk/transport-serial/src/main/java/org/apache/mina/transport/serial/SerialFilterChain.java
 (original)
+++ 
mina/trunk/transport-serial/src/main/java/org/apache/mina/transport/serial/SerialFilterChain.java
 Mon Sep  3 21:56:34 2007
@@ -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.transport.serial;
 
@@ -29,7 +29,7 @@
 
 /**
  * An [EMAIL PROTECTED] IoFilterChain} for serial communication transport.
- * 
+ *
  * @author The Apache MINA Project ([EMAIL PROTECTED])
  * @version $Rev: 529590 $, $Date: 2007-04-17 15:14:17 +0200 (mar., 17 avr. 
2007) $
  */
@@ -51,10 +51,10 @@
         Queue<WriteRequest> queue = s.getWriteRequestQueue();
 
         // SocketIoProcessor.doFlush() will reset it after write is finished
-        // because the buffer will be passed with messageSent event. 
+        // because the buffer will be passed with messageSent event.
         ((ByteBuffer) writeRequest.getMessage()).mark();
         synchronized (queue) {
-            queue.offer(writeRequest);
+            queue.add(writeRequest);
             if (queue.size() == 1 && session.getTrafficMask().isWritable()) {
                 // Notify serial session worker only when writeRequestQueue 
was empty.
                 s.notifyWriteWorker();


Reply via email to