forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[improve][fn] Optimize Function Worker startup by lazy loading and di…
…rect zip/bytecode access (apache#22122) (cherry picked from commit bbc6224) (cherry picked from commit 3d3606b)
- 3.1-temp
- (#227)
- 3.1_ds
- (#227)
- 3.1_ds_fx2
- (#227)
- 3.1_fx
- (#227)
- 3.1_fx_merged
- (#227)
- 3.1_fx_merged_ci
- (#227)
- 3.1_test2
- (#227)
- AS-4278
- (#363, #227)
- AS-4278-python
- (#227)
- asyc-internal-stats
- (#249, #227)
- compress-managed-cursor-info
- (#227)
- compress-ml-merged
- (#227)
- cpick/remove_geo_replicated_cluster
- (#227)
- cursor-recovery
- (#227)
- fix-small-compressed-cursors
- (#227)
- fix/namespace-deletion
- (#253, #227)
- ml-lightproto
- (#227)
- msgMetadataRecycle
- (#227)
- nonpersistent_keyhash
- (#254, #227)
- post-commit-fix
- (#227)
- test-filter-classloader
- (#280, #227)
- trnsactions-auth
- (#227)
- upgrade-doc
- (#227)
1 parent
25a0a7f
commit 4946e62
Showing
43 changed files
with
3,642 additions
and
4,809 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
311 changes: 63 additions & 248 deletions
311
pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionCommon.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
179 changes: 179 additions & 0 deletions
179
...-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionFilePackage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.pulsar.functions.utils; | ||
|
||
import java.io.Closeable; | ||
import java.io.File; | ||
import java.io.IOException; | ||
import java.io.UncheckedIOException; | ||
import java.net.MalformedURLException; | ||
import java.net.URLClassLoader; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import net.bytebuddy.description.type.TypeDescription; | ||
import net.bytebuddy.dynamic.ClassFileLocator; | ||
import net.bytebuddy.pool.TypePool; | ||
import org.apache.pulsar.common.nar.NarClassLoader; | ||
import org.apache.pulsar.common.nar.NarClassLoaderBuilder; | ||
import org.apache.pulsar.functions.utils.functions.FunctionUtils; | ||
import org.zeroturnaround.zip.ZipUtil; | ||
|
||
/** | ||
* FunctionFilePackage is a class that represents a function package and | ||
* implements the ValidatableFunctionPackage interface which decouples the | ||
* function package from classloading. | ||
*/ | ||
public class FunctionFilePackage implements AutoCloseable, ValidatableFunctionPackage { | ||
private final File file; | ||
private final ClassFileLocator.Compound classFileLocator; | ||
private final TypePool typePool; | ||
private final boolean isNar; | ||
private final String narExtractionDirectory; | ||
private final boolean enableClassloading; | ||
|
||
private ClassLoader classLoader; | ||
|
||
private final Object configMetadata; | ||
|
||
public FunctionFilePackage(File file, String narExtractionDirectory, boolean enableClassloading, | ||
Class<?> configClass) { | ||
this.file = file; | ||
boolean nonZeroFile = file.isFile() && file.length() > 0; | ||
this.isNar = nonZeroFile ? ZipUtil.containsAnyEntry(file, | ||
new String[] {"META-INF/services/pulsar-io.yaml", "META-INF/bundled-dependencies"}) : false; | ||
this.narExtractionDirectory = narExtractionDirectory; | ||
this.enableClassloading = enableClassloading; | ||
if (isNar) { | ||
List<File> classpathFromArchive = null; | ||
try { | ||
classpathFromArchive = NarClassLoader.getClasspathFromArchive(file, narExtractionDirectory); | ||
} catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
List<ClassFileLocator> classFileLocators = new ArrayList<>(); | ||
classFileLocators.add(ClassFileLocator.ForClassLoader.ofSystemLoader()); | ||
for (File classpath : classpathFromArchive) { | ||
if (classpath.exists()) { | ||
try { | ||
ClassFileLocator locator; | ||
if (classpath.isDirectory()) { | ||
locator = new ClassFileLocator.ForFolder(classpath); | ||
} else { | ||
locator = ClassFileLocator.ForJarFile.of(classpath); | ||
} | ||
classFileLocators.add(locator); | ||
} catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
} | ||
} | ||
this.classFileLocator = new ClassFileLocator.Compound(classFileLocators); | ||
this.typePool = TypePool.Default.of(classFileLocator); | ||
try { | ||
this.configMetadata = FunctionUtils.getPulsarIOServiceConfig(file, configClass); | ||
} catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
} else { | ||
try { | ||
this.classFileLocator = nonZeroFile | ||
? new ClassFileLocator.Compound(ClassFileLocator.ForClassLoader.ofSystemLoader(), | ||
ClassFileLocator.ForJarFile.of(file)) : | ||
new ClassFileLocator.Compound(ClassFileLocator.ForClassLoader.ofSystemLoader()); | ||
} catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
this.typePool = | ||
TypePool.Default.of(classFileLocator); | ||
this.configMetadata = null; | ||
} | ||
} | ||
|
||
public TypeDescription resolveType(String className) { | ||
return typePool.describe(className).resolve(); | ||
} | ||
|
||
public boolean isNar() { | ||
return isNar; | ||
} | ||
|
||
public File getFile() { | ||
return file; | ||
} | ||
|
||
public TypePool getTypePool() { | ||
return typePool; | ||
} | ||
|
||
@Override | ||
public <T> T getFunctionMetaData(Class<T> clazz) { | ||
return configMetadata != null ? clazz.cast(configMetadata) : null; | ||
} | ||
|
||
@Override | ||
public synchronized void close() throws IOException { | ||
classFileLocator.close(); | ||
if (classLoader instanceof Closeable) { | ||
((Closeable) classLoader).close(); | ||
} | ||
} | ||
|
||
public boolean isEnableClassloading() { | ||
return enableClassloading; | ||
} | ||
|
||
public synchronized ClassLoader getClassLoader() { | ||
if (classLoader == null) { | ||
classLoader = createClassLoader(); | ||
} | ||
return classLoader; | ||
} | ||
|
||
private ClassLoader createClassLoader() { | ||
if (enableClassloading) { | ||
if (isNar) { | ||
try { | ||
return NarClassLoaderBuilder.builder() | ||
.narFile(file) | ||
.extractionDirectory(narExtractionDirectory) | ||
.build(); | ||
} catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
} else { | ||
try { | ||
return new URLClassLoader(new java.net.URL[] {file.toURI().toURL()}, | ||
NarClassLoader.class.getClassLoader()); | ||
} catch (MalformedURLException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
} | ||
} else { | ||
throw new IllegalStateException("Classloading is not enabled"); | ||
} | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "FunctionFilePackage{" | ||
+ "file=" + file | ||
+ ", isNar=" + isNar | ||
+ '}'; | ||
} | ||
} |
170 changes: 170 additions & 0 deletions
170
...unctions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionRuntimeCommon.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.pulsar.functions.utils; | ||
|
||
import static org.apache.commons.lang3.StringUtils.isEmpty; | ||
import java.io.File; | ||
import java.io.IOException; | ||
import org.apache.pulsar.common.nar.NarClassLoader; | ||
import org.apache.pulsar.common.nar.NarClassLoaderBuilder; | ||
import org.apache.pulsar.common.util.ClassLoaderUtils; | ||
import org.apache.pulsar.functions.proto.Function; | ||
import org.apache.pulsar.functions.utils.functions.FunctionUtils; | ||
import org.apache.pulsar.functions.utils.io.ConnectorUtils; | ||
|
||
public class FunctionRuntimeCommon { | ||
public static NarClassLoader extractNarClassLoader(File packageFile, | ||
String narExtractionDirectory) { | ||
if (packageFile != null) { | ||
try { | ||
return NarClassLoaderBuilder.builder() | ||
.narFile(packageFile) | ||
.extractionDirectory(narExtractionDirectory) | ||
.build(); | ||
} catch (IOException e) { | ||
throw new IllegalArgumentException(e.getMessage()); | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
public static ClassLoader getClassLoaderFromPackage( | ||
Function.FunctionDetails.ComponentType componentType, | ||
String className, | ||
File packageFile, | ||
String narExtractionDirectory) { | ||
String connectorClassName = className; | ||
ClassLoader jarClassLoader = null; | ||
boolean keepJarClassLoader = false; | ||
NarClassLoader narClassLoader = null; | ||
boolean keepNarClassLoader = false; | ||
|
||
Exception jarClassLoaderException = null; | ||
Exception narClassLoaderException = null; | ||
|
||
try { | ||
try { | ||
jarClassLoader = ClassLoaderUtils.extractClassLoader(packageFile); | ||
} catch (Exception e) { | ||
jarClassLoaderException = e; | ||
} | ||
try { | ||
narClassLoader = extractNarClassLoader(packageFile, narExtractionDirectory); | ||
} catch (Exception e) { | ||
narClassLoaderException = e; | ||
} | ||
|
||
// if connector class name is not provided, we can only try to load archive as a NAR | ||
if (isEmpty(connectorClassName)) { | ||
if (narClassLoader == null) { | ||
throw new IllegalArgumentException(String.format("%s package does not have the correct format. " | ||
+ "Pulsar cannot determine if the package is a NAR package or JAR package. " | ||
+ "%s classname is not provided and attempts to load it as a NAR package produced " | ||
+ "the following error.", | ||
FunctionCommon.capFirstLetter(componentType), FunctionCommon.capFirstLetter(componentType)), | ||
narClassLoaderException); | ||
} | ||
try { | ||
if (componentType == Function.FunctionDetails.ComponentType.FUNCTION) { | ||
connectorClassName = FunctionUtils.getFunctionClass(narClassLoader); | ||
} else if (componentType == Function.FunctionDetails.ComponentType.SOURCE) { | ||
connectorClassName = ConnectorUtils.getIOSourceClass(narClassLoader); | ||
} else { | ||
connectorClassName = ConnectorUtils.getIOSinkClass(narClassLoader); | ||
} | ||
} catch (IOException e) { | ||
throw new IllegalArgumentException(String.format("Failed to extract %s class from archive", | ||
componentType.toString().toLowerCase()), e); | ||
} | ||
|
||
try { | ||
narClassLoader.loadClass(connectorClassName); | ||
keepNarClassLoader = true; | ||
return narClassLoader; | ||
} catch (ClassNotFoundException | NoClassDefFoundError e) { | ||
throw new IllegalArgumentException(String.format("%s class %s must be in class path", | ||
FunctionCommon.capFirstLetter(componentType), connectorClassName), e); | ||
} | ||
|
||
} else { | ||
// if connector class name is provided, we need to try to load it as a JAR and as a NAR. | ||
if (jarClassLoader != null) { | ||
try { | ||
jarClassLoader.loadClass(connectorClassName); | ||
keepJarClassLoader = true; | ||
return jarClassLoader; | ||
} catch (ClassNotFoundException | NoClassDefFoundError e) { | ||
// class not found in JAR try loading as a NAR and searching for the class | ||
if (narClassLoader != null) { | ||
|
||
try { | ||
narClassLoader.loadClass(connectorClassName); | ||
keepNarClassLoader = true; | ||
return narClassLoader; | ||
} catch (ClassNotFoundException | NoClassDefFoundError e1) { | ||
throw new IllegalArgumentException( | ||
String.format("%s class %s must be in class path", | ||
FunctionCommon.capFirstLetter(componentType), connectorClassName), e1); | ||
} | ||
} else { | ||
throw new IllegalArgumentException(String.format("%s class %s must be in class path", | ||
FunctionCommon.capFirstLetter(componentType), connectorClassName), e); | ||
} | ||
} | ||
} else if (narClassLoader != null) { | ||
try { | ||
narClassLoader.loadClass(connectorClassName); | ||
keepNarClassLoader = true; | ||
return narClassLoader; | ||
} catch (ClassNotFoundException | NoClassDefFoundError e1) { | ||
throw new IllegalArgumentException( | ||
String.format("%s class %s must be in class path", | ||
FunctionCommon.capFirstLetter(componentType), connectorClassName), e1); | ||
} | ||
} else { | ||
StringBuilder errorMsg = new StringBuilder(FunctionCommon.capFirstLetter(componentType) | ||
+ " package does not have the correct format." | ||
+ " Pulsar cannot determine if the package is a NAR package or JAR package."); | ||
|
||
if (jarClassLoaderException != null) { | ||
errorMsg.append( | ||
" Attempts to load it as a JAR package produced error: " + jarClassLoaderException | ||
.getMessage()); | ||
} | ||
|
||
if (narClassLoaderException != null) { | ||
errorMsg.append( | ||
" Attempts to load it as a NAR package produced error: " + narClassLoaderException | ||
.getMessage()); | ||
} | ||
|
||
throw new IllegalArgumentException(errorMsg.toString()); | ||
} | ||
} | ||
} finally { | ||
if (!keepJarClassLoader) { | ||
ClassLoaderUtils.closeClassLoader(jarClassLoader); | ||
} | ||
if (!keepNarClassLoader) { | ||
ClassLoaderUtils.closeClassLoader(narClassLoader); | ||
} | ||
} | ||
} | ||
|
||
} |
89 changes: 89 additions & 0 deletions
89
...unctions/utils/src/main/java/org/apache/pulsar/functions/utils/LoadedFunctionPackage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.pulsar.functions.utils; | ||
|
||
import java.io.IOException; | ||
import java.io.UncheckedIOException; | ||
import net.bytebuddy.description.type.TypeDescription; | ||
import net.bytebuddy.dynamic.ClassFileLocator; | ||
import net.bytebuddy.pool.TypePool; | ||
import org.apache.pulsar.common.nar.NarClassLoader; | ||
import org.apache.pulsar.functions.utils.functions.FunctionUtils; | ||
|
||
/** | ||
* LoadedFunctionPackage is a class that represents a function package and | ||
* implements the ValidatableFunctionPackage interface which decouples the | ||
* function package from classloading. This implementation is backed by | ||
* a ClassLoader, and it is used when the function package is already loaded | ||
* by a ClassLoader. This is the case in the LocalRunner and in some of | ||
* the unit tests. | ||
*/ | ||
public class LoadedFunctionPackage implements ValidatableFunctionPackage { | ||
private final ClassLoader classLoader; | ||
private final Object configMetadata; | ||
private final TypePool typePool; | ||
|
||
public <T> LoadedFunctionPackage(ClassLoader classLoader, Class<T> configMetadataClass, T configMetadata) { | ||
this.classLoader = classLoader; | ||
this.configMetadata = configMetadata; | ||
typePool = TypePool.Default.of( | ||
ClassFileLocator.ForClassLoader.of(classLoader)); | ||
} | ||
|
||
public LoadedFunctionPackage(ClassLoader classLoader, Class<?> configMetadataClass) { | ||
this.classLoader = classLoader; | ||
if (classLoader instanceof NarClassLoader) { | ||
try { | ||
configMetadata = FunctionUtils.getPulsarIOServiceConfig((NarClassLoader) classLoader, | ||
configMetadataClass); | ||
} catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
} else { | ||
configMetadata = null; | ||
} | ||
typePool = TypePool.Default.of( | ||
ClassFileLocator.ForClassLoader.of(classLoader)); | ||
} | ||
|
||
@Override | ||
public TypeDescription resolveType(String className) { | ||
return typePool.describe(className).resolve(); | ||
} | ||
|
||
@Override | ||
public TypePool getTypePool() { | ||
return typePool; | ||
} | ||
|
||
@Override | ||
public <T> T getFunctionMetaData(Class<T> clazz) { | ||
return configMetadata != null ? clazz.cast(configMetadata) : null; | ||
} | ||
|
||
@Override | ||
public boolean isEnableClassloading() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public ClassLoader getClassLoader() { | ||
return classLoader; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...ons/utils/src/main/java/org/apache/pulsar/functions/utils/ValidatableFunctionPackage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.pulsar.functions.utils; | ||
|
||
import net.bytebuddy.description.type.TypeDescription; | ||
import net.bytebuddy.pool.TypePool; | ||
|
||
/** | ||
* This abstraction separates the function and connector definition from classloading, | ||
* enabling validation without the need for classloading. It utilizes Byte Buddy for | ||
* type and annotation resolution. | ||
* | ||
* The function or connector definition is directly extracted from the archive file, | ||
* eliminating the need for classloader initialization. | ||
* | ||
* The getClassLoader method should only be invoked when classloading is enabled. | ||
* Classloading is required in the LocalRunner and in the Functions worker when the | ||
* worker is configured with the 'validateConnectorConfig' set to true. | ||
*/ | ||
public interface ValidatableFunctionPackage { | ||
/** | ||
* Resolves the type description for the given class name within the function package. | ||
*/ | ||
TypeDescription resolveType(String className); | ||
/** | ||
* Returns the Byte Buddy TypePool instance for the function package. | ||
*/ | ||
TypePool getTypePool(); | ||
/** | ||
* Returns the function or connector definition metadata. | ||
* Supports FunctionDefinition and ConnectorDefinition as the metadata type. | ||
*/ | ||
<T> T getFunctionMetaData(Class<T> clazz); | ||
/** | ||
* Returns if classloading is enabled for the function package. | ||
*/ | ||
boolean isEnableClassloading(); | ||
/** | ||
* Returns the classloader for the function package. The classloader is | ||
* lazily initialized when classloading is enabled. | ||
*/ | ||
ClassLoader getClassLoader(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.