Class DefaultCacheServer.SimpleContext

    • Constructor Detail

      • SimpleContext

        public SimpleContext​(String sTenant,
                             ContainerAdapter adapter)
        Construct the SimpleContext for a given tenant.
        Parameters:
        sTenant - the tenant name
        adapter - the corresponding ContainerAdapter
    • Method Detail

      • getDomainPartition

        public String getDomainPartition()
        Description copied from interface: ContainerContext
        Obtain the Domain Partition name associated with this ContainerContext.

        Note, that to get the name of the the GLOBAL DomainPartition, the caller should do the following:

            getGlobalContext().getDomainPartition();
         

        Specified by:
        getDomainPartition in interface ContainerContext
        Returns:
        the Domain Partition name or null if the container does not support Multi-Tenancy or this feature is turned off
      • isGlobalDomainPartition

        public boolean isGlobalDomainPartition()
        Description copied from interface: ContainerContext
        Check whether or not the DomainPartition associated with this context is GLOBAL.

        Note, that this call is basically equivalent to the following:

            equals(getGlobalContext());
         

        Specified by:
        isGlobalDomainPartition in interface ContainerContext
        Returns:
        true if the DomainPartition associated with this context is GLOBAL
      • getGlobalContext

        public ContainerContext getGlobalContext()
        Description copied from interface: ContainerContext
        Obtain the ContainerContext associated with GLOBAL Domain Partition.

        Important note: since the ContainerContext object could use the context as a part of the event dispatcher or listener identity, it's imperative for the container to maintain no more than one instance of the global context.

        Specified by:
        getGlobalContext in interface ContainerContext
        Returns:
        the ContainerContext associated with the GLOBAL Domain Partition.
      • getCurrentThreadContext

        public ContainerContext getCurrentThreadContext()
        Description copied from interface: ContainerContext
        Obtain the ContainerContext associated with the current thread. Note, that the returned context could only be one of
        • null, if the current thread is not associated with any context;
        • the GLOBAL context;
        • this ContainerContext;
        • another instance of ContainerContext representing the same Domain Partition as this context.
        Note2: since the ContainerContext object could use the context as a part of the event dispatcher or listener identity, it's imperative for the container to maintain no more than one instance of the context per distinct Domain Partition per application.
        Specified by:
        getCurrentThreadContext in interface ContainerContext
        Returns:
        the ContainerContext associated with the current thread or null if the thread has no association
      • setCurrentThreadContext

        public void setCurrentThreadContext()
        Description copied from interface: ContainerContext
        Set the execution context for the calling thread to be associated with this ContainerContext's Domain Partition.

        Note, that to set the execution context as GLOBAL, the caller should do the following:

            getGlobalContext().setCurrentThreadContext();
         

        Specified by:
        setCurrentThreadContext in interface ContainerContext
      • runInDomainPartitionContext

        public <V> V runInDomainPartitionContext​(Callable<V> action)
        Description copied from interface: ContainerContext
        Call the specified action in the context of the associated Domain Partition.

        Note, that to call the action in the GLOBAL context, the caller should do the following:

            getGlobalContext().runInDomainPartitionContext(action);
         

        Specified by:
        runInDomainPartitionContext in interface ContainerContext
        Type Parameters:
        V - the result type of the action
        Parameters:
        action - the action to call
        Returns:
        the result of the Callable action
      • isCacheShared

        public boolean isCacheShared​(String sCache)
        Description copied from interface: ContainerContext
        Check whether or not the cache with the specified name should be shared across various Domain Partitions.
        Specified by:
        isCacheShared in interface ContainerContext
        Parameters:
        sCache - the cache name
        Returns:
        true iff the specified cache should be shared
      • getCacheAttribute

        public Object getCacheAttribute​(String sCache,
                                        String sAttribute)
        Description copied from interface: ContainerContext
        Obtain a value for a configuration attribute for a given cache.
        Specified by:
        getCacheAttribute in interface ContainerContext
        Parameters:
        sCache - the cache name
        sAttribute - the attribute name
        Returns:
        the specified attribute value or null, if the default value should be used
      • evaluateAttribute

        protected String evaluateAttribute​(String sCache,
                                           String sAttribute)
        Get the value for a given macro attribute for a given cache mapping.