directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pro...@apache.org
Subject svn commit: r447151 - in /directory/trunks/mina/core/src/main/java/org/apache/mina: transport/socket/nio/ transport/socket/nio/support/ util/
Date Sun, 17 Sep 2006 21:48:06 GMT
Author: proyal
Date: Sun Sep 17 14:48:06 2006
New Revision: 447151

URL: http://svn.apache.org/viewvc?view=rev&rev=447151
Log:
DIRMINA-267 - Allow usage of an Executor for launching threads in processors/acceptors

Added:
    directory/trunks/mina/core/src/main/java/org/apache/mina/util/NamePreservingRunnable.java
  (with props)
    directory/trunks/mina/core/src/main/java/org/apache/mina/util/NewThreadExecutor.java 
 (with props)
Modified:
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnector.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketIoProcessor.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnectorDelegate.java

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java?view=diff&rev=447151&r1=447150&r2=447151
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java
Sun Sep 17 14:48:06 2006
@@ -22,6 +22,8 @@
 import org.apache.mina.common.IoAcceptor;
 import org.apache.mina.common.support.DelegatedIoAcceptor;
 import org.apache.mina.transport.socket.nio.support.DatagramAcceptorDelegate;
+import org.apache.mina.util.NewThreadExecutor;
+import edu.emory.mathcs.backport.java.util.concurrent.Executor;
 
 /**
  * {@link IoAcceptor} for datagram transport (UDP/IP).
@@ -32,10 +34,20 @@
 public class DatagramAcceptor extends DelegatedIoAcceptor
 {
     /**
-     * Creates a new instance.
+     * Creates a new instance using a NewThreadExecutor
      */
     public DatagramAcceptor()
     {
-        init( new DatagramAcceptorDelegate( this ) );
+        init( new DatagramAcceptorDelegate( this, new NewThreadExecutor( ) ) );
+    }
+
+    /**
+     * Creates a new instance.
+     * 
+     * @param executor Executor to use for launching threads
+     */
+    public DatagramAcceptor( Executor executor )
+    {
+        init( new DatagramAcceptorDelegate( this, executor ) );
     }
 }

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnector.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnector.java?view=diff&rev=447151&r1=447150&r2=447151
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnector.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnector.java
Sun Sep 17 14:48:06 2006
@@ -22,6 +22,8 @@
 import org.apache.mina.common.IoConnector;
 import org.apache.mina.common.support.DelegatedIoConnector;
 import org.apache.mina.transport.socket.nio.support.DatagramConnectorDelegate;
+import org.apache.mina.util.NewThreadExecutor;
+import edu.emory.mathcs.backport.java.util.concurrent.Executor;
 
 /**
  * {@link IoConnector} for datagram transport (UDP/IP).
@@ -32,10 +34,20 @@
 public class DatagramConnector extends DelegatedIoConnector
 {
     /**
-     * Creates a new instance.
+     * Creates a new instance using a NewThreadExecutor 
      */
     public DatagramConnector()
     {
-        init( new DatagramConnectorDelegate( this ) );
+        init( new DatagramConnectorDelegate( this, new NewThreadExecutor( ) ) );
+    }
+
+    /**
+     * Creates a new instance.
+     * 
+     * @param executor Executor to use for launching threads
+     */
+    public DatagramConnector( Executor executor )
+    {
+        init( new DatagramConnectorDelegate( this, executor ) );
     }
 }

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java?view=diff&rev=447151&r1=447150&r2=447151
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
Sun Sep 17 14:48:06 2006
@@ -39,6 +39,9 @@
 import org.apache.mina.common.IoServiceConfig;
 import org.apache.mina.common.support.BaseIoAcceptor;
 import org.apache.mina.util.Queue;
+import org.apache.mina.util.NewThreadExecutor;
+import org.apache.mina.util.NamePreservingRunnable;
+import edu.emory.mathcs.backport.java.util.concurrent.Executor;
 
 /**
  * {@link IoAcceptor} for socket transport (TCP/IP).
@@ -53,6 +56,7 @@
      */
     private static volatile int nextId = 0;
 
+    private final Executor executor;
     private final Object lock = new Object();
     private final int id = nextId ++;
     private final String threadName = "SocketAcceptor-" + id;
@@ -73,31 +77,33 @@
     private int processorDistributor = 0;
 
     /**
-     * Create an acceptor with a single processing thread
+     * Create an acceptor with a single processing thread using a NewThreadExecutor
      */
     public SocketAcceptor()
     {
-        this( 1 );
+        this( 1, new NewThreadExecutor() );
     }
 
     /**
      * Create an acceptor with the desired number of processing threads
      *
      * @param processorCount Number of processing threads
+     * @param executor Executor to use for launching threads
      */
-    public SocketAcceptor( int processorCount )
+    public SocketAcceptor( int processorCount, Executor executor )
     {
         if( processorCount < 1 )
         {
             throw new IllegalArgumentException( "Must have at least one processor" );
         }
 
+        this.executor = executor;
         this.processorCount = processorCount;
         ioProcessors = new SocketIoProcessor[processorCount];
 
         for( int i = 0; i < processorCount; i++ )
         {
-            ioProcessors[i] = new SocketIoProcessor( "SocketAcceptorIoProcessor-" + id +
"." + i );
+            ioProcessors[i] = new SocketIoProcessor( "SocketAcceptorIoProcessor-" + id +
"." + i, executor );
         }
     }
 
@@ -176,7 +182,7 @@
                 selector = Selector.open();
                 worker = new Worker();
 
-                worker.start();
+                executor.execute( new NamePreservingRunnable( worker ) );
             }
         }
     }
@@ -247,15 +253,12 @@
         }
     }
 
-    private class Worker extends Thread
+    private class Worker implements Runnable
     {
-        Worker()
-        {
-            super( SocketAcceptor.this.threadName );
-        }
-
         public void run()
         {
+            Thread.currentThread().setName(SocketAcceptor.this.threadName );
+
             for( ; ; )
             {
                 try
@@ -336,17 +339,16 @@
                 }
 
                 boolean success = false;
-                SocketSessionImpl session = null;
                 try
                 {
                     RegistrationRequest req = ( RegistrationRequest ) key.attachment();
-                    session = new SocketSessionImpl( SocketAcceptor.this,
-                                                     nextProcessor(),
-                                                     getListeners(),
-                                                     req.config,
-                                                     ch,
-                                                     req.handler,
-                                                     req.address );
+                    SocketSessionImpl session = new SocketSessionImpl( SocketAcceptor.this,
+                                                                       nextProcessor(),
+                                                                       getListeners(),
+                                                                       req.config,
+                                                                       ch,
+                                                                       req.handler,
+                                                                       req.address );
                     getFilterChainBuilder().buildFilterChain( session.getFilterChain() );
                     req.config.getFilterChainBuilder().buildFilterChain( session.getFilterChain()
);
                     req.config.getThreadModel().buildFilterChain( session.getFilterChain()
);
@@ -429,7 +431,7 @@
                 {
                     channels.put( req.address, ssc );
                 }
-                
+
                 getListeners().fireServiceActivated(
                         this, req.address, req.handler, req.config );
             }
@@ -518,7 +520,7 @@
                     request.done = true;
                     request.notifyAll();
                 }
-                
+
                 if( request.exception == null )
                 {
                     getListeners().fireServiceDeactivated(

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java?view=diff&rev=447151&r1=447150&r2=447151
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java
Sun Sep 17 14:48:06 2006
@@ -38,6 +38,9 @@
 import org.apache.mina.common.support.BaseIoConnector;
 import org.apache.mina.common.support.DefaultConnectFuture;
 import org.apache.mina.util.Queue;
+import org.apache.mina.util.NewThreadExecutor;
+import org.apache.mina.util.NamePreservingRunnable;
+import edu.emory.mathcs.backport.java.util.concurrent.Executor;
 
 /**
  * {@link IoConnector} for socket transport (TCP/IP).
@@ -59,6 +62,7 @@
     private final Queue connectQueue = new Queue();
     private final SocketIoProcessor[] ioProcessors;
     private final int processorCount;
+    private final Executor executor;
 
     /**
      * @noinspection FieldAccessedSynchronizedAndUnsynchronized
@@ -69,31 +73,33 @@
     private long workerTimeout = 1000L * 60;
 
     /**
-     * Create a connector with a single processing thread
+     * Create a connector with a single processing thread using a NewThreadExecutor 
      */
     public SocketConnector()
     {
-        this( 1 );
+        this( 1, new NewThreadExecutor() );
     }
-    
+
     /**
      * Create a connector with the desired number of processing threads
      *
      * @param processorCount Number of processing threads
+     * @param executor Executor to use for launching threads
      */
-    public SocketConnector( int processorCount )
+    public SocketConnector( int processorCount, Executor executor )
     {
         if( processorCount < 1 )
         {
             throw new IllegalArgumentException( "Must have at least one processor" );
         }
 
+        this.executor = executor;
         this.processorCount = processorCount;
         ioProcessors = new SocketIoProcessor[processorCount];
 
         for( int i = 0; i < processorCount; i++ )
         {
-            ioProcessors[i] = new SocketIoProcessor( "SocketConnectorIoProcessor-" + id +
"." + i );
+            ioProcessors[i] = new SocketIoProcessor( "SocketConnectorIoProcessor-" + id +
"." + i, executor );
         }
     }
 
@@ -231,7 +237,7 @@
         {
             selector = Selector.open();
             worker = new Worker();
-            worker.start();
+            executor.execute( new NamePreservingRunnable( worker ) );
         }
     }
 
@@ -370,17 +376,14 @@
         return ioProcessors[processorDistributor++ % processorCount];
     }
 
-    private class Worker extends Thread
+    private class Worker implements Runnable
     {
         private long lastActive = System.currentTimeMillis();
 
-        Worker()
-        {
-            super( SocketConnector.this.threadName );
-        }
-
         public void run()
         {
+            Thread.currentThread().setName( SocketConnector.this.threadName );
+
             for( ; ; )
             {
                 try

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketIoProcessor.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketIoProcessor.java?view=diff&rev=447151&r1=447150&r2=447151
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketIoProcessor.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketIoProcessor.java
Sun Sep 17 14:48:06 2006
@@ -19,13 +19,6 @@
  */
 package org.apache.mina.transport.socket.nio;
 
-import org.apache.mina.common.ByteBuffer;
-import org.apache.mina.common.ExceptionMonitor;
-import org.apache.mina.common.IdleStatus;
-import org.apache.mina.common.IoFilter.WriteRequest;
-import org.apache.mina.common.WriteTimeoutException;
-import org.apache.mina.util.Queue;
-
 import java.io.IOException;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.Selector;
@@ -33,6 +26,15 @@
 import java.util.Iterator;
 import java.util.Set;
 
+import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.ExceptionMonitor;
+import org.apache.mina.common.IdleStatus;
+import org.apache.mina.common.IoFilter.WriteRequest;
+import org.apache.mina.common.WriteTimeoutException;
+import org.apache.mina.util.NamePreservingRunnable;
+import org.apache.mina.util.Queue;
+import edu.emory.mathcs.backport.java.util.concurrent.Executor;
+
 /**
  * Performs all I/O operations for sockets which is connected or bound. This class is used
by MINA internally.
  *
@@ -44,6 +46,7 @@
     private final Object lock = new Object();
 
     private final String threadName;
+    private final Executor executor;
     /**
      * @noinspection FieldAccessedSynchronizedAndUnsynchronized
      */
@@ -57,9 +60,10 @@
     private Worker worker;
     private long lastIdleCheckTime = System.currentTimeMillis();
 
-    SocketIoProcessor( String threadName )
+    SocketIoProcessor( String threadName, Executor executor )
     {
         this.threadName = threadName;
+        this.executor = executor;
     }
 
     void addNew( SocketSessionImpl session ) throws IOException
@@ -89,7 +93,7 @@
             {
                 selector = Selector.open();
                 worker = new Worker();
-                worker.start();
+                executor.execute( new NamePreservingRunnable( worker ) );
             }
         }
     }
@@ -541,15 +545,12 @@
     }
 
 
-    private class Worker extends Thread
+    private class Worker implements Runnable
     {
-        Worker()
-        {
-            super( SocketIoProcessor.this.threadName );
-        }
-
         public void run()
         {
+            Thread.currentThread().setName( SocketIoProcessor.this.threadName );
+
             for( ; ; )
             {
                 try

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java?view=diff&rev=447151&r1=447150&r2=447151
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java
Sun Sep 17 14:48:06 2006
@@ -35,16 +35,18 @@
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.ExceptionMonitor;
 import org.apache.mina.common.IoAcceptor;
+import org.apache.mina.common.IoFilter.WriteRequest;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoServiceConfig;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.common.IoSessionRecycler;
-import org.apache.mina.common.IoFilter.WriteRequest;
 import org.apache.mina.common.support.BaseIoAcceptor;
 import org.apache.mina.common.support.IoServiceListenerSupport;
 import org.apache.mina.transport.socket.nio.DatagramAcceptorConfig;
 import org.apache.mina.transport.socket.nio.DatagramSessionConfig;
+import org.apache.mina.util.NamePreservingRunnable;
 import org.apache.mina.util.Queue;
+import edu.emory.mathcs.backport.java.util.concurrent.Executor;
 
 /**
  * {@link IoAcceptor} for datagram transport (UDP/IP).
@@ -57,6 +59,7 @@
     private static volatile int nextId = 0;
 
     private final IoAcceptor wrapper;
+    private final Executor executor;
     private final int id = nextId ++ ;
     private Selector selector;
     private final DatagramAcceptorConfig defaultConfig = new DatagramAcceptorConfig();
@@ -69,9 +72,10 @@
     /**
      * Creates a new instance.
      */
-    public DatagramAcceptorDelegate( IoAcceptor wrapper )
+    public DatagramAcceptorDelegate( IoAcceptor wrapper, Executor executor )
     {
         this.wrapper = wrapper;
+        this.executor = executor;
     }
 
     public void bind( SocketAddress address, IoHandler handler, IoServiceConfig config )
@@ -268,7 +272,7 @@
         {
             selector = Selector.open();
             worker = new Worker();
-            worker.start();
+            executor.execute( new NamePreservingRunnable( worker ) );
         }
     }
 
@@ -294,15 +298,12 @@
         }
     }
 
-    private class Worker extends Thread
+    private class Worker implements Runnable
     {
-        public Worker()
-        {
-            super( "DatagramAcceptor-" + id );
-        }
-
         public void run()
         {
+            Thread.currentThread().setName( "DatagramAcceptor-" + id );
+
             for( ;; )
             {
                 try

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnectorDelegate.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnectorDelegate.java?view=diff&rev=447151&r1=447150&r2=447151
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnectorDelegate.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnectorDelegate.java
Sun Sep 17 14:48:06 2006
@@ -28,19 +28,21 @@
 import java.util.Iterator;
 import java.util.Set;
 
+import edu.emory.mathcs.backport.java.util.concurrent.Executor;
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.ConnectFuture;
-import org.apache.mina.common.IoSessionRecycler;
 import org.apache.mina.common.ExceptionMonitor;
 import org.apache.mina.common.IoConnector;
+import org.apache.mina.common.IoFilter.WriteRequest;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoServiceConfig;
 import org.apache.mina.common.IoSession;
-import org.apache.mina.common.IoFilter.WriteRequest;
+import org.apache.mina.common.IoSessionRecycler;
 import org.apache.mina.common.support.BaseIoConnector;
 import org.apache.mina.common.support.DefaultConnectFuture;
 import org.apache.mina.transport.socket.nio.DatagramConnectorConfig;
 import org.apache.mina.transport.socket.nio.DatagramSessionConfig;
+import org.apache.mina.util.NamePreservingRunnable;
 import org.apache.mina.util.Queue;
 
 /**
@@ -54,6 +56,7 @@
     private static volatile int nextId = 0;
 
     private final IoConnector wrapper;
+    private final Executor executor;
     private final int id = nextId ++ ;
     private Selector selector;
     private final DatagramConnectorConfig defaultConfig = new DatagramConnectorConfig();
@@ -66,9 +69,10 @@
     /**
      * Creates a new instance.
      */
-    public DatagramConnectorDelegate( IoConnector wrapper )
+    public DatagramConnectorDelegate( IoConnector wrapper, Executor executor )
     {
         this.wrapper = wrapper;
+        this.executor = executor;
     }
 
     public ConnectFuture connect( SocketAddress address, IoHandler handler, IoServiceConfig
config )
@@ -195,7 +199,7 @@
         {
             selector = Selector.open();
             worker = new Worker();
-            worker.start();
+            executor.execute( new NamePreservingRunnable( worker ) );
         }
     }
 
@@ -313,15 +317,12 @@
         }
     }
     
-    private class Worker extends Thread
+    private class Worker implements Runnable
     {
-        public Worker()
-        {
-            super( "DatagramConnector-" + id );
-        }
-
         public void run()
         {
+            Thread.currentThread().setName( "DatagramConnector-" + id );
+
             for( ;; )
             {
                 try
@@ -597,8 +598,8 @@
                 }
 
                 SelectionKey key = req.channel.register( selector,
-                        SelectionKey.OP_READ, session );
-    
+                                                         SelectionKey.OP_READ, session );
+
                 session.setSelectionKey( key );
 
                 req.setSession( session );
@@ -608,7 +609,7 @@
             {
                 req.setException( t );
             }
-            finally 
+            finally
             {
                 if( !success )
                 {

Added: directory/trunks/mina/core/src/main/java/org/apache/mina/util/NamePreservingRunnable.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/util/NamePreservingRunnable.java?view=auto&rev=447151
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/util/NamePreservingRunnable.java
(added)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/util/NamePreservingRunnable.java
Sun Sep 17 14:48:06 2006
@@ -0,0 +1,50 @@
+/*
+ * 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.mina.util;
+
+/**
+ * A Runnable wrapper that preserves the name of the thread after the runnable is complete
(for Runnables
+ * that change the name of the Thread they use)
+ * 
+ * @author The Apache Directory Project (mina-dev@directory.apache.org)
+ * @version $Rev: 446581 $, $Date: 2006-09-15 11:36:12Z $,
+ */
+public class NamePreservingRunnable implements Runnable
+{
+    private final Runnable runnable;
+
+    public NamePreservingRunnable( Runnable runnable )
+    {
+        this.runnable = runnable;
+    }
+
+    public void run()
+    {
+        String name = Thread.currentThread().getName();
+
+        try
+        {
+            runnable.run();
+        }
+        finally
+        {
+            Thread.currentThread().setName( name );
+        }
+    }
+}

Propchange: directory/trunks/mina/core/src/main/java/org/apache/mina/util/NamePreservingRunnable.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/trunks/mina/core/src/main/java/org/apache/mina/util/NewThreadExecutor.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/util/NewThreadExecutor.java?view=auto&rev=447151
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/util/NewThreadExecutor.java (added)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/util/NewThreadExecutor.java Sun
Sep 17 14:48:06 2006
@@ -0,0 +1,35 @@
+/*
+ * 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.mina.util;
+
+import edu.emory.mathcs.backport.java.util.concurrent.Executor;
+
+/**
+ * An Executor that just launches in a new thread.
+ * 
+ * @author The Apache Directory Project (mina-dev@directory.apache.org)
+ * @version $Rev: 446581 $, $Date: 2006-09-15 11:36:12Z $,
+ */
+public class NewThreadExecutor implements Executor
+{
+    public void execute( Runnable command )
+    {
+        new Thread( command ).start();
+    }
+}

Propchange: directory/trunks/mina/core/src/main/java/org/apache/mina/util/NewThreadExecutor.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message