Rewrite for clarity
This commit is contained in:
parent
724e95975a
commit
45443d98fc
@ -225,33 +225,33 @@ public class HashPartitionService implements PartitionService {
|
|||||||
|
|
||||||
boolean isManaged;
|
boolean isManaged;
|
||||||
Set<UUID> assignedTenantProfiles = serviceInfoProvider.getAssignedTenantProfiles();
|
Set<UUID> assignedTenantProfiles = serviceInfoProvider.getAssignedTenantProfiles();
|
||||||
if (assignedTenantProfiles.isEmpty()) { // if this is regular rule engine
|
boolean isRegular = assignedTenantProfiles.isEmpty();
|
||||||
if (tenantId.isSysTenantId()) {
|
if (tenantId.isSysTenantId()) {
|
||||||
isManaged = true;
|
// All system queues are always processed on regular rule engines.
|
||||||
} else {
|
return isRegular;
|
||||||
|
}
|
||||||
TenantRoutingInfo routingInfo = getRoutingInfo(tenantId);
|
TenantRoutingInfo routingInfo = getRoutingInfo(tenantId);
|
||||||
|
if (isRegular) {
|
||||||
if (routingInfo.isIsolated()) {
|
if (routingInfo.isIsolated()) {
|
||||||
isManaged = CollectionsUtil.isEmpty(responsibleServices.get(routingInfo.getProfileId()));
|
isManaged = hasDedicatedService(routingInfo.getProfileId());
|
||||||
} else {
|
} else {
|
||||||
isManaged = true;
|
isManaged = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (tenantId.isSysTenantId()) {
|
|
||||||
isManaged = false;
|
|
||||||
} else {
|
|
||||||
TenantRoutingInfo routingInfo = getRoutingInfo(tenantId);
|
|
||||||
if (routingInfo.isIsolated()) {
|
if (routingInfo.isIsolated()) {
|
||||||
isManaged = assignedTenantProfiles.contains(routingInfo.getProfileId().getId());
|
isManaged = assignedTenantProfiles.contains(routingInfo.getProfileId().getId());
|
||||||
} else {
|
} else {
|
||||||
isManaged = false;
|
isManaged = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
log.trace("[{}] Tenant {} managed by this service", tenantId, isManaged ? "is" : "is not");
|
log.trace("[{}] Tenant {} managed by this service", tenantId, isManaged ? "is" : "is not");
|
||||||
return isManaged;
|
return isManaged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean hasDedicatedService(TenantProfileId profileId) {
|
||||||
|
return CollectionsUtil.isEmpty(responsibleServices.get(profileId));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TopicPartitionInfo resolve(ServiceType serviceType, String queueName, TenantId tenantId, EntityId entityId) {
|
public TopicPartitionInfo resolve(ServiceType serviceType, String queueName, TenantId tenantId, EntityId entityId) {
|
||||||
TenantId isolatedOrSystemTenantId = getIsolatedOrSystemTenantId(serviceType, tenantId);
|
TenantId isolatedOrSystemTenantId = getIsolatedOrSystemTenantId(serviceType, tenantId);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user