[Design of POJO Server] - Re: JBMICROCONT-288 - Invalid feature request and invalid pr
by adrian@jboss.org
"wolfc" wrote :
| (I think this translates to being able to have a serialized reference to a MC bean itself. But to facilitate that the MC bean would need a serialized reference to the Kernel.)
No, that's the wrong place like I said above.
If the problem is passivation then it is the job of the container to remove implementation
details that are not serializable and re-instate them later. i.e. its EJB3's job
Equally, you can't put non-serializable stuff in a web session and expect it to be serializable
without extra work.
I don't see what the issue is really.
These must be internal implementation details so you know how to implement
this "externalization", you're just being lazy. i.e. you're expecting the MC
to do something that is not its job and will likely lead to other problems
that don't want, expect this behaviour or want to do something else.
DON'T MIX IMPLEMENTATION AND POLICY
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4152044#4152044
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4152044
17 years, 10 months
[Design of POJO Server] - Modularising the appserver bootstrap
by adrian@jboss.org
I've made a start on modularising the appserver bootstrap,
as expected there are some subtle problems laying in wait.
CHANGE
First, what I've done is replaced bootstrap-beans.xml with a bootstrap.xml
that confirms to the this simple schema:
https://svn.jboss.org/repos/jbossas/trunk/bootstrap/src/resources/schema/...
The idea being that the other modularised files are loaded in the order given.
This makes the changes to the profile service to use a repository rather a lot easier.
See bootstrap-repo.xml which swaps profile-service.xml for profile-service-repository.xml
ISSUES
Obviously there's some circular references that need to be setup in the correct
order to avoid "chicken and egg" problems. This includes making the sure the
main "repositories"
* ClassLoading (classloading modules)
* AspectManager (aop config)
* MainDeployer (structure/normal deployers)
are configured first so they can accept other services that get registered later
(the things in brakets).
A good example of this, is that the @JMX aspect won't work if something
annotated with it is deployed before the AspectManager.
But then the AspectManager itself needs to be registered with JMX also
which is a sort of circular reference.
Less obvious is that AOP has some dependencies in the classloading
(ServiceMBean* and deployers) that need fixing before I can proceed
with further modularisation.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4152035#4152035
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4152035
17 years, 10 months
[Design the new POJO MicroContainer] - Re: Composite Map key and weak reference
by bstansberry@jboss.com
I believe Jason's #2 is what I was thinking about in our chat discussion. A rough impl:
| package hacks;
|
| import java.lang.annotation.Annotation;
| import java.lang.ref.Reference;
| import java.lang.ref.ReferenceQueue;
| import java.lang.ref.WeakReference;
|
| public class Key
| {
| private static final ReferenceQueue refQueue = new ReferenceQueue();
|
| private final KeyRef keyRef;
| private final WeakReference<Annotation>[] annotations;
|
| public Key(Class clazz, Annotation[] annotations)
| {
| this.keyRef = new KeyRef(this, clazz, refQueue);
| this.annotations = new WeakReference[annotations.length];
| for (int j = 0; j < annotations.length; j++)
| {
| this.annotations[j]= new WeakReference<Annotation>(annotations[j]);
| }
| }
|
| @Override
| public boolean equals(Object obj)
| {
| if (obj instanceof Key)
| {
| Key other = (Key) obj;
| Class clazz = keyRef.get();
| Class otherClass = other.keyRef.get();
| if (clazz == null || otherClass == null)
| {
| cleanKeyRefs();
| return false;
| }
| else
| {
| if (shouldCleanKeyRefs())
| cleanKeyRefs();
| return clazz.equals(otherClass); // need to add in annotations
| }
| }
|
| return false;
| }
|
| /** Allows optimization; i.e. change to only poll the queue every X invocations */
| private boolean shouldCleanKeyRefs()
| {
| return true;
| }
|
| /**
| * Poll the reference queue and clear the strong ref to Key from all
| * reference objects. This allows the Key to get removed from
| * WeakHashMap.
| */
| private void cleanKeyRefs()
| {
| Reference ref = null;
| while ((ref = refQueue.poll()) != null)
| {
| ((KeyRef) ref).key = null;
| }
| }
|
| private static class KeyRef extends WeakReference<Class>
| {
| private Key key;
|
| KeyRef(Key key, Class clazz, ReferenceQueue queue)
| {
| super(clazz, queue);
| this.key = key;
| }
| }
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4152029#4152029
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4152029
17 years, 10 months
[Design the new POJO MicroContainer] - Re: Composite Map key and weak reference
by jason.greene@jboss.com
So I take it the annotation refs point to annotations on the class ref?
I could see a couple of options:
* You could use a WeakIdentityHM using a Class ref as the key, and a nested normal HM using a key which has an array of weak annotation refs. This would then be wrapped in a delegate which emulates the composite key behavior.
|
| * Use a normal map, of any kind, and extend WeakReference to have an additional strong reference field, that points to your composite key class. Use this special reference for both the Class ref and all of the annotation refs. These are then registered in a ref queue, which is processed to remove gc'd entries periodically when accessing the map (by using the key reference). For this to work the key must do an identity check before comparing its contents (since the contents are gone during cleanup). If the map is concurrent you could do this cleanup in a separate thread.
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4152028#4152028
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4152028
17 years, 10 months