org.apache.cassandra.tracing

## Class TraceState

- java.lang.Object
- - org.apache.cassandra.tracing.TraceState

All Implemented Interfaces:
  ProgressEventNotifier

Direct Known Subclasses:
  TraceStateImpl

    public abstract class TraceState
    extends java.lang.Object
    implements ProgressEventNotifier

ThreadLocal state for a tracing session. The presence of an instance of this class as a ThreadLocal denotes that an operation is being traced.

### Nested Class Summary

Nested Classes
`static class` `TraceState.Status`

### Field Summary

Fields
`java.net.InetAddress` `coordinator`
`java.util.UUID` `sessionId`
`java.nio.ByteBuffer` `sessionIdBytes`
`Tracing.TraceType` `traceType`
`int` `ttl`
`com.google.common.base.Stopwatch` `watch`

### Constructor Summary

Constructors
`protected` `TraceState(java.net.InetAddress coordinator, java.util.UUID sessionId, Tracing.TraceType traceType)`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`boolean` `acquireReference()`
`void` `addProgressListener(ProgressListener listener)` Register progress listener to this publisher.
`int` `elapsed()`
`void` `enableActivityNotification(java.lang.String tag)` Activate notification with provided `tag` name.
`protected void` `notifyActivity()`
`int` `releaseReference()`
`void` `removeProgressListener(ProgressListener listener)` Remove progress listener from this publisher.
`void` `stop()`
`void` `trace(java.lang.String message)`
`void` `trace(java.lang.String format, java.lang.Object arg)`
`void` `trace(java.lang.String format, java.lang.Object[] args)`
`void` `trace(java.lang.String format, java.lang.Object arg1, java.lang.Object arg2)`
`protected abstract void` `traceImpl(java.lang.String message)`
`TraceState.Status` `waitActivity(long timeout)`
`protected void` `waitForPendingEvents()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### sessionId

    public final java.util.UUID sessionId

#### coordinator

    public final java.net.InetAddress coordinator

#### watch

    public final com.google.common.base.Stopwatch watch

#### sessionIdBytes

    public final java.nio.ByteBuffer sessionIdBytes

#### traceType

    public final Tracing.TraceType traceType

#### ttl

    public final int ttl

### Constructor Detail

#### TraceState

    protected TraceState(java.net.InetAddress coordinator,
                         java.util.UUID sessionId,
                         Tracing.TraceType traceType)

### Method Detail

#### enableActivityNotification

    public void enableActivityNotification(java.lang.String tag)

Activate notification with provided `tag` name.

Parameters:
  `tag` - Tag name to add when emitting notification

#### addProgressListener

    public void addProgressListener(ProgressListener listener)

Description copied from interface: `ProgressEventNotifier`
Register progress listener to this publisher.

Specified by:
  `addProgressListener` in interface `ProgressEventNotifier`
Parameters:
  `listener` - listener to register.

#### removeProgressListener

    public void removeProgressListener(ProgressListener listener)

Description copied from interface: `ProgressEventNotifier`
Remove progress listener from this publisher.

Specified by:
  `removeProgressListener` in interface `ProgressEventNotifier`
Parameters:
  `listener` - listener to remove

#### elapsed

    public int elapsed()

#### stop

    public void stop()

#### waitActivity

    public TraceState.Status waitActivity(long timeout)

#### notifyActivity

    protected void notifyActivity()

#### trace

    public void trace(java.lang.String format,
                      java.lang.Object arg)

#### trace

    public void trace(java.lang.String format,
                      java.lang.Object arg1,
                      java.lang.Object arg2)

#### trace

    public void trace(java.lang.String format,
                      java.lang.Object[] args)

#### trace

    public void trace(java.lang.String message)

#### traceImpl

    protected abstract void traceImpl(java.lang.String message)

#### waitForPendingEvents

    protected void waitForPendingEvents()

#### acquireReference

    public boolean acquireReference()

#### releaseReference

    public int releaseReference()