public class DynamicLinkerFactory extends Object
DynamicLinker
s. The most usual dynamic linker is a linker that is a composition
of all GuardingDynamicLinker
s known and pre-created by the caller as well as any
automatically discovered
guarding linkers and the standard fallback BeansLinker
. See
DynamicLinker
documentation for tips on how to use this class.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_UNSTABLE_RELINK_THRESHOLD
Default value for
unstable relink threshold . |
Constructor and Description |
---|
DynamicLinkerFactory() |
Modifier and Type | Method and Description |
---|---|
DynamicLinker |
createLinker()
Creates a new dynamic linker consisting of all the prioritized, autodiscovered, and fallback linkers.
|
void |
setClassLoader(ClassLoader classLoader)
Sets the class loader for automatic discovery of available linkers.
|
void |
setFallbackLinkers(GuardingDynamicLinker... fallbackLinkers)
Sets the fallback linkers.
|
void |
setFallbackLinkers(List<? extends GuardingDynamicLinker> fallbackLinkers)
Sets the fallback linkers.
|
void |
setPrioritizedLinker(GuardingDynamicLinker prioritizedLinker)
Sets a single prioritized linker.
|
void |
setPrioritizedLinkers(GuardingDynamicLinker... prioritizedLinkers)
Sets the prioritized linkers.
|
void |
setPrioritizedLinkers(List<? extends GuardingDynamicLinker> prioritizedLinkers)
Sets the prioritized linkers.
|
void |
setRuntimeContextArgCount(int runtimeContextArgCount)
Sets the number of arguments in the call sites that represent the stack context of the language runtime creating
the linker.
|
void |
setSyncOnRelink(boolean syncOnRelink)
Sets whether the linker created by this factory will invoke
MutableCallSite.syncAll(MutableCallSite[])
after a call site is relinked. |
void |
setUnstableRelinkThreshold(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.
|
public static final int DEFAULT_UNSTABLE_RELINK_THRESHOLD
unstable relink threshold
.public void setClassLoader(ClassLoader classLoader)
createLinker()
invocation will be used.classLoader
- the class loader used for the autodiscovery of available linkers.public void setPrioritizedLinkers(List<? extends GuardingDynamicLinker> prioritizedLinkers)
prioritizedLinkers
- the list of prioritized linkers. Null can be passed to indicate no prioritized linkers
(this is also the default value).public void setPrioritizedLinkers(GuardingDynamicLinker... prioritizedLinkers)
prioritizedLinkers
- a list of prioritized linkers.public void setPrioritizedLinker(GuardingDynamicLinker prioritizedLinker)
setPrioritizedLinkers(List)
with a single-element
list.prioritizedLinker
- the single prioritized linker. Must not be null.IllegalArgumentException
- if null is passed.public void setFallbackLinkers(List<? extends GuardingDynamicLinker> fallbackLinkers)
fallbackLinkers
- the list of fallback linkers. Can be empty to indicate the caller wishes to set no
fallback linkers.public void setFallbackLinkers(GuardingDynamicLinker... fallbackLinkers)
fallbackLinkers
- the list of fallback linkers. Can be empty to indicate the caller wishes to set no
fallback linkers. If it is left as null, the standard fallback BeansLinker
will be used.public void setRuntimeContextArgCount(int runtimeContextArgCount)
(this, contextArg1[, contextArg2[, ...]], normalArgs)
. It is
advisable to only pass one context-specific argument, though, of an easily recognizable, runtime specific type
encapsulating the runtime thread local state.runtimeContextArgCount
- the number of language runtime context arguments in call sites.public void setSyncOnRelink(boolean syncOnRelink)
MutableCallSite.syncAll(MutableCallSite[])
after a call site is relinked. Defaults to false. You probably want to set it to true if your runtime supports
multithreaded execution of dynamically linked code.syncOnRelink
- true for invoking sync on relink, false otherwise.public void setUnstableRelinkThreshold(int unstableRelinkThreshold)
unstableRelinkThreshold
- the new threshold. Must not be less than zero. The value of zero means that
call sites will never be considered unstable.LinkRequest.isCallSiteUnstable()
public DynamicLinker createLinker()
Copyright © 2016 Attila Szegedi. All rights reserved.