I have a system that I need to distrubte that works as follows. Servlets served by tomcat start up and spawn off threads with a large number of shared (distributed) fields. Ergo, I set the thread as a root and attempt to spawn the threads as normal from my servlet constructor. However, logging indicates that the Runnable I'm attempting to share's constructor never finishes. What could cause this?
In my servlet, I have an instance of the thread which I attempt to share as a root, and logging indicates that everything is fine until the end of the constructor for the class (UpdaterThread) that implements runnable.
I have the following:
Servlet:
print "Creating new thread"; updaterThread = new UpdaterThread(args); print "Launching thread."; new Thread( updaterThread ).start();
Now, I never see "Launching Thread" in my tomcat console output, although I can see all print statement up to the end of the UpdaterThread constructor. UpdaterThread maintains a reference to a map (shared by the servlet), a String, an SQL Connection, a Statement, a ReentrantReadWriteLock, a Long, and a transient boolean and Long not to be shared.
In the constructor for UpdaterThread, I pass a reference to the shared map and the value for the String. Without terracotta enabled, I can get beyond this point. What would cause tomcat and terracotta to hang without any kind of error message? The rrwl lock is not used until a later method is called, but I never get that far in program execution. Help?