[JBoss Microcontainer Development] New message: "Re: AnnotatedElementMetaDataLoader component metadata optimization"
by Kabir Khan
JBoss development,
A new message was posted in the thread "AnnotatedElementMetaDataLoader component metadata optimization":
http://community.jboss.org/message/527038#527038
Author : Kabir Khan
Profile : http://community.jboss.org/people/kabir.khan@jboss.com
Message:
--------------------------------------------------------------
I have gone back to making AEMDL.getCMDR() return null if there are no annotations. It is the fastest way, and is the least affected by caching. To preserve backwards compatibility and to not have to change any tests, I have added this fix to make MetaDataRetrievalToMetaDataBridge always return something even if there is no component metadata:
public MetaData getComponentMetaData(Signature signature)
{
MetaDataRetrieval component = retrieval.getComponentMetaDataRetrieval(signature);
if (component == null)
//return null;
return NullComponentMetaData.INSTANCE;
return new MetaDataRetrievalToMetaDataBridge(component);
}
...
private static class NullComponentMetaData implements MetaData
{
final static NullComponentMetaData INSTANCE = new NullComponentMetaData();
public <T extends Annotation> T getAnnotation(Class<T> annotationType)
{
return null;
}
public Annotation[] getAnnotations()
{
return MetaData.NO_ANNOTATIONS;
}
public Annotation[] getAnnotationsAnnotatedWith(Class<? extends Annotation> meta)
{
return MetaData.NO_ANNOTATIONS;
}
public MetaData getComponentMetaData(Signature signature)
{
return null;
}
public Annotation[] getLocalAnnotations()
{
return MetaData.NO_ANNOTATIONS;
}
public Object[] getLocalMetaData()
{
return MetaData.NO_METADATA;
}
public <T> T getMetaData(Class<T> type)
{
return null;
}
public Object[] getMetaData()
{
return MetaData.NO_METADATA;
}
public Object getMetaData(String name)
{
return null;
}
public <T> T getMetaData(String name, Class<T> type)
{
return null;
}
public MetaData getScopeMetaData(ScopeLevel level)
{
return null;
}
public long getValidTime()
{
return 0;
}
public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
{
return false;
}
public boolean isEmpty()
{
return true;
}
public boolean isMetaDataPresent(Class<?> type)
{
return false;
}
public boolean isMetaDataPresent(String name)
{
return false;
}
public boolean isMetaDataPresent(String name, Class<?> type)
{
return false;
}
}
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/527038#527038
14 years, 3 months
[jBPM Development] New message: "Storing java.util.Collection on process"
by Ruben Bentein
JBoss development,
A new message was posted in the thread "Storing java.util.Collection on process":
http://community.jboss.org/message/527010#527010
Author : Ruben Bentein
Profile : http://community.jboss.org/people/rubenbentein
Message:
--------------------------------------------------------------
I have a question about a best practise concerning processes with a dynamic list as a variable.
Let's say for example i have an process which has to store 0..* objects as variables. I.e. an process B
+public class B{+
+ string b1;+
+ string b2;
+
+ java.util.Collection<A> aCollection;
+
+}+
and a class A
+
+
+public class A{+
+ string a1;+
+ string a2;
+
+}+
so before calling
+executionService.startProcessInstanceByKey("B-process-name", variables);+
I have to fill the variables map. But how should i add aCollection ? Should i do something like
+
+
+variables.put("b1", someBObject.b1);+
+variables.put("b2", someBObject.b2);+
+for (int i=0 ; i<someBObject.aCollection.size() ; i++){
+
+ variables.put("aCollection[++" + i + "].a1", aCollection.get(i).a1++);
+
+ variables.put("aCollection[++" + i + "].a2", aCollection.get(i).a2);+
+}+
Or maybe there is a better/cleaner solution.
Or should i store these object in my own tables, and just store a reference (id) on the variables list ?
Thanks for any replies
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/527010#527010
14 years, 3 months
[JBoss Microcontainer Development] New message: "NPE on ungetValue()"
by Kabir Khan
JBoss development,
A new message was posted in the thread "NPE on ungetValue()":
http://community.jboss.org/message/526834#526834
Author : Kabir Khan
Profile : http://community.jboss.org/people/kabir.khan@jboss.com
Message:
--------------------------------------------------------------
Remy reported this:
> 9:46,189 WARN [ConfigureAction] Error unconfiguring bean
> AbstractKernelControllerContext@2fbfbe18{
> metadata=AbstractBeanMetaData@2ef49ac3{name=WarDeployer
> bean=org.jboss.web.tomcat.service.deployers.TomcatDeployer
> properties=[relativeOrder, tldJars, configFile, authenticators,
> java2ClassLoadingCompliance, domain, securityContextClassName,
> mainDeployer, policyRegistrationName, deleteWorkDirOnContextDestroy,
> securityManagementName, lenientEjbLink, defaultSecurityDomain]
> constructor=null autowireCandidate=true
> installs=[ManagedDeploymentCreator.addAttachmentType]
> uninstalls=[ManagedDeploymentCreator.removeAttachmentType]}name=WarDeployer
> target=org.jboss.web.tomcat.service.deployers.TomcatDeployer@33716286
> state=Configured
> depends=AbstractDependencyInfo@759a12cb{idependOn=[AbstractDependencyItem@4ed95bc3{name=WarDeployer
> dependsOn=ServiceBindingManager whenRequired=Configured
> dependentState=Installed resolved=false},
> AbstractDependencyItem@201787a6{name=WarDeployer
> dependsOn=MainDeployer whenRequired=Configured resolved=false},
> AbstractInstallMetaData$InstallationDependencyItem@1108565d{name=WarDeployer
> dependsOn=ManagedDeploymentCreator whenRequired=Installed
> dependentState=Installed resolved=false},
> AbstractInstallMetaData$InstallationDependencyItem@3a5dfc67{name=WarDeployer
> dependsOn=ManagedDeploymentCreator whenRequired=Installed
> dependentState=Installed resolved=false}]
> unresolved=[AbstractDependencyItem@4ed95bc3{name=WarDeployer
> dependsOn=ServiceBindingManager whenRequired=Configured
> dependentState=Installed resolved=false},
> AbstractInstallMetaData$InstallationDependencyItem@3a5dfc67{name=WarDeployer
> dependsOn=ManagedDeploymentCreator whenRequired=Installed
> dependentState=Installed resolved=false},
> AbstractInstallMetaData$InstallationDependencyItem@1108565d{name=WarDeployer
> dependsOn=ManagedDeploymentCreator whenRequired=Installed
> dependentState=Installed resolved=false},
> AbstractDependencyItem@201787a6{name=WarDeployer
> dependsOn=MainDeployer whenRequired=Configured resolved=false}]}}:
> java.lang.NullPointerException
> at org.jboss.beans.metadata.plugins.AbstractInjectionValueMetaData.ungetValue(AbstractInjectionValueMetaData.java:275)
> at org.jboss.kernel.plugins.dependency.PropertyDispatchWrapper.execute(PropertyDispatchWrapper.java:86)
> at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
> at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:125)
> at org.jboss.kernel.plugins.dependency.ConfigureAction.dispatchSetProperty(ConfigureAction.java:107)
> at org.jboss.kernel.plugins.dependency.ConfigureAction.setAttributes(ConfigureAction.java:85)
> at org.jboss.kernel.plugins.dependency.ConfigureAction.uninstallActionInternal(ConfigureAction.java:58)
> at org.jboss.kernel.plugins.dependency.InstallsAwareAction.uninstallAction(InstallsAwareAction.java:175)
> at org.jboss.kernel.plugins.dependency.InstallsAwareAction.uninstallAction(InstallsAwareAction.java:42)
> at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleUninstallAction(SimpleControllerContextAction.java:79)
> at org.jboss.dependency.plugins.action.AccessControllerContextAction.uninstall(AccessControllerContextAction.java:131)
> at org.jboss.dependency.plugins.AbstractControllerContextActions.uninstall(AbstractControllerContextActions.java:58)
> at org.jboss.dependency.plugins.AbstractControllerContext.uninstall(AbstractControllerContext.java:384)
> at org.jboss.dependency.plugins.AbstractController.uninstall(AbstractController.java:2063)
> at org.jboss.dependency.plugins.AbstractController.uninstallContext(AbstractController.java:1578)
> at org.jboss.dependency.plugins.AbstractController.uninstallContext(AbstractController.java:1431)
> at org.jboss.dependency.plugins.AbstractController.uninstall(AbstractController.java:735)
> at org.jboss.dependency.plugins.AbstractController.uninstall(AbstractController.java:648)
> at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.undeploy(BeanMetaDataDeployer.java:228)
> at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.undeploy(BeanMetaDataDeployer.java:58)
> at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalUndeploy(AbstractSimpleRealDeployer.java:69)
> at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.undeploy(AbstractRealDeployer.java:117)
> at org.jboss.deployers.plugins.deployers.DeployerWrapper.undeploy(DeployerWrapper.java:204)
> at org.jboss.deployers.plugins.deployers.DeployersImpl.doUndeploy(DeployersImpl.java:1690)
> at org.jboss.deployers.plugins.deployers.DeployersImpl.doUninstallParentLast(DeployersImpl.java:1597)
> at org.jboss.deployers.plugins.deployers.DeployersImpl.doUninstallParentLast(DeployersImpl.java:1590)
> at org.jboss.deployers.plugins.deployers.DeployersImpl.uninstall(DeployersImpl.java:1552)
> at org.jboss.dependency.plugins.AbstractControllerContext.uninstall(AbstractControllerContext.java:384)
> at org.jboss.dependency.plugins.AbstractController.uninstall(AbstractController.java:2063)
> at org.jboss.dependency.plugins.AbstractController.uninstallContext(AbstractController.java:1578)
> at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:923)
> at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:633)
> at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:811)
> at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:654)
> at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
> at org.jboss.system.server.profileservice.repository.ProfileDeployAction.uninstall(ProfileDeployAction.java:95)
> at org.jboss.system.server.profileservice.repository.AbstractProfileAction.uninstall(AbstractProfileAction.java:70)
> at org.jboss.system.server.profileservice.repository.AbstractProfileService.uninstall(AbstractProfileService.java:417)
> at org.jboss.dependency.plugins.AbstractControllerContext.uninstall(AbstractControllerContext.java:384)
> at org.jboss.dependency.plugins.AbstractController.uninstall(AbstractController.java:2063)
> at org.jboss.dependency.plugins.AbstractController.uninstallContext(AbstractController.java:1578)
> at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:923)
> at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:633)
> at org.jboss.system.server.profileservice.repository.AbstractProfileService.deactivateProfile(AbstractProfileService.java:448)
> at org.jboss.system.server.profileservice.ProfileServiceBootstrap.deactivateProfiles(ProfileServiceBootstrap.java:389)
> at org.jboss.system.server.profileservice.ProfileServiceBootstrap.shutdown(ProfileServiceBootstrap.java:347)
> at org.jboss.system.server.profileservice.ProfileServiceBootstrap.shutdown(ProfileServiceBootstrap.java:100)
> at org.jboss.bootstrap.impl.base.server.AbstractServer.shutdownBootstraps(AbstractServer.java:892)
> at org.jboss.bootstrap.impl.base.server.AbstractServer.shutdown(AbstractServer.java:309)
> at org.jboss.Main$ShutdownHook$1.run(Main.java:929)
While it should be simple to change this to
@SuppressWarnings({"deprecation"})
public Object ungetValue(TypeInfo info, ClassLoader cl) throws Throwable
{
if (getUnderlyingValue() == null)
{
if (item != null && context != null) //Added if
{
ControllerContext lookup = item.getControllerContext(context.getController()); // 275
if (lookup != null)
{
ungetTarget(context, lookup);
return null;
}
}
}
return super.ungetValue(info, cl);
}
I would like to understand better how we end up in this state?
context gets set in initialVisit(), and item gets set in describeVisit() and I can't see either ever being set to null on uninstall. Maybe if fromContext is used instead then context never gets set?
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/526834#526834
14 years, 3 months