com.hazelcast.config

## Class UserCodeDeploymentConfig

- java.lang.Object
- - com.hazelcast.config.UserCodeDeploymentConfig

-     public class UserCodeDeploymentConfig
      extends 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 classpath of all cluster members.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `UserCodeDeploymentConfig.ClassCacheMode` Controls caching of caches loaded from remote members
    `static class` | `UserCodeDeploymentConfig.ProviderMode` Controls how to react on receiving a classloading request from a remote member

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UserCodeDeploymentConfig()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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
    `boolean` | `isEnabled()` Returns true when User Code Deployment is enabled
    `UserCodeDeploymentConfig` | `setBlacklistedPrefixes(String blacklistedPrefixes)` Comma separated list of prefixes of classes 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 constraint members to 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 prefixes of classes which will be loaded remotely.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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 when User Code Deployment is enabled
      Returns:
        `true` when User Code Deployment is enabled

    - #### setProviderFilter

          public UserCodeDeploymentConfig setProviderFilter(String providerFilter)

      Filter to constraint members to 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 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 fine grained 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();

               UserCodeDeploymentConfig userCodeDeploymentConfig = hazelcastConfig.getUserCodeDeploymentConfig();
               userCodeDeploymentConfig.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`

      Returns:
        this instance of UserCodeDeploymentConfig for easy method-chaining
      See Also:
        `Member.setStringAttribute(String, String)`

    - #### getProviderFilter

          public String getProviderFilter()

      Get current filter or `null` when no filter is defined.
      Returns:
        current filter or `null` when no filter is defined
      See Also:
        `setProviderFilter(String)`

    - #### setBlacklistedPrefixes

          public UserCodeDeploymentConfig setBlacklistedPrefixes(String blacklistedPrefixes)

      Comma separated list of prefixes of classes which will never be loaded remotely. A prefix can be a package name or a classname.

      For example setting a blacklist prefix to `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`

      Returns:
        this instance of UserCodeDeploymentConfig for easy method-chaining

    - #### getBlacklistedPrefixes

          public String getBlacklistedPrefixes()

      Return currently configured blacklist prefixes.
      Returns:
        currently configured blacklist prefixes
      See Also:
        `setBlacklistedPrefixes(String)`

    - #### setWhitelistedPrefixes

          public UserCodeDeploymentConfig setWhitelistedPrefixes(String whitelistedPrefixes)

      Comma separated list of prefixes of classes which will be loaded remotely.

      Use this to enable User Code Deployment of selected classes only and disable remote loading for all other classes. This gives you a nice control over classloading.

      The prefixes are interpreted by using the same rules as described at `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.

      Returns:
        this instance of UserCodeDeploymentConfig for easy method-chaining

    - #### getWhitelistedPrefixes

          public String getWhitelistedPrefixes()

      Return currently configured whitelist prefixes
      Returns:
        currently configured whitelist prefixes

    - #### setProviderMode

          public UserCodeDeploymentConfig setProviderMode(UserCodeDeploymentConfig.ProviderMode providerMode)

      Configure behaviour when providing classes to remote members.

      Default: `UserCodeDeploymentConfig.ProviderMode.LOCAL_AND_CACHED_CLASSES`

      Returns:
        this instance of UserCodeDeploymentConfig for easy method-chaining
      See Also:
        `UserCodeDeploymentConfig.ProviderMode`

    - #### getProviderMode

          public UserCodeDeploymentConfig.ProviderMode getProviderMode()

      Return the current ProviderMode
      Returns:
        current ProviderMode

    - #### setClassCacheMode

          public UserCodeDeploymentConfig setClassCacheMode(UserCodeDeploymentConfig.ClassCacheMode classCacheMode)

      Configure caching of classes loaded from remote members.

      Default: `UserCodeDeploymentConfig.ClassCacheMode.ETERNAL`

      Returns:
        this instance of UserCodeDeploymentConfig for easy method-chaining
      See Also:
        `UserCodeDeploymentConfig.ClassCacheMode`

    - #### getClassCacheMode

          public UserCodeDeploymentConfig.ClassCacheMode getClassCacheMode()

      Return the current ClassCacheMode
      Returns:
        current ProviderMode

Copyright © 2019. All rights reserved.