You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by tr...@apache.org on 2006/09/20 08:33:54 UTC

svn commit: r448093 - /directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java

Author: trustin
Date: Tue Sep 19 23:33:53 2006
New Revision: 448093

URL: http://svn.apache.org/viewvc?view=rev&rev=448093
Log:
Changed the time unit of worker timeout to seconds (from milliseconds)

Modified:
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java

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=448093&r1=448092&r2=448093
==============================================================================
--- 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 Tue Sep 19 23:33:53 2006
@@ -70,7 +70,7 @@
     private Selector selector;
     private Worker worker;
     private int processorDistributor = 0;
-    private long workerTimeout = 1000L * 60;
+    private int workerTimeout = 60;  // 1 min.
 
     /**
      * Create a connector with a single processing thread using a NewThreadExecutor 
@@ -104,25 +104,25 @@
     }
 
     /**
-     * How many milliseconds to keep the connection thread alive between connection requests
+     * How many seconds to keep the connection thread alive between connection requests
      *
-     * @return Number of milliseconds to keep connection thread alive
+     * @return Number of seconds to keep connection thread alive
      */
-    public long getWorkerTimeout()
+    public int getWorkerTimeout()
     {
         return workerTimeout;
     }
 
     /**
-     * Set how many milliseconds the connection worker thread should remain alive once idle before terminating itself.
+     * Set how many seconds the connection worker thread should remain alive once idle before terminating itself.
      *
-     * @param workerTimeout Number of milliseconds to keep thread alive. Must be >=0
+     * @param workerTimeout Number of seconds to keep thread alive. Must be >=0
      */
-    public void setWorkerTimeout( long workerTimeout )
+    public void setWorkerTimeout( int workerTimeout )
     {
         if( workerTimeout < 0 )
         {
-            throw new IllegalArgumentException( "Must be > 0" );
+            throw new IllegalArgumentException( "Must be >= 0" );
         }
         this.workerTimeout = workerTimeout;
     }
@@ -401,7 +401,7 @@
 
                     if( selector.keys().isEmpty() )
                     {
-                        if( System.currentTimeMillis() - lastActive > workerTimeout )
+                        if( System.currentTimeMillis() - lastActive > workerTimeout * 1000L )
                         {
                             synchronized( lock )
                             {