|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object akka.util.Switch
public class Switch
An atomic switch that can be either on or off
Constructor Summary | |
---|---|
Switch(boolean startAsOn)
|
Method Summary | ||
---|---|---|
|
fold(scala.Function0<T> on,
scala.Function0<T> off)
Executes the provided callbacks depending on if the switch is either on or off waiting for any pending changes to happen before (locking) Be careful of longrunning or blocking within the provided action as it can lead to deadlocks or bad performance |
|
boolean |
ifOff(scala.Function0<scala.runtime.BoxedUnit> action)
Executes the provided action and returns if the action was executed or not, if the switch is IMMEDIATELY off (i.e. |
|
|
ifOffYield(scala.Function0<T> action)
Executes the provided action and returns its value if the switch is IMMEDIATELY off (i.e. |
|
boolean |
ifOn(scala.Function0<scala.runtime.BoxedUnit> action)
Executes the provided action and returns if the action was executed or not, if the switch is IMMEDIATELY on (i.e. |
|
|
ifOnYield(scala.Function0<T> action)
Executes the provided action and returns its value if the switch is IMMEDIATELY on (i.e. |
|
boolean |
isOff()
Returns whether the switch is IMMEDDIATELY off (no locking) |
|
boolean |
isOn()
Returns whether the switch is IMMEDIATELY on (no locking) |
|
|
locked(scala.Function0<T> code)
Executes the given code while holding this switch’s lock, i.e. |
|
boolean |
switchOff()
Switches the switch off (if on), uses locking |
|
boolean |
switchOff(scala.Function0<scala.runtime.BoxedUnit> action)
Executes the provided action if the lock is on under a lock, so be _very_ careful with longrunning/blocking operations in it Only executes the action if the switch is on, and switches it off immediately after obtaining the lock Will switch it back on if the provided action throws an exception |
|
boolean |
switchOn()
Switches the switch on (if off), uses locking |
|
boolean |
switchOn(scala.Function0<scala.runtime.BoxedUnit> action)
Executes the provided action if the lock is off under a lock, so be _very_ careful with longrunning/blocking operations in it Only executes the action if the switch is off, and switches it on immediately after obtaining the lock Will switch it back off if the provided action throws an exception |
|
protected boolean |
transcend(boolean from,
scala.Function0<scala.runtime.BoxedUnit> action)
|
|
boolean |
whileOff(scala.Function0<scala.runtime.BoxedUnit> action)
Executes the provided action and returns if the action was executed or not, if the switch is off, waiting for any pending changes to happen before (locking) Be careful of longrunning or blocking within the provided action as it can lead to deadlocks or bad performance |
|
|
whileOffYield(scala.Function0<T> action)
Executes the provided action and returns its value if the switch is off, waiting for any pending changes to happen before (locking) Be careful of longrunning or blocking within the provided action as it can lead to deadlocks or bad performance |
|
boolean |
whileOn(scala.Function0<scala.runtime.BoxedUnit> action)
Executes the provided action and returns if the action was executed or not, if the switch is on, waiting for any pending changes to happen before (locking) Be careful of longrunning or blocking within the provided action as it can lead to deadlocks or bad performance |
|
|
whileOnYield(scala.Function0<T> action)
Executes the provided action and returns its value if the switch is on, waiting for any pending changes to happen before (locking) Be careful of longrunning or blocking within the provided action as it can lead to deadlocks or bad performance |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Switch(boolean startAsOn)
Method Detail |
---|
protected boolean transcend(boolean from, scala.Function0<scala.runtime.BoxedUnit> action)
public boolean switchOff(scala.Function0<scala.runtime.BoxedUnit> action)
action
- (undocumented)
public boolean switchOn(scala.Function0<scala.runtime.BoxedUnit> action)
action
- (undocumented)
public boolean switchOff()
public boolean switchOn()
public <T> scala.Option<T> ifOnYield(scala.Function0<T> action)
action
- (undocumented)
public <T> scala.Option<T> ifOffYield(scala.Function0<T> action)
action
- (undocumented)
public boolean ifOn(scala.Function0<scala.runtime.BoxedUnit> action)
action
- (undocumented)
public boolean ifOff(scala.Function0<scala.runtime.BoxedUnit> action)
action
- (undocumented)
public <T> scala.Option<T> whileOnYield(scala.Function0<T> action)
action
- (undocumented)
public <T> scala.Option<T> whileOffYield(scala.Function0<T> action)
action
- (undocumented)
public boolean whileOn(scala.Function0<scala.runtime.BoxedUnit> action)
action
- (undocumented)
public boolean whileOff(scala.Function0<scala.runtime.BoxedUnit> action)
action
- (undocumented)
public <T> T fold(scala.Function0<T> on, scala.Function0<T> off)
on
- (undocumented)off
- (undocumented)
public <T> T locked(scala.Function0<T> code)
code
- (undocumented)
public boolean isOn()
public boolean isOff()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |