avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/util/system Windows95.java WindowsNT.java
Date Mon, 11 Feb 2002 21:51:12 GMT
bloritsch    02/02/11 13:51:12

  Modified:    src/scratchpad/org/apache/avalon/excalibur/command
                        TPCThreadManager.java
               src/scratchpad/org/apache/avalon/excalibur/system
                        ContainerManager.java
               src/scratchpad/org/apache/avalon/excalibur/util/system
                        Windows95.java WindowsNT.java
  Log:
  fix some compile errors, and integrate SystemUtil with ContainerManager
  
  Revision  Changes    Path
  1.6       +2 -12     jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/command/TPCThreadManager.java
  
  Index: TPCThreadManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/command/TPCThreadManager.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TPCThreadManager.java	5 Feb 2002 22:19:06 -0000	1.5
  +++ TPCThreadManager.java	11 Feb 2002 21:51:12 -0000	1.6
  @@ -13,6 +13,7 @@
   import org.apache.avalon.excalibur.concurrent.Mutex;
   import org.apache.avalon.excalibur.thread.*;
   import org.apache.avalon.excalibur.thread.impl.ResourceLimitingThreadPool;
  +import org.apache.avalon.excalibur.util.SystemUtil;
   
   import org.apache.avalon.excalibur.event.Source;
   import org.apache.avalon.excalibur.event.EventHandler;
  @@ -44,18 +45,7 @@
        */
       public TPCThreadManager()
       {
  -        this( Integer.parseInt( System.getProperty( "os.arch.cpus", "1" ) ) , 1 );
  -    }
  -
  -    /**
  -     * This constructor assumes there is a parameter named "os.arch.cpus"
  -     * that has a default for the number of CPUs on a system.  Otherwise, the value
  -     * is 1.
  -     */
  -    public TPCThreadManager(Parameters params)
  -    {
  -        this( params.getParameterAsInteger( "os.arch.cpus", 1 ) ,
  -              params.getParameterAsInteger( "container.threadsPerCPU", 2 ) );
  +        this( SystemUtil.numProcessors() );
       }
   
       /**
  
  
  
  1.21      +8 -14     jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/ContainerManager.java
  
  Index: ContainerManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/ContainerManager.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- ContainerManager.java	5 Feb 2002 22:19:06 -0000	1.20
  +++ ContainerManager.java	11 Feb 2002 21:51:12 -0000	1.21
  @@ -17,6 +17,7 @@
   import org.apache.avalon.excalibur.logger.LoggerManager;
   import org.apache.avalon.excalibur.logger.LogKitLoggerManager;
   import org.apache.avalon.excalibur.util.ComponentStateValidator;
  +import org.apache.avalon.excalibur.util.SystemUtil;
   import org.apache.avalon.excalibur.source.*;
   import org.apache.avalon.excalibur.command.*;
   import org.apache.avalon.excalibur.pool.*;
  @@ -105,18 +106,10 @@
    *       by the ThreadManager per CPU.  This defaults to 2.
    *     </td>
    *   </tr>
  - *   <tr>
  - *     <td><code>CPU_COUNT</code></td>
  - *     <td>
  - *       <code>Integer</code> representing the number of CPUs on a machine.
 The
  - *       value is used in efficiency calculations, and determining the number of
  - *       threads to have running for the CommandManager.  Defaults to <code>1</code>.
  - *     </td>
  - *   </tr>
    * </table>
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.20 $ $Date: 2002/02/05 22:19:06 $
  + * @version CVS $Revision: 1.21 $ $Date: 2002/02/11 21:51:12 $
    */
   public class ContainerManager implements Disposable
   {
  @@ -126,9 +119,9 @@
       public static final String LOGKIT_CONFIG     = "container.loggerConfig";
       public static final String ROLE_CONFIG       = "container.roles";
       public static final String THREADS_CPU       = "container.threadsPerCPU";
  +    public static final String THREAD_TIMEOUT    = "container.threadTimeout";
       public static final String CONTAINER_CONFIG  = "container.configFile";
       public static final String LOG_CATEGORY      = "container.logCategory";
  -    public static final String CPU_COUNT         = "os.arch.cpus";
   
       private static final Configuration EMPTY_CONFIG;
   
  @@ -197,7 +190,11 @@
           m_contextDirectory = new File(initialParameters.getParameter( CONTEXT_DIRECTORY,
"./" ) );
           m_workDirectory = new File( initialParameters.getParameter( CONTEXT_DIRECTORY,
"/tmp" ) );
           m_commandManager = new CommandManager();
  -        m_threadManager = new TPCThreadManager( initialParameters );
  +        m_threadManager = new TPCThreadManager(
  +            SystemUtil.numProcessors(),
  +            initialParameters.getParameterAsInteger( THREADS_CPU, 1 ),
  +            initialParameters.getParameterAsInteger( THREAD_TIMEOUT, 1000 )
  +        );
           m_threadManager.register( m_commandManager );
           m_poolManager = new DefaultPoolManager( m_commandManager.getCommandQueue() );
   
  @@ -390,9 +387,6 @@
               DefaultContext context = new DefaultContext();
               context.put( CONTEXT_DIRECTORY, m_contextDirectory );
               context.put( WORK_DIRECTORY, m_workDirectory );
  -            context.put( CPU_COUNT,
  -                    new Integer(m_initialParameters.getParameterAsInteger( CPU_COUNT, 1
) )
  -            );
               context.put( LOG_CATEGORY,
                       m_initialParameters.getParameter(LOG_CATEGORY, null)
               );
  
  
  
  1.2       +2 -2      jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/util/system/Windows95.java
  
  Index: Windows95.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/util/system/Windows95.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Windows95.java	11 Feb 2002 21:37:24 -0000	1.1
  +++ Windows95.java	11 Feb 2002 21:51:12 -0000	1.2
  @@ -19,14 +19,14 @@
    * Windows versions, but I only have one to test.
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2002/02/11 21:37:24 $
  + * @version CVS $Revision: 1.2 $ $Date: 2002/02/11 21:51:12 $
    */
   public final class Windows95 implements CPUParser
   {
       private final int    m_processors;
       private final String m_cpuInfo;
   
  -    public Windows2000()
  +    public Windows95()
       {
           int procs = 1;
           String info = "";
  
  
  
  1.2       +3 -3      jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/util/system/WindowsNT.java
  
  Index: WindowsNT.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/util/system/WindowsNT.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WindowsNT.java	11 Feb 2002 21:37:24 -0000	1.1
  +++ WindowsNT.java	11 Feb 2002 21:51:12 -0000	1.2
  @@ -19,14 +19,14 @@
    * Windows versions, but I only have one to test.
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2002/02/11 21:37:24 $
  + * @version CVS $Revision: 1.2 $ $Date: 2002/02/11 21:51:12 $
    */
  -public final class Windows2000 implements CPUParser
  +public final class WindowsNT implements CPUParser
   {
       private final int    m_processors;
       private final String m_cpuInfo;
   
  -    public Windows2000()
  +    public WindowsNT()
       {
           int procs = 1;
           String info = "";
  
  
  

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


Mime
View raw message