× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Brad,

let me take two postings together

// snip
> I'm still having problems understanding the scope of how the
> connection pool works.  Coming from the AS/400 where you
> have jobs/activation groups that define the scope of
> applications, understanding how a singleton object works is
> still a bit confusing.
>

the scope of a Singleton is an instance of the JVM.
running from clients every client has his own connection pool.
running in the Web Server all user of one JVM share the same pool.
If the Webserver runs more than one JVM, there wil be a pool for each JVM,
shared by the users using this JVM.

> For example, if Joe runs an app that creates the connection
> manager, then mary runs the same app, where does the single
> instance of the object come into play.  Since they are on
> different machines, do they each have their own connection
> object inside their own JVM?  And in this case the only
> benifit of the connection mananger and pool is reuse of a
> single connection?

yes

>
> I guess it makes more sense in a servlet environment where
> the connection manager is created on the server and multiple
> requests can share connections and pools.

It depends on the number of connections to open.
If an user needs only few connections (maybe 10) and uses this 8 h a day, you
don't need a connection pool. (normal Client Server session oriented 5250
like workload)
If many (assume 1000) users come over http (a protocoll without sessions) and
you don't know how long they will use their connection (assume some seconds)
then you will get benefit of pooling of expensive ressources.
If you don't need it, don't use it. You only have a performance benefit if
you can express it in seconds.

// snip

> I run a program that creates three connections.  I use
> methods to return the number of connections, free
> connetions, and clients in use by the DBCM.  If I use this
> during the running of the program, things work great and the
> data returned is correct (ie it tells me I have 3
> connections in use, and 0 in use after I reclaim those 3
> connections).
>
> Now, I put an endless loop in this application before the
> three connections are reclaimed.  Just so that the three
> connections will stay there.

this programm will loop in every JVM implementing it coorectly. If CRTJVAPGM
does something else it is damaged.

>
> Now I run another application to see if I can get the
> instance data from the class created by the currently
> running application.  

Do you really mean applications???
then you will start it with java MyTestApp and start a new JVM for each
application.

It ends up creating another instance
> of the Database Connection Manager instead of using the
> already existing one.

Now you have two applications running in two different JVMs each of it using
a pool of its own.

>
> Am I missing something here?  

maybe the difference between a job and a thread.

two applications (started by java MyApp) result in two JVMs -> comparable to
two jobs, sharing only CPU not memory.

two threads (started by your program, or the application server) running some
application run in one jvm (comparable to job) in diffrent threads, sharing
cpu and memory.


This DB Con Mgr class is set
> up as a Singleton class, meaning that (I thought) if a
> instance already existed, a new one was not created, and the
> current existing instance was returned to the application.
> So this 2nd application should return that I have 3
> connections in use, or so I thought.
>
> This doesn't seem to be the case in this scenario.  But it
> is what I expected since both applications are running in
> the same JVM.

if you (or the appserver) really started a new thread, please post your code.

Dieter


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.