| Modifier and Type | Method and Description |
|---|---|
boolean |
changeOwner(Lock lock,
ApplicationId appId)
Change the ownership of a set of read and/or write locks.
|
Lock |
createMultiLock(ApplicationId appId,
LockName name,
List<LockNameType> locks)
Create a lock object that represents a pool of locks requested.
|
Lock |
createReadLock(ApplicationId appId,
LockName name)
Get read lock object.
|
Lock |
createWriteLock(ApplicationId appId,
LockName name)
Get write lock object.
|
void |
deleteLock(Lock lock)
Delete a lock create using any of the create lock methods above.
|
List<Lock> |
getAppLocks(ApplicationId appId)
Get the list of locks
Lock that are created by the specified
application instance. |
List<Lock> |
getAppLocks(List<LockName> lockNameList,
ApplicationId appId)
Get the list of locks
Lock present on the specified set of
lockInfos that were created by the provided application instance. |
Lock createReadLock(ApplicationId appId, LockName name)
appId - Application Id [ appName and instanceId ]name - Lock name hierarchy [ Ex: new LockName("appName", "tbl",
"key1") ]Lock createWriteLock(ApplicationId appId, LockName name)
appId - Application Id [ appName and instanceId ]name - Lock name hierarchy [ Ex: new LockName("appName", "tbl",
"key1") ]Lock createMultiLock(ApplicationId appId, LockName name, List<LockNameType> locks) throws LockServiceException.LockMaxCountExceededException, LockServiceException.LockAlreadyCreatedException, LockServiceException.LockListMismatchException, ServiceNotAvailableException, IOException, InterruptedException
appId - Application Id [ appName and instanceId ]name - Unique name of the lock. This can be used to uniquely
identify name of the lock poollocks - List of locksLockServiceException.LockMaxCountExceededException - Locks count exceeded limitLockServiceException.LockAlreadyCreatedException - lock already created by app instanceLockServiceException.LockListMismatchException - Lock list mismatch with existing lockServiceNotAvailableException - Lock service is downInterruptedException - Operation interrupted exceptionIOException - IO exception while data serializationvoid deleteLock(Lock lock) throws ServiceNotAvailableException, InterruptedException
lock - Lock to be deleteServiceNotAvailableException - Lock service is downInterruptedException - Operation interrupted exceptionList<Lock> getAppLocks(List<LockName> lockNameList, ApplicationId appId) throws ServiceNotAvailableException, InterruptedException
Lock present on the specified set of
lockInfos that were created by the provided application instance.
Input parameter lockList can contain a set of {APP, Key}
combination and/or {APP} alone. In case of {APP, Key}, all the locks of
the specified application instance are retrieved that are on the key
{Key} specified. In case of {APP}, all the locks on keys under {APP} are
retrieved that are created by the specified application instance.
On getting the Lock list, Application is supposed to understand current
state Lock.getState() of each Lock Lock and act
on it.
This method shall be used when an application instance dies and another
instance takes over the control. The latter application would take the
locks owned by the crashed application instance and act on them.lockNameList - List of LockName objects. The list contains the list
of lock hierarchy to be searched that were owned by the provided
application instance. All type [read/write/multi] of locks that are owned
by the application instance are fetched by the query.appId - Lock owning Application identifierServiceNotAvailableException - Lock service is downInterruptedException - Operation interrupted exceptionList<Lock> getAppLocks(ApplicationId appId) throws ServiceNotAvailableException, InterruptedException
Lock that are created by the specified
application instance.
Note: This is a time consuming operation. It is suggested to use another
variant of the API that takes the LockNameType list to search for the
application owning locks.
On getting the Lock list, Application is supposed to understand current
state Lock.getState() of each Lock Lock and act
on it.
This method shall be used when an application instance dies and another
instance takes over the control. The latter application would take the
locks owned by the crashed application instance and act on them.appId - Lock owning Application identifierServiceNotAvailableException - Lock service is downInterruptedException - Operation interrupted exceptionboolean changeOwner(Lock lock, ApplicationId appId) throws ServiceNotAvailableException, InterruptedException, IOException
lock - lock whose ownership needs to be changedappId - New owner Application identifiertrue if operation succeeds false otherwiseServiceNotAvailableException - Lock service is downInterruptedException - Operation interrupted exceptionIOException - IO exception while data serializationCopyright © 2014. All Rights Reserved.