-
Notifications
You must be signed in to change notification settings - Fork 212
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
Unified interface #356
Open
morrowgi
wants to merge
8
commits into
master
Choose a base branch
from
UnifiedInterface
base: master
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.
Open
Unified interface #356
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
78c73da
Adding in ManifestComparator to Elasticcache
morrowgi d1baf27
Cleaning up code
morrowgi b1de0e0
Removing compile micro-events
morrowgi ab47860
Adding in connection tester to both elasticache and couchbase
morrowgi c129319
Updating to use DistributedCache interface
morrowgi 5d2fe57
Updating as per PR comments
morrowgi 27f84fc
Updating to DistributedCache to extend DistributedMap
morrowgi bcf247c
Updating based on PR comments
morrowgi 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
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,4 +1,4 @@ | ||
version=0.91.3 | ||
version=0.91.4 | ||
springVersion=4.3.3.RELEASE | ||
springBootVersion=1.4.1.RELEASE | ||
jerseyVersion=2.24 | ||
|
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
18 changes: 18 additions & 0 deletions
18
micro-couchbase/src/main/java/com/aol/micro/server/couchbase/ConfigureCacheTester.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,18 @@ | ||
package com.aol.micro.server.couchbase; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.scheduling.annotation.Scheduled; | ||
|
||
@Configuration | ||
public class ConfigureCacheTester { | ||
|
||
@Autowired | ||
private CouchbaseConnectionTester couchbaseConnectionTester; | ||
|
||
|
||
@Scheduled(fixedDelay = 60000) | ||
public synchronized void runCouchbaseConnectionTester(){ | ||
couchbaseConnectionTester.scheduleAndLog(); | ||
} | ||
} |
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
55 changes: 55 additions & 0 deletions
55
micro-couchbase/src/main/java/com/aol/micro/server/couchbase/CouchbaseConnectionTester.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,55 @@ | ||
package com.aol.micro.server.couchbase; | ||
|
||
|
||
import com.aol.micro.server.distributed.DistributedCache; | ||
import com.aol.micro.server.distributed.DistributedMap; | ||
import com.aol.micro.server.events.ScheduledJob; | ||
import com.aol.micro.server.events.SystemData; | ||
import com.couchbase.client.CouchbaseClient; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
import java.util.Random; | ||
|
||
@Slf4j | ||
public class CouchbaseConnectionTester implements ScheduledJob { | ||
|
||
private static final Random random = new Random(); | ||
|
||
private final DistributedCache cache; | ||
private final CouchbaseClient couchbaseClient; | ||
|
||
public CouchbaseConnectionTester(DistributedCache cache, CouchbaseClient couchbaseClient) { | ||
|
||
this.cache = cache; | ||
this.couchbaseClient = couchbaseClient; | ||
} | ||
|
||
@Override | ||
public SystemData scheduleAndLog() { | ||
|
||
log.trace("runTestConnection()..."); | ||
boolean result = false; | ||
try { | ||
result = testConnection(); | ||
} catch (RuntimeException e) { | ||
log.debug("Could not connect to Cache" + e.getMessage()); | ||
} | ||
cache.setConnectionTested(result); | ||
|
||
log.debug("Testing Couchbase connection: {}", result); | ||
return null; | ||
|
||
} | ||
|
||
private boolean testConnection() { | ||
String key = "PING_TEST"; | ||
log.trace("Testing connection using key {}", key); | ||
|
||
int testValue = random.nextInt(1111); | ||
couchbaseClient.set(key, 120, testValue); | ||
int received = (Integer) couchbaseClient.get(key); | ||
|
||
return received == testValue; | ||
} | ||
|
||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd change the reference name as well 😃