com.hazelcast.spi.tenantcontrol

## Interface TenantControlFactory

-     @Beta
      public interface TenantControlFactory

  A `TenantControlFactory` supplies `TenantControl` objects when Hazelcast service attaches the tenant control to a distributed object. An implementation of `TenantControlFactory` is instantiated via `ServiceLoader`, so in order to be picked up:
  - Its class name must be stored in a service definition file in `META-INF/services/com.hazelcast.spi.tenantcontrol.TenantControlFactory`
  - It must have a public no-args constructor

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static TenantControlFactory` | `NOOP_TENANT_CONTROL_FACTORY` Default tenant control factory.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `TenantControl` | `saveCurrentTenant(DestroyEventContext event)` To be called from the application's thread to connect a Hazelcast object with a particular tenant, e.g.

- - ### Field Detail

    - #### NOOP_TENANT_CONTROL_FACTORY

          static final TenantControlFactory NOOP_TENANT_CONTROL_FACTORY

      Default tenant control factory. Always produces `TenantControl.NOOP_TENANT_CONTROL`

  - ### Method Detail

    - #### saveCurrentTenant

          TenantControl saveCurrentTenant(DestroyEventContext event)

      To be called from the application's thread to connect a Hazelcast object with a particular tenant, e.g. JCache-based cache with a particular application Implementor will save the current thread context and return it Further operations from other threads will use the returned context for this particular Hazelcast object to re-establish the invocation context
      Parameters:
        `event` - hook to destroy any Hazelcast object when the tenant is destroyed, This is used, for example, to delete all associated caches from the application when it gets undeployed, so there are no ClassCastExceptions afterwards
      Returns:
        new TenantControl instance with the saved state of the current tenant

Copyright © 2019. All rights reserved.