<style>@media print{section footer{margin-top: 700pxpx !important;}}</style>
JBoss OneDayTalk 2013
mvn archetype:generate \
-DarchetypeArtifactId=jboss-javaee6-webapp-archetype \
-DarchetypeGroupId=org.jboss.spec.archetypes \
-DarchetypeVersion=7.1.2.Final \
-DgroupId=de.consol.research \
-DartifactId=infinispan-jpa-example \
-Dversion=1.0-SNAPSHOT \
-Dname="Infinispan JPA Example" \
-DarchetypeCatalog=http://search.maven.org/remotecontent?filepath=archetype-catalog.xml \
-DinteractiveMode=false
cd infinispan-jpa-example
mvn clean verify jboss-as:run
SET TRACE_LEVEL_SYSTEM_OUT 2;
persistence.xml
:
<shared-cache-mode>DISABLE_SELECTIVE</shared-cache-mode>
<properties>
<property name="hibernate.cache.use_second_level_cache" value="true"/>
</properties>
ALL |
All entity data is stored in the second-level cache for this persistence unit. |
NONE |
No data is cached in the persistence unit. The persistence provider must not cache any data. |
ENABLE_SELECTIVE |
Enable caching for entities that have been explicitly set with the @Cacheable
annotation.
|
DISABLE_SELECTIVE |
Enable caching for all entities except those that have been explicitly set with the @Cacheable(false)
annotation.
|
UNSPECIFIED |
The caching behavior for the persistence unit is undefined. The persistence provider's default caching behavior will be used. |
Deliverable | Start | Finish |
---|---|---|
Public Review Ballot | 27 Aug | 9 Sep |
Proposed Final Draft | 30 Sep | |
Reference Implementation (https://github.com/jsr107/RI), Technology Compatibility Kit | 31 Oct | |
Appeal Ballot (7 days) | 31 Oct | 7 Nov |
Final Approval Ballot | 14 Nov | 28 Nov |
Final Release | 28 Nov | 12 Dec |
private Cache<String, Integer> cache;
public void incrementUnsafe(String user) {
if ( ! cache.containsKey(user) ) {
cache.put(user, 0);
}
int current = cache.get(user);
cache.put("user", current + 1);
}
private Cache<String, Integer> cache;
public synchronized void incrementThreadSafe(String user) {
if ( ! cache.containsKey(user) ) {
cache.put(user, 0);
}
int current = cache.get(user);
cache.put("user", current + 1);
}
private Cache<String, Integer> cache;
public void incrementAtomic(String user) {
cache.putIfAbsent(user, 0);
int current;
do {
current = cache.get(user);
}
while (!cache.replace(user, current, current + 1));
}
Alternatively, caches provide
pessimistic lock / mutate / unlock.