Modifier and Type | Class and Description |
---|---|
static class |
DistributedClassloadingConfig.ClassCacheMode
Controls caching of caches loaded from remote members
|
static class |
DistributedClassloadingConfig.ProviderMode
Controls how to react on receiving a classloading request from a remote member
|
Constructor and Description |
---|
DistributedClassloadingConfig() |
Modifier and Type | Method and Description |
---|---|
String |
getBlacklistedPrefixes()
Return currently configured blacklist prefixes.
|
DistributedClassloadingConfig.ClassCacheMode |
getClassCacheMode()
Return the current ClassCacheMode
|
String |
getProviderFilter()
Get current filter or {
null } when no filter is defined. |
DistributedClassloadingConfig.ProviderMode |
getProviderMode()
Return the current ProviderMode
|
String |
getWhitelistedPrefixes()
Return currently configured whitelist prefixes
|
boolean |
isEnabled()
Returns true when distributed classloading is enabled
|
DistributedClassloadingConfig |
setBlacklistedPrefixes(String blacklistedPrefixes)
Comma separated list of prefixes of classes which will never be loaded remotely.
|
DistributedClassloadingConfig |
setClassCacheMode(DistributedClassloadingConfig.ClassCacheMode classCacheMode)
Configure caching of classes loaded from remote members.
|
DistributedClassloadingConfig |
setEnabled(boolean enabled)
Enable or disable distributed classloading.
|
DistributedClassloadingConfig |
setProviderFilter(String providerFilter)
Filter to constraint members to be used for classloading request when a class
is not available locally.
|
DistributedClassloadingConfig |
setProviderMode(DistributedClassloadingConfig.ProviderMode providerMode)
Configure behaviour when providing classes to remote members.
|
DistributedClassloadingConfig |
setWhitelistedPrefixes(String whitelistedPrefixes)
Comma separated list of prefixes of classes which will be loaded remotely.
|
public DistributedClassloadingConfig setEnabled(boolean enabled)
false
}enabled
- public boolean isEnabled()
true
} when distributed classloading is enabledpublic DistributedClassloadingConfig setProviderFilter(String providerFilter)
HAS_ATTRIBUTE:foo
this will send classloading requests
only to members which has a member attribute foo
set. Value is ignored,
it can be any type. A present of the attribute is sufficient.
This facility allows to have a control on 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();
DistributedClassloadingConfig distributedClassloadingConfig = hazelcastConfig.getDistributedClassloadingConfig();
distributedClassloadingConfig.setProviderFilter(HAS_ATTRIBUTE:class-provider);
HazecastInstance instance = Hazelcast.newHazelcastInstance(hazelcastConfig);
This member is marked with the class-provider
attribute - the member configured above may him
it to provide a class which is not locally available:
Config hazelcastConfig = new Config();
MemberAttributeConfig memberAttributes = hazelcastConfig.getMemberAttributeConfig();
memberAttributes.setAttribute("class-provider", "true");
HazecastInstance instance = Hazelcast.newHazelcastInstance(hazelcastConfig);
Setting the filter to null will allow to load classes from all members.
Default: {null
}providerFilter
- com.hazelcast.core.Member#setStringAttribute(String, String)}
public String getProviderFilter()
null
} when no filter is defined.null
} when no filter is defined.setProviderFilter(String)
public DistributedClassloadingConfig setBlacklistedPrefixes(String blacklistedPrefixes)
com.foo
will disable remote loading of all classes
from the com.foo
package, but also classes from all sub-packages won't be loaded.
Eg. com.foo.bar.MyClass
will be black-listed too.
When you set the blacklist to com.foo.Class
then the Class will obviously be black-listed,
but a class com.foo.ClassSuffix
will be blacklisted too.
Setting the prefixes to {null
} will disable the blacklist
Default: {null
}blacklistedPrefixes
- public String getBlacklistedPrefixes()
setBlacklistedPrefixes(String)
public DistributedClassloadingConfig setWhitelistedPrefixes(String whitelistedPrefixes)
setBlacklistedPrefixes(String)
}
Setting the prefix to {null
} will disable the white-list and all non-blacklisted classes will be allowed
to load from remote members.whitelistedPrefixes
- public String getWhitelistedPrefixes()
public DistributedClassloadingConfig setProviderMode(DistributedClassloadingConfig.ProviderMode providerMode)
DistributedClassloadingConfig.ProviderMode.LOCAL_AND_CACHED_CLASSES
providerMode
- ProviderMode}
public DistributedClassloadingConfig.ProviderMode getProviderMode()
public DistributedClassloadingConfig setClassCacheMode(DistributedClassloadingConfig.ClassCacheMode classCacheMode)
DistributedClassloadingConfig.ClassCacheMode.ETERNAL
classCacheMode
- ClassCacheMode}
public DistributedClassloadingConfig.ClassCacheMode getClassCacheMode()
Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.