[JBoss Microcontainer Development] New message: "Re: Pluggable dependency resolver"
by Kabir Khan
JBoss development,
A new message was posted in the thread "Pluggable dependency resolver":
http://community.jboss.org/message/524747#524747
Author : Kabir Khan
Profile : http://community.jboss.org/people/kabir.khan@jboss.com
Message:
--------------------------------------------------------------
I did a little benchmark to test out my assumption that the indexing resolver performs better for large amounts of contexts waiting for dependencies. In each case I deploy 1000 beans.
* Scenario 1 - all contexts in the right order
Bean 1 has no depdencies
Bean 2 depends on Bean 1
Bean 3 depends on Bean 2
etc.
Standard resolver: 702 ms
Indexing resolver: 554 ms
* Scenario 2 - all contexts in wrong order
Bean 1 depends on Bean 2
Bean 2 depdends on Bean 1
etc.
Standard resolver: 3476
Indexing resolver: 601
I tried this with higher numbers, but this causes a StackOverflowError with the indexing resolver, the reason being that it works recursively when a waiting context gets its dependencies resolved. AbstractController.install()->IndexingDependencyResolver.resolveContext(ControllerContext) (takes the installed context as param) ->AbstractContoller.incrementState()->IndexingDependencyResolver.stateIncremented()->IndexingDependencyResolver.resolveContext(ControllerContext) (takes any waiting context as param). I'll try to untangle this recursion.
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/524747#524747
14 years, 11 months
[JBoss Microcontainer Development] New message: "Re: ScopeInfo's MetaData handling looks inconsistent"
by Ales Justin
JBoss development,
A new message was posted in the thread "ScopeInfo's MetaData handling looks inconsistent":
http://community.jboss.org/message/524656#524656
Author : Ales Justin
Profile : http://community.jboss.org/people/alesj
Message:
--------------------------------------------------------------
I added this patch, which does lazy init on ControllerContext::getScopeInfo::getMetaData.
Or is keeping ControllerContext around bad aka too leaky?
This does remove the need for MDR::getMetaData call, which would otherwise initialize MDR.
Index: dependency/src/main/java/org/jboss/dependency/plugins/AbstractScopeInfo.java
===================================================================
--- dependency/src/main/java/org/jboss/dependency/plugins/AbstractScopeInfo.java (revision 76911)
+++ dependency/src/main/java/org/jboss/dependency/plugins/AbstractScopeInfo.java Sun Feb 07 23:37:34 CET 2010
@@ -64,7 +64,10 @@
/** The added scopes */
private CopyOnWriteArraySet<ScopeKey> addedScopes = new CopyOnWriteArraySet<ScopeKey>();
-
+
+ /** The owning context */
+ private ControllerContext context;
+
/**
* Create a new AbstractScopeInfo.
*
@@ -110,13 +113,21 @@
{
if (repository == null)
return null;
-
+
- return repository.getMetaData(getScope());
+ MetaData metaData = repository.getMetaData(getScope());
+ if (metaData == null)
+ {
+ initMetaDataRetrieval(repository, context);
+ metaData = repository.getMetaData(scopeKey);
- }
+ }
+ return metaData;
+ }
public void addMetaData(MutableMetaDataRepository repository, ControllerContext context)
{
this.repository = repository;
+ this.context = context;
+
ScopeKey scope = getMutableScope();
MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(scope);
MutableMetaDataLoader mutable;
@@ -130,7 +141,7 @@
{
mutable = getMutableMetaDataLoader(retrieval);
}
-
+
if (mutable == null)
{
log.warn("MetaData context is not mutable: " + retrieval + " for " + context.toShortString());
@@ -176,8 +187,9 @@
}
}
addedScopes.clear();
- this.repository = null;
-
+
+ this.context = null;
+ this.repository = null;
}
/**
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/524656#524656
14 years, 11 months