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 at the beginning of the first read operation and the lock is kept until ServiceGeodatabase::close or ServiceGeodatabase::switchVersion(string) methods are called. A call to ServiceFeatureTable::clearCache(bool) also ends a read session if the ServiceFeatureTable is in Enums.FeatureRequestModeManualCache.

The following read operations are affected by this behavior:

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:

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.

The following edit operations are affected by this behavior:

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?