Enum ClassLoaderUsage
- java.lang.Object
-
- java.lang.Enum<ClassLoaderUsage>
-
- de.aristaflow.adept2.model.common.ClassLoaderUsage
-
- All Implemented Interfaces:
Serializable
,Comparable<ClassLoaderUsage>
public enum ClassLoaderUsage extends Enum<ClassLoaderUsage>
What classloader to use for the execution of an activity. This may be an own classloader for each execution, a shared classloader for different executions of the same activity, a shared classloader for the correspondung runtime manager and the classloader of the AristaFlow platform. The shared classloader will be relative to a runtime manager on a specific JVM.- Author:
- Ulrich Kreher
-
-
Enum Constant Summary
Enum Constants Enum Constant Description NON_SHARED
Each activity instance will be loaded by its own classloader and is therefore a singleton.PLATFORM
The classloader of the AristaFlow platform will be used.SHARE_ACTIVITY_INSTANCES
A classloader will be used for all instances of the very same activity executed on the same runtime manager independent from process instances and templates but separated between system and non-system component.SHARE_EXECUTABLE_COMPONENT
A classloader will be used for all activities having the same executable component name (AbstractActivity.getExecutableComponentName()
) and system component (AbstractActivity.getSystemComponent()
).SHARE_IMPLEMENTATION_CLASS
A classloader will be used for all activities having the same implementation class (AbstractActivity.getImplementationClass()
) and system component (AbstractActivity.getSystemComponent()
).SHARE_RUNTIME_MANAGER
The classloader for the runtime manager will be used and thus all classes will be shared among all activities.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte
getCode()
Returns a byte code representing this classloader usage.static ClassLoaderUsage
valueOf(byte code)
Returns the classloader usage for the designated code ornull
if the code is not recognised.static ClassLoaderUsage
valueOf(String name)
Returns the enum constant of this type with the specified name.static ClassLoaderUsage[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
PLATFORM
public static final ClassLoaderUsage PLATFORM
The classloader of the AristaFlow platform will be used.
-
SHARE_RUNTIME_MANAGER
public static final ClassLoaderUsage SHARE_RUNTIME_MANAGER
The classloader for the runtime manager will be used and thus all classes will be shared among all activities. Note that the libraries of the activity have to be in the shared directory of the runtime manager.
-
SHARE_ACTIVITY_INSTANCES
public static final ClassLoaderUsage SHARE_ACTIVITY_INSTANCES
A classloader will be used for all instances of the very same activity executed on the same runtime manager independent from process instances and templates but separated between system and non-system component. Equality considers executable component name (AbstractActivity.getExecutableComponentName()
), configuration name (AbstractActivity.getConfigurationName()
), operation name (AbstractActivity.getOperationName()
), activity name (AbstractActivity.getActivityName()
) and system component (AbstractActivity.getSystemComponent()
).
The runtime manager instantiates the executable component for every execution but the static fields will be shared. However, the classloader sharing will be based on a runtime manager and a JVM; singleton behaviour based on process instance, process template or other process model elements cannot be achieved directly. To achieve this special behaviour, the implementation of theExecutableComponent
needs to implement this by providing the information based on the data of theEBPInstanceReference
. For instance it can multiplex on the process instance ID or other data from the process model.
-
NON_SHARED
public static final ClassLoaderUsage NON_SHARED
Each activity instance will be loaded by its own classloader and is therefore a singleton.
-
SHARE_EXECUTABLE_COMPONENT
public static final ClassLoaderUsage SHARE_EXECUTABLE_COMPONENT
A classloader will be used for all activities having the same executable component name (AbstractActivity.getExecutableComponentName()
) and system component (AbstractActivity.getSystemComponent()
). SeeSHARE_ACTIVITY_INSTANCES
for details on how to control singleton behaviour.
-
SHARE_IMPLEMENTATION_CLASS
public static final ClassLoaderUsage SHARE_IMPLEMENTATION_CLASS
A classloader will be used for all activities having the same implementation class (AbstractActivity.getImplementationClass()
) and system component (AbstractActivity.getSystemComponent()
). SeeSHARE_ACTIVITY_INSTANCES
for details on how to control singleton behaviour.
-
-
Method Detail
-
values
public static ClassLoaderUsage[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ClassLoaderUsage c : ClassLoaderUsage.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ClassLoaderUsage valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getCode
public byte getCode()
Returns a byte code representing this classloader usage. This code is resilient to reordering or renaming the enum constants.- Returns:
- A byte code representing this classloader usage.
-
valueOf
public static ClassLoaderUsage valueOf(byte code)
Returns the classloader usage for the designated code ornull
if the code is not recognised.- Parameters:
code
- The code for which to find the classloader usage.- Returns:
- The classloader usage for the designated code.
-
-