ArcGIS Developers

Enums.FeatureServiceSessionType enumeration

The Enums.FeatureServiceSessionType applies to both the read and edit sessions.

When the Enums.FeatureServiceSessionType is set to Enums.FeatureServiceSessionTypePersistent the following rules govern the lock type and duration: If session is a read session, then a shared lock is acquired when the ServiceGeodatabase is loaded and the lock is kept until either ServiceGeodatabase::close or ServiceGeodatabase::switchVersion(string) methods are called.

When ServiceGeodatabase::switchVersion(string) is called, a read session is started on the new version before releasing the session on the previous version. If acquiring a shared lock on the new version fails, an error is raised.

If session is an edit session, then an exclusive lock is acquired (by upgrading the shared lock) at the beginning of a write operation and held until one of the following methods is called: * ServiceFeatureTable::undoLocalEdits * ServiceGeodatabase::undoLocalEdits * ServiceFeatureTable::applyEdits * ServiceGeodatabase::applyEdits

When all edit operations are applied successfully the exclusive lock is demoted back to a shared lock. A call to ServiceGeodatabase::close will release the exclusive lock. Exception: If the current version is the default version, no exclusive lock will be acquired.

When Enums.FeatureServiceSessionType is set to Enums.FeatureServiceSessionTypeTransient, no explicit locks are requested.

The FeatureServiceSessionType can be one of:

Enums.FeatureServiceSessionTypeTransient(0) A momentary session is used during queries and edit operations. This type of session will avoid holding a lock any longer than necessary, allowing other clients to connect to, query, and edit a version being used by the ServiceGeodatabase. Use this type of session when concurrency is more important than data consistency between queries or between concurrent users. This is the default value.
Enums.FeatureServiceSessionTypePersistent(1) A session is held open as long as tables are actively reading or writing. This type of session will hold a lock on the version the ServiceGeodatabase is working with, ensuring data consistency but decreasing concurrency. This will create a persistent lock for both read and edit sessions.

During read sessions, a shared lock will be held while tables are connected to the feature service, preventing other clients from editing the version.

During edit sessions, an exclusive lock will be held while edits have been made to the locally cached data, preventing other clients from both reading and editing. When all edits are successfully applied to the service, the exclusive lock is released.

Feedback on this topic?