Closed viju2008 closed 4 years ago
This looks like it is due to a difference in the CacheStore
and CacheLoader
interfaces in Coherence CE 20.06 and in commercial 14.1.1.
In CE the methods on a loadAll
method on CacheLoader
and the storeAll
and eraseAll
on CacheStore
have been implemented as default methods on the interfaces, in 14.1.1 they have not. The example code for the CacheStores needs to add the missing methods. I have committed changes to the example on GitHub, the missing methods look like this:
@Override
public Map<StudentId, Student> loadAll(Collection<? extends StudentId> colKeys) {
Map<StudentId, Student> map = new HashMap<>();
for (StudentId key : colKeys) {
Student value = load(key);
if (value != null) {
map.put(key, value);
}
}
return map;
}
@Override
public void eraseAll(Collection<? extends StudentId> colKeys) {
boolean fRemove = true;
for (Iterator<? extends StudentId> iter = colKeys.iterator(); iter.hasNext(); ) {
erase(iter.next());
if (fRemove) {
try {
iter.remove();
}
catch (UnsupportedOperationException e) {
fRemove = false;
}
}
}
}
@Override
public void storeAll(Map<? extends StudentId, ? extends Student> mapEntries) {
boolean fRemove = true;
for (Iterator<? extends Map.Entry<? extends StudentId, ? extends Student>> iter = mapEntries.entrySet().iterator();
iter.hasNext(); ) {
Map.Entry<? extends StudentId, ? extends Student> entry = iter.next();
store(entry.getKey(), entry.getValue());
if (fRemove) {
try {
iter.remove();
}
catch (UnsupportedOperationException e) {
fRemove = false;
}
}
}
}
Hello,
I added the Commercial version of coherence as per the URL i have provided in mail.
However the build process failed. The POM.XML and build output are below
### I am attaching the pom. xml
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
### The build output is below
ubuntu@master-node:/home/ubuntu4$ ./mvnw clean install -DskipTests -f spring-boot-storage-service/ [INFO] Scanning for projects... [INFO] [INFO] --------------< org.example:spring-boot-storage-service >--------------- [INFO] Building spring-boot-storage-service 1.0.0-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ spring-boot-storage-service --- [INFO] [INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ spring-boot-storage-service --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] Copying 3 resources [INFO] [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ spring-boot-storage-service --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 6 source files to /home/ubuntu4/spring-boot-storage-service/target/classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /home/ubuntu4/spring-boot-storage-service/src/main/java/com/oracle/coherence/examples/storage/StudentCacheStore.java:[15,8] com.oracle.coherence.examples.storage.StudentCacheStore is not abstract and does not override abstract method eraseAll(java.util.Collection<? extends com.oracle.coherence.examples.domain.StudentId>) in com.tangosol.net.cache.CacheStore [INFO] 1 error [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.556 s [INFO] Finished at: 2020-09-20T11:31:01Z [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project spring-boot-storage-service: Compilation failure [ERROR] /home/ubuntu4/spring-boot-storage-service/src/main/java/com/oracle/coherence/examples/storage/StudentCacheStore.java:[15,8] com.oracle.coherence.examples.storage.StudentCacheStore is not abstract and does not override abstract method eraseAll(java.util.Collection<? extends com.oracle.coherence.examples.domain.StudentId>) in com.tangosol.net.cache.CacheStore [ERROR] [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException[](url)