avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: avalon-excalibur/event/src/java/org/apache/excalibur/util SystemUtil.java
Date Thu, 12 Jun 2003 13:49:23 GMT
bloritsch    2003/06/12 06:49:23

  Modified:    event/src/java/org/apache/excalibur/event/command
                        TPCThreadManager.java
               event/src/java/org/apache/excalibur/util SystemUtil.java
  Log:
  Start the pooled executor with defaults that will allow it to grow on demand.  Also remove
an unnecessary check.
  
  Revision  Changes    Path
  1.41      +7 -10     avalon-excalibur/event/src/java/org/apache/excalibur/event/command/TPCThreadManager.java
  
  Index: TPCThreadManager.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/event/src/java/org/apache/excalibur/event/command/TPCThreadManager.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- TPCThreadManager.java	2 Jun 2003 19:26:09 -0000	1.40
  +++ TPCThreadManager.java	12 Jun 2003 13:49:23 -0000	1.41
  @@ -108,25 +108,21 @@
        */
       public void parameterize( Parameters parameters ) throws ParameterException
       {
  -        this.m_processors = parameters.getParameterAsInteger( "processors", -1 );
  -        if( this.m_processors < 1 )
  -        {
  -            this.m_processors = Math.max( 1, SystemUtil.numProcessors() );
  -        }
  +        m_processors = Math.max(1, parameters.getParameterAsInteger( "processors", 1 )
);
   
  -        this.m_threadsPerProcessor =
  +        m_threadsPerProcessor =
               Math.max( parameters.getParameterAsInteger( "threads-per-processor", 1 ), 1
);
   
           setSleepTime( parameters.getParameterAsLong( "sleep-time", 1000L ) );
   
  -        this.m_hardShutdown = ( parameters.getParameterAsBoolean( "force-shutdown", false
) );
  +        m_hardShutdown = ( parameters.getParameterAsBoolean( "force-shutdown", false )
);
       }
   
       public void initialize() throws Exception
       {
  -        if( this.m_processors < 1 )
  +        if( m_processors < 1 )
           {
  -            this.m_processors = Math.max( 1, SystemUtil.numProcessors() );
  +            m_processors = Math.max( 1, SystemUtil.numProcessors() );
           }
   
           if( isInitialized() )
  @@ -134,8 +130,9 @@
               throw new IllegalStateException( "ThreadManager is already initailized" );
           }
   
  -        m_threadPool = new PooledExecutor(( m_processors * m_threadsPerProcessor ) + 1);
  +        m_threadPool = new PooledExecutor( m_processors + 1 );
           m_threadPool.setMinimumPoolSize( 2 ); // at least two threads
  +        m_threadPool.setMaximumPoolSize( ( m_processors * m_threadsPerProcessor ) + 1 );
           m_threadPool.setKeepAliveTime( getSleepTime() );
           m_threadPool.waitWhenBlocked();
   
  
  
  
  1.8       +1 -1      avalon-excalibur/event/src/java/org/apache/excalibur/util/SystemUtil.java
  
  Index: SystemUtil.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/event/src/java/org/apache/excalibur/util/SystemUtil.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message