Class TenantBroker

java.lang.Object
com.power4j.fist.data.tenant.isolation.TenantBroker

public class TenantBroker extends Object
Since:
2022.1
Author:
CJ (power4j@outlook.com)
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    applyAs(String tenant, org.apache.commons.lang3.function.FailableSupplier<T,? extends Throwable> action)
    在指定的租户上下文中执行业务逻辑,并返回业务逻辑执行结构
    <T> T
    applyAs(String tenant, org.apache.commons.lang3.function.FailableSupplier<T,? extends Throwable> action, org.apache.commons.lang3.function.FailableFunction<Throwable,T,? extends Throwable> errorHandler)
    在指定的租户上下文中执行业务逻辑,并返回业务逻辑执行结构
     
    void
    runAs(String tenant, org.apache.commons.lang3.function.FailableRunnable<? extends Throwable> action)
    在指定的租户上下文中执行业务逻辑
    void
    runAs(String tenant, org.apache.commons.lang3.function.FailableRunnable<? extends Throwable> action, org.apache.commons.lang3.function.FailableConsumer<Throwable,? extends Throwable> errorHandler)
    在指定的租户上下文中执行业务逻辑

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TenantBroker

      public TenantBroker()
  • Method Details

    • applyAs

      public <T> T applyAs(@Nullable String tenant, org.apache.commons.lang3.function.FailableSupplier<T,? extends Throwable> action, @Nullable org.apache.commons.lang3.function.FailableFunction<Throwable,T,? extends Throwable> errorHandler)
      在指定的租户上下文中执行业务逻辑,并返回业务逻辑执行结构
      Type Parameters:
      T - 返回值类型
      Parameters:
      tenant - 租户
      action - 业务逻辑
      errorHandler - 异常处理器
      Returns:
      返回值由 action 的返回值确定
    • applyAs

      public <T> T applyAs(@Nullable String tenant, org.apache.commons.lang3.function.FailableSupplier<T,? extends Throwable> action)
      在指定的租户上下文中执行业务逻辑,并返回业务逻辑执行结构
      Type Parameters:
      T - 返回值类型
      Parameters:
      tenant - 租户
      action - 业务逻辑
      Returns:
      返回值由 action 的返回值确定
    • runAs

      public void runAs(@Nullable String tenant, org.apache.commons.lang3.function.FailableRunnable<? extends Throwable> action, @Nullable org.apache.commons.lang3.function.FailableConsumer<Throwable,? extends Throwable> errorHandler)
      在指定的租户上下文中执行业务逻辑
      Parameters:
      tenant - 租户
      action - 业务逻辑
      errorHandler - 异常处理器
    • runAs

      public void runAs(@Nullable String tenant, org.apache.commons.lang3.function.FailableRunnable<? extends Throwable> action)
      在指定的租户上下文中执行业务逻辑
      Parameters:
      tenant - 租户
      action - 业务逻辑
    • dump

      public String dump()