I removed the FastThreadLocal class which was cruft from way back in
the day when ThreadLocals were very slow. In the process I
generified and clean up all uses of ThreadLocal, but have a few
questions about some of the code. Hopefully someone who can remember
back to early 2000 can help.
On Jan 8, 2007, at 7:50 PM, [EMAIL PROTECTED] wrote:
======================================================================
========
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/
main/java/org/apache/openejb/core/ServerFederation.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/
main/java/org/apache/openejb/core/ServerFederation.java Mon Jan 8
19:50:03 2007
@@ -53,17 +53,20 @@
}
public static void setApplicationServer(ApplicationServer
server) {
+ // todo why do we restrict null? This makes call to
setApplicationServer non symetrical. Throw an exception?
if (server != null) {
- threadStorage.set(server);
+ applicationServer.set(server);
}
}
Any idea why we don't allow null to be set into the application
server? If the thread local holds, null we return localServer.
I think the proper implementation is to make localServer the
initValue for the thread local, and if someone attempts to set the
application server to null, we throw an exception.
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/
src/main/java/org/apache/openejb/core/ivm/IntraVmArtifact.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/
container/openejb-core/src/main/java/org/apache/openejb/core/ivm/
IntraVmArtifact.java?view=diff&rev=494312&r1=494311&r2=494312
======================================================================
========
+ // todo why not put in message catalog?
private static final String NO_ARTIFACT_ERROR = "The artifact
this object represents could not be found.";
Is there a primer on how to use the message catalog somewhere?
@@ -59,11 +54,11 @@
instanceHandle = in.read();
}
- private Object readResolve() throws ObjectStreamException {
- List list = (List) thread.get();
- if (list == null) throw new InvalidObjectException
(NO_MAP_ERROR);
+ protected Object readResolve() throws ObjectStreamException {
+ List<Object> list = handles.get();
Object artifact = list.get(instanceHandle);
if (artifact == null) throw new InvalidObjectException
(NO_ARTIFACT_ERROR + instanceHandle);
+ // todo WHY?
if (list.size() == instanceHandle + 1) {
list.clear();
}
Does anyone know why we clear the list here? This same code exists in
org.apache.openejb.proxy.ImmutableArtifact. Is this a duplicate class?
Thanks,
-dain