[Jboss-cvs] JBossAS SVN: r55115 - in projects/microcontainer/trunk/dependency: . src/main/org/jboss/dependency/plugins src/tests/org/jboss/test/dependency/controller/test
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Aug 3 11:47:18 EDT 2006
Author: adrian at jboss.org
Date: 2006-08-03 11:47:12 -0400 (Thu, 03 Aug 2006)
New Revision: 55115
Modified:
projects/microcontainer/trunk/dependency/.classpath
projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractController.java
projects/microcontainer/trunk/dependency/src/tests/org/jboss/test/dependency/controller/test/ControllerTestSuite.java
Log:
Handle recursive uninstall requests by re-retrieving the
current state inside the loop.
Also improved some of the logging.
Modified: projects/microcontainer/trunk/dependency/.classpath
===================================================================
--- projects/microcontainer/trunk/dependency/.classpath 2006-08-03 15:43:03 UTC (rev 55114)
+++ projects/microcontainer/trunk/dependency/.classpath 2006-08-03 15:47:12 UTC (rev 55115)
@@ -7,5 +7,6 @@
<classpathentry kind="lib" path="/thirdparty/junit/lib/junit.jar"/>
<classpathentry kind="lib" path="/thirdparty/oswego-concurrent/lib/concurrent.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/test/lib/jboss-test.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/apache-log4j/lib/log4j.jar"/>
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Modified: projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractController.java
===================================================================
--- projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractController.java 2006-08-03 15:43:03 UTC (rev 55114)
+++ projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractController.java 2006-08-03 15:47:12 UTC (rev 55115)
@@ -146,7 +146,7 @@
throw new IllegalArgumentException("Null name " + context.toShortString());
if (allContexts.get(name) != null)
- throw new IllegalStateException("Already installed " + name);
+ throw new IllegalStateException(name + " is already installed.");
install(context, trace);
}
@@ -349,8 +349,8 @@
{
log.error("Error installing to " + toState.getStateString() + ": " + context.toShortString(), t);
uninstallContext(context, ControllerState.NOT_INSTALLED, trace);
+ errorContexts.add(context);
context.setError(t);
- errorContexts.add(context);
return false;
}
@@ -493,21 +493,21 @@
{
int targetState = states.indexOf(toState);
if (targetState == -1)
- log.error("Internal error unknown state " + toState + " states=" + states);
+ log.error("INTERNAL ERROR: unknown state " + toState + " states=" + states, new Exception("STACKTRACE"));
- ControllerState fromState = context.getState();
- int currentState = states.indexOf(fromState);
- if (currentState == -1)
- log.error("Internal error during uninstall current state not found: " + context.toShortString());
-
- if (targetState > currentState)
+ while (true)
{
- log.error("Internal error during uninstall: toState=" + toState + " context=" + context.toShortString());
- return;
+ ControllerState fromState = context.getState();
+ if (ControllerState.ERROR.equals(fromState))
+ return;
+ int currentState = states.indexOf(fromState);
+ if (currentState == -1)
+ log.error("INTERNAL ERROR: current state not found: " + context.toShortString(), new Exception("STACKTRACE"));
+ if (targetState > currentState)
+ return;
+ else
+ uninstallContext(context, trace);
}
-
- for (int i = currentState; i >= targetState; --i)
- uninstallContext(context, trace);
}
/**
@@ -527,8 +527,11 @@
log.trace("Uninstalling " + name + " from " + fromState.getStateString());
Set<ControllerContext> fromContexts = contextsByState.get(fromState);
- if (fromContexts.remove(context) == false)
- throw new IllegalStateException("Context not found in previous state " + fromState.getStateString() + " context=" + context.toShortString());
+ if (fromContexts == null || fromContexts.remove(context) == false)
+ {
+ log.error("INTERNAL ERROR: context not found in previous state " + fromState.getStateString() + " context=" + context.toShortString(), new Exception("STACKTRACE"));
+ return;
+ }
DependencyInfo dependencies = context.getDependencyInfo();
Set dependsOnMe = dependencies.getDependsOnMe(null);
Modified: projects/microcontainer/trunk/dependency/src/tests/org/jboss/test/dependency/controller/test/ControllerTestSuite.java
===================================================================
--- projects/microcontainer/trunk/dependency/src/tests/org/jboss/test/dependency/controller/test/ControllerTestSuite.java 2006-08-03 15:43:03 UTC (rev 55114)
+++ projects/microcontainer/trunk/dependency/src/tests/org/jboss/test/dependency/controller/test/ControllerTestSuite.java 2006-08-03 15:47:12 UTC (rev 55115)
@@ -51,6 +51,7 @@
suite.addTest(DisabledControllerTestCase.suite());
suite.addTest(OnDemandDependencyTestCase.suite());
suite.addTest(RecursiveControllerActionTestCase.suite());
+ suite.addTest(ErrorControllerActionTestCase.suite());
return suite;
}
More information about the jboss-cvs-commits
mailing list