-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

"Campbell Boucher-Burnet" <[EMAIL PROTECTED]> writes:

> Fred:
> 
> I'm not sure I completely agree.  As long as the connections are all inside
> the same VM, jdbcConnection can garantee that requests for the same URL all
> share a single instance of the Database, which makes concurrent access safe

BTW... I also tweaked our connection pool to only use one instance... and it
still failed :(

> (i.e. openStandalone is syncronized, and Database.execute() is syncronized,
> and instances against each distinct database are cached) and should not result
> in the "Database is un use by..." message:
> 
>     private synchronized void openStandalone(String user, String password)
>      throws SQLException { dDatabase = (Database)
>      tDatabase.get(sDatabaseName);
> 
>  int usage;
> 
>  if (dDatabase == null) {
>      dDatabase = new Database(sDatabaseName);
> 
>      tDatabase.put(sDatabaseName, dDatabase);
> 
>      usage = 1;
>  } else {
>      usage = 1 + ((Integer) iUsageCount.get(sDatabaseName)).intValue();
>  }
> 
>  iUsageCount.put(sDatabaseName, new Integer(usage));
> 
>  cChannel = dDatabase.connect(user, password);
>     }
> /*
> NOTE:  I just realized a bug in the code above!!!  Relative "standalone"
> urls are broken, since we do not cannonicalize the path before puting it in
> the hashtable.  Thus, if the current directory is changed inside the JVM and
> a new "standalone" url connection is requested in the relative form, a
> connection to the previously opened instasnce will be returned until the
> usage count against the relative url goes to zero.  This needs to be fixed
> or documented in a clear manner.
> */

Hm... wasn't this only added in JDK 1.4?  It might be better to compute absolute
paths on startup.
<snip/>

> However, it should *not* be possible to have connections to the same
> standalone database url from separate JVMs/OS processes.  Theoretically, one
> should get the "The Database is in use by another process" message every time
> an attempt is made by some process after another process successfully makes
> the first connection.

OK... what about from multiple threads?  What if you have the save JVM but
multiple threads in the above scenario?

Oh... I see what you are saying... multiple VMs all starting standalone by
themselves on the same on-disk DB.... right.
<snip/>

- -- 
Kevin A. Burton ( [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] )
             Location - San Francisco, CA, Cell - 415.595.9965
        Jabber - [EMAIL PROTECTED],  Web - http://relativity.yi.org/

The dawn is rising on a new day!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Get my public key at: http://relativity.yi.org/pgpkey.txt

iD8DBQE8iSkdAwM6xb2dfE0RAhZpAKCnKN58ZdL++lJM53SC/ox6OuvLAwCg0Gkk
XCm8PzG40INvCqvtxmZ1lmE=
=0ps/
-----END PGP SIGNATURE-----

_______________________________________________
hsqldb-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hsqldb-developers

Reply via email to