[JBoss Microcontainer Development] - Re: Supporting qualifiers in MC
by kabir.khan@jboss.com
It seems the metadata for the context is created after the context is described. From some breakpoints
| QualifierMetaData.describeVisit(MetaDataVisitor) line: 59
| DescribedMetaDataVisitor(AbstractMetaDataVisitor).internalDescribeVisit(MetaDataVisitorNode) line: 137
| DescribedMetaDataVisitor(AbstractMetaDataVisitor).describeVisit(MetaDataVisitorNode) line: 87
| AbstractBeanMetaData(AbstractFeatureMetaData).describeVisit(MetaDataVisitor) line: 106
| DescribedMetaDataVisitor.run() line: 53
| AccessController.doPrivileged(PrivilegedAction<T>) line: not available [native method]
| AbstractKernelControllerContext.infoprocessMetaData() line: 249
| AbstractKernelControllerContext.setBeanInfo(BeanInfo) line: 180
| PreInstallAction.installActionInternal(KernelControllerContext) line: 89 <<<
| PreInstallAction(InstallsAwareAction).installAction(KernelControllerContext) line: 54
|
| BasicMetaDataRepository.addMetaDataRetrieval(MetaDataRetrieval) line: 109
| KernelScopeInfo(AbstractScopeInfo).addMetaData(MutableMetaDataRepository, ControllerContext) line: 126
| BasicKernelMetaDataRepository.addMetaData(ControllerContext) line: 70
| PreInstallAction.installActionInternal(KernelControllerContext) line: 95 <<<
| PreInstallAction(InstallsAwareAction).installAction(KernelControllerContext) line: 54
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4266811#4266811
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4266811
16 years, 4 months
[JBoss Microcontainer Development] - Re: Supporting qualifiers in MC
by kabir.khan@jboss.com
The requirements for the usage of MDR are clearer after our team call. For the record, supplied qualifiers should be read from the MDR so that qualifiers can be applied on for example deployment level.
I've stumbled upon this though when trying to populate the MDR with qualifers, that the mutable scope has not been created yet:
| public void describeVisit(MetaDataVisitor vistor)
| {
| super.describeVisit(vistor);
| KernelControllerContext context = vistor.getControllerContext();
|
| MetaDataRetrieval retrieval = context.getKernel().getMetaDataRepository().getMetaDataRepository().getMetaDataRetrieval(context.getScopeInfo().getMutableScope());
| if (retrieval instanceof MutableMetaData)
| {
| /At this stage retrieval is null
| }
|
I'm still a bit wooly on the MDR stuff, so I might be doing something wrong
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4266804#4266804
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4266804
16 years, 4 months
[JBoss Microcontainer Development] - MemoryMetaDataLoader not threadsafe?
by kabir.khan@jboss.com
Although it will not happen when describing this metadata class, the following does not look very thread safe to me.
| @Override
| public void describeVisit(MetaDataVisitor vistor)
| {
| super.describeVisit(vistor);
| KernelControllerContext context = vistor.getControllerContext();
| MetaDataRetrieval retrieval = context.getKernel().getMetaDataRepository().getMetaDataRepository().getMetaDataRetrieval(context.getScopeInfo().getMutableScope());
| if (retrieval instanceof MutableMetaData)
| {
| MetaDataItem<?> item = retrieval.retrieveMetaData(QUALIFIER_KEY);
| //TODO - The following is not threadsafe
| List<Object> list = null;
| if (item == null)
| {
| list = new CopyOnWriteArrayList<Object>();
| ((MutableMetaData)retrieval).addMetaData(QUALIFIER_KEY, list, List.class);
| }
| else
| {
| list = (List<Object>)item.getValue();
| }
| list.addAll(getEnabled());
| }
| }
|
Since MDR is considered for general usage, it might be an issue if two different threads need to do something similar. i.e. check for existance of metadata then add metadata. addMetaData() seems to overwrite what is there so a check is needed, unless ConcurrentMap.putIfAbsent () semantics are added. For simple values this will probably be fine, last one wins and overwrites, but for things like collections we should have the possiblity to merge the new collection and the exisiting collection, if that is what is intended.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4266800#4266800
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4266800
16 years, 4 months