This entry was posted on Thursday, December 20th, 2007 at 1:01 pm and is filed under FAQ. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
How to disconnect from a virtual space
Q: “Our application kicks off with a menu where icons are clicked to invoke windows which have their own transaction to the database. How does an application connect to a VOSS virtual space and automatically disconnect when the menu is closed?”
A: To clarify terminology: “connecting” to a virtual space means making the image aware of its existence, requiring a pathname; “log-on” to a virtual space means opening the files in that image and registering that image’s log-on in the space’s dictionary of current accesses (using the ImageID set when VOSS is installed in the image) by the system’s private log-on transaction. There’s no need to log-off after every transaction, but the two operations could be combined like this:
| vom customers departments |
[ [ vom := VOManager newForExistingSpace: ‘c:\vospaces\myspace’. “connect”
vom isNil ifTrue: [^self].
vom open ifFalse: [^self]. “log-on”
[ customers := vom rootDictionary at: ‘customers’.
departments := vom rootDictionary at: ‘departments’
] atomicReadOnly.
…
…
…
] ensure:
[ vom notNil ifTrue: [vom close; disconnect]]
] forkAt: (Processor userBackgroundPriority).
Leave a Reply
