Class ThreadRuntime

  • All Implemented Interfaces:
    Runtime

    public class ThreadRuntime
    extends java.lang.Object
    implements Runtime
    A function container implemented using java thread.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.concurrent.CompletableFuture<org.apache.pulsar.functions.proto.InstanceCommunication.MetricsData> getAndResetMetrics()  
      java.lang.Throwable getDeathException()  
      java.util.concurrent.CompletableFuture<org.apache.pulsar.functions.proto.InstanceCommunication.FunctionStatus> getFunctionStatus​(int instanceId)  
      java.util.concurrent.CompletableFuture<org.apache.pulsar.functions.proto.InstanceCommunication.MetricsData> getMetrics​(int instanceId)  
      java.lang.String getPrometheusMetrics()  
      boolean isAlive()  
      void join()  
      java.util.concurrent.CompletableFuture<java.lang.Void> resetMetrics()  
      void start()
      The core logic that initialize the thread container and executes the function.
      void stop()  
      • Methods inherited from class java.lang.Object

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

      • start

        public void start()
                   throws java.lang.Exception
        The core logic that initialize the thread container and executes the function.
        Specified by:
        start in interface Runtime
        Throws:
        java.lang.Exception
      • join

        public void join()
                  throws java.lang.Exception
        Specified by:
        join in interface Runtime
        Throws:
        java.lang.Exception
      • stop

        public void stop()
        Specified by:
        stop in interface Runtime
      • getFunctionStatus

        public java.util.concurrent.CompletableFuture<org.apache.pulsar.functions.proto.InstanceCommunication.FunctionStatus> getFunctionStatus​(int instanceId)
        Specified by:
        getFunctionStatus in interface Runtime
      • getAndResetMetrics

        public java.util.concurrent.CompletableFuture<org.apache.pulsar.functions.proto.InstanceCommunication.MetricsData> getAndResetMetrics()
        Specified by:
        getAndResetMetrics in interface Runtime
      • getMetrics

        public java.util.concurrent.CompletableFuture<org.apache.pulsar.functions.proto.InstanceCommunication.MetricsData> getMetrics​(int instanceId)
        Specified by:
        getMetrics in interface Runtime
      • getPrometheusMetrics

        public java.lang.String getPrometheusMetrics()
                                              throws java.io.IOException
        Specified by:
        getPrometheusMetrics in interface Runtime
        Throws:
        java.io.IOException
      • resetMetrics

        public java.util.concurrent.CompletableFuture<java.lang.Void> resetMetrics()
        Specified by:
        resetMetrics in interface Runtime
      • isAlive

        public boolean isAlive()
        Specified by:
        isAlive in interface Runtime
      • getDeathException

        public java.lang.Throwable getDeathException()
        Specified by:
        getDeathException in interface Runtime