avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/lookup FortressServiceManager.java FortressServiceSelector.java
Date Sat, 09 Nov 2002 03:09:53 GMT
donaldp     2002/11/08 19:09:53

  Modified:    fortress/src/java/org/apache/excalibur/fortress/handler
                        AbstractComponentHandler.java
               fortress/src/java/org/apache/excalibur/fortress/lookup
                        FortressServiceManager.java
                        FortressServiceSelector.java
  Log:
  Make sure initialization occurs inside get() rather than requiring all users initialize
it before calling get()
  
  Revision  Changes    Path
  1.29      +6 -5      jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/handler/AbstractComponentHandler.java
  
  Index: AbstractComponentHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/handler/AbstractComponentHandler.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- AbstractComponentHandler.java	8 Nov 2002 02:32:31 -0000	1.28
  +++ AbstractComponentHandler.java	9 Nov 2002 03:09:52 -0000	1.29
  @@ -206,11 +206,12 @@
       public Object get()
           throws Exception
       {
  -        if( !m_initialized )
  +        synchronized( this )
           {
  -            final String message =
  -                "You cannot get a component from an uninitialized holder";
  -            throw new IllegalStateException( message );
  +            if( !m_initialized )
  +            {
  +                initialize();
  +            }
           }
   
           if( m_disposed )
  
  
  
  1.23      +1 -6      jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/lookup/FortressServiceManager.java
  
  Index: FortressServiceManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/lookup/FortressServiceManager.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- FortressServiceManager.java	9 Nov 2002 02:54:54 -0000	1.22
  +++ FortressServiceManager.java	9 Nov 2002 03:09:52 -0000	1.23
  @@ -124,11 +124,6 @@
           try
           {
               final ComponentHandler handler = (ComponentHandler)result;
  -            if( !handler.isInitialized() )
  -            {
  -                ContainerUtil.initialize( handler );
  -            }
  -
               final Object component = handler.get();
               m_used.put( component, handler );
               return component;
  
  
  
  1.15      +8 -9      jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/lookup/FortressServiceSelector.java
  
  Index: FortressServiceSelector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/lookup/FortressServiceSelector.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- FortressServiceSelector.java	8 Nov 2002 02:32:31 -0000	1.14
  +++ FortressServiceSelector.java	9 Nov 2002 03:09:53 -0000	1.15
  @@ -85,23 +85,22 @@
       {
           if( null == hint )
           {
  -            throw new IllegalArgumentException( "hint cannot be null" );
  +            final String message = "hint cannot be null";
  +            throw new IllegalArgumentException( message );
           }
   
  -        final ComponentHandler handler = (ComponentHandler)m_components.get( m_role, hint
);
  +        final ComponentHandler handler =
  +            (ComponentHandler)m_components.get( m_role, hint );
           if( null == handler )
           {
  +            final String message =
  +                "The hint does not exist in the ComponentSelector";
               throw new ServiceException( m_role + "/" + hint.toString(),
  -                                        "The hint does not exist in the ComponentSelector"
);
  +                                        message );
           }
   
           try
           {
  -            if( !handler.isInitialized() )
  -            {
  -                ContainerUtil.initialize( handler );
  -            }
  -
               final Object component = handler.get();
               m_used.put( component, handler );
               return component;
  
  
  

--
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