Class JavaInstanceRunnable
java.lang.Object
org.apache.pulsar.functions.instance.JavaInstanceRunnable
- All Implemented Interfaces:
AutoCloseable,Runnable
A function container implemented using java thread.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionJavaInstanceRunnable(InstanceConfig instanceConfig, org.apache.pulsar.client.api.ClientBuilder clientBuilder, org.apache.pulsar.client.api.PulsarClient pulsarClient, PulsarAdmin pulsarAdmin, String stateStorageImplClass, String stateStorageServiceUrl, SecretsProvider secretsProvider, FunctionCollectorRegistry collectorRegistry, ClassLoader componentClassLoader, ClassLoader transformFunctionClassLoader) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()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.MetricsDataorg.apache.pulsar.functions.proto.InstanceCommunication.FunctionStatus.Builderorg.apache.pulsar.functions.proto.InstanceCommunication.MetricsDatavoidvoidrun()The core logic that initialize the instance thread and executes the function.
-
Constructor Details
-
JavaInstanceRunnable
public JavaInstanceRunnable(InstanceConfig instanceConfig, org.apache.pulsar.client.api.ClientBuilder clientBuilder, org.apache.pulsar.client.api.PulsarClient pulsarClient, PulsarAdmin pulsarAdmin, String stateStorageImplClass, String stateStorageServiceUrl, SecretsProvider secretsProvider, FunctionCollectorRegistry collectorRegistry, ClassLoader componentClassLoader, ClassLoader transformFunctionClassLoader) 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. -
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:
closein interfaceAutoCloseable
-
getStatsAsString
- 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()
-