Class ThrowableCache

java.lang.Object
com.rollbar.jvmti.ThrowableCache

public final class ThrowableCache extends Object
ThrowableCache is a mechanism for storing information from the native interface at the time of an exception which can be queried later by the notifier for enhancing payloads.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    add(Throwable throwable, CacheFrame[] frames)
    Add a list of frames with extra information to the cache associated to this particular throwable.
    static void
    addAppPackage(String newAppPackage)
    Add a string representing a package prefix to check against class names in stack traces to determine whether to cache throwables or not.
    static CacheFrame[]
    get(Throwable throwable)
    Get the cached frames associated with the given throwable.
    static boolean
    shouldCacheThrowable(Throwable throwable, int numFrames)
    Whether or not we should cache this throwable which has a particular number of frames in its stacktrace.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • add

      public static void add(Throwable throwable, CacheFrame[] frames)
      Add a list of frames with extra information to the cache associated to this particular throwable.
      Parameters:
      throwable - a throwable to use as a cache key.
      frames - frames associated with this throwable.
    • get

      public static CacheFrame[] get(Throwable throwable)
      Get the cached frames associated with the given throwable.
      Parameters:
      throwable - a throwable to use as a cache key.
      Returns:
      the list of frames previously cached or null.
    • shouldCacheThrowable

      public static boolean shouldCacheThrowable(Throwable throwable, int numFrames)
      Whether or not we should cache this throwable which has a particular number of frames in its stacktrace.
      Parameters:
      throwable - the throwable we might want to cache.
      numFrames - the number of frames in the stacktrace.
      Returns:
      true if we should gather info about this throwable and cache it.
    • addAppPackage

      public static void addAppPackage(String newAppPackage)
      Add a string representing a package prefix to check against class names in stack traces to determine whether to cache throwables or not.
      Parameters:
      newAppPackage - a string to add to the set of packages in your app.