[jboss-svn-commits] JBL Code SVN: r10251 - labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Mar 15 23:46:30 EDT 2007
Author: bill.burke at jboss.com
Date: 2007-03-15 23:46:30 -0400 (Thu, 15 Mar 2007)
New Revision: 10251
Modified:
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java
Log:
formatting
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java 2007-03-16 03:39:50 UTC (rev 10250)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java 2007-03-16 03:46:30 UTC (rev 10251)
@@ -25,203 +25,218 @@
/**
* Controller class to manage the lifecycles of a set of managed instances.
+ *
* @author kevin
*/
public class ManagedLifecycleController
{
- /**
- * The managed lifecycle instances.
- */
- private final ManagedLifecycle[] instances ;
-
- /**
- * Construct the controller to manage the specified managed lifecycle instances.
- * @param lifecycles The managed lifecycle instances.
- */
- public ManagedLifecycleController(final Collection<ManagedLifecycle> lifecycles)
- {
- final int numInstances = (lifecycles == null ? 0 : lifecycles.size()) ;
- instances = lifecycles.toArray(new ManagedLifecycle[numInstances]) ;
- }
-
- /**
- * Start the lifecyles for the managed instances.
- * <p/>
- * The managed instances will be left in the destroyed state if an error occurs.
- * @throws ManagedLifecycleException For errors during the lifecycle start.
- */
- public void start()
- throws ManagedLifecycleException
- {
- initialiseInstances() ;
- startInstances() ;
- }
-
- /**
- * Restart the lifecyles for the managed instances.
- * <p/>
- * The managed instances will be left in the destroyed state if an error occurs.
- * @throws ManagedLifecycleException For errors during the lifecycle restart.
- */
- public void restart()
- throws ManagedLifecycleException
- {
- stopInstances() ;
- startInstances() ;
- }
-
- /**
- * Stop the lifecyles for the managed instances.
- * <p/>
- * The managed instances will be left in the destroyed state if an error occurs.
- * @throws ManagedLifecycleException For errors during the lifecycle stop.
- */
- public void stop()
- throws ManagedLifecycleException
- {
- stopInstances() ;
- destroyInstances() ;
- }
-
- /**
- * Initialise the managed instances.
- * @throws ManagedLifecycleException For errors during initialisation.
- */
- private void initialiseInstances()
- throws ManagedLifecycleException
- {
- final int numInstances = instances.length ;
- for(int count = 0 ; count < numInstances ; count++)
- {
- final ManagedLifecycle instance = instances[count] ;
- try
+ /**
+ * The managed lifecycle instances.
+ */
+ private final ManagedLifecycle[] instances;
+
+ /**
+ * Construct the controller to manage the specified managed lifecycle instances.
+ *
+ * @param lifecycles The managed lifecycle instances.
+ */
+ public ManagedLifecycleController(final Collection<ManagedLifecycle> lifecycles)
+ {
+ final int numInstances = (lifecycles == null ? 0 : lifecycles.size());
+ instances = lifecycles.toArray(new ManagedLifecycle[numInstances]);
+ }
+
+ /**
+ * Start the lifecyles for the managed instances.
+ * <p/>
+ * The managed instances will be left in the destroyed state if an error occurs.
+ *
+ * @throws ManagedLifecycleException For errors during the lifecycle start.
+ */
+ public void start()
+ throws ManagedLifecycleException
+ {
+ initialiseInstances();
+ startInstances();
+ }
+
+ /**
+ * Restart the lifecyles for the managed instances.
+ * <p/>
+ * The managed instances will be left in the destroyed state if an error occurs.
+ *
+ * @throws ManagedLifecycleException For errors during the lifecycle restart.
+ */
+ public void restart()
+ throws ManagedLifecycleException
+ {
+ stopInstances();
+ startInstances();
+ }
+
+ /**
+ * Stop the lifecyles for the managed instances.
+ * <p/>
+ * The managed instances will be left in the destroyed state if an error occurs.
+ *
+ * @throws ManagedLifecycleException For errors during the lifecycle stop.
+ */
+ public void stop()
+ throws ManagedLifecycleException
+ {
+ stopInstances();
+ destroyInstances();
+ }
+
+ /**
+ * Initialise the managed instances.
+ *
+ * @throws ManagedLifecycleException For errors during initialisation.
+ */
+ private void initialiseInstances()
+ throws ManagedLifecycleException
+ {
+ final int numInstances = instances.length;
+ for (int count = 0; count < numInstances; count++)
+ {
+ final ManagedLifecycle instance = instances[count];
+ try
+ {
+ instance.initialise();
+ }
+ catch (final ManagedLifecycleException mle)
+ {
+ if (count > 0)
{
- instance.initialise() ;
+ destroyInstances(count - 1);
}
- catch (final ManagedLifecycleException mle)
+ throw mle;
+ }
+ }
+ }
+
+ /**
+ * Start the managed instances.
+ *
+ * @throws ManagedLifecycleException For errors during starting.
+ */
+ private void startInstances()
+ throws ManagedLifecycleException
+ {
+ final int numInstances = instances.length;
+ for (int count = 0; count < numInstances; count++)
+ {
+ final ManagedLifecycle instance = instances[count];
+ try
+ {
+ instance.start();
+ }
+ catch (final ManagedLifecycleException mle)
+ {
+ if (count > 0)
{
- if (count > 0)
- {
- destroyInstances(count-1) ;
- }
- throw mle ;
+ stopInstances(count - 1);
+ destroyInstances(numInstances - 1);
}
- }
- }
-
- /**
- * Start the managed instances.
- * @throws ManagedLifecycleException For errors during starting.
- */
- private void startInstances()
- throws ManagedLifecycleException
- {
- final int numInstances = instances.length ;
- for(int count = 0 ; count < numInstances ; count++)
- {
- final ManagedLifecycle instance = instances[count] ;
- try
+ throw mle;
+ }
+ }
+ }
+
+ /**
+ * Stop the managed instances.
+ *
+ * @throws ManagedLifecycleException For errors during stopping.
+ */
+ private void stopInstances()
+ throws ManagedLifecycleException
+ {
+ final int numInstances = instances.length;
+ for (int count = numInstances - 1; count >= 0; count--)
+ {
+ final ManagedLifecycle instance = instances[count];
+ try
+ {
+ instance.stop();
+ }
+ catch (final ManagedLifecycleException mle)
+ {
+ if (count > 0)
{
- instance.start() ;
+ stopInstances(count - 1);
+ destroyInstances(numInstances - 1);
}
- catch (final ManagedLifecycleException mle)
+ throw mle;
+ }
+ }
+ }
+
+ /**
+ * Destroy the managed instances.
+ *
+ * @throws ManagedLifecycleException For errors during destruction.
+ */
+ private void destroyInstances()
+ throws ManagedLifecycleException
+ {
+ final int numInstances = instances.length;
+ for (int count = numInstances - 1; count >= 0; count--)
+ {
+ final ManagedLifecycle instance = instances[count];
+ try
+ {
+ instance.destroy();
+ }
+ catch (final ManagedLifecycleException mle)
+ {
+ if (count > 0)
{
- if (count > 0)
- {
- stopInstances(count-1) ;
- destroyInstances(numInstances-1) ;
- }
- throw mle ;
+ destroyInstances(count - 1);
}
- }
- }
-
- /**
- * Stop the managed instances.
- * @throws ManagedLifecycleException For errors during stopping.
- */
- private void stopInstances()
- throws ManagedLifecycleException
- {
- final int numInstances = instances.length ;
- for(int count = numInstances-1 ; count >= 0 ; count--)
- {
- final ManagedLifecycle instance = instances[count] ;
- try
- {
- instance.stop() ;
- }
- catch (final ManagedLifecycleException mle)
- {
- if (count > 0)
- {
- stopInstances(count-1) ;
- destroyInstances(numInstances-1) ;
- }
- throw mle ;
- }
- }
- }
-
- /**
- * Destroy the managed instances.
- * @throws ManagedLifecycleException For errors during destruction.
- */
- private void destroyInstances()
- throws ManagedLifecycleException
- {
- final int numInstances = instances.length ;
- for(int count = numInstances-1 ; count >= 0 ; count--)
- {
- final ManagedLifecycle instance = instances[count] ;
- try
- {
- instance.destroy() ;
- }
- catch (final ManagedLifecycleException mle)
- {
- if (count > 0)
- {
- destroyInstances(count-1) ;
- }
- throw mle ;
- }
- }
- }
-
- /**
- * Silently stop a partial set of the managed instances.
- * @param firstInstance The index of the first instance to stop
- */
- private void stopInstances(final int firstInstance)
- throws ManagedLifecycleException
- {
- for(int count = firstInstance ; count >= 0 ; count--)
- {
- final ManagedLifecycle instance = instances[count] ;
- try
- {
- instance.stop() ;
- }
- catch (final ManagedLifecycleException mle) {} // Ignore exception
- }
- }
-
- /**
- * Silently destroy a partial set of the managed instances.
- * @param firstInstance The index of the first instance to stop
- */
- private void destroyInstances(final int firstInstance)
- throws ManagedLifecycleException
- {
- for(int count = firstInstance ; count >= 0 ; count--)
- {
- final ManagedLifecycle instance = instances[count] ;
- try
- {
- instance.destroy() ;
- }
- catch (final ManagedLifecycleException mle) {} // Ignore exception
- }
- }
+ throw mle;
+ }
+ }
+ }
+
+ /**
+ * Silently stop a partial set of the managed instances.
+ *
+ * @param firstInstance The index of the first instance to stop
+ */
+ private void stopInstances(final int firstInstance)
+ throws ManagedLifecycleException
+ {
+ for (int count = firstInstance; count >= 0; count--)
+ {
+ final ManagedLifecycle instance = instances[count];
+ try
+ {
+ instance.stop();
+ }
+ catch (final ManagedLifecycleException mle)
+ {
+ } // Ignore exception
+ }
+ }
+
+ /**
+ * Silently destroy a partial set of the managed instances.
+ *
+ * @param firstInstance The index of the first instance to stop
+ */
+ private void destroyInstances(final int firstInstance)
+ throws ManagedLifecycleException
+ {
+ for (int count = firstInstance; count >= 0; count--)
+ {
+ final ManagedLifecycle instance = instances[count];
+ try
+ {
+ instance.destroy();
+ }
+ catch (final ManagedLifecycleException mle)
+ {
+ } // Ignore exception
+ }
+ }
}
More information about the jboss-svn-commits
mailing list