coherence-community / coherence-spring Goto Github PK
View Code? Open in Web Editor NEWCoherence Spring Project
Home Page: https://spring.coherence.community/
License: Universal Permissive License v1.0
Coherence Spring Project
Home Page: https://spring.coherence.community/
License: Universal Permissive License v1.0
Currently, cache expiration needs to be configured via cache-config.xml
. Similar to Spring Session session support, we can also add a feature to set the TTL via the CacheManager
and thus, using the TTL when adding entries to the NamedCache
map.
It would be trivial to implement a simple ExecutorService for Spring that was clustered.
To align with the licensing of Coherence CE we need to change the license from CDDL to the more liberal The Universal Permissive License (UPL).
Upgrade to Java 7
The OWASP Dependency Check failure due to CVE (CVE-2020-36518) was initially fixed but subsequently the CVE itself got updated and the affected version range of Jackson Databind was expanded. The current GA release of Spring Boot 2.6.5
does not include a fixed Jackson Databind dependency, yet.
As soon as an update to Spring Boot 2.6.6
is available, we will update the relevant Spring Boot dependency.
See #92 for further details. See also the Spring Boot issue: spring-projects/spring-boot#30451
We should increase the default Coherence startup timeout to 5
minutes (Currently it is set to 1
minute).
We need to ensure that when we publish our Spring documentation we include the xsd appropriately.
Alternatively we need to find a place to host this stuff.
As part of moving to Java 8 and Coherence 12.2.x, we need to upgrade to use the latest Oracle Bedrock 4.x
According to the official Coherence documentation , cache.lock(key)
returns immediately, with a boolean result indicating whether the lock has been obtained.
As a result, the following code will perform the cache.put()
unconditionally:
public <T> T get(Object key, Callable<T> valueLoader) {
...
this.cache.lock(key);
try {
...
this.cache.put(key, value); //It will always execute this, no matter what
}
finally {
this.cache.unlock(key);
}
}
}
The code should check on the result, or pass "-1" as second parameter (blocking indefinitely until a lock can be obtained).
Also, valueLoader should throw ValueRetrievalException
when the value cannot be loaded, instead of IllegalStateException
.
Add Spring Session demo including Spring Security integration.
This will also resolves an OWASP Dependency Check CVE (CVE-2020-36518) which is related to Jackson Databind. Spring Boot is not going to update the Jackson dependency in Spring Boot 2.5.x
. Thus, the urgent need to go to Spring Boot 2.6.x
.
In certain situations it might be desirable to set an optional cache prefix. For instance, if you use multiple caches such as:
@Cacheable("books") ...
@Cacheable("readers") ...
@Cacheable("authors") ...
In that case it might be useful to define an application specific common cache prefix, e.g. spring_
in order to make the caches more easily identifiable in your Coherence cluster without having to repeat the prefix with every use of the Spring cache annotations.
Currently the Coherence instance type is always specified as Cluster Member. We should configure the Coherence instance as Client automatically (sensible default), if all configured sessions are either of type Coherence*Extend or gRPC. Users should also be able to explicitly configure (override) the setting either through Spring Configuration or a Spring Boot property.
pom.xml is presented in wrong way. Artifact Id is "coherence-spring" not "coherence-spring-integration" The correct one is available on maven central.
https://mvnrepository.com/artifact/com.oracle.coherence.spring/coherence-spring/2.0.0
Upgrade to Coherence 12.1.2-0-4 (and certify against 12.1.3-0-2)
Upgrade to Spring Framework 4.2.0
With the move to non-xml-based configuration and the introduction of Spring Boot, it would be nice to allow Spring-based Applications to create and inject resources into Coherence (aka: the "spring-on-top-model" / "coherence-embedded-in-spring-model").
To achieve this we should introduce the SpringBasedCoherenceSession, that wraps the internal configuration of Coherence and injects the appropriate Spring ApplicationContext into Coherence (ResourceRegistry) prior to starting Coherence. This would thus allow Coherence to look up / inject Spring resources and additionally, allow Spring to control the start and injection of Coherence-based resources (beans) into Spring applications.
Ultimately this should solve the nasty "chicken/egg" start up issues when trying to integrate Coherence and Spring together - eg: which framework is responsible to starting what and how are they integrated without creating infinite loops / race-conditions on startup.
The default for maxOccurs is 1 I believe
so without maxOccurs, I can only specify one property.
eg:
public class SomeValue implements Serializable, ApplicationContextAware {
private transient ApplicationContext context;
private transient SomeBean someBean;
private transient boolean init = false;
public void setApplicationContext( ApplicationContext applicationContext )
throws BeansException {
context = applicationContext;
}
@Autowired
public void setSomeBean( SomeBean someBean) {
this.someBean = someBean;
}
@PostConstruct
public void init() {
someBean.doSomethingUseful();
init = true;
}
...
}
Imagine being able to invoke NamedCache#put(“key”, someValue) where someValue is an instance of SomeValue class and the cache could to know how to hydrate and call the appropriate methods when deserializing or instantiate the bean through the proper BeanFactory.
Basically this is a "live-spring-bean" (aka: LiveObject) pattern specifically for Spring.
The questions remain: Could we also allow / provide SpringRemoting onto said cached objects?
Migrate Coherence-based Documentation to be a Maven Site
When injecting Coherence NamedCaches, by default the MapToMapConverter
is hit, which can be an extremely expensive operation (executing entrySet()
on the map). We need to prevent that by adding our own Converter to ConversionService
.
When doing an update for a non-existing id
via CoherenceRepository
using e.g.:
this.taskRepository.update(id, myModel -> {
myModel.setDescription(description);
return myModel;
});
then a NullPointerException
is thrown:
(Wrapped: Failed request execution for PartitionedCache service on Member(Id=1, Timestamp=2021-10-27 11:06:31.053, Address=10.10.0.15:62339, MachineId=14914, Location=process:61491, Role=IntellijRtJunitJUnitStarter)) java.lang.NullPointerException
at com.tangosol.util.Base.ensureRuntimeException(Base.java:252)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.tagException(Grid.CDB:61)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache.onInvokeRequest(PartitionedCache.CDB:93)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$InvokeRequest.run(PartitionedCache.CDB:1)
at com.tangosol.coherence.component.util.DaemonPool$WrapperTask.run(DaemonPool.CDB:1)
at com.tangosol.coherence.component.util.DaemonPool$WrapperTask.run(DaemonPool.CDB:32)
at com.tangosol.coherence.component.util.daemon.queueProcessor.Service$DaemonPool$WrapperTask.run(Service.CDB:12)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.PartitionedService$DaemonPool$WrapperTask.run(PartitionedService.CDB:1)
at com.tangosol.coherence.component.util.DaemonPool$Daemon.onNotify(DaemonPool.CDB:66)
at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:54)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NullPointerException
at java.base/java.util.Objects.requireNonNull(Objects.java:221)
at com.oracle.coherence.examples.todo.server.service.SpringDataTaskService$lambda$update$c3e6a45f$1$0:CD693EBC65EA338BA81B91F7C8B386B4.lambda$update$c3e6a45f$1(Unknown Source)
at com.oracle.coherence.examples.todo.server.service.SpringDataTaskService$lambda$update$c3e6a45f$1$0:CD693EBC65EA338BA81B91F7C8B386B4.apply(Unknown Source)
at com.oracle.coherence.repository.AbstractRepositoryBase$lambda$updateFunctionProcessor$b845d0ab$1$0:8240A1DA38A2C604E65046FD1F877E5F.lambda$updateFunctionProcessor$b845d0ab$1(Unknown Source)
at com.oracle.coherence.repository.AbstractRepositoryBase$lambda$updateFunctionProcessor$b845d0ab$1$0:8240A1DA38A2C604E65046FD1F877E5F.process(Unknown Source)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$Storage.invoke(PartitionedCache.CDB:17)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache.onInvokeRequest(PartitionedCache.CDB:56)
... 8 more
We should throw a more business-friendly exception, possibly even considering returning Spring data exceptions:
I have configured two distributed caches, each one has its own service and each one has a spring bean as cache store/loader (see attached coherence caches configuration).
After populating both caches, if I start a second cache node which should join coherence cluster, I got following exception:
2013-12-13 15:45:39.893/2.121 Oracle Coherence GE 12.1.2.0.1 <Error> (thread=DistributedCache:DistributedCache1, member=2):
java.lang.IllegalArgumentException: Can not register resource [default] as resource [com.oracle.coherence.spring.SpringNamespaceHandler$SpringBeanFactoryBuilder$CoherenceApplicationContext; loaded from [file:/home/stefano/Dev/spikes/coherence-12c-spike/bin/application-context.xml]] is it already registered with [interface org.springframework.beans.factory.BeanFactory] as [default]
at com.tangosol.util.SimpleResourceRegistry.registerResource(SimpleResourceRegistry.java:183)
at com.oracle.coherence.spring.SpringNamespaceHandler$SpringBeanFactoryBuilder.realize(SpringNamespaceHandler.java:723)
at com.oracle.coherence.spring.SpringNamespaceHandler$SpringBeanBuilder.ensureBeanFactory(SpringNamespaceHandler.java:543)
at com.oracle.coherence.spring.SpringNamespaceHandler$SpringBeanBuilder.realize(SpringNamespaceHandler.java:440)
at com.tangosol.coherence.config.scheme.ClassScheme.realize(ClassScheme.java:162)
at com.tangosol.coherence.config.scheme.CacheStoreScheme.realizeLocal(CacheStoreScheme.java:45)
at com.tangosol.coherence.config.scheme.CacheStoreScheme.realize(CacheStoreScheme.java:59)
at com.tangosol.coherence.config.scheme.ReadWriteBackingMapScheme.realizeMap(ReadWriteBackingMapScheme.java:83)
at com.tangosol.coherence.config.scheme.ReadWriteBackingMapScheme.realizeMap(ReadWriteBackingMapScheme.java:45)
at com.tangosol.net.ExtensibleConfigurableCacheFactory$Manager.instantiateBackingMap(ExtensibleConfigurableCacheFactory.java:1399)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$Storage.instantiateBackingMap(PartitionedCache.CDB:24)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$Storage.setCacheName(PartitionedCache.CDB:25)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache.ensureKnownStorage(PartitionedCache.CDB:20)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache.finalizeAcceptingClients(PartitionedCache.CDB:17)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.PartitionedService.finalizeStartup(PartitionedService.CDB:15)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.PartitionedService.onServiceStarted(PartitionedService.CDB:83)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache.onServiceStarted(PartitionedCache.CDB:30)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid$MemberWelcomeRequest$Poll.onCompletion(Grid.CDB:82)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.PartitionedService$MemberWelcomeRequest$Poll.onCompletion(PartitionedService.CDB:1)
at com.tangosol.coherence.component.net.Poll.close(Poll.CDB:10)
at com.tangosol.coherence.component.net.Poll.onResponded(Poll.CDB:43)
at com.tangosol.coherence.component.net.Poll.onResponse(Poll.CDB:3)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid$MemberWelcomeRequest$Poll.onResponse(Grid.CDB:6)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$MemberWelcomeRequest$Poll.onResponse(PartitionedCache.CDB:29)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onMessage(Grid.CDB:53)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onNotify(Grid.CDB:23)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.PartitionedService.onNotify(PartitionedService.CDB:3)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache.onNotify(PartitionedCache.CDB:3)
at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:51)
at java.lang.Thread.run(Thread.java:662)
I have verified that changing inside SpringNamespaceHandler the way application context is registered inside coherence (setting the RegistrationBehavior to IGNORE) solves the problem.
21.12.3
With the demise of maven.java.net, we need to migrate the Coherence Spring build system to target Maven Central
Randy suggested that we should move to version 4 from version 3
Provide access to Coherence Services from the SpringBasedCoherenceSession
All of the Spring dependencies should be "provided" instead of "compile" and "runtime".
Hi,
is it safe change version to 12.2.1.2.0 in?
<oracle.coherence.version>12.1.2-0-4</oracle.coherence.version>
Should it be done on your side?
Thanks.
Ryszard
spring-data-jpa 2.5.6
does not work any longer with our old Hibernate version in the Hibernate Cache Demo. We need to be able to upgrade to new versions of Hibernate.
When coherence.cacheconfig is set, the config file this property point to will be treat as default
However, in the current code
if I use default constructor, it will not load current property file (only load coherence default)
if I use correct URI in constructor, it will not associate as default ConfigurableCacheFactory
either way won't way.
need code change to check that situation.
When user a user adds the Coherence Spring Session dependency, Spring Boot's auto-configuration support should be activated by default.
Right now, Spring session support needs to be manually enabled via:
coherence:
spring:
session:
enabled: true
The current functional tests depend on the Coherence-based Testing Framework. This isn't available publicly and hence we need to refactor the tests to work directly with JUnit and/or Oracle Tools.
Test fails with NPE as coherence
isn't @autowired
.
2020-12-07 12:49:58,296 [main] INFO org.springframework.test.context.support.DefaultTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener]
2020-12-07 12:49:58,303 [main] INFO org.springframework.test.context.support.DefaultTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@2e54db99, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@55e8ec2f, org.springframework.test.context.support.DirtiesContextTestExecutionListener@4f2613d1, org.springframework.test.context.event.EventPublishingTestExecutionListener@6d24ffa1]
java.lang.NullPointerException
at com.oracle.coherence.spring.cache.CoherenceCacheManagerTests.getBasicCaches(CoherenceCacheManagerTests.java:79)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:688)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
<snip/>
2020-12-07 12:49:58,801 [main] ERROR org.springframework.test.context.TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@55e8ec2f] to prepare test instance [com.oracle.coherence.spring.cache.CoherenceCacheManagerTests@55b8dbda]```
Upgrade to Spring 3.2.14
Introduce built-in SpringBased Coherence Configuration so that people can import it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.