Hello Berin!
BL> If we don't get any more patches in 24 hours, I will put it up for vote again.
Plz don't cout this one, it's quite cosmetic, but something that I
personally will probably use in the future. Yes, and Shash seems to
have reported that they have been quite active with producing
additional lifecycle interfaces, so this may really find people who
will use it, I think.
--- AbstractContainer.orig 2003-05-29 22:09:54.000000000 +0400
+++ AbstractContainer.java 2003-05-29 23:28:48.000000000 +0400
@@ -285,18 +285,8 @@
extLogger.debug( message );
}
- /**
- * We do need a new InstrumentableCreator, as we want strictly our
- * m_instrumentManager to be engaged. We assume there is no
- * InstrumentableCreator in the LifecycleExtensionManager passed to us
- * already. If there is one this is probably a bug. Not testing this
currently,
- * although might test this in the future in order to
- * throw something like an IllegalArgumentException.
- */
- m_extManager.addCreatorExtension( new InstrumentableCreator(
m_instrumentManager ) );
-
- // just to be on the safe side
- m_extManager.makeReadOnly();
+ // m_extManager will intentionally remain writeable until
+ // made read-only in initialize()
}
/**
@@ -615,6 +605,12 @@
public void initialize()
throws CompositeException, Exception
{
+ // let derived containers add their own lifecycle extensions
+ provideLifecycleExtensions( m_extManager );
+
+ // make m_extManager read-only to be on the safe side
+ m_extManager.makeReadOnly();
+
// go over all components
final Iterator i = m_components.iterator();
final BoundedFifoBuffer buffer = new BoundedFifoBuffer( Math.max(
m_components.size(), 1 ) );
@@ -852,4 +848,33 @@
/* the default implementation: just use the same as for container itself */
return parent;
}
+
+ /**
+ * Override his method to manage the set of lifecycle extensions.
+ * As the contract of managing lifecycle extensions has not solidified
+ * yet this method allowes you do anything with the set of extensions
+ * supplied by our manager (container manager or parent container):
+ * add and remove them as you like. Note however that
+ * InstrumentableCreatro should always be added as in this default
+ * implementation not to upset the Instrumentable and InstrumentManageable
+ * components we will create.
+ * This method is called from withing initialize().
+ * @param extManager a copy of the LifecycleExtensionManager provided by
+ * our manager (container manager or parent container)
+ * or a new empty one if none has been provided.
+ */
+ protected void provideLifecycleExtensions( final LifecycleExtensionManager
extManager )
+ throws Exception
+ {
+ /**
+ * AbstractContainer adds only one extension, the InstrumentableCreator.
+ * We do need a new InstrumentableCreator, as we want strictly our
+ * m_instrumentManager to be engaged. We assume there is no
+ * InstrumentableCreator in the LifecycleExtensionManager passed to us
+ * already. If there is one this is probably a bug. Not testing this
currently,
+ * although might test this in the future in order to
+ * throw something like an IllegalArgumentException.
+ */
+ extManager.addCreatorExtension( new InstrumentableCreator(
m_instrumentManager ) );
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]