JBoss development,
A new message was posted in the thread "DependencyInfo remove items":
http://community.jboss.org/message/522866#522866
Author : Kabir Khan
Profile :
http://community.jboss.org/people/kabir.khan@jboss.com
Message:
--------------------------------------------------------------
All tests pass with the below change which I have committed against
https://jira.jboss.org/jira/browse/JBKERNEL-84. However, I do see a few warnings like this
when running KernelAllTestSuite due to DemandDependencyItem not having its iDependOn set.
Any ideas on making this more flexible? I kind of wish DependencyItem would record its
dependencies somehow...
29221 WARN [AbstractKernelController] Problem finding dependency for
AbstractDemandMetaData$DemandDependencyItem@4946101f{name=bean depends
On=null whenRequired=Instantiated resolved=false demand=foobar}
java.lang.IllegalArgumentException: Null name
at
org.jboss.dependency.plugins.AbstractController.getContext(AbstractController.java:520)
at
org.jboss.kernel.plugins.dependency.AbstractKernelController.getContext(AbstractKernelController.java:150)
at
org.jboss.dependency.plugins.AbstractController.uninstallContext(AbstractController.java:1477)
at
org.jboss.dependency.plugins.AbstractController.uninstallContext(AbstractController.java:1391)
at
org.jboss.dependency.plugins.AbstractController.uninstall(AbstractController.java:704)
at
org.jboss.dependency.plugins.AbstractController.uninstall(AbstractController.java:617)
at
org.jboss.test.kernel.lazy.test.LazyInstantiationTest.testLazy(LazyInstantiationTest.java:109)
Index: dependency/src/main/java/org/jboss/dependency/plugins/AbstractController.java
===================================================================
--- dependency/src/main/java/org/jboss/dependency/plugins/AbstractController.java
(revision 100075)
+++ dependency/src/main/java/org/jboss/dependency/plugins/AbstractController.java (working
copy)
@@ -1459,7 +1459,40 @@
}
}
}
-
+
+ Set<DependencyItem> iDependOn = dependencies.getIDependOn(null);
+ if (iDependOn.isEmpty() == false)
+ {
+ for (DependencyItem item : iDependOn)
+ {
+ if (item.isResolved())
+ {
+ ControllerState whenRequired = item.getWhenRequired();
+ if (whenRequired == null || whenRequired.equals(fromState))
+ {
+ if (item.unresolved(this))
+ {
+ try
+ {
+ ControllerContext dependency =
getContext(item.getIDependOn(), item.getDependentState());
+ if (dependency != null)
+ {
+ DependencyInfo info = dependency.getDependencyInfo();
+ if (info != null)
+ {
+ info.removeDependsOnMe(item);
+ }
+ }
+ }
+ catch(RuntimeException e)
+ {
+ log.warn("Problem finding dependency for " +
item, e);
+ }
+ }
+ }
+ }
+ }
+ }
}
catch (Throwable error)
{
--------------------------------------------------------------
To reply to this message visit the message page:
http://community.jboss.org/message/522866#522866