• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

connection pooling/oracle/multiple jvms

 
Glen MacDonald
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been using OracleConnectionCacheImpl in a manner suggested to me by the sample code on Oracle's web site, and when I originally set this up I had a lot of debug statements that occasionally reported that I had more instances of this than expected. I had to get on with other work but I've been puzzled about this for a while. There was only suppposed to be one instance created at class load time. Would the class get loaded more than once if there are multiple JVMs running? Anything else that can cause a class to be loaded more than once?
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Glen,
As far as I am aware, a class can only be loaded once into a given "ClassLoader". Each JVM has at least one "ClassLoader". Application servers (like Oracle's OC4J) use many different "ClassLoader"s.
However, a class can be instantiated multiple times. Therefore I differentiate between a class (i.e. the "OracleConnectionCacheImpl" class) and instances of that class. I assume the "manner" you are alluding to is using the "singleton" pattern, whereby a class is instantiated only once. The (unsaid) assumption, though, is that there is only one instance per "ClassLoader".
Therefore, if, as you claim, you are seeing several instances of the "OracleConnectionCacheImpl" class (across several JVMs), then this is definitely possible.
In case you are unaware (and if you are interested), there is a white paper at Oracle's Technet Web site explaining the class loader architecture for OC4J:
http://technet.oracle.com/tech/java/oc4j/pdf/ClassLoadingInOC4J_WP.pdf
Hope this has helped you.
Good luck,
Avi.
 
Glen MacDonald
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Avi. Your assumptions are correct, and I will read the article that you suggest.
Cheers
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic