org.apache.cassandra.tracing

## Class TraceState

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

- All Implemented Interfaces:
    ProgressEventNotifier
  Direct Known Subclasses:
    ExpiredTraceState

      public 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
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `TraceState.Status`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `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
    Constructor and Description
    `TraceState(java.net.InetAddress coordinator, java.util.UUID sessionId, Tracing.TraceType traceType)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.
    `static void` | `mutateWithTracing(java.nio.ByteBuffer sessionId, java.lang.String message, int elapsed, int ttl)` Called from `OutboundTcpConnection` for non-local traces (traces that are not initiated by local node == coordinator).
    `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)`
    `TraceState.Status` | `waitActivity(long timeout)`
    `protected void` | `waitForPendingEvents()` Post a no-op event to the TRACING stage, so that we can be sure that any previous mutations have at least been applied to one replica.

    - ### 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

          public 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)

    - #### 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)

    - #### mutateWithTracing

          public static void mutateWithTracing(java.nio.ByteBuffer sessionId,
                                               java.lang.String message,
                                               int elapsed,
                                               int ttl)

      Called from `OutboundTcpConnection` for non-local traces (traces that are not initiated by local node == coordinator).

    - #### waitForPendingEvents

          protected void waitForPendingEvents()

      Post a no-op event to the TRACING stage, so that we can be sure that any previous mutations have at least been applied to one replica. This works because the tracking executor only has one thread in its pool, see `StageManager.tracingExecutor()`.

    - #### acquireReference

          public boolean acquireReference()

    - #### releaseReference

          public int releaseReference()

Copyright © 2018 The Apache Software Foundation