@GridToStringExclude public interface GridKernalGateway
Modifier and Type | Method and Description |
---|---|
void |
addStopListener(Runnable lsnr)
Adds stop listener.
|
GridKernalState |
getState()
Gets current kernal state.
|
void |
lightCheck()
Performs light-weight check on the kernal state at the moment of this call.
|
void |
readLock()
Should be called on entering every kernal related call
originated directly or indirectly via public API.
|
void |
readLockAnyway()
Same as
readLock() but doesn't throw IllegalStateException if grid stop. |
void |
readUnlock()
Should be called on leaving every kernal related call
originated directly or indirectly via public API.
|
void |
removeStopListener(Runnable lsnr)
Removes previously added stop listener.
|
void |
setState(GridKernalState state)
Sets kernal state.
|
boolean |
tryWriteLock(long timeout) |
String |
userStackTrace()
Gets user stack trace through the first call of grid public API.
|
void |
writeLock()
This method waits for all current calls to exit and blocks any further
readLock() calls until writeUnlock() method is called. |
void |
writeUnlock()
This method unblocks
writeLock() . |
void lightCheck() throws IllegalStateException
This method should only be used when the kernal state should be checked just once at the beginning of the method and the fact that kernal state can change in the middle of such method's execution should not matter.
For example, when a method returns a constant value its implementation doesn't depend
on the kernal being valid throughout its execution. In such case it is enough to check
the kernal's state just once at the beginning of this method to provide consistent behavior
of the API without incurring overhead of lock-based
guard methods.
IllegalStateException
- Thrown in case when no kernal calls are allowed.void readLock() throws IllegalStateException
This method essentially acquires a read lock and multiple threads can enter the call without blocking.
IllegalStateException
- Thrown in case when no kernal calls are allowed.readUnlock()
void readLockAnyway()
readLock()
but doesn't throw IllegalStateException if grid stop.void setState(GridKernalState state)
state
- Kernal state to set.GridKernalState getState()
void readUnlock()
This method essentially releases the internal read-lock acquired previously
by readLock()
method.
readLock()
void writeLock()
readLock()
calls until writeUnlock()
method is called.
This method essentially acquires the internal write lock.
void writeUnlock()
writeLock()
.
This method essentially releases internal write lock previously acquired
by writeLock()
method.
void addStopListener(Runnable lsnr)
lsnr
- Listener to add.void removeStopListener(Runnable lsnr)
lsnr
- Listener to remove.String userStackTrace()
boolean tryWriteLock(long timeout) throws InterruptedException
timeout
- Timeout.True
if write lock has been acquired.InterruptedException
- If interrupted.
Follow @ApacheIgnite
Ignite Fabric : ver. 1.0.0 Release Date : March 31 2015