Package io.perfmark

Class TaskCloseable

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public final class TaskCloseable
    extends java.lang.Object
    implements java.io.Closeable
    TaskCloseable is a helper class to simplify the closing of PerfMark tasks. It should be used in a try-with-resources block so that PerfMark tasks are recorded even in the event of exceptions.

    Implementation note: This would normally implement AutoCloseable, but that is not available in Java 6. A future version of PerfMark may implement the parent interface instead.

    Since:
    0.23.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) static TaskCloseable INSTANCE  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private TaskCloseable()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Stops the opened task.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TaskCloseable

        private TaskCloseable()
    • Method Detail

      • close

        public void close()
        Stops the opened task. See PerfMark.traceTask(String).
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable