Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

global object

 
Neil Goldsmith
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All of our servlets need to obtain a global object via a JNDI lookup and pass it data. The global object then sends a command over a socket connection to a legacy system, gets back a response and sends it back to the servlet. The global object starts up and goes down along with the appserver ( or servlet container) This should work on both Tomcat and Websphere. I've noticed WS is much more restrictive with objects running within the app server, no multiple threading, no sockets, whereas I can do all of that within Tomcat by simply creating a Global JNDI resource defined in server.xml.

I'd like to come up with a general solution that works for both Tomcat and WS. Am I missing something within WS that might allow me to do this? Is there a better solution that will work for both TC and WS?

thx
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A static variable will be able to be accessed as long as the jvm is up. If you loaded the jar/class of this variable in the server classpath it would be available to all applications within the server.
 
D Rog
Ranch Hand
Posts: 472
Linux Objective C Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just mad idea to create a fake servlet which context can be accessed from all others.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic