Overview | Package | Class | Tree | Deprecated | Index | Help
| JProfiler API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.jprofiler.api.agent.probe
Class ThreadLocalStack

    java.lang.Object
      com.jprofiler.api.agent.probe.ThreadLocalStack

    public class ThreadLocalStack

extends java.lang.Object

A stack that saves objects in thread local data structures. This utility class is important for calculating payload timing where you need to save payload infos in the `InterceptorProbe.interceptionEnter(InterceptorContext, Object, Class, String, String, String, Object[])` method and retrieve them in the `InterceptorProbe.interceptionExit(InterceptorContext, Object, Class, String, String, String, Object)` method of an interceptor.

Usually, you can use the `InterceptorContext.push(PayloadInfo)` and `InterceptorContext.pop()` methods which use such a thread local stack. Use this class only if you have to maintain more that ony such stack in a single probe.

Constructor Summary
`ThreadLocalStack()`

Method Summary
`java.util.List` | `getList()` Returns the stack as a list.
`boolean` | `isEmpty()` Checks if the thread-local stack is empty.
`java.lang.Object` | `peek()` Retrieves the object on top of the thread-local stack.
`java.lang.Object` | `pop()` Pops an object from the thread-local stack.
`void` | `push(java.lang.Object object)` Pushes an object onto the thread-local stack.
`int` | `size()` Returns the number of objects currently on the thread-local stack.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ThreadLocalStack

    public ThreadLocalStack()

Method Detail

### push

    public void push(java.lang.Object object)

  Pushes an object onto the thread-local stack.

  Parameters:
    `object` - the object

### pop

    public java.lang.Object pop()

  Pops an object from the thread-local stack.

  Returns:
    the object.

### peek

    public java.lang.Object peek()

  Retrieves the object on top of the thread-local stack.

  Returns:
    the object.

### size

    public int size()

  Returns the number of objects currently on the thread-local stack.

  Returns:
    the number of objects

### getList

    public java.util.List getList()

  Returns the stack as a list.

  Returns:
    a list

### isEmpty

    public boolean isEmpty()

  Checks if the thread-local stack is empty.

  Returns:
    if the stack is empty or not

Overview | Package | Class | Tree | Deprecated | Index | Help
| JProfiler API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD