org.apache.ignite.internal.util

## Class GridDebug

- java.lang.Object
- - org.apache.ignite.internal.util.GridDebug

Direct Known Subclasses:
  D

    public class GridDebug
    extends Object

Utility class for debugging.

### Nested Class Summary

Nested Classes
`static class` `GridDebug.Item` Debug info queue item.

### Constructor Summary

Constructors
Constructor and Description
`GridDebug()`

### Method Summary

All Methods Static Methods Concrete Methods
`static void` `allowWriteLog(boolean allow)`
`static void` `debug(Object... x)` Add the data to debug queue.
`static void` `dump(Collection<GridDebug.Item> que)` Dump given queue to stdout.
`static void` `dumpHeap(String fileName, boolean live)` Call this method from your application whenever you want to dump the heap snapshot into a file.
`static void` `dumpLastAndStop(int n)` Dumps given number of last events.
`static Object` `dumpStack()`
`static String` `dumpWithReset()` Dump existing queue to stdout and atomically replace it with new queue.
`static String` `dumpWithReset(ConcurrentLinkedQueue<GridDebug.Item> q2, IgnitePredicate<GridDebug.Item> filter)` Dump existing queue to stdout and atomically replace it with given.
`static String` `dumpWithStop(Object... x)` Dump existing queue to stdout and atomically replace it with null so that no subsequent logging is possible.
`static void` `hangIfStopped()` Hangs for 5 minutes if stopped.
`static ConcurrentLinkedQueue<GridDebug.Item>` `queue()` Gets collected debug items queue.
`static void` `reset()` Reset queue to empty one.
`static void` `start()` Sets starting time after which `timing(String)` measurements can be done.
`static void` `timing(String label)` Print timing after the `start()` call.
`static void` `write(Object... x)` Writes to log file which should reside on ram disk.

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

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

### Constructor Detail

#### GridDebug

    public GridDebug()

### Method Detail

#### queue

    public static ConcurrentLinkedQueue<GridDebug.Item> queue()

Gets collected debug items queue.

Returns:
  Items queue.

#### allowWriteLog

    public static void allowWriteLog(boolean allow)

Parameters:
  `allow` - Write log.

#### write

    public static void write(Object... x)

Writes to log file which should reside on ram disk.

Parameters:
  `x` - Data to log.

#### debug

    public static void debug(Object... x)

Add the data to debug queue.

Parameters:
  `x` - Debugging data.

#### hangIfStopped

    public static void hangIfStopped()

Hangs for 5 minutes if stopped.

#### start

    public static void start()

Sets starting time after which `timing(String)` measurements can be done.

#### timing

    public static void timing(String label)

Print timing after the `start()` call.

Parameters:
  `label` - Label.

#### dumpStack

    public static Object dumpStack()

Returns:
  Object which will dump thread stack on toString call.

#### dumpLastAndStop

    public static void dumpLastAndStop(int n)

Dumps given number of last events.

Parameters:
  `n` - Number of last elements to dump.

#### dump

    public static void dump(Collection<GridDebug.Item> que)

Dump given queue to stdout.

Parameters:
  `que` - Queue.

#### dumpWithStop

    public static String dumpWithStop(Object... x)

Dump existing queue to stdout and atomically replace it with null so that no subsequent logging is possible.

Parameters:
  `x` - Parameters.
Returns:
  Empty string (useful for assertions like `assert x == 0 : D.dumpWithStop();` ).

#### dumpWithReset

    public static String dumpWithReset()

Dump existing queue to stdout and atomically replace it with new queue.

Returns:
  Empty string (useful for assertions like `assert x == 0 : D.dumpWithReset();` ).

#### dumpWithReset

    public static String dumpWithReset(@Nullable
                                       ConcurrentLinkedQueue<GridDebug.Item> q2,
                                       @Nullable
                                       IgnitePredicate<GridDebug.Item> filter)

Dump existing queue to stdout and atomically replace it with given.

Parameters:
  `q2` - Queue.
  `filter` - Filter for logged debug items.
Returns:
  Empty string.

#### reset

    public static void reset()

Reset queue to empty one.

#### dumpHeap

    public static void dumpHeap(String fileName,
                                boolean live)

Call this method from your application whenever you want to dump the heap snapshot into a file.

Parameters:
  `fileName` - name of the heap dump file
  `live` - flag that tells whether to dump only the live objects

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.6.0
Release Date | : July 10 2018