public class MemoryLocksService extends Object implements Service, Instrumentable
Modifier and Type | Class and Description |
---|---|
static class |
MemoryLocksService.Type |
Modifier and Type | Field and Description |
---|---|
protected static String |
INSTRUMENTATION_GROUP |
CONF_PREFIX, DEFAULT_LOCK_TIMEOUT, lockTimeout
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 |
getMemoryLocks() |
LockToken |
getReadLock(String resource,
long wait)
Obtain a READ lock for a source.
|
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.
|
protected static final String INSTRUMENTATION_GROUP
public MemoryLocksService()
public void init(Services services) throws ServiceException
init
in interface Service
services
- services instance.ServiceException
- thrown if the service could not initialize.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 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 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.public MemoryLocks getMemoryLocks()
Copyright © 2018 Apache Software Foundation. All rights reserved.