Skip to Content.
Sympa Menu

notify-dpml - r960 - trunk/main/metro/runtime/src/main/net/dpml/metro/runtime

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: r960 - trunk/main/metro/runtime/src/main/net/dpml/metro/runtime
  • Date: Tue, 24 Jan 2006 10:59:59 +0100

Author: mcconnell
Date: 2006-01-24 10:59:58 +0100 (Tue, 24 Jan 2006)
New Revision: 960

Modified:

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentHandler.java

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionController.java

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentModel.java

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultContextModel.java

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultProvider.java

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/UnicastEventSource.java
Log:
add rmi unexport to the disposal semantics of the metro component model

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java
2006-01-24 09:30:29 UTC (rev 959)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java
2006-01-24 09:59:58 UTC (rev 960)
@@ -102,15 +102,18 @@
/**
* Create a new runtime handler using a supplied context.
* @param model the managed context
+ * @param flag if true the component model is responsible for model
lifecycle
* @return the runtime handler
*/
- public ComponentHandler createComponentHandler( ComponentModel model )
throws ControlException
+ public ComponentHandler createComponentHandler(
+ ComponentModel model, boolean flag ) throws ControlException
{
ClassLoader anchor = Thread.currentThread().getContextClassLoader();
- return createComponentHandler( anchor, model );
+ return createComponentHandler( anchor, model, flag );
}

- public ClassLoader createClassLoader( ClassLoader anchor, ComponentModel
model ) throws ControlException
+ public ClassLoader createClassLoader(
+ ClassLoader anchor, ComponentModel model ) throws ControlException
{
try
{
@@ -166,9 +169,10 @@
* @param context the managed context
* @return the runtime handler
*/
- ComponentHandler createComponentHandler( ClassLoader anchor,
ComponentModel context ) throws ControlException
+ ComponentHandler createComponentHandler(
+ ClassLoader anchor, ComponentModel context, boolean flag ) throws
ControlException
{
- return createComponentHandler( null, anchor, context );
+ return createComponentHandler( null, anchor, context, flag );
}

/**
@@ -179,7 +183,8 @@
* @return the runtime handler
*/
ComponentHandler createComponentHandler(
- Component parent, ClassLoader anchor, ComponentModel context ) throws
ControlException
+ Component parent, ClassLoader anchor, ComponentModel context, boolean
flag )
+ throws ControlException
{
try
{
@@ -188,7 +193,7 @@
Logger logger = new StandardLogger( path.substring( 1 ).replace(
'/', '.' ) );
final ClassLoaderDirective directive =
context.getClassLoaderDirective();
ClassLoader classloader = createClassLoader( anchor, directive,
name );
- return new ComponentHandler( parent, classloader, logger, this,
context );
+ return new ComponentHandler( parent, classloader, logger, this,
context, flag );
}
catch( RemoteException e )
{

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentHandler.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentHandler.java
2006-01-24 09:30:29 UTC (rev 959)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentHandler.java
2006-01-24 09:59:58 UTC (rev 960)
@@ -27,6 +27,8 @@
import java.lang.reflect.InvocationTargetException;
import java.net.URI;
import java.rmi.RemoteException;
+import java.rmi.NoSuchObjectException;
+import java.rmi.server.UnicastRemoteObject;
import java.util.EventObject;
import java.util.Map;
import java.util.Hashtable;
@@ -127,6 +129,7 @@
private final Map m_cache = new Hashtable(); // context entry/value cache

private final DefaultPartsManager m_parts;
+ private final boolean m_flag;


//--------------------------------------------------------------------------
// mutable state
@@ -140,7 +143,7 @@

ComponentHandler(
final Component parent, final ClassLoader classloader, final Logger
logger,
- final ComponentController control, final ComponentModel model )
+ final ComponentController control, final ComponentModel model, boolean
flag )
throws RemoteException, ControlException
{
super( logger );
@@ -151,6 +154,7 @@
m_controller = control;
m_model = model;
m_path = model.getContextPath();
+ m_flag = flag;

m_support = new PropertyChangeSupport( this );
model.addModelListener( this );
@@ -582,6 +586,14 @@
{
getLogger().debug( "disposal" );
m_holder.dispose();
+ if( m_flag )
+ {
+ if( m_model instanceof Disposable )
+ {
+ Disposable disposable = (Disposable) m_model;
+ disposable.dispose();
+ }
+ }
super.dispose();
}
}

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionController.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionController.java
2006-01-24 09:30:29 UTC (rev 959)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionController.java
2006-01-24 09:59:58 UTC (rev 960)
@@ -185,7 +185,7 @@
public Component createComponent( URI uri ) throws Exception
{
Model model = createModel( uri );
- return createComponent( model );
+ return createComponent( model, true );
}

/**
@@ -196,10 +196,22 @@
*/
public Component createComponent( Model model ) throws Exception
{
+ return createComponent( model, false );
+ }
+
+ /**
+ * Create and return a remote reference to a component handler.
+ * @param model the component model
+ * @param flag if true the component is responsible for model retraction
+ * @return the component handler
+ * @exception Exception if an error occurs during component creation
+ */
+ private Component createComponent( Model model, boolean flag ) throws
Exception
+ {
if( model instanceof ComponentModel )
{
ComponentModel componentModel = (ComponentModel) model;
- return m_controller.createComponentHandler( componentModel );
+ return m_controller.createComponentHandler( componentModel, flag
);
}
else
{
@@ -349,7 +361,6 @@
getLogger().debug( "initating controller disposal" );
m_context.removeControllerContextListener( m_listener );
m_dispatch.dispose();
- getLogger().debug( "disposal complete" );
}

/**

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentModel.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentModel.java
2006-01-24 09:30:29 UTC (rev 959)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultComponentModel.java
2006-01-24 09:59:58 UTC (rev 960)
@@ -124,7 +124,8 @@
if( part instanceof ComponentDirective )
{
ComponentDirective component = (ComponentDirective) part;
- ComponentModel model = m_controller.createComponentModel(
m_classloader, base, component );
+ ComponentModel model =
+ m_controller.createComponentModel( m_classloader, base,
component );
m_parts.put( key, model );
}
else
@@ -400,9 +401,19 @@
}

//
------------------------------------------------------------------------
+ // Disposable
+ //
------------------------------------------------------------------------
+
+ public void dispose()
+ {
+ m_context.dispose();
+ super.dispose();
+ }
+
+ //
------------------------------------------------------------------------
// internals
//
------------------------------------------------------------------------
-
+
private String[] getPartKeys( Type type )
{
PartReference[] references = m_type.getPartReferences();

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultContextModel.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultContextModel.java
2006-01-24 09:30:29 UTC (rev 959)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultContextModel.java
2006-01-24 09:59:58 UTC (rev 960)
@@ -83,7 +83,8 @@
* @exception RemoteException if a remote I/O error occurs
*/
DefaultContextModel(
- DefaultComponentModel parent, Logger logger, ClassLoader classloader,
Type type, ContextDirective directive )
+ DefaultComponentModel parent, Logger logger, ClassLoader classloader,
+ Type type, ContextDirective directive )
throws ModelException, RemoteException
{
super( logger );
@@ -314,7 +315,7 @@
//
------------------------------------------------------------------------
// internals
//
------------------------------------------------------------------------
-
+
private void validatePartReferences( final PartReference[] references )
throws UnknownKeyException
{
int n = references.length;

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultProvider.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultProvider.java
2006-01-24 09:30:29 UTC (rev 959)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/DefaultProvider.java
2006-01-24 09:59:58 UTC (rev 960)
@@ -288,7 +288,7 @@
return m_activated;
}

- void dispose()
+ public void dispose()
{
synchronized( getLock() )
{

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/UnicastEventSource.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/UnicastEventSource.java
2006-01-24 09:30:29 UTC (rev 959)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/UnicastEventSource.java
2006-01-24 09:59:58 UTC (rev 960)
@@ -26,6 +26,8 @@

import net.dpml.logging.Logger;

+import net.dpml.part.Disposable;
+
/**
* A abstract base class that established an event queue and handles event
dispatch
* operations for listeners declared in a class extending this base class.
@@ -33,7 +35,7 @@
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
-public abstract class UnicastEventSource extends UnicastRemoteObject
+public abstract class UnicastEventSource extends UnicastRemoteObject
implements Disposable
{
/**
* Registered event listeners.
@@ -174,7 +176,7 @@
/**
* Dispose of the event source.
*/
- void dispose()
+ public void dispose()
{
if( m_disposed )
{




  • r960 - trunk/main/metro/runtime/src/main/net/dpml/metro/runtime, mcconnell at BerliOS, 01/24/2006

Archive powered by MHonArc 2.6.24.

Top of Page