Class BroadcastingTenantRegistry

  • All Implemented Interfaces:
    TenantRegistry

    public class BroadcastingTenantRegistry
    extends Object
    implements TenantRegistry
    Decorator for TenantRegistry which publishes the events specified in the Atlassian Tenancy API.

    The separation between VolatileSingleTenantRegistry and this implementation is currently necessary since the tenant is not persisted (within Confluence). There should be no TenantArrivedEvent published in case of an existing tenant being replayed. This is achieved by replaying the tenant very early in the bootstrap, during the initialisation of the bootstrap container. The bootstrap container hosts the VolatileSingleTenantRegistry which will not broadcast any events of the API.

    Since:
    5.6
    • Constructor Detail

      • BroadcastingTenantRegistry

        public BroadcastingTenantRegistry​(TenantRegistry delegate,
                                          com.atlassian.event.api.EventPublisher eventPublisher)
    • Method Detail

      • addTenant

        public boolean addTenant​(com.atlassian.tenancy.api.Tenant tenant)
        Specified by:
        addTenant in interface TenantRegistry
        Parameters:
        tenant - the tenant to add
        Returns:
        true if the tenant was added during this request, false if the registry already knew it
      • removeTenant

        public boolean removeTenant​(com.atlassian.tenancy.api.Tenant tenant)
        Specified by:
        removeTenant in interface TenantRegistry
        Parameters:
        tenant - the tenant to remove
        Returns:
        true if the tenant was removed, false if the registry didn't know about it
      • isTenantRegistered

        public boolean isTenantRegistered​(com.atlassian.tenancy.api.Tenant tenant)
        Specified by:
        isTenantRegistered in interface TenantRegistry
        Parameters:
        tenant - the tenant to test for being registered
        Returns:
        true if the tenant is currently registered
      • isRegistryVacant

        public boolean isRegistryVacant()
        Specified by:
        isRegistryVacant in interface TenantRegistry
        Returns:
        true if the registry currently has no tenants