public class AtomicState extends Object
Modifier and Type | Field and Description |
---|---|
protected AtomicInteger |
currentState |
protected AtomicBoolean |
isToeScheduled |
protected AtomicBoolean |
isToeWaiting |
protected AtomicLong |
tackRequests |
protected AtomicLong |
tickRequests |
protected AtomicLong |
toeRequests |
protected AtomicLong |
toeThread |
protected AtomicLong |
waitingTicks |
Constructor and Description |
---|
AtomicState() |
AtomicState(AccessState initialStatus) |
Modifier and Type | Method and Description |
---|---|
void |
discardScheduledToe()
This method discards scheduled Toe state entry, but doesn't exits currently entered Toe state, if that's the case.
|
AccessState |
getCurrentState()
This method returns the current memory state
|
long |
getTackRequests()
This method returns number of current Tack sessions
|
long |
getTickRequests()
This method returns number of current Tick sessions
|
long |
getWaitingTickRequests()
This methods
|
boolean |
isToeAvailable()
This method checks, if Toe state can be entered.
|
void |
releaseToe()
This method requests release Toe status back to Tack.
|
void |
requestTack()
This method requests to change state to Tack
|
void |
requestTick()
This method requests to change state to Tick.
|
void |
requestTick(long time,
TimeUnit timeUnit)
This method requests to change state to Tick.
|
void |
requestToe()
This method requests to change state to Toe
PLEASE NOTE: this method is blocking, untill all Tick requests are brought down to Tack state;
|
void |
scheduleToe()
This method schedules Toe state entry, but doesn't enters it.
|
boolean |
tryRequestToe()
This method requests to change state to Toe
PLEASE NOTE: this method is non-blocking, if Toe request is impossible atm, it will return false.
|
protected final AtomicInteger currentState
protected final AtomicLong tickRequests
protected final AtomicLong tackRequests
protected final AtomicLong toeRequests
protected final AtomicLong waitingTicks
protected final AtomicBoolean isToeWaiting
protected final AtomicBoolean isToeScheduled
protected final AtomicLong toeThread
public AtomicState()
public AtomicState(AccessState initialStatus)
public void requestTick()
public void requestTick(long time, TimeUnit timeUnit)
time
- timeUnit
- public void requestTack()
public void requestToe()
public boolean tryRequestToe()
public void releaseToe()
public AccessState getCurrentState()
public long getWaitingTickRequests()
public long getTickRequests()
public long getTackRequests()
public boolean isToeAvailable()
public void scheduleToe()
public void discardScheduledToe()
Copyright © 2016. All Rights Reserved.