-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pipeline & Transaction with failover to multi cluster (#3602)
- Loading branch information
Showing
21 changed files
with
5,204 additions
and
8,774 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package redis.clients.jedis; | ||
|
||
import java.io.Closeable; | ||
|
||
public abstract class AbstractPipeline extends PipeliningBase implements Closeable { | ||
|
||
protected AbstractPipeline(CommandObjects commandObjects) { | ||
super(commandObjects); | ||
} | ||
|
||
@Override | ||
public abstract void close(); | ||
|
||
/** | ||
* Synchronize pipeline by reading all responses. | ||
*/ | ||
public abstract void sync(); | ||
|
||
public Response<Long> publish(String channel, String message) { | ||
return appendCommand(commandObjects.publish(channel, message)); | ||
} | ||
|
||
public Response<Long> publish(byte[] channel, byte[] message) { | ||
return appendCommand(commandObjects.publish(channel, message)); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/redis/clients/jedis/AbstractTransaction.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,35 @@ | ||
package redis.clients.jedis; | ||
|
||
import java.io.Closeable; | ||
import java.util.List; | ||
|
||
public abstract class AbstractTransaction extends PipeliningBase implements Closeable { | ||
|
||
protected AbstractTransaction() { | ||
super(new CommandObjects()); | ||
} | ||
|
||
public abstract void multi(); | ||
|
||
/** | ||
* Must be called before {@link AbstractTransaction#multi() MULTI}. | ||
*/ | ||
public abstract String watch(final String... keys); | ||
|
||
/** | ||
* Must be called before {@link AbstractTransaction#multi() MULTI}. | ||
*/ | ||
public abstract String watch(final byte[]... keys); | ||
|
||
public abstract String unwatch(); | ||
|
||
@Override public abstract void close(); | ||
|
||
public abstract List<Object> exec(); | ||
|
||
public abstract String discard(); | ||
|
||
public Response<Long> waitReplicas(int replicas, long timeout) { | ||
return appendCommand(commandObjects.waitReplicas(replicas, timeout)); | ||
} | ||
} |
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
Oops, something went wrong.