Class JavaInstanceRunnable

java.lang.Object
org.apache.pulsar.functions.instance.JavaInstanceRunnable
All Implemented Interfaces:
AutoCloseable, Runnable

public class JavaInstanceRunnable extends Object implements AutoCloseable, Runnable
A function container implemented using java thread.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    JavaInstanceRunnable(InstanceConfig instanceConfig, org.apache.pulsar.client.api.ClientBuilder clientBuilder, org.apache.pulsar.client.api.PulsarClient pulsarClient, org.apache.pulsar.client.admin.PulsarAdmin pulsarAdmin, String stateStorageImplClass, String stateStorageServiceUrl, org.apache.pulsar.functions.secretsprovider.SecretsProvider secretsProvider, FunctionCollectorRegistry collectorRegistry, ClassLoader functionClassLoader)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    NOTE: this method is be synchronized because it is potentially called by two different places one inside the run/finally clause and one inside the ThreadRuntime::stop.
    org.apache.pulsar.functions.proto.InstanceCommunication.MetricsData
     
    org.apache.pulsar.functions.proto.InstanceCommunication.FunctionStatus.Builder
     
    org.apache.pulsar.functions.proto.InstanceCommunication.MetricsData
     
     
    void
     
    void
    run()
    The core logic that initialize the instance thread and executes the function.

    Methods inherited from class java.lang.Object

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

    • JavaInstanceRunnable

      public JavaInstanceRunnable(InstanceConfig instanceConfig, org.apache.pulsar.client.api.ClientBuilder clientBuilder, org.apache.pulsar.client.api.PulsarClient pulsarClient, org.apache.pulsar.client.admin.PulsarAdmin pulsarAdmin, String stateStorageImplClass, String stateStorageServiceUrl, org.apache.pulsar.functions.secretsprovider.SecretsProvider secretsProvider, FunctionCollectorRegistry collectorRegistry, ClassLoader functionClassLoader) throws org.apache.pulsar.client.api.PulsarClientException
      Throws:
      org.apache.pulsar.client.api.PulsarClientException
  • Method Details

    • run

      public void run()
      The core logic that initialize the instance thread and executes the function.
      Specified by:
      run in interface Runnable
    • close

      public void close()
      NOTE: this method is be synchronized because it is potentially called by two different places one inside the run/finally clause and one inside the ThreadRuntime::stop.
      Specified by:
      close in interface AutoCloseable
    • getStatsAsString

      public String getStatsAsString() throws IOException
      Throws:
      IOException
    • getAndResetMetrics

      public org.apache.pulsar.functions.proto.InstanceCommunication.MetricsData getAndResetMetrics()
    • getMetrics

      public org.apache.pulsar.functions.proto.InstanceCommunication.MetricsData getMetrics()
    • resetMetrics

      public void resetMetrics()
    • getFunctionStatus

      public org.apache.pulsar.functions.proto.InstanceCommunication.FunctionStatus.Builder getFunctionStatus()