Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Increased GlobalLock timeout to 30s, added more info about lock owner

Christian Bauer7fe5e4efc64e
diff --git a/agent/src/main/java/org/openremote/agent/protocol/AbstractProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/AbstractProtocol.java
index b7f483405..68ff12e4e 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/AbstractProtocol.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/AbstractProtocol.java
@@ -129,7 +129,7 @@ public abstract class AbstractProtocol implements Protocol {
this.messageBrokerContext = container.getService(MessageBrokerSetupService.class).getContext();
this.producerTemplate = container.getService(MessageBrokerService.class).getProducerTemplate();
- withLock(getProtocolName(), () -> {
+ withLock(getProtocolName() + "::start", () -> {
try {
messageBrokerContext.addRoutes(new RouteBuilder() {
@Override
@@ -155,7 +155,7 @@ public abstract class AbstractProtocol implements Protocol {
@Override
final public void stop(Container container) {
- withLock(getProtocolName(), () -> {
+ withLock(getProtocolName() + "::stop", () -> {
linkedAttributes.clear();
try {
messageBrokerContext.stopRoute("Actuator-" + getProtocolName(), 1, TimeUnit.MILLISECONDS);
@@ -171,7 +171,7 @@ public abstract class AbstractProtocol implements Protocol {
@Override
final public void linkProtocolConfiguration(AssetAttribute protocolConfiguration, Consumer<ConnectionStatus> statusConsumer) {
- withLock(getProtocolName(), () -> {
+ withLock(getProtocolName() + "::linkProtocolConfiguration", () -> {
LOG.finer("Linking protocol configuration to protocol '" + getProtocolName() + "': " + protocolConfiguration);
linkedProtocolConfigurations.put(
protocolConfiguration.getReferenceOrThrow(),
@@ -183,7 +183,7 @@ public abstract class AbstractProtocol implements Protocol {
@Override
final public void unlinkProtocolConfiguration(AssetAttribute protocolConfiguration) {
- withLock(getProtocolName(), () -> {
+ withLock(getProtocolName() + "::unlinkProtocolConfiguration", () -> {
LOG.finer("Unlinking protocol configuration from protocol '" + getProtocolName() + "': " + protocolConfiguration);
doUnlinkProtocolConfiguration(protocolConfiguration);
linkedProtocolConfigurations.remove(protocolConfiguration.getReferenceOrThrow());
@@ -192,7 +192,7 @@ public abstract class AbstractProtocol implements Protocol {
@Override
final public void linkAttributes(Collection<AssetAttribute> attributes, AssetAttribute protocolConfiguration) {
- withLock(getProtocolName(), () -> {
+ withLock(getProtocolName() + "::linkAttributes", () -> {
attributes.forEach(attribute -> {
LOG.fine("Linking attribute to '" + getProtocolName() + "': " + attribute);
AttributeRef attributeRef = attribute.getReferenceOrThrow();
@@ -223,7 +223,7 @@ public abstract class AbstractProtocol implements Protocol {
@Override
final public void unlinkAttributes(Collection<AssetAttribute> attributes, AssetAttribute protocolConfiguration) throws Exception {
- withLock(getProtocolName(), () ->
+ withLock(getProtocolName() + "::unlinkAttributes", () ->
attributes.forEach(attribute -> {
LOG.fine("Unlinking attribute on '" + getProtocolName() + "': " + attribute);
AttributeRef attributeRef = attribute.getReferenceOrThrow();
@@ -239,7 +239,7 @@ public abstract class AbstractProtocol implements Protocol {
* Gets a linked attribute by its attribute ref
*/
protected AssetAttribute getLinkedAttribute(AttributeRef attributeRef) {
- return withLockReturning(getProtocolName(), () -> linkedAttributes.get(attributeRef));
+ return withLockReturning(getProtocolName() + "::getLinkedAttribute", () -> linkedAttributes.get(attributeRef));
}
/**
@@ -251,7 +251,7 @@ public abstract class AbstractProtocol implements Protocol {
}
protected AssetAttribute getLinkedProtocolConfiguration(AttributeRef protocolConfigurationRef) {
- return withLockReturning(getProtocolName(), () -> {
+ return withLockReturning(getProtocolName() + "::getLinkedProtocolConfigurations", () -> {
LinkedProtocolInfo linkedProtocolInfo = linkedProtocolConfigurations.get(protocolConfigurationRef);
// Don't bother with null check if someone calls here with an attribute not linked to this protocol
// then they're doing something wrong so fail hard and fast
@@ -261,7 +261,7 @@ public abstract class AbstractProtocol implements Protocol {
final protected void processLinkedAttributeWrite(AttributeEvent event) {
LOG.finest("Processing linked attribute write on " + getProtocolName() + ": " + event);
- withLock(getProtocolName(), () -> {
+ withLock(getProtocolName() + "::processLinkedAttributeWrite", () -> {
AssetAttribute attribute = linkedAttributes.get(event.getAttributeRef());
if (attribute == null) {
LOG.warning("Attribute doesn't exist on this protocol: " + event.getAttributeRef());
@@ -286,7 +286,7 @@ public abstract class AbstractProtocol implements Protocol {
* publish new sensor values, which performs additional verification and uses a different messaging queue.
*/
final protected void sendAttributeEvent(AttributeEvent event) {
- withLock(getProtocolName(), () -> {
+ withLock(getProtocolName() + "::sendAttributeEvent", () -> {
// Don't allow updating linked attributes with this mechanism as it could cause an infinite loop
if (linkedAttributes.containsKey(event.getAttributeRef())) {
LOG.warning("Cannot update an attribute linked to the same protocol; use updateLinkedAttribute for that: " + event);
@@ -303,7 +303,7 @@ public abstract class AbstractProtocol implements Protocol {
*/
@SuppressWarnings("unchecked")
final protected void updateLinkedAttribute(final AttributeState finalState, long timestamp) {
- withLock(getProtocolName(), () -> {
+ withLock(getProtocolName() + "::updateLinkedAttribute", () -> {
AttributeState state = finalState;
AssetAttribute attribute = linkedAttributes.get(state.getAttributeRef());
@@ -418,7 +418,7 @@ public abstract class AbstractProtocol implements Protocol {
* the consumer to perform the modification.
*/
final protected void updateLinkedProtocolConfiguration(AssetAttribute protocolConfiguration, Consumer<AssetAttribute> protocolUpdater) {
- withLock(getProtocolName(), () -> {
+ withLock(getProtocolName() + "::updateLinkedProtocolConfiguration", () -> {
// Clone the protocol configuration rather than modify this one
AssetAttribute modifiedProtocolConfiguration = protocolConfiguration.deepCopy();
protocolUpdater.accept(modifiedProtocolConfiguration);
@@ -430,7 +430,7 @@ public abstract class AbstractProtocol implements Protocol {
* Update the runtime status of a protocol configuration by its attribute ref
*/
final protected void updateStatus(AttributeRef protocolRef, ConnectionStatus connectionStatus) {
- withLock(getProtocolName(), () -> {
+ withLock(getProtocolName() + "::updateStatus", () -> {
LinkedProtocolInfo protocolInfo = linkedProtocolConfigurations.get(protocolRef);
if (protocolInfo != null) {
LOG.fine("Updating protocol status to '" + connectionStatus + "': " + protocolRef);
@@ -444,7 +444,7 @@ public abstract class AbstractProtocol implements Protocol {
* Gets the current runtime status of a protocol configuration.
*/
final protected ConnectionStatus getStatus(AssetAttribute protocolConfiguration) {
- return withLockReturning(getProtocolName(), () -> {
+ return withLockReturning(getProtocolName() + "::getStatus", () -> {
LinkedProtocolInfo linkedProtocolInfo = linkedProtocolConfigurations.get(protocolConfiguration.getReferenceOrThrow());
return linkedProtocolInfo.getCurrentConnectionStatus();
});
diff --git a/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientProtocol.java
index c3504cbb1..e8c80fc11 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientProtocol.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientProtocol.java
@@ -919,7 +919,7 @@ public class HttpClientProtocol extends AbstractProtocol {
}
protected void cancelPolling(AttributeRef attributeRef) {
- withLock(getProtocolName(), () -> {
+ withLock(getProtocolName() + "::cancelPolling", () -> {
ScheduledFuture pingPoll = pollingMap.remove(attributeRef);
if (pingPoll != null) {
pingPoll.cancel(false);
diff --git a/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.java
index 57f7d3d3d..04050ed88 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.java
@@ -316,7 +316,7 @@ public class SimulatorProtocol extends AbstractProtocol {
* Call this to simulate a sensor update after the specified delay (it uses the last value supplied from send to actuator).
*/
public void updateSensor(AttributeRef attributeRef, int updateSensorDelayMilliseconds) {
- withLock(getProtocolName(), () -> {
+ withLock(getProtocolName() + "::updateSensor", () -> {
AttributeRef instanceRef = attributeInstanceMap.get(attributeRef);
if (instanceRef == null) {
@@ -371,7 +371,7 @@ public class SimulatorProtocol extends AbstractProtocol {
* Call this to simulate a send to actuator.
*/
public boolean putValue(AttributeState attributeState) {
- Boolean result = withLockReturning(getProtocolName(), () -> {
+ Boolean result = withLockReturning(getProtocolName() + "::putValue", () -> {
AttributeRef attributeRef = attributeState.getAttributeRef();
AttributeRef instanceRef = attributeInstanceMap.get(attributeRef);
@@ -429,7 +429,7 @@ public class SimulatorProtocol extends AbstractProtocol {
* Call this to get the current value of an attribute.
*/
public Optional<Value> getValue(AttributeRef attributeRef) {
- return withLockReturning(getProtocolName(), () -> {
+ return withLockReturning(getProtocolName() + "::getValue", () -> {
SimulatorElement element = elements.get(attributeRef);
return element != null ? element.getValue() : Optional.empty();
});
@@ -453,7 +453,7 @@ public class SimulatorProtocol extends AbstractProtocol {
* Read a state snapshot.
*/
public Optional<SimulatorState> getSimulatorState(AttributeRef protocolConfigurationRef) {
- return withLockReturning(getProtocolName(), () -> {
+ return withLockReturning(getProtocolName() + "::getSimulatorState", () -> {
LOG.info("Getting simulator state for protocol configuration: " + protocolConfigurationRef);
if (!instances.containsKey(protocolConfigurationRef))
return Optional.empty();
@@ -472,7 +472,7 @@ public class SimulatorProtocol extends AbstractProtocol {
* Write a state snapshot.
*/
public void updateSimulatorState(SimulatorState simulatorState) {
- withLock(getProtocolName(), () -> {
+ withLock(getProtocolName() + "::updateSimulatorState", () -> {
AttributeRef protocolConfigurationRef = simulatorState.getProtocolConfigurationRef();
if (!instances.containsKey(protocolConfigurationRef)) {
LOG.info("Ignoring simulator update, no instance for protocol configuration: " + protocolConfigurationRef);
diff --git a/container/src/main/java/org/openremote/container/concurrent/GlobalLock.java b/container/src/main/java/org/openremote/container/concurrent/GlobalLock.java
index d2434ac8b..c040bae82 100644
--- a/container/src/main/java/org/openremote/container/concurrent/GlobalLock.java
+++ b/container/src/main/java/org/openremote/container/concurrent/GlobalLock.java
@@ -77,7 +77,7 @@ public class GlobalLock {
* @return Defaults to 10 seconds.
*/
static public int getLockTimeoutMillis() {
- return 10000;
+ return 30000;
}
/**
diff --git a/manager/src/main/java/org/openremote/manager/agent/AgentService.java b/manager/src/main/java/org/openremote/manager/agent/AgentService.java
index 2d9aa4c01..068af1822 100644
--- a/manager/src/main/java/org/openremote/manager/agent/AgentService.java
+++ b/manager/src/main/java/org/openremote/manager/agent/AgentService.java
@@ -435,7 +435,7 @@ public class AgentService extends RouteBuilder implements ContainerService, Asse
}
protected void linkProtocolConfigurations(Stream<AssetAttribute> configurations) {
- withLock(getClass().getSimpleName(), () -> configurations.forEach(configuration -> {
+ withLock(getClass().getSimpleName() + "::linkProtocolConfigurations", () -> configurations.forEach(configuration -> {
AttributeRef protocolAttributeRef = configuration.getReferenceOrThrow();
Protocol protocol = getProtocol(configuration);
@@ -497,7 +497,7 @@ public class AgentService extends RouteBuilder implements ContainerService, Asse
}
protected void unlinkProtocolConfigurations(Stream<AssetAttribute> configurations) {
- withLock(getClass().getSimpleName(), () -> configurations.forEach(configuration -> {
+ withLock(getClass().getSimpleName() + "::unlinkProtocolConfigurations", () -> configurations.forEach(configuration -> {
AttributeRef protocolAttributeRef = configuration.getReferenceOrThrow();
// Get all assets that have attributes that use this protocol configuration
@@ -539,7 +539,7 @@ public class AgentService extends RouteBuilder implements ContainerService, Asse
}
protected void publishProtocolConnectionStatus(AttributeRef protocolRef, ConnectionStatus connectionStatus) {
- withLock(getClass().getSimpleName(), () -> {
+ withLock(getClass().getSimpleName() + "::publishProtocolConnectionStatus", () -> {
Pair<AssetAttribute, ConnectionStatus> protocolDeploymentInfo = protocolConfigurations.get(protocolRef);
if (protocolDeploymentInfo != null && protocolDeploymentInfo.value != connectionStatus) {
LOG.info("Agent protocol status updated to " + connectionStatus + ": " + protocolRef);
@@ -559,7 +559,7 @@ public class AgentService extends RouteBuilder implements ContainerService, Asse
}
public ConnectionStatus getProtocolConnectionStatus(AttributeRef protocolRef) {
- return withLockReturning(getClass().getSimpleName(), () ->
+ return withLockReturning(getClass().getSimpleName() + "::getProtocolConnectionStatus", () ->
Optional.ofNullable(protocolConfigurations.get(protocolRef))
.map(pair -> pair.value)
.orElse(null));
@@ -570,7 +570,7 @@ public class AgentService extends RouteBuilder implements ContainerService, Asse
}
protected void linkAttributes(AssetAttribute protocolConfiguration, Collection<AssetAttribute> attributes) {
- withLock(getClass().getSimpleName(), () -> {
+ withLock(getClass().getSimpleName() + "::linkAttributes", () -> {
LOG.fine("Linking all attributes that use protocol attribute: " + protocolConfiguration);
Protocol protocol = getProtocol(protocolConfiguration);
@@ -594,7 +594,7 @@ public class AgentService extends RouteBuilder implements ContainerService, Asse
}
protected void unlinkAttributes(AssetAttribute protocolConfiguration, Collection<AssetAttribute> attributes) {
- withLock(getClass().getSimpleName(), () -> {
+ withLock(getClass().getSimpleName() + "::unlinkAttributes", () -> {
LOG.fine("Unlinking all attributes that use protocol attribute: " + protocolConfiguration);
Protocol protocol = getProtocol(protocolConfiguration);
@@ -634,7 +634,7 @@ public class AgentService extends RouteBuilder implements ContainerService, Asse
return false;
}
- Boolean result = withLockReturning(getClass().getSimpleName(), () ->
+ Boolean result = withLockReturning(getClass().getSimpleName() + "::processAssetUpdate", () ->
AgentLink.getAgentLink(attribute)
.map(ref ->
getProtocolConfiguration(ref)
@@ -699,7 +699,7 @@ public class AgentService extends RouteBuilder implements ContainerService, Asse
}
public Optional<AssetAttribute> getProtocolConfiguration(AttributeRef protocolRef) {
- return withLockReturning(getClass().getSimpleName(), () -> {
+ return withLockReturning(getClass().getSimpleName() + "::getProtocolConfiguration", () -> {
Pair<AssetAttribute, ConnectionStatus> deploymentStatusPair = protocolConfigurations.get(protocolRef);
return deploymentStatusPair == null ? Optional.empty() : Optional.of(deploymentStatusPair.key);
});
@@ -714,16 +714,16 @@ public class AgentService extends RouteBuilder implements ContainerService, Asse
}
protected void addReplaceAgent(Asset agent) {
- withLock(getClass().getSimpleName(), () -> getAgents().put(agent.getId(), agent)
+ withLock(getClass().getSimpleName() + "::addReplaceAgent", () -> getAgents().put(agent.getId(), agent)
);
}
protected void removeAgent(Asset agent) {
- withLock(getClass().getSimpleName(), () -> getAgents().remove(agent.getId()));
+ withLock(getClass().getSimpleName() + "::removeAgent", () -> getAgents().remove(agent.getId()));
}
public Map<String, Asset> getAgents() {
- return withLockReturning(getClass().getSimpleName(), () -> {
+ return withLockReturning(getClass().getSimpleName() + "::getAgents", () -> {
if (agentMap == null) {
agentMap = assetStorageService.findAll(new AssetQuery()
.select(new AssetQuery.Select(AssetQuery.Include.ALL))
diff --git a/manager/src/main/java/org/openremote/manager/asset/AssetProcessingService.java b/manager/src/main/java/org/openremote/manager/asset/AssetProcessingService.java
index 09822db20..69719065c 100644
--- a/manager/src/main/java/org/openremote/manager/asset/AssetProcessingService.java
+++ b/manager/src/main/java/org/openremote/manager/asset/AssetProcessingService.java
@@ -249,7 +249,7 @@ public class AssetProcessingService extends RouteBuilder implements ContainerSer
// Lock the global context, we can only process attribute events when the
// context isn't locked. Agent- and RulesService lock the context while protocols
// or rulesets are modified.
- .process(exchange -> withLock("AssetQueueProcessor", () -> {
+ .process(exchange -> withLock(getClass().getSimpleName() + "::processFromAssetQueue", () -> {
AttributeEvent event = exchange.getIn().getBody(AttributeEvent.class);
LOG.finest("Processing: " + event);
diff --git a/manager/src/main/java/org/openremote/manager/rules/RulesEngine.java b/manager/src/main/java/org/openremote/manager/rules/RulesEngine.java
index d258fe1c2..1c9e42efe 100644
--- a/manager/src/main/java/org/openremote/manager/rules/RulesEngine.java
+++ b/manager/src/main/java/org/openremote/manager/rules/RulesEngine.java
@@ -259,14 +259,14 @@ public class RulesEngine<T extends Ruleset> {
}
public void fire() {
- withLock(getClass().getSimpleName(), () -> {
+ withLock(toString() + "::scheduleFire", () -> {
// Schedule a firing within the guaranteed expiration time (so not immediately), and
// only if the last firing is done. This effectively limits how often the rules engine
// will fire, only once within the guaranteed minimum expiration time.
if (fireTimer == null || fireTimer.isDone()) {
LOG.fine("Scheduling rules firing on: " + this);
fireTimer = executorService.schedule(
- () -> withLock(getClass().getSimpleName(), () -> {
+ () -> withLock(RulesEngine.this.toString() + "::fire", () -> {
// Are temporary facts present before rules are fired?
boolean hadTemporaryFactsBefore = facts.hasTemporaryFacts();
@@ -382,7 +382,7 @@ public class RulesEngine<T extends Ruleset> {
}
protected void printSessionStats() {
- withLock(getClass().getSimpleName(), () -> {
+ withLock(toString() + "::printSessionStats", () -> {
Collection<AssetState> assetStateFacts = facts.getAssetStates();
Collection<TemporaryFact<AssetState>> assetEventFacts = facts.getAssetEvents();
Map<String, Object> namedFacts = facts.getNamedFacts();
@@ -392,9 +392,9 @@ public class RulesEngine<T extends Ruleset> {
STATS_LOG.info("On " + this + ", in memory facts are Total: " + total
+ ", AssetState: " + assetStateFacts.size()
+ ", AssetEvent: " + assetEventFacts.size()
- + ", Temporary: " + temporaryFactsCount
+ ", Named: " + namedFacts.size()
- + ", Anonymous: " + anonFacts.size());
+ + ", Anonymous: " + anonFacts.size()
+ + ", Temporary: " + temporaryFactsCount);
// Additional details if FINEST is enabled
if (STATS_LOG.isLoggable(Level.FINEST)) {
diff --git a/manager/src/main/java/org/openremote/manager/rules/RulesService.java b/manager/src/main/java/org/openremote/manager/rules/RulesService.java
index ca5cf1309..79e979359 100644
--- a/manager/src/main/java/org/openremote/manager/rules/RulesService.java
+++ b/manager/src/main/java/org/openremote/manager/rules/RulesService.java
@@ -193,7 +193,7 @@ public class RulesService extends RouteBuilder implements ContainerService, Asse
@Override
public void stop(Container container) throws Exception {
- withLock(getClass().getSimpleName(), () -> {
+ withLock(getClass().getSimpleName() + "::stop", () -> {
assetEngines.forEach((assetId, rulesEngine) -> rulesEngine.stop());
assetEngines.clear();
tenantEngines.forEach((realm, rulesEngine) -> rulesEngine.stop());
@@ -234,7 +234,7 @@ public class RulesService extends RouteBuilder implements ContainerService, Asse
}
protected void processTenantChange(Tenant tenant, PersistenceEvent.Cause cause) {
- withLock(getClass().getSimpleName(), () -> {
+ withLock(getClass().getSimpleName() + "::processTenantChange", () -> {
// Check if enabled status has changed
boolean wasEnabled = Arrays.asList(activeTenantIds).contains(tenant.getId());
boolean isEnabled = tenant.getEnabled() && cause != PersistenceEvent.Cause.DELETE;
@@ -274,7 +274,7 @@ public class RulesService extends RouteBuilder implements ContainerService, Asse
}
protected void processAssetChange(ServerAsset asset, PersistenceEvent persistenceEvent) {
- withLock(getClass().getSimpleName(), () -> {
+ withLock(getClass().getSimpleName() + "::processAssetChange", () -> {
// We must load the asset from database (only when required), as the
// persistence event might not contain a completely loaded asset
@@ -398,7 +398,7 @@ public class RulesService extends RouteBuilder implements ContainerService, Asse
}
protected void processRulesetChange(Ruleset ruleset, PersistenceEvent.Cause cause) {
- withLock(getClass().getSimpleName(), () -> {
+ withLock(getClass().getSimpleName() + "::processRulesetChange", () -> {
if (cause == PersistenceEvent.Cause.DELETE || !ruleset.isEnabled()) {
if (ruleset instanceof GlobalRuleset) {
undeployGlobalRuleset((GlobalRuleset) ruleset);
@@ -452,7 +452,7 @@ public class RulesService extends RouteBuilder implements ContainerService, Asse
* is returned from the method.
*/
protected RulesEngine<GlobalRuleset> deployGlobalRuleset(GlobalRuleset ruleset) {
- return withLockReturning(getClass().getSimpleName(), () -> {
+ return withLockReturning(getClass().getSimpleName() + "::deployGlobalRuleset", () -> {
boolean created = globalEngine == null;
// Global rules have access to everything in the system
@@ -474,7 +474,7 @@ public class RulesService extends RouteBuilder implements ContainerService, Asse
}
protected void undeployGlobalRuleset(GlobalRuleset ruleset) {
- withLock(getClass().getSimpleName(), () -> {
+ withLock(getClass().getSimpleName() + "::undeployGlobalRuleset", () -> {
if (globalEngine == null) {
return;
}
@@ -486,7 +486,7 @@ public class RulesService extends RouteBuilder implements ContainerService, Asse
}
protected RulesEngine<TenantRuleset> deployTenantRuleset(TenantRuleset ruleset) {
- return withLockReturning(getClass().getSimpleName(), () -> {
+ return withLockReturning(getClass().getSimpleName() + "::deployTenantRuleset", () -> {
final boolean[] created = {false};
// Look for existing rules engines for this tenant
@@ -511,7 +511,7 @@ public class RulesService extends RouteBuilder implements ContainerService, Asse
}
protected void undeployTenantRuleset(TenantRuleset ruleset) {
- withLock(getClass().getSimpleName(), () -> {
+ withLock(getClass().getSimpleName() + "::undeployTenantRuleset", () -> {
RulesEngine<TenantRuleset> rulesEngine = tenantEngines.get(ruleset.getRealmId());
if (rulesEngine == null) {
return;
@@ -552,7 +552,7 @@ public class RulesService extends RouteBuilder implements ContainerService, Asse
}
protected RulesEngine<AssetRuleset> deployAssetRuleset(AssetRuleset ruleset) {
- return withLockReturning(getClass().getSimpleName(), () -> {
+ return withLockReturning(getClass().getSimpleName() + "::deployAssetRuleset", () -> {
final boolean[] created = {false};
// Look for existing rules engine for this asset
@@ -576,7 +576,7 @@ public class RulesService extends RouteBuilder implements ContainerService, Asse
}
protected void undeployAssetRuleset(AssetRuleset ruleset) {
- withLock(getClass().getSimpleName(), () -> {
+ withLock(getClass().getSimpleName() + "::undeployAssetRuleset", () -> {
RulesEngine<AssetRuleset> assetRulesEngine = assetEngines.get(ruleset.getAssetId());
if (assetRulesEngine == null) {
return;
@@ -589,7 +589,7 @@ public class RulesService extends RouteBuilder implements ContainerService, Asse
}
protected void insertAssetEvent(AssetState assetState, String expires) {
- withLock(getClass().getSimpleName(), () -> {
+ withLock(getClass().getSimpleName() + "::insertAssetEvent", () -> {
// Get the chain of rule engines that we need to pass through
List<RulesEngine> rulesEngines = getEnginesInScope(assetState.getRealmId(), assetState.getPath());
@@ -614,7 +614,7 @@ public class RulesService extends RouteBuilder implements ContainerService, Asse
}
protected void updateAssetState(AssetState assetState, boolean skipStatusCheck, boolean fireImmediately) {
- withLock(getClass().getSimpleName(), () -> {
+ withLock(getClass().getSimpleName() + "::updateAssetState", () -> {
// TODO: implement rules processing error state handling
// Get the chain of rule engines that we need to pass through