Commit Graph

99 Commits

Author SHA1 Message Date
Juergen Hoeller 98d6f7b443 Polishing 2014-06-26 16:01:24 +02:00
Stephane Nicoll aaae10ce3b Cache operation invocation hook point
This commit adds a invokeOperation protected method in case one
needs a hook point in the way the underlying cache method is invoked,
and how exceptions that might be thrown by that invocation are handled.

Issue: SPR-11540
2014-06-02 15:00:51 +02:00
Stephane Nicoll bb6e07bd3a polishing 2014-05-26 13:39:38 +02:00
Stephane Nicoll 9952973e01 Add missing cache-resolver attribute
Prior to this commit, CacheResolver could not be configured through
the XML namespace (i.e. cache:annotation-driven). This is now the
case.

Issue: SPR-11490
2014-05-21 09:03:18 +02:00
Stephane Nicoll 05e96ee448 Cache provider related exceptions handling
This commit adds the necessary infrastructure to handle exceptions
thrown by a cache provider in both Spring's and JCache's caching
abstractions.

Both interceptors can be configured with a CacheErrorHandler that
defines several callbacks on typical cache operations. In particular,
handleCacheGetError can be implemented in such a way that an
exception thrown by the provider is handled as a cache miss by the
caching abstraction.

The handler can be configured with both CachingConfigurer and the
XML namespace (error-handler property)

Issue: SPR-9275
2014-05-20 16:39:34 +02:00
Juergen Hoeller b43fc7ac0f Building against Quartz 2.2.1 and JavaMail 1.5.2 2014-05-12 22:31:27 +02:00
Juergen Hoeller e04fb15a5e Compilation compatibility with JasperReports 5.5.2 2014-05-12 20:34:38 +02:00
Philippe Marschall 1e8c799a60 Clean up spring-context-support tests warnings
Clean up compiler warnings in the tests of spring-context-support.

This commit:
* adds type parameters to all the types except `Cache` (mostly `List`
  and `Map`)
* removes unused imports
2014-04-22 07:32:11 +02:00
Juergen Hoeller 9a59292603 SchedulerFactoryBean supports non-durable jobs when accompanied by a trigger
Issue: SPR-11689
2014-04-15 15:24:49 +02:00
Stephane Nicoll 3cda355e7f polishing
This commit fixes the handling of cached exceptions in the JSR-107
advisor. Such exceptions are now properly propagated instead of being
wrapped in a RuntimeException.

Issue: SPR-9616
2014-04-08 17:04:25 +02:00
Stephane Nicoll a198026469 fix CI build
Prior to this commit, AnnotatedJCacheableService contained an annotated
method demonstrating a failure scenario. This could break depending on
the order of the methods array as AopUtils creates the proxy if the
pointcut matches by checking each method.

On the CI server, the first method was this invalid use case so
checking if the proxy has to be created lead to an unexpected
exception. This scenario has been moved to its own private class now.
2014-04-08 11:37:41 +02:00
Stephane Nicoll 7b5e9e8c8e polishing
This fixes a Java6 backward compatible issue introduced in the JCache
implementation.

This commit also adds new representative tests.

Issue: SPR-9616
2014-04-07 21:43:05 +02:00
Stephane Nicoll f3b8a4103e Use CacheResolver in Spring abstraction
Prior to this commit, the CacheResolver was not used by Spring's
caching abstraction. This commit provides the necessary configuration
options to tune how a cache is resolved for a given operation.

CacheResolver can be customized globally, at the operation level or at
the class level. This breaks the CachingConfigurer class and a support
implementation is provided that implements all methods so that the
default is taken if it's not overridden. The JSR-107 support has been
updated as well, with a similar support class.

In particular, the static and runtime information of a cache
operation were mixed which prevents any forms of caching. As the
CacheResolver and the KeyGenerator can be customized, every operation
call lead to a lookup in the context for the bean.

This commit adds CacheOperationMetadata, a static holder of all
the non-runtime metadata about a cache operation. This is used
as an input source for the existing CacheOperationContext.

Caching the operation metadata in an AspectJ aspect can have side
effects as the aspect is static instance for the current ClassLoader.
The metadata cache needs to be cleared when the context shutdowns.
This is essentially a test issue only as in practice each application
runs in its class loader. Tests are now closing the context properly
to honor the DisposableBean callback.

Issue: SPR-11490
2014-04-07 15:41:09 +02:00
Stephane Nicoll 47a4327193 Add JSR-107 cache annotations support
This commit adds support for the JSR-107 cache annotations alongside
the Spring's cache annotations, that is @CacheResult, @CachePut,
@CacheRemove and @CacheRemoveAll as well as related annotations
@CacheDefaults, @CacheKey and @CacheValue.

Spring's caching configuration infrastructure detects the presence of
the JSR-107 API and Spring's JCache implementation. Both
@EnableCaching and the cache namespace are able to configure the
required JCache infrastructure when necessary. Both proxy mode
and AspectJ mode are supported.

As JSR-107 permits the customization of the CacheResolver to use for
both regular and exception caches, JCacheConfigurer has been
introduced as an extension of CachingConfigurer and permits to define
those.

If an exception is cached and should be rethrown, it is cloned and
the call stack is rewritten so that it matches the calling thread each
time. If the exception cannot be cloned, the original exception is
returned.

Internally, the interceptors uses Spring's caching abstraction by default
with an adapter layer when a JSR-107 component needs to be called.
This is the case for CacheResolver and CacheKeyGenerator.

The implementation uses Spring's CacheManager abstraction behind the
scene. The standard annotations can therefore be used against any
CacheManager implementation.

Issue: SPR-9616
2014-04-07 12:07:20 +02:00
Stephane Nicoll 3e74d3b2fb Add putIfAbsent on Cache abstraction
This commit adds a putIfAbsent method to the Cache interface. This
method offers an atomic put if the key is not already associated in
the cache.

Issue: SPR-11400
2014-04-03 11:37:22 +02:00
Stephane Nicoll 119dfd9cf9 Fix cache decoration
Prior to this commit, a cache that is added on-the-fly is not properly
decorated by the provided CacheManager implementation that supports
it (EhCache and JCache).

This commits adds an extra getMissingCache method to
the AbstractCacheManager that can be extended to provide a cache that
may exist in the native cache manager but is not yet known by the
spring abstraction.

Issue: SPR-11518
2014-04-01 14:48:35 +02:00
Sam Brannen 906321dcdd Fix broken tests in QuartzSupportTests
This commit ensures that QuartzSupportTests and its related
configuration are compatible with Quartz 2.1.7.

 - Test jobs are now durable where required.

 - Deleted legacy tests that attempted to use a Runnable instead of a
   Job as a jobClass for a JobDetail.

 - Replaced quartz-hsql.sql with current version for Quartz 2.1.7.

Issue: SPR-11630
2014-03-30 18:05:38 +02:00
Juergen Hoeller ea1e27efa2 Require Jackson 2.0+, EhCache 2.5+, Quartz 2.1.4+
Issue: SPR-11262
2014-03-27 21:59:23 +01:00
Stephane Nicoll 4cd818b9e4 Harmonize log configuration
Prior to this commit, the codebase was using a mix of log4j.xml
and log4j.properties for test-related logging configuration. This
can be an issue as log4j takes the xml variant first when looking
for a default bootstrap configuration.

In practice, some modules declaring the properties variant were
taking the xml variant configuration from another module.

The general structure of the configuration has also been
harmonized to provide a standard console output as well as an
easy way to enable trace logs for the current module.
2014-03-20 09:43:29 -07:00
Juergen Hoeller 38e7c4776b Cache.get(key, type) should also work in case of null value found in cache
Issue: SPR-11567
2014-03-18 00:50:59 +01:00
Sam Brannen c8f2e07182 Clean up test warnings that show up in Gradle console 2014-03-06 14:50:46 +01:00
Stephane Nicoll 45406aa19b Add tests for TransactionAwareCacheDecorator
This commit adds tests for TransactionAwareCacheDecorator. In
particular, the put/evict behaviour when the operation is invoked in
the course of Spring-managed transaction.
2014-03-05 16:48:20 +01:00
Juergen Hoeller ef1748f694 EhCache/JCacheCacheManager needs to re-obtain runtime-added Cache reference for potential decoration
Issue: SPR-11407
2014-02-14 21:58:48 +01:00
Juergen Hoeller c719c70ea9 Fixed 'globalJobListeners'/'globalTriggerListeners' to work with Quartz 2.0 & 2.1 as well
Issue: SPR-11362
2014-01-28 12:25:24 +01:00
Juergen Hoeller 1865361163 CronTriggerFactoryBean allows 'calendarName' and 'description' to be specified
Also making 'description' available on SimpleTriggerFactoryBean.

Issue: SPR-9771
(cherry picked from commit 7502ecd)
2014-01-13 23:44:45 +01:00
Juergen Hoeller 24030a3f61 Added deprecation log message and javadoc note for Quartz 1.x support
Issue: SPR-11262
2014-01-05 21:39:05 +01:00
Juergen Hoeller b228a06e07 Consistent support for setStartTime in CronTrigger(Factory)Bean and SimpleTrigger(Factory)Bean, and consistent declaration of varargs in scheduling.quartz package
Issue: SPR-10940
2014-01-05 17:30:42 +01:00
Juergen Hoeller 38a8ace5bb Full Quartz 2.2 support, including LocalDataSourceJobStore
While we've had basic Quartz 2.2 support before, a few details were missing:
* LocalDataSourceJobStore's ConnectionProvider adapters need to provide an empty implementation of Quartz 2.2's new initialize method.
* SchedulerFactoryBean's "schedulerContextMap" needs to be explicitly declared with String keys, otherwise it can't be compiled against Quartz 2.2 (forward compatibility once we're dropping Quartz 1.x support). This doesn't hurt against older Quartz versions either, since the keys need to be Strings anyway.

Issue: SPR-11284
2014-01-05 17:24:18 +01:00
Juergen Hoeller 640d8cb67f Consistent implementation of AsyncListenableTaskExecutor
Issue: SPR-11282
2014-01-03 21:57:07 +01:00
Juergen Hoeller 73d8f069fe EhCacheFactoryBean does not call set(Sampled)StatisticsEnabled on EhCache 2.7/2.8
Issue: SPR-11265
2013-12-30 12:52:35 +01:00
Juergen Hoeller a884cde18c Upgraded to JCache 1.0 RC1
Also completing 4.0's consistency efforts between Spring's cache adapters.
2013-12-20 01:28:16 +01:00
Juergen Hoeller a9605a11e9 "acceptExisting" flag allows for sharing per cacheManagerName on EhCache 2.5+
As a benefit over the "shared" flag, this allows for sharing a specific CacheManager in a system with potentially multiple CacheManagers involved, and it supports controlled shutdown by the EhCacheManagerFactoryBean that actually created the CacheManager.

Issue: SPR-11178
2013-12-11 17:25:02 +01:00
Juergen Hoeller d6e84631f5 Fixed @since tag 2013-12-10 13:26:42 +01:00
Juergen Hoeller 6d7ce439b1 Introduced GuavaCacheManager as an alternative to ConcurrentMapCacheManager 2013-12-10 11:59:35 +01:00
Phillip Webb d4245610a2 Fix performance test HSQLDB error
Fix QuartzSupportTests that has been failing since the HSQLDB upgrade.
2013-12-02 23:59:32 -08:00
Juergen Hoeller 6c1f62b19d EhCacheFactoryBean calls CacheManager.addCache before setStatisticsEnabled
Issue: SPR-11080
Issue: SPR-11092
(cherry picked from commit 6ce2eb9)
2013-12-03 01:37:24 +01:00
Juergen Hoeller de890fd100 Synchronized cache creation on CacheManager
Issue: SPR-11132
2013-12-02 11:02:07 +01:00
Phillip Webb a31ac882c5 Fix various javadoc warnings 2013-11-26 13:25:37 -08:00
Phillip Webb 59002f2456 Fix remaining compiler warnings
Fix remaining Java compiler warnings, mainly around missing
generics or deprecated code.

Also add the `-Werror` compiler option to ensure that any future
warnings will fail the build.

Issue: SPR-11064
2013-11-25 12:52:42 -08:00
Juergen Hoeller 50d3f71923 Added get(key, type) method to Cache interface
This new get variant not only allows for generically specifying the required value type; it also skips the ValueWrapper that the standard get method returns. Note that it is not possible to differentiate between non-existing cache entries and cached null values that way; for that purpose, the standard get variant needs to be used.

Issue: SPR-11061
2013-11-04 14:31:41 +01:00
Juergen Hoeller 49758a2a96 Added convenience classes for typical JSR-236 setup in a Java EE 7 environment
Introduced DefaultManagedTaskExecutor, DefaultManagedTaskScheduler and DefaultManagedAwareThreadFactory classes, revised related javadoc, and deprecated unsupported JBossWorkManagerTaskExecutor in favor of JSR-236 setup on WildFly 8.

Issue: SPR-8195
2013-11-02 20:14:02 +01:00
Juergen Hoeller bb2802208b Upgraded to JCache 0.11 for Spring Framework 4.0 RC1
Unfortunately, the JCache API changed quite a bit since 0.6. We're building against a snapshot of JCache 0.11 now, tracking its way to final after the Public Review Ballot.
2013-10-17 19:35:21 +02:00
Juergen Hoeller a3df311bb5 EhCacheFactoryBean calls addCache after listener registration
Issue: SPR-10904
2013-09-14 07:33:48 +02:00
Juergen Hoeller 676f7f9571 Updated Quartz version range in javadoc
Issue: SPR-10775
2013-07-30 17:33:49 +02:00
Juergen Hoeller f835188601 Remove the JobDetail from the job data map after discovering it
Issue: SPR-10775
2013-07-30 17:22:43 +02:00
Juergen Hoeller d504d69ae5 Added "requestsRecovery" bean property to JobDetailFactoryBean
Issue: SPR-10775
2013-07-30 17:21:18 +02:00
Rob Winch 9468548116 Add @Override to remaining source files
Issue: SPR-10130
2013-05-13 17:04:56 -05:00
Juergen Hoeller 2a44228b98 Consistent use of <pre class="code">
Issue: SPR-8108
2013-05-07 21:31:26 +02:00
Phillip Webb e1c25ff1a3 Workaround jasper report test fail on OSX
Add temporary Assume.canLoadNativeDirFonts() method allowing failing
jasper report tests to be bypassed on OSX.

This should be revisited when JDK 8 is released.

Issue: SPR-10537
2013-05-07 08:23:46 -07:00
Juergen Hoeller 0a8f5b2919 Removed deprecated helper classes and methods (that have been deprecated since 3.0 or before) 2013-05-02 17:25:10 +02:00