avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifestyle AbstractLifestyleHandler.java LifestyleHandler.java SingletonLifestyleHandler.java ThreadLocalLifestyleHandler.java TransientLifestyleHandler.java
Date Tue, 17 Dec 2002 04:57:21 GMT
mcconnell    2002/12/16 20:57:21

  Modified:    assembly/src/java/org/apache/avalon/assembly/lifestyle
                        AbstractLifestyleHandler.java LifestyleHandler.java
                        SingletonLifestyleHandler.java
                        ThreadLocalLifestyleHandler.java
                        TransientLifestyleHandler.java
  Log:
  Added support for handler termination and associated object decommissioning.
  
  Revision  Changes    Path
  1.9       +22 -4     avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifestyle/AbstractLifestyleHandler.java
  
  Index: AbstractLifestyleHandler.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifestyle/AbstractLifestyleHandler.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AbstractLifestyleHandler.java	14 Dec 2002 21:04:41 -0000	1.8
  +++ AbstractLifestyleHandler.java	17 Dec 2002 04:57:20 -0000	1.9
  @@ -220,11 +220,20 @@
       public abstract Object access( StageDescriptor stage ) throws LifestyleException;
   
      /**
  -    * Release an a service or handler established by the appliance.
  +    * Release an a service or handler established by the appliance.  The 
  +    * default implementation irreversably decommissions the supplied object.
       * @param object the service to be released
       */
  -    public abstract void release( Object object );
  -
  +    public void release( Object object )
  +    {
  +        if( getLogger().isDebugEnabled() )
  +        {
  +            final String debug = "release: " + getAppliance();
  +            getLogger().debug( debug );
  +        }
  +        processReleaseStage( object );
  +        m_deployment.decommission( getAppliance(), object );
  +    }
   
       //==============================================================
       // Disposable
  @@ -470,4 +479,13 @@
           }
           return table;
       }
  +
  +   /**
  +    * Terminate the appliance.
  +    */
  +    public void terminate()
  +    {
  +        dispose();
  +    }
  +
   }
  
  
  
  1.4       +6 -1      avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifestyle/LifestyleHandler.java
  
  Index: LifestyleHandler.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifestyle/LifestyleHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LifestyleHandler.java	14 Dec 2002 21:04:41 -0000	1.3
  +++ LifestyleHandler.java	17 Dec 2002 04:57:20 -0000	1.4
  @@ -85,4 +85,9 @@
       */
       void release( Object object );
   
  +   /**
  +    * Terminate the handler.
  +    */
  +    void terminate();
  +
   }
  
  
  
  1.7       +2 -10     avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifestyle/SingletonLifestyleHandler.java
  
  Index: SingletonLifestyleHandler.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifestyle/SingletonLifestyleHandler.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SingletonLifestyleHandler.java	14 Dec 2002 21:04:41 -0000	1.6
  +++ SingletonLifestyleHandler.java	17 Dec 2002 04:57:20 -0000	1.7
  @@ -126,7 +126,6 @@
       {
       }
   
  -
       //==============================================================
       // Disposable
       //==============================================================
  @@ -138,14 +137,7 @@
       {
           if( m_instance != null )
           {
  -            if( getLogger().isDebugEnabled() )
  -            {
  -                final String debug =
  -                  "release in appliance: " 
  -                     + getAppliance().getProfile().getName();
  -                getLogger().debug( debug );
  -            }
  -            super.processReleaseStage( m_instance );
  +            super.release( m_instance );
               m_instance = null;
           }
           super.dispose();
  
  
  
  1.5       +9 -0      avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifestyle/ThreadLocalLifestyleHandler.java
  
  Index: ThreadLocalLifestyleHandler.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifestyle/ThreadLocalLifestyleHandler.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ThreadLocalLifestyleHandler.java	12 Dec 2002 00:32:32 -0000	1.4
  +++ ThreadLocalLifestyleHandler.java	17 Dec 2002 04:57:20 -0000	1.5
  @@ -156,4 +156,13 @@
               }
           }
       }
  +
  +    public void terminate()
  +    {
  +        if( m_instance != null )
  +        {
  +            super.release( m_instance.get() );
  +            m_instance = null;
  +        }
  +    }
   }
  
  
  
  1.5       +2 -2      avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifestyle/TransientLifestyleHandler.java
  
  Index: TransientLifestyleHandler.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifestyle/TransientLifestyleHandler.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TransientLifestyleHandler.java	14 Dec 2002 21:04:41 -0000	1.4
  +++ TransientLifestyleHandler.java	17 Dec 2002 04:57:20 -0000	1.5
  @@ -125,7 +125,7 @@
       */
       public void release( Object object )
       {
  -        super.processReleaseStage( object );
  +        super.release( object );
           synchronized( m_instances )
           {
               m_instances.remove( object );
  
  
  

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