Well, if you delegate to your own wrapper of the client you could change the 
backing client dynamically.  When a configuration change is needed you could 
increment a pool version, configure it as a new pool (e.g. "default_5"), and 
then atomically change the backing client to a newly instantiated one.  This 
would give you the appearance of changing the pool's configuration.  This would 
also be non-blocking since any current work in the older pool gets to still use 
that instance until it finishes the code client block and the next request is 
made from your application uses the updated version.

I haven't tried this, so be warned. :-)

-Ben

----- Original Message ----
From: Shlomi Marco <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: [email protected]
Sent: Wednesday, January 2, 2008 5:13:01 AM
Subject: Re-initing an initialized pool (Java-api)


(Problem w/first post...second try)
Hey all.


I'm trying to change pool setting in "mid-air" (application
already init and running for a while, now it needs parameters
readjustment, without restarting the VM)


>From the look at the code, once pool.initialize() has been called, you cannot 
>issue another pool.initialize(),

Is there a cleaver way to re-init the pool instance (it's a singleton) without 
modding the client api?

(whalin's API)


Edit:

Just noticed the shutdown()...


Edit 2:

I'm not sure if it is a bug or by design, but:

stopMaintThread() stops, well, the main thread:

if ( maintThread != null && maintThread.isRunning() )

maintThread.stopThread();


Now, in startMainThread(), there isn't a case where mainThread isn't null, but 
is initialized and stopped:

                if ( maintThread != null ) {


                        if ( maintThread.isRunning() ) {

                                log.error( "main thread already running" );

                        }

                        else {

                                maintThread.start();

                        }

                }

                else {

                        maintThread = new MaintThread( this );

                        maintThread.setInterval( this.maintSleep );

                        maintThread.start();

                }

        }


So, calling shutdown() and then calling pool.initialize() again, result in a 
IllegaleStateException.

Am I doing something wrong? is this NOT the way to re-init a pool?

or, is it just a bug?






      
____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

Reply via email to