directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r448093 - /directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java
Date Wed, 20 Sep 2006 06:33:54 GMT
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 )
                             {



Mime
View raw message