-
Notifications
You must be signed in to change notification settings - Fork 582
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue-628 Changes to handle failure during clustered write-behind
bump versions Cleanup unused Jackson stuff Use platform-layout instead of platform-kit since platform 5.10.17 Jackson => Gson Switch to gradle nexus publish plugin platform version bump up issue-628 Changes to handle failure during clustered write-behind issue-628 Changed test case to use hamcrest libraries instead of junit issue-628 Minor formatting changes issue-628 Incorporated review comments by Chris issue-628 Incorporated review comments issue-628 Incorporated review comments issue-628 fix for current issue for handling failures of clustered write-behind issue-628 Reverting previous change issue-628 Another approach to handle the failures in clustered write behind issue-628 Reverting previous change issue-628 Increases test case timeout issue-628 Increased test case timeout issue-628 Increased test case timeout issue-628 Increased test case timeout issue-628 Increases test case timeout issue-628 Increases test case timeout issue-628 Changed test case timeout issue-628 Changed test case timeout issue-628 Changed test case timeout issue-628 Changed test case timeout issue-628 Changed test case timeout issue-628 Changed test case timeout issue-628 Changed test case timeout issue-628 Changed test case timeout issue-628 Changed test case timeout issue-628 Changed test case timeout issue-628 Changed test case timeout issue-628 Changed test case timeout issue-628 Changed test case timeout issue-628 Changed test case timeout issue-628 Changed test case timeout
- Loading branch information
1 parent
ad2655f
commit 5b27a2a
Showing
16 changed files
with
251 additions
and
126 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
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
56 changes: 56 additions & 0 deletions
56
...egration-test/src/test/java/org/ehcache/clustered/writebehind/EvenNumberLoaderWriter.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,56 @@ | ||
/* | ||
* Copyright Terracotta, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.ehcache.clustered.writebehind; | ||
|
||
import org.ehcache.spi.loaderwriter.CacheLoaderWriter; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
class EvenNumberLoaderWriter<Long, String> implements CacheLoaderWriter<Long, String> { | ||
|
||
private final Map<Long, List<String>> records = new HashMap<>(); | ||
|
||
@Override | ||
public synchronized String load(Long key) { | ||
List<String> list = records.get(key); | ||
return list == null ? null : list.get(list.size() - 1); | ||
} | ||
|
||
@Override | ||
public synchronized void write(Long key, String value) throws Exception { | ||
if (Integer.parseInt(key.toString()) % 2 != 0) { | ||
throw new RuntimeException("Only even keys can be inserted"); | ||
} | ||
record(key, value); | ||
} | ||
|
||
@Override | ||
public void delete(Long key) { | ||
} | ||
|
||
private void record(Long key, String value) { | ||
records.computeIfAbsent(key, k -> new ArrayList<>()).add(value); | ||
} | ||
|
||
synchronized Map<Long, List<String>> getRecords() { | ||
return Collections.unmodifiableMap(records); | ||
} | ||
} |
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.