DynamicLinker
objects. Dynamic linkers
are the central objects in Dynalink; these are composed of several
GuardingDynamicLinker
objects and coordinate linking of call sites
with them. The usual dynamic linker is a linker
composed of all GuardingDynamicLinker
objects explicitly pre-created
by the user of the factory and configured with
setPrioritizedLinkers(List)
, as well as any
automatically discovered
ones, and
finally the ones configured with setFallbackLinkers(List)
; this last
category usually includes BeansLinker
.
Modifier and Type | Field and Description |
---|---|
private MethodTypeConversionStrategy | |
private List | |
private ClassLoader | |
private boolean | |
private static final int | DEFAULT_UNSTABLE_RELINK_THRESHOLD
Default value for |
private List | |
private static final AccessControlContext | GET_CLASS_LOADER_CONTEXT
References Deprecated
AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.
|
private MethodHandleTransformer | |
private GuardedInvocationTransformer | |
private List | |
private boolean | |
private int |
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
private static void | addClasses(final Set<Class<? extends GuardingDynamicLinker>> knownLinkerClasses, final List<? extends GuardingDynamicLinker> linkers)
|
private static <T> List | |
public DynamicLinker | Returns: the new dynamic LinkerCreates a new dynamic linker based on the current configuration. |
private List | |
public List | Returns: an immutable list of encounteredServiceConfigurationError s. Can be empty.Returns a list of |
private static ClassLoader | |
private static <T> List | |
public void | setAutoConversionStrategy(final MethodTypeConversionStrategy
the strategy for applying method invocation
conversions for the linker created by this factory. Can be null for no
custom strategy. autoConversionStrategy)Sets an object representing the conversion strategy for automatic type conversions. |
public void | setClassLoader(final ClassLoader
the class loader used for the automatic discovery of
available linkers. classLoader)Sets the class loader for automatic discovery of available guarding dynamic linkers. |
public void | setFallbackLinkers(final List<? extends GuardingDynamicLinker>
the list of fallback linkers. Can be empty to
indicate the caller wishes to set no fallback linkers. Note that if this
method is not invoked explicitly or is passed null, then the factory
will create an instance of fallbackLinkers)BeansLinker to serve as the default
fallback linker.Sets the fallback guarding dynamic linkers. |
public void | setFallbackLinkers(final GuardingDynamicLinker...
an array of fallback linkers. Can be empty to
indicate the caller wishes to set no fallback linkers. Note that if this
method is not invoked explicitly or is passed null, then the factory
will create an instance of fallbackLinkers)BeansLinker to serve as the default
fallback linker.Sets the fallback guarding dynamic linkers. |
public void | setInternalObjectsFilter(final MethodHandleTransformer
a method handle transformer filtering out
internal objects, or null. internalObjectsFilter)Sets a method handle transformer that is supposed to act as the
implementation of
|
public void | setPrelinkTransformer(final GuardedInvocationTransformer
the pre-link transformer for the dynamic
linker. Can be null to have the factory use the default transformer. prelinkTransformer)Set the pre-link transformer. |
public void | setPrioritizedLinker(final GuardingDynamicLinker
the single prioritized linker. Must not be null. prioritizedLinker)Sets a single prioritized linker. |
public void | setPrioritizedLinkers(final List<? extends GuardingDynamicLinker>
the list of prioritized linkers. Can be null. prioritizedLinkers)Sets the prioritized guarding dynamic linkers. |
public void | setPrioritizedLinkers(final GuardingDynamicLinker...
an array of prioritized linkers. Can be null. prioritizedLinkers)Sets the prioritized guarding dynamic linkers. |
public void | setSyncOnRelink(final boolean
true for invoking sync on relink, false otherwise. syncOnRelink)Sets whether the dynamic linker created by this factory will invoke
|
public void | setUnstableRelinkThreshold(final int
the new threshold. Must not be less than
zero. The value of zero means that call sites will never be considered
unstable. unstableRelinkThreshold)Sets the unstable relink threshold; the number of times a call site is relinked after which it will be considered unstable, and subsequent link requests for it will indicate this. |
autoConversionStrategy | back to summary |
---|---|
private MethodTypeConversionStrategy autoConversionStrategy |
autoLoadingErrors | back to summary |
---|---|
private List<ServiceConfigurationError> autoLoadingErrors |
classLoader | back to summary |
---|---|
private ClassLoader classLoader |
classLoaderExplicitlySet | back to summary |
---|---|
private boolean classLoaderExplicitlySet |
DEFAULT_UNSTABLE_RELINK_THRESHOLD | back to summary |
---|---|
private static final int DEFAULT_UNSTABLE_RELINK_THRESHOLD Default value for |
fallbackLinkers | back to summary |
---|---|
private List<? extends GuardingDynamicLinker> fallbackLinkers |
GET_CLASS_LOADER_CONTEXT | back to summary |
---|---|
private static final AccessControlContext GET_CLASS_LOADER_CONTEXT
References Deprecated
See corresponding docs for further information.
|
internalObjectsFilter | back to summary |
---|---|
private MethodHandleTransformer internalObjectsFilter |
prelinkTransformer | back to summary |
---|---|
private GuardedInvocationTransformer prelinkTransformer |
prioritizedLinkers | back to summary |
---|---|
private List<? extends GuardingDynamicLinker> prioritizedLinkers |
syncOnRelink | back to summary |
---|---|
private boolean syncOnRelink |
unstableRelinkThreshold | back to summary |
---|---|
private int unstableRelinkThreshold |
DynamicLinkerFactory | back to summary |
---|---|
public DynamicLinkerFactory() Creates a new dynamic linker factory with default configuration. Upon
creation, the factory can be configured using various |
addClasses | back to summary |
---|---|
private static void addClasses(final Set<Class<? extends GuardingDynamicLinker>> knownLinkerClasses, final List<? extends GuardingDynamicLinker> linkers) |
copyListRequireNonNullElements | back to summary |
---|---|
private static <T> List |
createLinker | back to summary |
---|---|
public DynamicLinker createLinker() Creates a new dynamic linker based on the current configuration. This
method can be invoked more than once to create multiple dynamic linkers.
Automatically discovered linkers are newly instantiated on every
invocation of this method. It is allowed to change the factory's
configuration between invocations. The method is not thread safe. After
invocation, callers can invoke
|
discoverAutoLoadLinkers | back to summary |
---|---|
private List |
getAutoLoadingErrors | back to summary |
---|---|
public List Returns a list of
|
getThreadContextClassLoader | back to summary |
---|---|
private static ClassLoader getThreadContextClassLoader()
|
requireNonNullElements | back to summary |
---|---|
private static <T> List |
setAutoConversionStrategy | back to summary |
---|---|
public void setAutoConversionStrategy(final MethodTypeConversionStrategy autoConversionStrategy) Sets an object representing the conversion strategy for automatic type
conversions. After
|
setClassLoader | back to summary |
---|---|
public void setClassLoader(final ClassLoader classLoader) Sets the class loader for automatic discovery of available guarding
dynamic linkers.
|
setFallbackLinkers | back to summary |
---|---|
public void setFallbackLinkers(final List<? extends GuardingDynamicLinker> fallbackLinkers) Sets the fallback guarding dynamic linkers. These linkers will be consulted last by the resulting dynamic linker when it is linking call sites, after any autodiscovered and prioritized linkers. If the factory also autodiscovers a linker class matching one of the fallback linkers, the autodiscovered class will be ignored and the explicit fallback instance will be used.
|
setFallbackLinkers | back to summary |
---|---|
public void setFallbackLinkers(final GuardingDynamicLinker... fallbackLinkers) Sets the fallback guarding dynamic linkers. Identical to calling
|
setInternalObjectsFilter | back to summary |
---|---|
public void setInternalObjectsFilter(final MethodHandleTransformer internalObjectsFilter) Sets a method handle transformer that is supposed to act as the
implementation of
|
setPrelinkTransformer | back to summary |
---|---|
public void setPrelinkTransformer(final GuardedInvocationTransformer prelinkTransformer) Set the pre-link transformer. This is a
|
setPrioritizedLinker | back to summary |
---|---|
public void setPrioritizedLinker(final GuardingDynamicLinker prioritizedLinker) Sets a single prioritized linker. Identical to calling
|
setPrioritizedLinkers | back to summary |
---|---|
public void setPrioritizedLinkers(final List<? extends GuardingDynamicLinker> prioritizedLinkers) Sets the prioritized guarding dynamic linkers. Language runtimes using Dynalink will usually have at least one linker for their own language. These linkers will be consulted first by the resulting dynamic linker when it is linking call sites, before any autodiscovered and fallback linkers. If the factory also autodiscovers a linker class matching one of the prioritized linkers, the autodiscovered class will be ignored and the explicit prioritized instance will be used.
|
setPrioritizedLinkers | back to summary |
---|---|
public void setPrioritizedLinkers(final GuardingDynamicLinker... prioritizedLinkers) Sets the prioritized guarding dynamic linkers. Identical to calling
|
setSyncOnRelink | back to summary |
---|---|
public void setSyncOnRelink(final boolean syncOnRelink) Sets whether the dynamic linker created by this factory will invoke
|
setUnstableRelinkThreshold | back to summary |
---|---|
public void setUnstableRelinkThreshold(final int unstableRelinkThreshold) Sets the unstable relink threshold; the number of times a call site is relinked after which it will be considered unstable, and subsequent link requests for it will indicate this. Defaults to 8 when not set explicitly.
|