You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Marcus Crafter <cr...@fztig938.bank.dresdner.net> on 2002/04/15 18:41:22 UTC

InformixDataSource && INIT_FACTORY bug ?

Hi All,

	Was just looking at the following code in InformixDataSource.java:

private static boolean INIT_FACTORY = false;

/**
 * Set up the system property for the context factory if it hasn't been
 * done already.  This is not done in a static initializer due to the
 * existence of the J2eeDataSource.
 */
public InformixDataSource()
{
    if( !InformixDataSource.INIT_FACTORY )
    {
        System.setProperty( Context.INITIAL_CONTEXT_FACTORY,
                            "org.apache.avalon.excalibur.naming.memory.Memor
yInitialContextFactory" );
    }
}

	It looks like the property is set everytime a new instance of
	InformixDataSource is created as INIT_FACTORY is never set to true.
	
	Shouldn't there be an InformixDataSource.INIT_FACTORY = true; in the
	constructor ? (Should it also be within a synchronized block to
	ensure that the static value is modified in a threadsafe manner ?)
	
	Just wanted to check before I go modifying things!! :)
	
	Cheers,
	
	Marcus

-- 
        .....
     ,,$$$$$$$$$,      Marcus Crafter
    ;$'      '$$$$:    Computer Systems Engineer
    $:         $$$$:   ManageSoft GmbH
     $       o_)$$$:   82-84 Mainzer Landstrasse
     ;$,    _/\ &&:'   60327 Frankfurt Germany
       '     /( &&&
           \_&&&&'
          &&&&.
    &&&&&&&:

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>