You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by sy...@apache.org on 2003/12/11 15:15:33 UTC

cvs commit: avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component ComponentHandler.java

sylvain     2003/12/11 06:15:33

  Modified:    component/src/java/org/apache/avalon/excalibur/component
                        ComponentHandler.java
  Log:
  Ensure handlers always have an instrument name (caused a NPE)
  
  Revision  Changes    Path
  1.2       +8 -2      avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component/ComponentHandler.java
  
  Index: ComponentHandler.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component/ComponentHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ComponentHandler.java	9 Nov 2003 12:45:26 -0000	1.1
  +++ ComponentHandler.java	11 Dec 2003 14:15:33 -0000	1.2
  @@ -374,7 +374,12 @@
               throw new Exception( "[CONFLICT] lifestyle interfaces: " + componentInstance.getClass().getName() );
           }
   
  -        return new ThreadSafeComponentHandler( componentInstance );
  +        ThreadSafeComponentHandler handler = new ThreadSafeComponentHandler( componentInstance );
  +        
  +        // Use the class name as intrument name
  +        handler.setInstrumentableName( componentInstance.getClass().getName() );
  +        
  +        return handler;
       }
   
       /*---------------------------------------------------------------
  @@ -386,6 +391,7 @@
       public ComponentHandler()
       {
           // Initialize the Instrumentable elements.
  +        setInstrumentableName( "unnamed handler" );
           addInstrument( m_referencesInstrument = new ValueInstrument( "references" ) );
           addInstrument( m_getsInstrument = new CounterInstrument( "gets" ) );
           addInstrument( m_putsInstrument = new CounterInstrument( "puts" ) );
  
  
  

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