forked from alibaba/COLA
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[REFACTOR]:[rename failover to fail]
这里不是故障恢复,只是出错回调
- Loading branch information
Showing
10 changed files
with
58 additions
and
55 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
...t-statemachine/src/main/java/com/alibaba/cola/statemachine/builder/AlertFailCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.alibaba.cola.statemachine.builder; | ||
|
||
import com.alibaba.cola.statemachine.exception.TransitionFailException; | ||
|
||
/** | ||
* Alert fail callback, throw an {@code TransitionFailException} | ||
* | ||
* @author 龙也 | ||
* @date 2022/9/15 12:02 PM | ||
*/ | ||
public class AlertFailCallback<S, E, C> implements FailCallback<S, E, C> { | ||
|
||
@Override | ||
public void onFail(S sourceState, E event, C context) { | ||
throw new TransitionFailException( | ||
"Cannot fire event [" + event + "] on current state [" + sourceState + "] with context [" + context + "]" | ||
); | ||
} | ||
} |
18 changes: 0 additions & 18 deletions
18
...achine/src/main/java/com/alibaba/cola/statemachine/builder/AlertFailoverCallbackImpl.java
This file was deleted.
Oops, something went wrong.
8 changes: 5 additions & 3 deletions
8
...tatemachine/builder/FailoverCallback.java → ...la/statemachine/builder/FailCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
package com.alibaba.cola.statemachine.builder; | ||
|
||
/** | ||
* FailCallback | ||
* | ||
* @author 龙也 | ||
* @date 2022/9/15 12:02 PM | ||
*/ | ||
@FunctionalInterface | ||
public interface FailoverCallback<S, E, C> { | ||
public interface FailCallback<S, E, C> { | ||
|
||
/** | ||
* Callback function to execute on failover | ||
* Callback function to execute if failed to trigger an Event | ||
* | ||
* @param sourceState | ||
* @param event | ||
* @param context | ||
*/ | ||
void onFailover(S sourceState, E event, C context); | ||
void onFail(S sourceState, E event, C context); | ||
} |
15 changes: 15 additions & 0 deletions
15
...nt-statemachine/src/main/java/com/alibaba/cola/statemachine/builder/NumbFailCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.alibaba.cola.statemachine.builder; | ||
|
||
/** | ||
* Default fail callback, do nothing. | ||
* | ||
* @author 龙也 | ||
* @date 2022/9/15 12:02 PM | ||
*/ | ||
public class NumbFailCallback<S, E, C> implements FailCallback<S, E, C> { | ||
|
||
@Override | ||
public void onFail(S sourceState, E event, C context) { | ||
//do nothing | ||
} | ||
} |
15 changes: 0 additions & 15 deletions
15
...machine/src/main/java/com/alibaba/cola/statemachine/builder/NumbFailoverCallbackImpl.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters