mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-19 23:02:24 +00:00
24 lines
502 B
Java
24 lines
502 B
Java
package org.multitenant.partition;
|
|
|
|
import io.ebean.config.CurrentTenantProvider;
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
class CurrentTenant implements CurrentTenantProvider {
|
|
|
|
static AtomicInteger callCounter = new AtomicInteger();
|
|
|
|
static int count() {
|
|
return callCounter.get();
|
|
}
|
|
|
|
/**
|
|
* Return the current tenantId from the user context.
|
|
*/
|
|
@Override
|
|
public String currentId() {
|
|
callCounter.incrementAndGet();
|
|
return UserContext.get().getTenantId();
|
|
}
|
|
}
|