-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yifuzhou
committed
Apr 29, 2024
1 parent
e72a362
commit 2034543
Showing
19 changed files
with
200 additions
and
292 deletions.
There are no files selected for viewing
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
40 changes: 40 additions & 0 deletions
40
...le/src/main/java/com/ctrip/xpipe/redis/console/keeper/Command/CheckKeeperRoleCommand.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,40 @@ | ||
package com.ctrip.xpipe.redis.console.keeper.Command; | ||
|
||
import com.ctrip.xpipe.api.endpoint.Endpoint; | ||
import com.ctrip.xpipe.pool.XpipeNettyClientKeyedObjectPool; | ||
import com.ctrip.xpipe.redis.core.protocal.cmd.InfoCommand; | ||
import com.ctrip.xpipe.redis.core.protocal.cmd.InfoResultExtractor; | ||
|
||
import java.util.concurrent.ScheduledExecutorService; | ||
|
||
public class CheckKeeperRoleCommand<T> extends AbstractKeeperCommand<T>{ | ||
|
||
private Endpoint keeper; | ||
|
||
private boolean expectedRole; | ||
|
||
public CheckKeeperRoleCommand(XpipeNettyClientKeyedObjectPool keyedObjectPool, ScheduledExecutorService scheduled, Endpoint keeper, boolean expectedRole) { | ||
super(keyedObjectPool, scheduled); | ||
this.keeper = keeper; | ||
this.expectedRole = expectedRole; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "CheckKeeperRoleCommand"; | ||
} | ||
|
||
@Override | ||
protected void doExecute() throws Throwable { | ||
InfoCommand infoCommand = generateInfoReplicationCommand(keeper); | ||
if (new InfoResultExtractor(infoCommand.execute().get()).getKeeperActive() == expectedRole) { | ||
this.future().setSuccess(); | ||
} | ||
this.future().setFailure(new Exception(String.format("keeper: %s is not %s", keeper, expectedRole))); | ||
} | ||
|
||
@Override | ||
protected void doReset() { | ||
|
||
} | ||
} |
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
4 changes: 0 additions & 4 deletions
4
...n/java/com/ctrip/xpipe/redis/console/keeper/impl/DefaultKeeperContainerAvailablePool.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
Oops, something went wrong.