public class MetadataLock
extends java.lang.Object
A lock for ensuring thread-safe access to mutable service metadata.
Constructor and Description |
---|
MetadataLock() |
Modifier and Type | Method and Description |
---|---|
com.sap.cloud.server.odata.core.ReadWriteMutex |
getMutex()
Return read and write mutex
|
void |
readLock(com.sap.cloud.server.odata.core.Action0 action)
Lock metadata to perform action that doesn't change metadata.
|
void |
writeLock(com.sap.cloud.server.odata.core.Action0 action)
Lock metadata to perform action that changes metadata.
|
public com.sap.cloud.server.odata.core.ReadWriteMutex getMutex()
Return read and write mutex
public void readLock(com.sap.cloud.server.odata.core.Action0 action)
Lock metadata to perform action that doesn't change metadata. Note: This is a non-reentrant lock. If a thread tries to acquire a lock while already holding a lock, the thread will hang.
action
- Action to perform while a shared read lock (shared) is held.public void writeLock(com.sap.cloud.server.odata.core.Action0 action)
Lock metadata to perform action that changes metadata.
action
- Action to perform while an exclusive write lock is held.