public class UserCodeDeploymentConfig extends Object
Modifier and Type | Class and Description |
---|---|
static class |
UserCodeDeploymentConfig.ClassCacheMode
Controls caching of classes loaded from remote members
|
static class |
UserCodeDeploymentConfig.ProviderMode
Controls how to react to receiving a classloading request from a remote member
|
Constructor and Description |
---|
UserCodeDeploymentConfig() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
String |
getBlacklistedPrefixes()
Return currently configured blacklist prefixes.
|
UserCodeDeploymentConfig.ClassCacheMode |
getClassCacheMode()
Return the current ClassCacheMode
|
String |
getProviderFilter()
Get current filter or
null when no filter is defined. |
UserCodeDeploymentConfig.ProviderMode |
getProviderMode()
Return the current ProviderMode
|
String |
getWhitelistedPrefixes()
Return currently configured whitelist prefixes
|
int |
hashCode() |
boolean |
isEnabled()
Returns true if User Code Deployment is enabled
|
UserCodeDeploymentConfig |
setBlacklistedPrefixes(String blacklistedPrefixes)
Comma-separated list of class prefixes which will never be loaded remotely.
|
UserCodeDeploymentConfig |
setClassCacheMode(UserCodeDeploymentConfig.ClassCacheMode classCacheMode)
Configure caching of classes loaded from remote members.
|
UserCodeDeploymentConfig |
setEnabled(boolean enabled)
Enable or disable User Code Deployment.
|
UserCodeDeploymentConfig |
setProviderFilter(String providerFilter)
Filter to limit members that can be used for classloading request when a user class
is not available locally.
|
UserCodeDeploymentConfig |
setProviderMode(UserCodeDeploymentConfig.ProviderMode providerMode)
Configure behaviour when providing classes to remote members.
|
UserCodeDeploymentConfig |
setWhitelistedPrefixes(String whitelistedPrefixes)
Comma-separated list of class prefixes which will be loaded remotely.
|
public UserCodeDeploymentConfig setEnabled(boolean enabled)
false
public boolean isEnabled()
true
when User Code Deployment is enabledpublic UserCodeDeploymentConfig setProviderFilter(String providerFilter)
Filter format: HAS_ATTRIBUTE:foo
this will send classloading requests
only to members which have a member attribute foo
set. Attribute value is ignored,
it can be of any type, a presence of the attribute is sufficient.
This facility allows to have a fine grained control over classloading. You can e.g. start Hazelcast lite members dedicated for class-serving.
Example usage:
This member will load classes only from members with the class-provider
attribute set.
It won't ask any other member to provide a locally unavailable class:
Config hazelcastConfig = new Config(); UserCodeDeploymentConfig userCodeDeploymentConfig = hazelcastConfig.getUserCodeDeploymentConfig(); userCodeDeploymentConfig.setProviderFilter("HAS_ATTRIBUTE:class-provider"); HazelcastInstance instance = Hazelcast.newHazelcastInstance(hazelcastConfig);
In the following example, the started member will be marked with the class-provider
attribute -
the member configured above may use it to provide a class which is not locally available:
Config hazelcastConfig = new Config(); MemberAttributeConfig memberAttributes = hazelcastConfig.getMemberAttributeConfig(); memberAttributes.setAttribute("class-provider", "true"); HazelcastInstance instance = Hazelcast.newHazelcastInstance(hazelcastConfig);
Setting the filter to null allows using any member to load classes.
Default: null
Member.getAttribute(String)
public String getProviderFilter()
null
when no filter is defined.null
when no filter is definedsetProviderFilter(String)
public UserCodeDeploymentConfig setBlacklistedPrefixes(String blacklistedPrefixes)
For example, setting a blacklist prefix to com.foo
will disable remote loading of all classes
from the com.foo
package and its sub-packages.
Eg. com.foo.bar.MyClass
will be black-listed too.
The prefix is compared to the class name string. For example, when you set the blacklist to
com.foo.Class
, the class com.foo.ClassSuffix
will be blacklisted too.
Setting the prefixes to null
or to empty string will disable the blacklist.
Default: null
public String getBlacklistedPrefixes()
setBlacklistedPrefixes(String)
public UserCodeDeploymentConfig setWhitelistedPrefixes(String whitelistedPrefixes)
Use this to limit User Code Deployment to selected classes only and disable remote loading for all other classes.
The prefixes are interpreted using the same rules as described in setBlacklistedPrefixes(String)
.
Setting the prefixes to null
or empty string will disable the white-list and all non-blacklisted
classes will be allowed to load from remote members.
public String getWhitelistedPrefixes()
public UserCodeDeploymentConfig setProviderMode(UserCodeDeploymentConfig.ProviderMode providerMode)
Default: UserCodeDeploymentConfig.ProviderMode.LOCAL_AND_CACHED_CLASSES
UserCodeDeploymentConfig.ProviderMode
public UserCodeDeploymentConfig.ProviderMode getProviderMode()
public UserCodeDeploymentConfig setClassCacheMode(UserCodeDeploymentConfig.ClassCacheMode classCacheMode)
UserCodeDeploymentConfig.ClassCacheMode
public UserCodeDeploymentConfig.ClassCacheMode getClassCacheMode()
Copyright © 2023 Hazelcast, Inc.. All rights reserved.