Class AbstractJMXMBean.TenantAwareExecutor<T>

  • Type Parameters:
    T - - the return type
    Enclosing class:
    AbstractJMXMBean

    protected abstract class AbstractJMXMBean.TenantAwareExecutor<T>
    extends java.lang.Object

    Inner tenant aware executor class. This claas deals with the AbstractJMXMBean.activateTenant() and AbstractJMXMBean.deactivateTenant() calls.

    The following example shows how to use this inner class:

     <code>
     public Integer getMaxAllowedSize()
     {
      <b>return</b> new TenantAwareExecutor<Integer>()
      {
        protected Integer doExecute()
        {
          <b>return</b> Integer.valueOf(Registry.getCurrentTenant().getCache().getMaxAllowedSize());
        }
      }.getResult();
     }
     </code>
     

    • Constructor Detail

      • TenantAwareExecutor

        protected TenantAwareExecutor()
        calls perform()
    • Method Detail

      • getResult

        public T getResult()
        Returns:
        the result of the doExecute() operation.
      • getCurrentTenant

        protected final Tenant getCurrentTenant()
      • doExecute

        protected abstract T doExecute()
        The content of this method will run with activated tenant and the tenant will always deactivated afterward.
        Returns:
        your result