-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[maintenance events] Push notification listener #4194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ggivo
wants to merge
29
commits into
redis:feature/maintenance-events
Choose a base branch
from
ggivo:feature/hu-notifications
base: feature/maintenance-events
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 19 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
9d5f0f3
Introduce push handler
ggivo 0f96e2d
Introduce PushHandlerChain for composable push event handling
ggivo 4aec187
Handle relax timeout for maintenance events
ggivo 67d4afa
Merge branch 'master' into feature/hu-notifications
ggivo ab62e9d
Support custom Push listeners for Jedis client
ggivo b36d7f8
Add proactiveRebindEnabled configuration option
ggivo 0452a93
PushHandler is now provided through JedisClientConfig instead through…
ggivo 4bd38da
Fix NPE in CacheConnection
ggivo 4ad3fce
[cleanup] Use weak reference in AdaptiveTimeoutHandler to avoid memor…
ggivo f475177
[cleanup] Fix javadoc errors
ggivo 56cd409
[cleanup] Fix TransactionCommandsTest mocked test
ggivo 175b773
Moving/Rebind initial support
ggivo c19d8a5
Mocked relaxed timeout test
ggivo 4ee525d
Mocked rebind test
ggivo b940ad7
Fix : wrong order connection.rebind pool.clear
ggivo 7efbe72
[clean up] Address review comments from a-TODO-rov
ggivo b0987e0
add more rebind tests
ggivo 7e11737
clean up
ggivo b769492
clean up remove unused test method
ggivo e7ffd1d
fix relaxed timeout on blocking command
ggivo a67b5cb
format
ggivo d34f72d
Merge branch 'redis:master' into feature/hu-notifications
ggivo 5a59b85
enforce code formating for new classes
ggivo 5d6c322
reformat to fix java docs
ggivo c6dec9b
force formating of TimeoutOptions.java
ggivo f5d57d4
Address review comments
ggivo 15dc654
Address review comments
ggivo 0e39aa4
Address review comments
ggivo 8d9a43f
format ConnectionTestHelper
ggivo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
18 changes: 18 additions & 0 deletions
18
src/main/java/redis/clients/jedis/MaintenanceEventHandler.java
This file contains hidden or 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,18 @@ | ||
| package redis.clients.jedis; | ||
|
|
||
| import java.util.Collection; | ||
|
|
||
| public interface MaintenanceEventHandler { | ||
|
|
||
|
|
||
| void addListener(MaintenanceEventListener listener); | ||
|
|
||
|
|
||
| void removeListener(MaintenanceEventListener listener); | ||
|
|
||
|
|
||
| void removeAllListeners(); | ||
|
|
||
|
|
||
| Collection<MaintenanceEventListener> getListeners(); | ||
ggivo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
29 changes: 29 additions & 0 deletions
29
src/main/java/redis/clients/jedis/MaintenanceEventHandlerImpl.java
This file contains hidden or 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,29 @@ | ||
| package redis.clients.jedis; | ||
|
|
||
| import java.util.Collection; | ||
| import java.util.List; | ||
| import java.util.concurrent.CopyOnWriteArrayList; | ||
|
|
||
| public class MaintenanceEventHandlerImpl implements MaintenanceEventHandler { | ||
| private final List<MaintenanceEventListener> listeners = new CopyOnWriteArrayList<>(); | ||
|
|
||
| @Override | ||
| public void addListener(MaintenanceEventListener listener) { | ||
| listeners.add(listener); | ||
| } | ||
|
|
||
| @Override | ||
| public void removeListener(MaintenanceEventListener listener) { | ||
| listeners.remove(listener); | ||
| } | ||
|
|
||
| @Override | ||
| public void removeAllListeners() { | ||
| listeners.clear(); | ||
| } | ||
|
|
||
| @Override | ||
| public Collection<MaintenanceEventListener> getListeners() { | ||
| return listeners; | ||
| } | ||
| } |
15 changes: 15 additions & 0 deletions
15
src/main/java/redis/clients/jedis/MaintenanceEventListener.java
This file contains hidden or 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 redis.clients.jedis; | ||
|
|
||
|
|
||
| public interface MaintenanceEventListener { | ||
|
|
||
| default void onMigrating(){}; | ||
|
|
||
| default void onMigrated(){}; | ||
|
|
||
| default void onFailOver(){}; | ||
|
|
||
| default void onFailedOver(){}; | ||
|
|
||
| default void onRebind( HostAndPort target){}; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.