Polish
This commit is contained in:
parent
bb63ce9935
commit
5a80f4f16e
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -85,7 +85,7 @@ public class TransactionAwareCacheDecorator implements Cache {
|
|||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
|
||||
@Override
|
||||
public void afterCommit() {
|
||||
targetCache.put(key, value);
|
||||
TransactionAwareCacheDecorator.this.targetCache.put(key, value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -105,7 +105,7 @@ public class TransactionAwareCacheDecorator implements Cache {
|
|||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
|
||||
@Override
|
||||
public void afterCommit() {
|
||||
targetCache.evict(key);
|
||||
TransactionAwareCacheDecorator.this.targetCache.evict(key);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -42,7 +42,7 @@ public class TransactionAwareCacheDecoratorTests {
|
|||
|
||||
@Test
|
||||
public void createWithNullTarget() {
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
this.thrown.expect(IllegalArgumentException.class);
|
||||
new TransactionAwareCacheDecorator(null);
|
||||
}
|
||||
|
||||
|
|
@ -77,13 +77,13 @@ public class TransactionAwareCacheDecoratorTests {
|
|||
Cache target = new ConcurrentMapCache("testCache");
|
||||
Cache cache = new TransactionAwareCacheDecorator(target);
|
||||
|
||||
TransactionStatus status = txManager.getTransaction(new DefaultTransactionAttribute(
|
||||
TransactionDefinition.PROPAGATION_REQUIRED));
|
||||
TransactionStatus status = this.txManager.getTransaction(
|
||||
new DefaultTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED));
|
||||
|
||||
Object key = new Object();
|
||||
cache.put(key, "123");
|
||||
assertNull(target.get(key));
|
||||
txManager.commit(status);
|
||||
this.txManager.commit(status);
|
||||
|
||||
assertEquals("123", target.get(key, String.class));
|
||||
}
|
||||
|
|
@ -119,11 +119,11 @@ public class TransactionAwareCacheDecoratorTests {
|
|||
cache.put(key, "123");
|
||||
|
||||
|
||||
TransactionStatus status = txManager.getTransaction(new DefaultTransactionAttribute(
|
||||
TransactionDefinition.PROPAGATION_REQUIRED));
|
||||
TransactionStatus status = this.txManager.getTransaction(
|
||||
new DefaultTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED));
|
||||
cache.evict(key);
|
||||
assertEquals("123", target.get(key, String.class));
|
||||
txManager.commit(status);
|
||||
this.txManager.commit(status);
|
||||
|
||||
assertNull(target.get(key));
|
||||
}
|
||||
|
|
@ -147,11 +147,11 @@ public class TransactionAwareCacheDecoratorTests {
|
|||
cache.put(key, "123");
|
||||
|
||||
|
||||
TransactionStatus status = txManager.getTransaction(new DefaultTransactionAttribute(
|
||||
TransactionDefinition.PROPAGATION_REQUIRED));
|
||||
TransactionStatus status = this.txManager.getTransaction(
|
||||
new DefaultTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED));
|
||||
cache.clear();
|
||||
assertEquals("123", target.get(key, String.class));
|
||||
txManager.commit(status);
|
||||
this.txManager.commit(status);
|
||||
|
||||
assertNull(target.get(key));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue