Class ProfilerMiddleware

  • All Implemented Interfaces:
    Middleware

    public class ProfilerMiddleware
    extends java.lang.Object
    implements Middleware
    A profile middleware that measures the execution time of a job, a more sophisticated profiler middleware can report latency to New Relic, Datadog, or use Micrometer to report latency or any other data.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void handle​(Job job, java.util.concurrent.Callable<java.lang.Void> next)
      Middleware handles that would be called
      protected void report​(Job job, java.time.Duration executionTime)
      Report execution of the said job
      • Methods inherited from class java.lang.Object

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

      • ProfilerMiddleware

        public ProfilerMiddleware()
    • Method Detail

      • report

        protected void report​(Job job,
                              java.time.Duration executionTime)
        Report execution of the said job
        Parameters:
        job - the running job
        executionTime - execution time
      • handle

        public void handle​(Job job,
                           java.util.concurrent.Callable<java.lang.Void> next)
                    throws java.lang.Exception
        Description copied from interface: Middleware
        Middleware handles that would be called
        Specified by:
        handle in interface Middleware
        Parameters:
        job - job object
        next - next middleware in chain
        Throws:
        java.lang.Exception - any exception