Class Disposables

java.lang.Object
com.complexible.common.base.Disposables

public final class Disposables extends Object

Since:
2.0
Version:
3.0
Author:
Michael Grove
  • Method Details

    • logActiveResources

      public static void logActiveResources()
    • getActiveResources

      public static ActiveResources getActiveResources()
      Get the active objects as tracked by this class.
      Returns:
      a list of the active resources
    • resetActiveResources

      public static void resetActiveResources(Iterable<Class<?>> ignoredTypes)
      Clear the active objects tracked by this class.
    • markCreated

      public static <T> T markCreated(T resource)
      Test / debug method for tracking resources to verify that they are released correctly. Tracking is gated by the "stardog.resources.track" System property.
      Parameters:
      resource - to track
    • markReleased

      public static void markReleased(Object resource)
      Test / debug method to mark that a particular resource has been released correctly.
      Parameters:
      resource - that was released
    • dispose

      public static void dispose(Disposable theDisposable, Disposable... theOtherDisposables)
    • dispose

      public static void dispose(Iterable<? extends Disposable> theDisposables)
    • disposeIf

      public static void disposeIf(Object theObj)
    • disposeQuietly

      public static void disposeQuietly(Disposable theDisposable)
    • autoDispose

      public static AutoDisposable autoDispose(Disposable theDisposable)
    • asCloseable

      public static AutoCloseable asCloseable(Disposable disposable)
      A utility method to treat a disposable object as an AutoCloseable. It's particularly useful for passing disposable references to AutoCloser.close(AutoCloseable...) instead of using lambdas, eg. disposable::dispose, since it handles nulls.