This is an automated email from the ASF dual-hosted git repository.

dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new 973974ebde [INLONG-8962][Agent] Fix the bug: before state and after 
state are the same in StateCallback.call (#10021)
973974ebde is described below

commit 973974ebdec768165847824b37d04da5e1ee6f21
Author: justinwwhuang <[email protected]>
AuthorDate: Fri Apr 19 17:38:02 2024 +0800

    [INLONG-8962][Agent] Fix the bug: before state and after state are the same 
in StateCallback.call (#10021)
---
 .../main/java/org/apache/inlong/agent/state/AbstractStateWrapper.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/state/AbstractStateWrapper.java
 
b/inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/state/AbstractStateWrapper.java
index 63ee273876..709af247c5 100644
--- 
a/inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/state/AbstractStateWrapper.java
+++ 
b/inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/state/AbstractStateWrapper.java
@@ -57,9 +57,10 @@ public abstract class AbstractStateWrapper implements 
Runnable {
         Pair<State, State> statePair = new ImmutablePair<>(currentState, 
nextState);
         StateCallback callback = callBacks.get(statePair);
         // change state before callback.
+        State lastState = currentState;
         currentState = nextState;
         if (callback != null) {
-            callback.call(currentState, nextState);
+            callback.call(lastState, nextState);
         }
     }
 

Reply via email to