Class UserCodeDeploymentConfig

  • public class UserCodeDeploymentConfig
    extends java.lang.Object
    Configuration of User Code Deployment. When enabled, it allows Hazelcast members to load classes from other cluster members. This simplifies deployment as you do not have to deploy your domain classes into the classpath of all cluster members.
    • Constructor Detail

      • UserCodeDeploymentConfig

        public UserCodeDeploymentConfig()
    • Method Detail

      • setEnabled

        public UserCodeDeploymentConfig setEnabled​(boolean enabled)
        Enable or disable User Code Deployment. Default: false
      • isEnabled

        public boolean isEnabled()
        Returns true if User Code Deployment is enabled
        true when User Code Deployment is enabled
      • setProviderFilter

        public UserCodeDeploymentConfig setProviderFilter​(java.lang.String providerFilter)
        Filter to limit members that can be used for classloading request when a user class is not available locally.

        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();
             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

        this instance of UserCodeDeploymentConfig for easy method-chaining
        See Also:
      • getProviderFilter

        public java.lang.String getProviderFilter()
        Get current filter or null when no filter is defined.
        current filter or null when no filter is defined
        See Also:
      • setBlacklistedPrefixes

        public UserCodeDeploymentConfig setBlacklistedPrefixes​(java.lang.String blacklistedPrefixes)
        Comma-separated list of class prefixes which will never be loaded remotely. A prefix can be a package name or a class name.

        For example, setting a blacklist prefix to will disable remote loading of all classes from the package and its sub-packages. Eg. will be black-listed too.

        The prefix is compared to the class name string. For example, when you set the blacklist to, the class will be blacklisted too.

        Setting the prefixes to null or to empty string will disable the blacklist.

        Default: null

        this instance of UserCodeDeploymentConfig for easy method-chaining
      • getBlacklistedPrefixes

        public java.lang.String getBlacklistedPrefixes()
        Return currently configured blacklist prefixes.
        currently configured blacklist prefixes
        See Also:
      • setWhitelistedPrefixes

        public UserCodeDeploymentConfig setWhitelistedPrefixes​(java.lang.String whitelistedPrefixes)
        Comma-separated list of class prefixes which will be loaded remotely.

        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.

        this instance of UserCodeDeploymentConfig for easy method-chaining
      • getWhitelistedPrefixes

        public java.lang.String getWhitelistedPrefixes()
        Return currently configured whitelist prefixes
        currently configured whitelist prefixes
      • equals

        public boolean equals​(java.lang.Object o)
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        hashCode in class java.lang.Object