use separate dbPool for async DB Tasks
This commit is contained in:
		
							parent
							
								
									e90a708185
								
							
						
					
					
						commit
						76e852bff0
					
				@ -62,7 +62,7 @@ public abstract class TbAbstractAlarmNode<C extends TbAbstractAlarmNodeConfigura
 | 
			
		||||
                        ctx.tellNext(toAlarmMsg(ctx, alarmResult, msg), "Cleared");
 | 
			
		||||
                    }
 | 
			
		||||
                },
 | 
			
		||||
                t -> ctx.tellFailure(msg, t));
 | 
			
		||||
                t -> ctx.tellFailure(msg, t), ctx.getDbCallbackExecutor());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected abstract ListenableFuture<AlarmResult> processAlarm(TbContext ctx, TbMsg msg);
 | 
			
		||||
 | 
			
		||||
@ -69,7 +69,7 @@ public abstract class TbAbstractGetAttributesNode<C extends TbGetAttributesNodeC
 | 
			
		||||
                putAttrAsync(ctx, entityId, msg, SHARED_SCOPE, config.getSharedAttributeNames(), "shared_"),
 | 
			
		||||
                putAttrAsync(ctx, entityId, msg, SERVER_SCOPE, config.getServerAttributeNames(), "ss_")
 | 
			
		||||
        );
 | 
			
		||||
        withCallback(allFutures, i -> ctx.tellNext(msg, SUCCESS), t -> ctx.tellFailure(msg, t));
 | 
			
		||||
        withCallback(allFutures, i -> ctx.tellNext(msg, SUCCESS), t -> ctx.tellFailure(msg, t), ctx.getDbCallbackExecutor());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private ListenableFuture<Void> putAttrAsync(TbContext ctx, EntityId entityId, TbMsg msg, String scope, List<String> keys, String prefix) {
 | 
			
		||||
 | 
			
		||||
@ -54,7 +54,7 @@ public abstract class TbEntityGetAttrNode<T extends EntityId> implements TbNode
 | 
			
		||||
            withCallback(
 | 
			
		||||
                    findEntityAsync(ctx, msg.getOriginator()),
 | 
			
		||||
                    entityId -> safeGetAttributes(ctx, msg, entityId),
 | 
			
		||||
                    t -> ctx.tellFailure(msg, t));
 | 
			
		||||
                    t -> ctx.tellFailure(msg, t), ctx.getDbCallbackExecutor());
 | 
			
		||||
        } catch (Throwable th) {
 | 
			
		||||
            ctx.tellFailure(msg, th);
 | 
			
		||||
        }
 | 
			
		||||
@ -68,7 +68,7 @@ public abstract class TbEntityGetAttrNode<T extends EntityId> implements TbNode
 | 
			
		||||
 | 
			
		||||
        withCallback(config.isTelemetry() ? getLatestTelemetry(ctx, entityId) : getAttributesAsync(ctx, entityId),
 | 
			
		||||
                attributes -> putAttributesAndTell(ctx, msg, attributes),
 | 
			
		||||
                t -> ctx.tellFailure(msg, t));
 | 
			
		||||
                t -> ctx.tellFailure(msg, t), ctx.getDbCallbackExecutor());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private ListenableFuture<List<KvEntry>> getAttributesAsync(TbContext ctx, EntityId entityId) {
 | 
			
		||||
 | 
			
		||||
@ -69,7 +69,7 @@ public class TbChangeOriginatorNode extends TbAbstractTransformNode {
 | 
			
		||||
                return null;
 | 
			
		||||
            }
 | 
			
		||||
            return ctx.transformMsg(msg, msg.getType(), n, msg.getMetaData(), msg.getData());
 | 
			
		||||
        });
 | 
			
		||||
        }, ctx.getDbCallbackExecutor());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private ListenableFuture<? extends EntityId> getNewOriginator(TbContext ctx, EntityId original) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user