Author: norman
Date: Tue Mar 22 11:14:03 2011
New Revision: 1084135

URL: http://svn.apache.org/viewvc?rev=1084135&view=rev
Log:
Use old blocking IO for IMAPServer as replacement for NIO. This is a workaround 
for the OOM which can get thrown with many slow clients. See IMAP-265

Added:
    
james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/OioIMAPServer.java
Modified:
    
james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml

Modified: 
james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml
URL: 
http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml?rev=1084135&r1=1084134&r2=1084135&view=diff
==============================================================================
--- 
james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml
 (original)
+++ 
james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml
 Tue Mar 22 11:14:03 2011
@@ -268,7 +268,8 @@
     <!-- 
       IMAP Server
      -->
-    <bean id="imapserver" class="org.apache.james.imapserver.netty.IMAPServer">
+    <!-- Use non NIO implementation as workaround for IMAP-265 -->
+    <bean id="imapserver" 
class="org.apache.james.imapserver.netty.OioIMAPServer">
         <property name="imapDecoder" ref="imapDecoder"/>
         <property name="imapEncoder" ref="imapEncoder"/>    
     </bean>

Added: 
james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/OioIMAPServer.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/OioIMAPServer.java?rev=1084135&view=auto
==============================================================================
--- 
james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/OioIMAPServer.java
 (added)
+++ 
james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/OioIMAPServer.java
 Tue Mar 22 11:14:03 2011
@@ -0,0 +1,55 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * 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.                                           *
+ ****************************************************************/
+package org.apache.james.imapserver.netty;
+
+import org.jboss.netty.channel.socket.ServerSocketChannelFactory;
+import org.jboss.netty.channel.socket.oio.OioServerSocketChannelFactory;
+
+/**
+ * IMAPServer which use old IO and not NIO. If you want to use NIO you should 
use {@link IMAPServer}
+ * 
+ *
+ */
+public class OioIMAPServer extends IMAPServer{
+
+    @Override
+    protected ServerSocketChannelFactory createSocketChannelFactory() {
+        return new OioServerSocketChannelFactory(createBossExecutor(), 
createWorkerExecutor());
+    }
+
+    /**
+     * Throws {@link UnsupportedOperationException}
+     */
+    @Override
+    public void setIoWorkerCount(int ioWorker) {
+        throw new UnsupportedOperationException("Setting the IoWorkerCount is 
not supported with IO implementation");
+    }
+
+    /**
+     * Return -1 as it is not known
+     * 
+     * 
+     */
+    @Override
+    public int getIoWorkerCount() {
+        return -1;
+    }
+
+    
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to