Package io.opencensus.implcore.internal
Class CurrentState
- java.lang.Object
-
- io.opencensus.implcore.internal.CurrentState
-
@ThreadSafe public final class CurrentState extends java.lang.Object
The current state base implementation for stats and tags.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
CurrentState.InternalState
static class
CurrentState.State
Current state for stats or tags.
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicReference<CurrentState.InternalState>
currentInternalState
-
Constructor Summary
Constructors Constructor Description CurrentState(CurrentState.State defaultState)
Constructs a newCurrentState
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CurrentState.State
get()
Returns the current state and updates the status as being read.CurrentState.State
getInternal()
Returns the current state without updating the status as being read.boolean
set(CurrentState.State state)
Sets current state to the given state.
-
-
-
Field Detail
-
currentInternalState
private final java.util.concurrent.atomic.AtomicReference<CurrentState.InternalState> currentInternalState
-
-
Constructor Detail
-
CurrentState
public CurrentState(CurrentState.State defaultState)
Constructs a newCurrentState
.- Parameters:
defaultState
- the default initial state.
-
-
Method Detail
-
get
public CurrentState.State get()
Returns the current state and updates the status as being read.- Returns:
- the current state and updates the status as being read.
-
getInternal
public CurrentState.State getInternal()
Returns the current state without updating the status as being read.- Returns:
- the current state without updating the status as being read.
-
set
public boolean set(CurrentState.State state)
Sets current state to the given state. Returns true if the current state is changed, false otherwise.- Parameters:
state
- the state to be set.- Returns:
- true if the current state is changed, false otherwise.
-
-