Class ThreadRuntime
java.lang.Object
org.apache.pulsar.functions.runtime.thread.ThreadRuntime
- All Implemented Interfaces:
Runtime
A function container implemented using java thread.
-
Method Summary
Modifier and TypeMethodDescriptionCompletableFuture<org.apache.pulsar.functions.proto.InstanceCommunication.MetricsData>CompletableFuture<org.apache.pulsar.functions.proto.InstanceCommunication.FunctionStatus>getFunctionStatus(int instanceId) CompletableFuture<org.apache.pulsar.functions.proto.InstanceCommunication.MetricsData>getMetrics(int instanceId) booleanisAlive()voidjoin()static ClassLoaderloadJars(String jarFile, InstanceConfig instanceConfig, String functionId, String functionName, String narExtractionDirectory, org.apache.pulsar.functions.utils.functioncache.FunctionCacheManager fnCache) voidstart()The core logic that initialize the thread container and executes the function.voidstop()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.pulsar.functions.runtime.Runtime
reinitialize, terminate
-
Method Details
-
loadJars
public static ClassLoader loadJars(String jarFile, InstanceConfig instanceConfig, String functionId, String functionName, String narExtractionDirectory, org.apache.pulsar.functions.utils.functioncache.FunctionCacheManager fnCache) throws Exception - Throws:
Exception
-
start
The core logic that initialize the thread container and executes the function. -
join
-
stop
public void stop() -
getFunctionStatus
public CompletableFuture<org.apache.pulsar.functions.proto.InstanceCommunication.FunctionStatus> getFunctionStatus(int instanceId) - Specified by:
getFunctionStatusin interfaceRuntime
-
getAndResetMetrics
public CompletableFuture<org.apache.pulsar.functions.proto.InstanceCommunication.MetricsData> getAndResetMetrics()- Specified by:
getAndResetMetricsin interfaceRuntime
-
getMetrics
public CompletableFuture<org.apache.pulsar.functions.proto.InstanceCommunication.MetricsData> getMetrics(int instanceId) - Specified by:
getMetricsin interfaceRuntime
-
getPrometheusMetrics
- Specified by:
getPrometheusMetricsin interfaceRuntime- Throws:
IOException
-
resetMetrics
- Specified by:
resetMetricsin interfaceRuntime
-
isAlive
public boolean isAlive() -
getDeathException
- Specified by:
getDeathExceptionin interfaceRuntime
-