Unfortunately, I don't think the lock file has enough information in it
(you'd need an IP address and port number) to make starting an HSQL
server useful. Unless, of course, you make your own lock file ...
For example ...
Client A (192.168.0.43) runs the modeler. No lock file exists. Great,
start a server!
Client B (192.168.0.54) runs the modeler. Same user on a shared file
system. Lock file exists. Try connecting to the original Client A
started server. You'd need to know the IP and port number to change the
connection dictionary so you could talk to client A's HSQLDB server.
But wait, there is more! What if client A shuts down while client B is
still using its server? What if client A and B start battling over
preference settings (optimistic locking errors everywhere)? What port
number do you use? You could potentially have two Modelers running on a
single system (different users) and they'd need different port numbers.
I'm sure I could dream up more scenarios ...
I think the cleanest solution is to only allow access by one client at a
time. Maybe capture the exception better to report it to the user.
Just my thoughts ...
/dev/mrg
-----Original Message-----
From: Andrus Adamchik [mailto:andru..bjectstyle.org]
Sent: Tuesday, November 02, 2004 11:38 AM
To: cayenne-deve..bjectstyle.org
Subject: RE: [OS-JIRA] Created: (CAY-227) Cannot launch modeler on OSX
when logged in as user with networked home directory
I was also thinking about that when I looked at the stack... Still it is
likely more subtle. Current behavior for handling multiple instances is
that when a db.lck file is detected (this might indicate other another
open app or a crashed app), it copies the db (using db1, db2, db3 and so
on), and runs from that copy. So the fact that the copy can't be
accessed
is probably some concurrency issue (two instances of modeler loaded at
the
same time).
Ah... This whole part should probably be redone anyway... Maybe the
first
instance that locks the DB should become an HSQL server?
Also as Ari (the author of this bug report) is likely not on this list,
I
guess I should paste this thread as an issue comment in JIRA.
Andrus
> I don't think this is a network issue. Here is the offending
exception,
> I think:
>
> Caused by: java.sql.SQLException: The database is already in use by
> another process: org.hsqldb.NIOLockFil..9737627[file
>
=/private/Network/Servers/dish.ish.com.au/SharedItems/Users/ari/.cayenne
> /prefs/1.1/db3.lck, exists=true, locked=false, valid=false, fl =null]:
>
> With HSQLDB in embedded/standalone mode (where you aren't running a
> server -- the client accesses the database file directly), the
database
> can only be accessed by one client at a time. I'd be willing to bet
you
> had tried to run the modeler twice (two different OS X systems). This
> is related to the modeler switching over to HSQLDB to store
preferences.
>
> /dev/mrg
>
>
> -----Original Message-----
> From: jir..bjectstyle.org [mailto:jira@objectstyle.org]
> Sent: Tuesday, November 02, 2004 8:00 AM
> To: cayenne-deve..bjectstyle.org
> Subject: [OS-JIRA] Created: (CAY-227) Cannot launch modeler on OSX
when
> logged in as user with networked home directory
>
>
> Message:
>
> A new issue has been created in JIRA.
>
> ---------------------------------------------------------------------
> View the issue:
>
> http://objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-227
>
>
> Here is an overview of the issue:
> ---------------------------------------------------------------------
> Key: CAY-227
> Summary: Cannot launch modeler on OSX when logged in as user with
> networked home directory
> Type: Bug
>
> Status: Assigned
> Priority: Major
>
> Project: Cayenne
> Components:
> CayenneModeler GUI
> Versions:
> 1.1
>
> Assignee: Andrus Adamchik
> Reporter: Ari Maniatis
>
> Created: Tue, 2 Nov 2004 7:58 AM
> Updated: Tue, 2 Nov 2004 7:58 AM
> Environment: OSX 10.3, Cayenne 1.1RC2. Home directory is on network
> share point. No problem when run as user with local home directory.
>
> Description:
> apple.awt.EventQueueExceptionHandler Caught Throwable :
> org.objectstyle.cayenne.CayenneRuntimeException: [v.1.1RC2 October 24
> 2004] Global exception.
> org.objectstyle.cayenne.CayenneRuntimeException: [v.1.1RC2 October 24
> 2004] Global exception.
> at
>
org.objectstyle.cayenne.access.util.SelectObserver.nextGlobalException(S
> electObserver.java:222)
> at
>
org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:325
> )
> at
>
org.objectstyle.cayenne.access.DataDomain.performQueries(DataDomain.java
> :654)
> at
>
org.objectstyle.cayenne.access.DataContext.performQueries(DataContext.ja
> va:1408)
> at
>
org.objectstyle.cayenne.access.Transaction.performQueries(Transaction.ja
> va:179)
> at
>
org.objectstyle.cayenne.access.DataContext.performQueries(DataContext.ja
> va:1366)
> at
>
org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java
> :1622)
> at
>
org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java
> :1556)
> at
>
org.objectstyle.cayenne.pref.CayennePreferenceService.getDomain(CayenneP
> referenceService.java:119)
> at
>
org.objectstyle.cayenne.pref.CayennePreferenceService.getPreferenceDomai
> n(CayennePreferenceService.java:172)
> at
>
org.objectstyle.cayenne.pref.CayennePreferenceService.initPreferences(Ca
> yennePreferenceService.java:180)
> at
>
org.objectstyle.cayenne.pref.HSQLEmbeddedPreferenceService.startService(
> HSQLEmbeddedPreferenceService.java:153)
> at
>
org.objectstyle.cayenne.modeler.Application.initPreferences(Application.
> java:295)
> at
>
org.objectstyle.cayenne.modeler.Application.startup(Application.java:219
> )
> at org.objectstyle.cayenne.modeler.Main$1.run(Main.java:136)
at
> java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
> at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
> at
>
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThrea
> d.java:234)
> at
>
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.
> java:184)
> at
> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178)
> at
> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:170)
> at
> java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
> Caused by: java.sql.SQLException: The database is already in use by
> another process: org.hsqldb.NIOLockFil..9737627[file
>
=/private/Network/Servers/dish.ish.com.au/SharedItems/Users/ari/.cayenne
> /prefs/1.1/db3.lck, exists=true, locked=false, valid=false, fl =null]:
> at org.hsqldb.jdbc.jdbcUtil.sqlException(Unknown Source)
> at org.hsqldb.jdbc.jdbcConnection.<init>(Unknown Source)
> at org.hsqldb.jdbcDriver.getConnection(Unknown Source)
> at org.hsqldb.jdbcDriver.connect(Unknown Source)
> at
>
org.objectstyle.cayenne.conn.DriverDataSource.getConnection(DriverDataSo
> urce.java:151)
> at
>
org.objectstyle.cayenne.conn.PooledConnectionImpl.reconnect(PooledConnec
> tionImpl.java:126)
> at
>
org.objectstyle.cayenne.conn.PooledConnectionImpl.getConnection(PooledCo
> nnectionImpl.java:163)
> at
>
org.objectstyle.cayenne.conn.PoolManager.uncheckConnection(PoolManager.j
> ava:427)
> at
>
org.objectstyle.cayenne.conn.PoolManager.getConnection(PoolManager.java:
> 411)
> at
>
org.objectstyle.cayenne.conn.PoolManager.getConnection(PoolManager.java:
> 385)
> at
>
org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:313
> )
> ... 20 more
>
>
>
> ---------------------------------------------------------------------
> JIRA INFORMATION:
> This message is automatically generated by JIRA.
>
> If you think it was sent incorrectly contact one of the
administrators:
> http://objectstyle.org/jira/secure/Administrators.jspa
>
> If you want more information on JIRA, or have a bug to report see:
> http://www.atlassian.com/software/jira
This archive was generated by hypermail 2.0.0 : Tue Nov 02 2004 - 11:56:17 EST