public class MemoryLocksService extends Object implements Service, Instrumentable
CONF_PREFIX, DEFAULT_LOCK_TIMEOUT, lockTimeout, USE_XCOMMAND
Constructor and Description |
---|
MemoryLocksService() |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroy the memory locks service.
|
Class<? extends Service> |
getInterface()
Return the public interface for the memory locks services
|
MemoryLocks.LockToken |
getReadLock(String resource,
long wait)
Obtain a READ lock for a source.
|
MemoryLocks.LockToken |
getWriteLock(String resource,
long wait)
Obtain a WRITE lock for a source.
|
void |
init(Services services)
Initialize the memory locks service
|
void |
instrument(Instrumentation instr)
Instruments the memory locks service.
|
public MemoryLocksService()
public void destroy()
public Class<? extends Service> getInterface()
getInterface
in interface Service
MemoryLocksService
.public void instrument(Instrumentation instr)
instrument
in interface Instrumentable
instr
- instance to instrument the memory locks service to.public MemoryLocks.LockToken getReadLock(String resource, long wait) throws InterruptedException
resource
- resource name.wait
- time out in milliseconds to wait for the lock, -1 means no timeout and 0 no wait.null
if the lock could not be obtained.InterruptedException
- thrown if the thread was interrupted while waiting.public MemoryLocks.LockToken getWriteLock(String resource, long wait) throws InterruptedException
resource
- resource name.wait
- time out in milliseconds to wait for the lock, -1 means no timeout and 0 no wait.null
if the lock could not be obtained.InterruptedException
- thrown if the thread was interrupted while waiting.Copyright © 2015 Apache Software Foundation. All Rights Reserved.