25.01.2015 Views

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Object Concurrency<br />

Setting<br />

1<br />

2<br />

3<br />

4<br />

Meaning<br />

Atomic<br />

Shared<br />

Shared /<br />

Retained<br />

Exclusive<br />

Description<br />

When an object is loaded, the %LoadData method<br />

creates a shared lock for the object, provided that the<br />

object occupies more than one storage node in the<br />

database. No locks are held for objects stored in a single<br />

node. %LoadData releases the lock after it finishes<br />

loading the object. When an object is initially saved to the<br />

database (inserted), %SaveData holds an exclusive lock<br />

during the save, provided that the object occupies more<br />

than one storage node in the database. %SaveData holds<br />

no locks for objects stored in a single node. When a<br />

previously saved object is saved to the database<br />

(updated), %SaveData holds an exclusive lock during the<br />

save.<br />

When an object is loaded, the %LoadData method<br />

creates a shared lock for the object. %LoadData releases<br />

the lock after it finishes loading the object.When an object<br />

is initially saved to the database (inserted), %SaveData<br />

holds an exclusive lock during the save, provided that the<br />

object occupies more than one storage node in the<br />

database. %SaveData holds no locks for objects stored<br />

in a single node.When a previously saved object is saved<br />

to the database (updated), %SaveData holds an exclusive<br />

lock during the course of the save.<br />

A shared lock is acquired either when an existing object<br />

is opened or when a new object is initially saved to the<br />

database (inserted); the lock is released when the object<br />

is destructed. Additionally, when an object is initially saved<br />

to the database, %SaveData holds an exclusive lock<br />

during the save, provided the object occupies more than<br />

one storage node in the database.<br />

An exclusive lock is acquired either when an existing<br />

object is opened or when a new object is initially saved<br />

to the database (inserted); the lock is released when the<br />

object is destructed.<br />

It is important to set concurrency options at an appropriate level for your application. Consider<br />

the following scenario:<br />

1. Process A opens an object.<br />

2. Process B deletes that object from disk.<br />

202 <strong>Using</strong> <strong>Caché</strong> <strong>Objects</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!