You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2019/05/29 12:19:00 UTC
svn commit: r1860336 [4/7] - in /commons/proper/jcs:
branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/util/
branches/generics-interface/src/java/org/apache/jcs/auxiliary/remote/value/
branches/generics-interface/src/java/org/apache/...
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractMemoryCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractMemoryCache.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractMemoryCache.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractMemoryCache.java Wed May 29 12:18:56 2019
@@ -22,6 +22,7 @@ package org.apache.commons.jcs.engine.me
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
@@ -35,7 +36,6 @@ import org.apache.commons.jcs.engine.beh
import org.apache.commons.jcs.engine.behavior.ICompositeCacheAttributes;
import org.apache.commons.jcs.engine.control.CompositeCache;
import org.apache.commons.jcs.engine.control.group.GroupAttrName;
-import org.apache.commons.jcs.engine.control.group.GroupId;
import org.apache.commons.jcs.engine.memory.behavior.IMemoryCache;
import org.apache.commons.jcs.engine.memory.util.MemoryElementDescriptor;
import org.apache.commons.jcs.engine.stats.StatElement;
@@ -135,7 +135,7 @@ public abstract class AbstractMemoryCach
element -> element));
}
- return new HashMap<>();
+ return new HashMap<K, ICacheElement<K, V>>();
}
/**
@@ -231,13 +231,13 @@ public abstract class AbstractMemoryCach
IStats stats = new Stats();
stats.setTypeName( "Abstract Memory Cache" );
- ArrayList<IStatElement<?>> elems = new ArrayList<>();
+ ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>();
stats.setStatElements(elems);
- elems.add(new StatElement<>("Put Count", putCnt));
- elems.add(new StatElement<>("Hit Count", hitCnt));
- elems.add(new StatElement<>("Miss Count", missCnt));
- elems.add(new StatElement<>( "Map Size", Integer.valueOf(getSize()) ) );
+ elems.add(new StatElement<AtomicLong>("Put Count", putCnt));
+ elems.add(new StatElement<AtomicLong>("Hit Count", hitCnt));
+ elems.add(new StatElement<AtomicLong>("Miss Count", missCnt));
+ elems.add(new StatElement<Integer>( "Map Size", Integer.valueOf(getSize()) ) );
return stats;
}
@@ -334,28 +334,31 @@ public abstract class AbstractMemoryCach
*/
protected boolean removeByGroup(K key)
{
- GroupId groupId = ((GroupAttrName<?>) key).groupId;
+ boolean removed = false;
// remove all keys of the same group hierarchy.
- return map.entrySet().removeIf(entry -> {
+ for (Iterator<Map.Entry<K, MemoryElementDescriptor<K, V>>> itr = map.entrySet().iterator(); itr.hasNext();)
+ {
+ Map.Entry<K, MemoryElementDescriptor<K, V>> entry = itr.next();
K k = entry.getKey();
- if (k instanceof GroupAttrName && ((GroupAttrName<?>) k).groupId.equals(groupId))
+ if (k instanceof GroupAttrName && ((GroupAttrName<?>) k).groupId.equals(((GroupAttrName<?>) key).groupId))
{
lock.lock();
try
{
+ itr.remove();
lockedRemoveElement(entry.getValue());
- return true;
+ removed = true;
}
finally
{
lock.unlock();
}
}
+ }
- return false;
- });
+ return removed;
}
/**
@@ -366,28 +369,31 @@ public abstract class AbstractMemoryCach
*/
protected boolean removeByHierarchy(K key)
{
- String keyString = key.toString();
+ boolean removed = false;
// remove all keys of the same name hierarchy.
- return map.entrySet().removeIf(entry -> {
+ for (Iterator<Map.Entry<K, MemoryElementDescriptor<K, V>>> itr = map.entrySet().iterator(); itr.hasNext();)
+ {
+ Map.Entry<K, MemoryElementDescriptor<K, V>> entry = itr.next();
K k = entry.getKey();
- if (k instanceof String && ((String) k).startsWith(keyString))
+ if (k instanceof String && ((String) k).startsWith(key.toString()))
{
lock.lock();
try
{
+ itr.remove();
lockedRemoveElement(entry.getValue());
- return true;
+ removed = true;
}
finally
{
lock.unlock();
}
}
+ }
- return false;
- });
+ return removed;
}
/**
@@ -457,7 +463,7 @@ public abstract class AbstractMemoryCach
@Override
public Set<K> getKeySet()
{
- return new LinkedHashSet<>(map.keySet());
+ return new LinkedHashSet<K>(map.keySet());
}
/**
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCache.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCache.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCache.java Wed May 29 12:18:56 2019
@@ -74,7 +74,7 @@ public class LHMLRUMemoryCache<K, V>
throws IOException
{
putCnt.incrementAndGet();
- map.put( ce.getKey(), new MemoryElementDescriptor<>(ce) );
+ map.put( ce.getKey(), new MemoryElementDescriptor<K, V>(ce) );
}
/**
@@ -189,6 +189,7 @@ public class LHMLRUMemoryCache<K, V>
}
else
{
+
if ( log.isDebugEnabled() )
{
log.debug( "LHMLRU max size: " + getCacheAttributes().getMaxObjects()
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/soft/SoftReferenceMemoryCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/soft/SoftReferenceMemoryCache.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/soft/SoftReferenceMemoryCache.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/soft/SoftReferenceMemoryCache.java Wed May 29 12:18:56 2019
@@ -74,7 +74,7 @@ public class SoftReferenceMemoryCache<K,
public synchronized void initialize( CompositeCache<K, V> hub )
{
super.initialize( hub );
- strongReferences = new LinkedBlockingQueue<>();
+ strongReferences = new LinkedBlockingQueue<ICacheElement<K, V>>();
log.info( "initialized Soft Reference Memory Cache for " + getCacheName() );
}
@@ -84,7 +84,7 @@ public class SoftReferenceMemoryCache<K,
@Override
public ConcurrentMap<K, MemoryElementDescriptor<K, V>> createMap()
{
- return new ConcurrentHashMap<>();
+ return new ConcurrentHashMap<K, MemoryElementDescriptor<K, V>>();
}
/**
@@ -93,7 +93,7 @@ public class SoftReferenceMemoryCache<K,
@Override
public Set<K> getKeySet()
{
- Set<K> keys = new HashSet<>();
+ Set<K> keys = new HashSet<K>();
for (Map.Entry<K, MemoryElementDescriptor<K, V>> e : map.entrySet())
{
SoftReferenceElementDescriptor<K, V> sred = (SoftReferenceElementDescriptor<K, V>) e.getValue();
@@ -137,8 +137,8 @@ public class SoftReferenceMemoryCache<K,
List<IStatElement<?>> elems = stats.getStatElements();
int emptyrefs = map.size() - getSize();
- elems.add(new StatElement<>("Empty References", Integer.valueOf(emptyrefs)));
- elems.add(new StatElement<>("Strong References", Integer.valueOf(strongReferences.size())));
+ elems.add(new StatElement<Integer>("Empty References", Integer.valueOf(emptyrefs)));
+ elems.add(new StatElement<Integer>("Strong References", Integer.valueOf(strongReferences.size())));
return stats;
}
@@ -198,7 +198,7 @@ public class SoftReferenceMemoryCache<K,
try
{
- map.put(ce.getKey(), new SoftReferenceElementDescriptor<>(ce));
+ map.put(ce.getKey(), new SoftReferenceElementDescriptor<K, V>(ce));
strongReferences.add(ce);
trimStrongReferences();
}
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/util/SoftReferenceElementDescriptor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/util/SoftReferenceElementDescriptor.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/util/SoftReferenceElementDescriptor.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/util/SoftReferenceElementDescriptor.java Wed May 29 12:18:56 2019
@@ -43,7 +43,7 @@ public class SoftReferenceElementDescrip
public SoftReferenceElementDescriptor( ICacheElement<K, V> ce )
{
super( null );
- this.srce = new SoftReference<>(ce);
+ this.srce = new SoftReference<ICacheElement<K, V>>(ce);
}
/**
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/access/JCSWorker.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/access/JCSWorker.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/access/JCSWorker.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/access/JCSWorker.java Wed May 29 12:18:56 2019
@@ -105,7 +105,7 @@ public class JCSWorker<K, V>
/**
* Map to hold who's doing work presently.
*/
- private volatile ConcurrentMap<String, JCSWorkerHelper<V>> map = new ConcurrentHashMap<>();
+ private volatile ConcurrentMap<String, JCSWorkerHelper<V>> map = new ConcurrentHashMap<String, JCSWorkerHelper<V>>();
/**
* Region for the JCS cache.
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPCleanupRunner.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPCleanupRunner.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPCleanupRunner.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPCleanupRunner.java Wed May 29 12:18:56 2019
@@ -72,7 +72,7 @@ public class UDPCleanupRunner
// html
// TODO this should get a copy. you can't simply remove from this.
// the listeners need to be notified.
- Set<DiscoveredService> toRemove = new HashSet<>();
+ Set<DiscoveredService> toRemove = new HashSet<DiscoveredService>();
// can't remove via the iterator. must remove directly
for (DiscoveredService service : discoveryService.getDiscoveredServices())
{
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryManager.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryManager.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryManager.java Wed May 29 12:18:56 2019
@@ -42,7 +42,7 @@ public class UDPDiscoveryManager
private static UDPDiscoveryManager INSTANCE = new UDPDiscoveryManager();
/** Known services */
- private final Map<String, UDPDiscoveryService> services = new HashMap<>();
+ private final Map<String, UDPDiscoveryService> services = new HashMap<String, UDPDiscoveryService>();
/** private for singleton */
private UDPDiscoveryManager()
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryMessage.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryMessage.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryMessage.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryMessage.java Wed May 29 12:18:56 2019
@@ -63,7 +63,7 @@ public class UDPDiscoveryMessage
private long requesterId;
/** Names of regions */
- private ArrayList<String> cacheNames = new ArrayList<>();
+ private ArrayList<String> cacheNames = new ArrayList<String>();
/**
* @param port The port to set.
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryReceiver.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryReceiver.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryReceiver.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryReceiver.java Wed May 29 12:18:56 2019
@@ -26,7 +26,6 @@ import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;
import java.util.concurrent.ExecutorService;
-import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.jcs.engine.CacheInfo;
import org.apache.commons.jcs.engine.behavior.IShutdownObserver;
@@ -58,19 +57,19 @@ public class UDPDiscoveryReceiver
private static final int maxPoolSize = 2;
/** The processor */
- private final ExecutorService pooledExecutor;
+ private ExecutorService pooledExecutor = null;
/** number of messages received. For debugging and testing. */
- private AtomicInteger cnt = new AtomicInteger(0);
+ private int cnt = 0;
/** Service to get cache names and handle request broadcasts */
- private final UDPDiscoveryService service;
+ private UDPDiscoveryService service = null;
/** Address */
- private final String multicastAddressString;
+ private String multicastAddressString = "";
/** The port */
- private final int multicastPort;
+ private int multicastPort = 0;
/** Is it shutdown. */
private boolean shutdown = false;
@@ -93,7 +92,7 @@ public class UDPDiscoveryReceiver
this.multicastPort = multicastPort;
// create a small thread pool to handle a barrage
- this.pooledExecutor = ThreadPoolManager.getInstance().createPool(
+ pooledExecutor = ThreadPoolManager.getInstance().createPool(
new PoolConfiguration(false, 0, maxPoolSize, maxPoolSize, 0, WhenBlockedPolicy.DISCARDOLDEST, maxPoolSize),
"JCS-UDPDiscoveryReceiver-", Thread.MIN_PRIORITY);
@@ -102,7 +101,16 @@ public class UDPDiscoveryReceiver
log.info( "Constructing listener, [" + this.multicastAddressString + ":" + this.multicastPort + "]" );
}
- createSocket( this.multicastAddressString, this.multicastPort );
+ try
+ {
+ createSocket( this.multicastAddressString, this.multicastPort );
+ }
+ catch ( IOException ioe )
+ {
+ // consider eating this so we can go on, or constructing the socket
+ // later
+ throw ioe;
+ }
}
/**
@@ -157,8 +165,9 @@ public class UDPDiscoveryReceiver
log.debug( "Received packet from address [" + packet.getSocketAddress() + "]" );
}
- try (ByteArrayInputStream byteStream = new ByteArrayInputStream(mBuffer, 0, packet.getLength());
- ObjectInputStream objectStream = new ObjectInputStreamClassLoaderAware(byteStream, null))
+ final ByteArrayInputStream byteStream = new ByteArrayInputStream( mBuffer, 0, packet.getLength() );
+
+ try (ObjectInputStream objectStream = new ObjectInputStreamClassLoaderAware( byteStream, null ))
{
obj = objectStream.readObject();
}
@@ -195,7 +204,8 @@ public class UDPDiscoveryReceiver
{
Object obj = waitForMessage();
- cnt.incrementAndGet();
+ // not thread safe, but just for debugging
+ cnt++;
if ( log.isDebugEnabled() )
{
@@ -251,7 +261,7 @@ public class UDPDiscoveryReceiver
*/
public void setCnt( int cnt )
{
- this.cnt.set(cnt);
+ this.cnt = cnt;
}
/**
@@ -259,7 +269,7 @@ public class UDPDiscoveryReceiver
*/
public int getCnt()
{
- return cnt.get();
+ return cnt;
}
/**
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoverySenderThread.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoverySenderThread.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoverySenderThread.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoverySenderThread.java Wed May 29 12:18:56 2019
@@ -40,7 +40,7 @@ public class UDPDiscoverySenderThread
private final UDPDiscoveryAttributes attributes;
/** List of known regions. */
- private ArrayList<String> cacheNames = new ArrayList<>();
+ private ArrayList<String> cacheNames = new ArrayList<String>();
/**
* @param cacheNames The cacheNames to set.
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryService.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryService.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryService.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryService.java Wed May 29 12:18:56 2019
@@ -66,13 +66,13 @@ public class UDPDiscoveryService
private boolean shutdown = false;
/** This is a set of services that have been discovered. */
- private Set<DiscoveredService> discoveredServices = new CopyOnWriteArraySet<>();
+ private Set<DiscoveredService> discoveredServices = new CopyOnWriteArraySet<DiscoveredService>();
/** This a list of regions that are configured to use discovery. */
- private final Set<String> cacheNames = new CopyOnWriteArraySet<>();
+ private final Set<String> cacheNames = new CopyOnWriteArraySet<String>();
/** Set of listeners. */
- private final Set<IDiscoveryListener> discoveryListeners = new CopyOnWriteArraySet<>();
+ private final Set<IDiscoveryListener> discoveryListeners = new CopyOnWriteArraySet<IDiscoveryListener>();
/**
* @param attributes
@@ -274,7 +274,7 @@ public class UDPDiscoveryService
*/
protected ArrayList<String> getCacheNames()
{
- ArrayList<String> names = new ArrayList<>();
+ ArrayList<String> names = new ArrayList<String>();
names.addAll( cacheNames );
return names;
}
@@ -300,8 +300,8 @@ public class UDPDiscoveryService
*/
public void startup()
{
- udpReceiverThread = new Thread(receiver);
- udpReceiverThread.setDaemon(true);
+ udpReceiverThread = new Thread( receiver );
+ udpReceiverThread.setDaemon( true );
// udpReceiverThread.setName( t.getName() + "--UDPReceiver" );
udpReceiverThread.start();
}
@@ -378,7 +378,7 @@ public class UDPDiscoveryService
*/
public Set<IDiscoveryListener> getCopyOfDiscoveryListeners()
{
- Set<IDiscoveryListener> copy = new HashSet<>();
+ Set<IDiscoveryListener> copy = new HashSet<IDiscoveryListener>();
copy.addAll( getDiscoveryListeners() );
return copy;
}
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/CompressingSerializer.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/CompressingSerializer.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/CompressingSerializer.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/CompressingSerializer.java Wed May 29 12:18:56 2019
@@ -19,14 +19,22 @@ package org.apache.commons.jcs.utils.ser
* under the License.
*/
-import java.io.IOException;
-
+import org.apache.commons.jcs.engine.behavior.IElementSerializer;
+import org.apache.commons.jcs.io.ObjectInputStreamClassLoaderAware;
import org.apache.commons.jcs.utils.zip.CompressionUtil;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
/**
* Performs default serialization and de-serialization. It gzips the value.
*/
-public class CompressingSerializer extends StandardSerializer
+public class CompressingSerializer
+ implements IElementSerializer
{
/**
* Serializes an object using default serialization. Compresses the byte array.
@@ -39,12 +47,32 @@ public class CompressingSerializer exten
public <T> byte[] serialize( T obj )
throws IOException
{
- byte[] uncompressed = super.serialize(obj);
+ byte[] uncompressed = serializeObject( obj );
byte[] compressed = CompressionUtil.compressByteArray( uncompressed );
return compressed;
}
/**
+ * Does the basic serialization.
+ * <p>
+ * @param obj object
+ * @return byte[]
+ * @throws IOException on i/o problem
+ */
+ protected <T> byte[] serializeObject( T obj )
+ throws IOException
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ try (ObjectOutputStream oos = new ObjectOutputStream( baos ))
+ {
+ oos.writeObject( obj );
+ }
+
+ return baos.toByteArray();
+ }
+
+ /**
* Uses default de-serialization to turn a byte array into an object. Decompresses the value
* first. All exceptions are converted into IOExceptions.
* <p>
@@ -61,8 +89,28 @@ public class CompressingSerializer exten
{
return null;
}
-
byte[] decompressedByteArray = CompressionUtil.decompressByteArray( data );
- return super.deSerialize(decompressedByteArray, loader);
+ return deserializeObject( decompressedByteArray );
+ }
+
+ /**
+ * Does the standard deserialization.
+ * <p>
+ * @param decompressedByteArray array of decompressed bytes
+ * @return Object
+ * @throws IOException on i/o error
+ * @throws ClassNotFoundException if class is not found during deserialization
+ */
+ protected <T> T deserializeObject( byte[] decompressedByteArray )
+ throws IOException, ClassNotFoundException
+ {
+ ByteArrayInputStream bais = new ByteArrayInputStream( decompressedByteArray );
+
+ try (ObjectInputStream ois = new ObjectInputStreamClassLoaderAware( bais, null ))
+ {
+ @SuppressWarnings("unchecked") // Need to cast from Object
+ T readObject = (T) ois.readObject();
+ return readObject;
+ }
}
}
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/SerializationConversionUtil.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/SerializationConversionUtil.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/SerializationConversionUtil.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/SerializationConversionUtil.java Wed May 29 12:18:56 2019
@@ -71,10 +71,7 @@ public class SerializationConversionUtil
{
try
{
- serializedValue = elementSerializer.serialize(element.getVal());
-
- // update size in bytes
- element.getElementAttributes().setSize(serializedValue.length);
+ serializedValue = elementSerializer.serialize( element.getVal() );
}
catch ( IOException e )
{
@@ -89,7 +86,7 @@ public class SerializationConversionUtil
throw new IOException( "Could not serialize object. The ElementSerializer is null." );
}
}
- ICacheElementSerialized<K, V> serialized = new CacheElementSerialized<>(
+ ICacheElementSerialized<K, V> serialized = new CacheElementSerialized<K, V>(
element.getCacheName(), element.getKey(), serializedValue, element.getElementAttributes() );
return serialized;
@@ -142,7 +139,7 @@ public class SerializationConversionUtil
// we could just use the default.
log.warn( "ElementSerializer is null. Could not serialize object." );
}
- ICacheElement<K, V> deSerialized = new CacheElement<>( serialized.getCacheName(), serialized.getKey(), deSerializedValue );
+ ICacheElement<K, V> deSerialized = new CacheElement<K, V>( serialized.getCacheName(), serialized.getKey(), deSerializedValue );
deSerialized.setElementAttributes( serialized.getElementAttributes() );
return deSerialized;
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/StandardSerializer.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/StandardSerializer.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/StandardSerializer.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/serialization/StandardSerializer.java Wed May 29 12:18:56 2019
@@ -19,15 +19,16 @@ package org.apache.commons.jcs.utils.ser
* under the License.
*/
+import org.apache.commons.jcs.engine.behavior.IElementSerializer;
+import org.apache.commons.jcs.io.ObjectInputStreamClassLoaderAware;
+
+import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import org.apache.commons.jcs.engine.behavior.IElementSerializer;
-import org.apache.commons.jcs.io.ObjectInputStreamClassLoaderAware;
-
/**
* Performs default serialization and de-serialization.
* <p>
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/AbstractLRUMap.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/AbstractLRUMap.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/AbstractLRUMap.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/AbstractLRUMap.java Wed May 29 12:18:56 2019
@@ -1,9 +1,31 @@
package org.apache.commons.jcs.utils.struct;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.Serializable;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Iterator;
import java.util.Map;
+import java.util.NoSuchElementException;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.Lock;
@@ -62,11 +84,11 @@ public abstract class AbstractLRUMap<K,
*/
public AbstractLRUMap()
{
- list = new DoubleLinkedList<>();
+ list = new DoubleLinkedList<LRUElementDescriptor<K, V>>();
// normal hashtable is faster for
// sequential keys.
- map = new ConcurrentHashMap<>();
+ map = new ConcurrentHashMap<K, LRUElementDescriptor<K, V>>();
}
@@ -278,7 +300,7 @@ public abstract class AbstractLRUMap<K,
putCnt++;
LRUElementDescriptor<K, V> old = null;
- LRUElementDescriptor<K, V> me = new LRUElementDescriptor<>(key, value);
+ LRUElementDescriptor<K, V> me = new LRUElementDescriptor<K, V>(key, value);
lock.lock();
try
@@ -439,22 +461,33 @@ public abstract class AbstractLRUMap<K,
}
log.debug( "verifycache: checking via keysets!" );
- map.forEach((key, value) -> {
- boolean _found = false;
+ for (Iterator<K> itr2 = map.keySet().iterator(); itr2.hasNext(); )
+ {
+ found = false;
+ Serializable val = null;
+ try
+ {
+ val = (Serializable) itr2.next();
+ }
+ catch ( NoSuchElementException nse )
+ {
+ log.error( "verifycache: no such element exception" );
+ continue;
+ }
for (LRUElementDescriptor<K, V> li2 = list.getFirst(); li2 != null; li2 = (LRUElementDescriptor<K, V>) li2.next )
{
- if ( key.equals( li2.getKey() ) )
+ if ( val.equals( li2.getKey() ) )
{
- _found = true;
+ found = true;
break;
}
}
- if ( !_found )
+ if ( !found )
{
- log.error( "verifycache: key not found in list : " + key );
+ log.error( "verifycache: key not found in list : " + val );
dumpCacheEntries();
- if ( map.containsKey( key ) )
+ if ( map.containsKey( val ) )
{
log.error( "verifycache: map contains key" );
}
@@ -463,7 +496,7 @@ public abstract class AbstractLRUMap<K,
log.error( "verifycache: map does NOT contain key, what the HECK!" );
}
}
- });
+ }
}
/**
@@ -490,13 +523,13 @@ public abstract class AbstractLRUMap<K,
IStats stats = new Stats();
stats.setTypeName( "LRUMap" );
- ArrayList<IStatElement<?>> elems = new ArrayList<>();
+ ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>();
- elems.add(new StatElement<>( "List Size", Integer.valueOf(list.size()) ) );
- elems.add(new StatElement<>( "Map Size", Integer.valueOf(map.size()) ) );
- elems.add(new StatElement<>( "Put Count", Long.valueOf(putCnt) ) );
- elems.add(new StatElement<>( "Hit Count", Long.valueOf(hitCnt) ) );
- elems.add(new StatElement<>( "Miss Count", Long.valueOf(missCnt) ) );
+ elems.add(new StatElement<Integer>( "List Size", Integer.valueOf(list.size()) ) );
+ elems.add(new StatElement<Integer>( "Map Size", Integer.valueOf(map.size()) ) );
+ elems.add(new StatElement<Long>( "Put Count", Long.valueOf(putCnt) ) );
+ elems.add(new StatElement<Long>( "Hit Count", Long.valueOf(hitCnt) ) );
+ elems.add(new StatElement<Long>( "Miss Count", Long.valueOf(missCnt) ) );
stats.setStatElements( elems );
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolManager.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolManager.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/threadpool/ThreadPoolManager.java Wed May 29 12:18:56 2019
@@ -91,8 +91,8 @@ public class ThreadPoolManager
*/
private ThreadPoolManager()
{
- this.pools = new ConcurrentHashMap<>();
- this.schedulerPools = new ConcurrentHashMap<>();
+ this.pools = new ConcurrentHashMap<String, ExecutorService>();
+ this.schedulerPools = new ConcurrentHashMap<String, ScheduledExecutorService>();
configure();
}
@@ -126,7 +126,7 @@ public class ThreadPoolManager
log.debug( "Creating a Bounded Buffer to use for the pool" );
}
- queue = new LinkedBlockingQueue<>(config.getBoundarySize());
+ queue = new LinkedBlockingQueue<Runnable>(config.getBoundarySize());
}
else
{
@@ -134,7 +134,7 @@ public class ThreadPoolManager
{
log.debug( "Creating a non bounded Linked Queue to use for the pool" );
}
- queue = new LinkedBlockingQueue<>();
+ queue = new LinkedBlockingQueue<Runnable>();
}
ThreadPoolExecutor pool = new ThreadPoolExecutor(
@@ -295,7 +295,7 @@ public class ThreadPoolManager
*/
public ArrayList<String> getPoolNames()
{
- return new ArrayList<>(pools.keySet());
+ return new ArrayList<String>(pools.keySet());
}
/**
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSConcurrentCacheAccessUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSConcurrentCacheAccessUnitTest.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSConcurrentCacheAccessUnitTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSConcurrentCacheAccessUnitTest.java Wed May 29 12:18:56 2019
@@ -37,7 +37,7 @@ import org.apache.commons.jcs.access.exc
*/
public class JCSConcurrentCacheAccessUnitTest extends TestCase
{
- private final static int THREADS = 20;
+ private final static int THREADS = 10;
private final static int LOOPS = 10000;
/**
@@ -67,7 +67,7 @@ public class JCSConcurrentCacheAccessUni
JCS.setConfigFilename( "/TestJCS-73.ccf" );
cache = JCS.getGroupCacheInstance( "cache" );
errcount = new AtomicInteger(0);
- valueMismatchList = Collections.synchronizedList(new ArrayList<>());
+ valueMismatchList = Collections.synchronizedList(new ArrayList<String>());
}
@Override
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSThrashTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSThrashTest.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSThrashTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSThrashTest.java Wed May 29 12:18:56 2019
@@ -169,7 +169,7 @@ public class JCSThrashTest
jcs.put( key, value );
// Create 15 threads that read the keys;
- final List<Executable> executables = new ArrayList<>();
+ final List<Executable> executables = new ArrayList<Executable>();
for ( int i = 0; i < 15; i++ )
{
final JCSThrashTest.Executable executable = new JCSThrashTest.Executable()
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSUnitTest.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSUnitTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSUnitTest.java Wed May 29 12:18:56 2019
@@ -82,7 +82,7 @@ public class JCSUnitTest
*/
private LinkedList<HashMap<String, String>> buildList()
{
- LinkedList<HashMap<String, String>> list = new LinkedList<>();
+ LinkedList<HashMap<String, String>> list = new LinkedList<HashMap<String,String>>();
for ( int i = 0; i < 100; i++ )
{
@@ -97,7 +97,7 @@ public class JCSUnitTest
*/
private HashMap<String, String> buildMap()
{
- HashMap<String, String> map = new HashMap<>();
+ HashMap<String, String> map = new HashMap<String, String>();
byte[] keyBytes = new byte[32];
byte[] valBytes = new byte[128];
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSvsHashtablePerformanceTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSvsHashtablePerformanceTest.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSvsHashtablePerformanceTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSvsHashtablePerformanceTest.java Wed May 29 12:18:56 2019
@@ -144,7 +144,7 @@ public class JCSvsHashtablePerformanceTe
// /////////////////////////////////////////////////////////////
name = "Hashtable";
- Hashtable<String, String> cache2 = new Hashtable<>();
+ Hashtable<String, String> cache2 = new Hashtable<String, String>();
start = System.currentTimeMillis();
for ( int i = 0; i < tries; i++ )
{
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/access/CacheAccessUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/access/CacheAccessUnitTest.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/access/CacheAccessUnitTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/access/CacheAccessUnitTest.java Wed May 29 12:18:56 2019
@@ -177,7 +177,7 @@ public class CacheAccessUnitTest
access.put( keyTwo, valueTwo );
access.put( keyThree, valueThree );
- Set<String> input = new HashSet<>();
+ Set<String> input = new HashSet<String>();
input.add( keyOne );
input.add( keyTwo );
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockAuxiliaryCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockAuxiliaryCache.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockAuxiliaryCache.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockAuxiliaryCache.java Wed May 29 12:18:56 2019
@@ -80,7 +80,7 @@ public class MockAuxiliaryCache<K, V>
throws IOException
{
getMatchingCallCount++;
- return new HashMap<>();
+ return new HashMap<K, ICacheElement<K, V>>();
}
/**
@@ -93,7 +93,7 @@ public class MockAuxiliaryCache<K, V>
@Override
public Map<K, ICacheElement<K, V>> getMultiple(Set<K> keys)
{
- return new HashMap<>();
+ return new HashMap<K, ICacheElement<K, V>>();
}
/**
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockAuxiliaryCacheFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockAuxiliaryCacheFactory.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockAuxiliaryCacheFactory.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockAuxiliaryCacheFactory.java Wed May 29 12:18:56 2019
@@ -44,7 +44,7 @@ public class MockAuxiliaryCacheFactory
createCache( AuxiliaryCacheAttributes attr, ICompositeCacheManager cacheMgr,
ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
{
- MockAuxiliaryCache<K, V> auxCache = new MockAuxiliaryCache<>();
+ MockAuxiliaryCache<K, V> auxCache = new MockAuxiliaryCache<K, V>();
auxCache.setCacheEventLogger( cacheEventLogger );
auxCache.setElementSerializer( elementSerializer );
return auxCache;
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockCacheEventLogger.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockCacheEventLogger.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockCacheEventLogger.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockCacheEventLogger.java Wed May 29 12:18:56 2019
@@ -46,7 +46,7 @@ public class MockCacheEventLogger
public int errorEventCalls = 0;
/** list of messages */
- public List<String> errorMessages = new ArrayList<>();
+ public List<String> errorMessages = new ArrayList<String>();
/**
* @param source
@@ -93,6 +93,6 @@ public class MockCacheEventLogger
String eventName, String optionalDetails, T key )
{
startICacheEventCalls++;
- return new CacheEvent<>();
+ return new CacheEvent<T>();
}
}
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java Wed May 29 12:18:56 2019
@@ -56,12 +56,12 @@ public class AbstractDiskCacheUnitTest
IDiskCacheAttributes diskCacheAttributes = new IndexedDiskCacheAttributes();
diskCacheAttributes.setCacheName( cacheName );
- AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<>( diskCacheAttributes );
+ AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<String, String>( diskCacheAttributes );
String key = "myKey";
String value = "myValue";
IElementAttributes elementAttributes = new ElementAttributes();
- ICacheElement<String, String> cacheElement = new CacheElement<>( cacheName, key, value, elementAttributes );
+ ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
diskCache.update( cacheElement );
@@ -86,12 +86,12 @@ public class AbstractDiskCacheUnitTest
IDiskCacheAttributes diskCacheAttributes = new IndexedDiskCacheAttributes();
diskCacheAttributes.setCacheName( cacheName );
- AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<>( diskCacheAttributes );
+ AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<String, String>( diskCacheAttributes );
String key = "myKey";
String value = "myValue";
IElementAttributes elementAttributes = new ElementAttributes();
- ICacheElement<String, String> cacheElement = new CacheElement<>( cacheName, key, value, elementAttributes );
+ ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
diskCache.update( cacheElement );
@@ -118,13 +118,13 @@ public class AbstractDiskCacheUnitTest
IDiskCacheAttributes diskCacheAttributes = new IndexedDiskCacheAttributes();
diskCacheAttributes.setAllowRemoveAll( false );
- AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<>( diskCacheAttributes );
+ AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<String, String>( diskCacheAttributes );
String cacheName = "testRemoveAll_notAllowed";
String key = "myKey";
String value = "myValue";
IElementAttributes elementAttributes = new ElementAttributes();
- ICacheElement<String, String> cacheElement = new CacheElement<>( cacheName, key, value, elementAttributes );
+ ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
diskCache.update( cacheElement );
@@ -149,13 +149,13 @@ public class AbstractDiskCacheUnitTest
IDiskCacheAttributes diskCacheAttributes = new IndexedDiskCacheAttributes();
diskCacheAttributes.setAllowRemoveAll( true );
- AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<>( diskCacheAttributes );
+ AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<String, String>( diskCacheAttributes );
String cacheName = "testRemoveAll_allowed";
String key = "myKey";
String value = "myValue";
IElementAttributes elementAttributes = new ElementAttributes();
- ICacheElement<String, String> cacheElement = new CacheElement<>( cacheName, key, value, elementAttributes );
+ ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
diskCache.update( cacheElement );
@@ -171,7 +171,7 @@ public class AbstractDiskCacheUnitTest
extends AbstractDiskCache<K, V>
{
/** Internal map */
- protected Map<K, ICacheElement<K, V>> map = new HashMap<>();
+ protected Map<K, ICacheElement<K, V>> map = new HashMap<K, ICacheElement<K, V>>();
/** used by the abstract aux class */
protected IDiskCacheAttributes diskCacheAttributes;
@@ -207,7 +207,7 @@ public class AbstractDiskCacheUnitTest
@Override
public Set<K> getKeySet() throws IOException
{
- return new HashSet<>(map.keySet());
+ return new HashSet<K>(map.keySet());
}
/**
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/PurgatoryElementUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/PurgatoryElementUnitTest.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/PurgatoryElementUnitTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/PurgatoryElementUnitTest.java Wed May 29 12:18:56 2019
@@ -37,8 +37,8 @@ public class PurgatoryElementUnitTest
String key = "myKey";
String value = "myValue";
IElementAttributes elementAttributes = new ElementAttributes();
- ICacheElement<String, String> cacheElement = new CacheElement<>( cacheName, key, value, elementAttributes );
- PurgatoryElement<String, String> purgatoryElement = new PurgatoryElement<>( cacheElement );
+ ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
+ PurgatoryElement<String, String> purgatoryElement = new PurgatoryElement<String, String>( cacheElement );
purgatoryElement.setSpoolable( false );
// DO WORK
@@ -57,8 +57,8 @@ public class PurgatoryElementUnitTest
String value = "myValue";
IElementAttributes elementAttributes = new ElementAttributes();
- ICacheElement<String, String> cacheElement = new CacheElement<>( cacheName, key, value );
- PurgatoryElement<String, String> purgatoryElement = new PurgatoryElement<>( cacheElement );
+ ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value );
+ PurgatoryElement<String, String> purgatoryElement = new PurgatoryElement<String, String>( cacheElement );
purgatoryElement.setElementAttributes( elementAttributes );
// DO WORK
@@ -76,8 +76,8 @@ public class PurgatoryElementUnitTest
String key = "myKey";
String value = "myValue";
IElementAttributes elementAttributes = new ElementAttributes();
- ICacheElement<String, String> cacheElement = new CacheElement<>( cacheName, key, value, elementAttributes );
- PurgatoryElement<String, String> purgatoryElement = new PurgatoryElement<>( cacheElement );
+ ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
+ PurgatoryElement<String, String> purgatoryElement = new PurgatoryElement<String, String>( cacheElement );
// DO WORK
String result = purgatoryElement.toString();
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheConcurrentUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheConcurrentUnitTest.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheConcurrentUnitTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheConcurrentUnitTest.java Wed May 29 12:18:56 2019
@@ -164,7 +164,7 @@ public class BlockDiskCacheConcurrentUni
}
// Test that getElements returns all the expected values
- Set<String> keys = new HashSet<>();
+ Set<String> keys = new HashSet<String>();
for ( int i = 0; i <= items; i++ )
{
keys.add( i + ":key" );
@@ -225,7 +225,7 @@ public class BlockDiskCacheConcurrentUni
}
// Test that getElements returns all the expected values
- Set<String> keys = new HashSet<>();
+ Set<String> keys = new HashSet<String>();
for ( int i = start; i <= end; i++ )
{
keys.add( i + ":key" );
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheKeyStoreUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheKeyStoreUnitTest.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheKeyStoreUnitTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheKeyStoreUnitTest.java Wed May 29 12:18:56 2019
@@ -70,8 +70,8 @@ public class BlockDiskCacheKeyStoreUnitT
private void innerTestPutKeys(BlockDiskCacheAttributes attributes)
{
- BlockDiskCache<String, String> blockDiskCache = new BlockDiskCache<>(attributes);
- BlockDiskKeyStore<String> keyStore = new BlockDiskKeyStore<>(attributes, blockDiskCache);
+ BlockDiskCache<String, String> blockDiskCache = new BlockDiskCache<String, String>(attributes);
+ BlockDiskKeyStore<String> keyStore = new BlockDiskKeyStore<String>(attributes, blockDiskCache);
// DO WORK
int numElements = 100;
@@ -125,7 +125,7 @@ public class BlockDiskCacheKeyStoreUnitT
private void testSaveLoadKeysInner(BlockDiskCacheAttributes attributes)
{
- BlockDiskKeyStore<String> keyStore = new BlockDiskKeyStore<>(attributes, null);
+ BlockDiskKeyStore<String> keyStore = new BlockDiskKeyStore<String>(attributes, null);
// DO WORK
int numElements = 1000;
@@ -180,7 +180,7 @@ public class BlockDiskCacheKeyStoreUnitT
attributes.setDiskLimitType(DiskLimitType.SIZE);
@SuppressWarnings({ "unchecked", "rawtypes" })
- BlockDiskKeyStore<String> keyStore = new BlockDiskKeyStore<>(attributes, new BlockDiskCache(attributes));
+ BlockDiskKeyStore<String> keyStore = new BlockDiskKeyStore<String>(attributes, new BlockDiskCache(attributes));
keyStore.put("1", new int[1000]);
keyStore.put("2", new int[1000]);
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheSameRegionConcurrentUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheSameRegionConcurrentUnitTest.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheSameRegionConcurrentUnitTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheSameRegionConcurrentUnitTest.java Wed May 29 12:18:56 2019
@@ -155,7 +155,7 @@ public class BlockDiskCacheSameRegionCon
}
// Test that getElements returns all the expected values
- Set<String> keys = new HashSet<>();
+ Set<String> keys = new HashSet<String>();
for ( int i = start; i <= end; i++ )
{
keys.add( i + ":key" );
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheUnitTestAbstract.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheUnitTestAbstract.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheUnitTestAbstract.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheUnitTestAbstract.java Wed May 29 12:18:56 2019
@@ -49,12 +49,12 @@ public abstract class BlockDiskCacheUnit
cattr.setCacheName(cacheName);
cattr.setMaxKeySize(100);
cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
- BlockDiskCache<String, String> diskCache = new BlockDiskCache<>(cattr);
+ BlockDiskCache<String, String> diskCache = new BlockDiskCache<String, String>(cattr);
// DO WORK
for (int i = 0; i <= items; i++)
{
- diskCache.update(new CacheElement<>(cacheName, i + ":key", cacheName + " data " + i));
+ diskCache.update(new CacheElement<String, String>(cacheName, i + ":key", cacheName + " data " + i));
}
Thread.sleep(500);
@@ -82,12 +82,12 @@ public abstract class BlockDiskCacheUnit
cattr.setCacheName(cacheName);
cattr.setMaxKeySize(100);
cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
- BlockDiskCache<String, String> diskCache = new BlockDiskCache<>(cattr);
+ BlockDiskCache<String, String> diskCache = new BlockDiskCache<String, String>(cattr);
// DO WORK
for (int i = 0; i <= items; i++)
{
- diskCache.update(new CacheElement<>(cacheName, i + ":key", cacheName + " data " + i));
+ diskCache.update(new CacheElement<String, String>(cacheName, i + ":key", cacheName + " data " + i));
}
Map<String, ICacheElement<String, String>> matchingResults = diskCache.getMatching("1.8.+");
@@ -171,10 +171,10 @@ public abstract class BlockDiskCacheUnit
cattr.setMaxKeySize(100);
cattr.setBlockSizeBytes(200);
cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
- BlockDiskCache<String, String> diskCache = new BlockDiskCache<>(cattr);
+ BlockDiskCache<String, String> diskCache = new BlockDiskCache<String, String>(cattr);
// DO WORK
- diskCache.update(new CacheElement<>(cacheName, "x", string));
+ diskCache.update(new CacheElement<String, String>(cacheName, "x", string));
// VERIFY
assertNotNull(diskCache.get("x"));
@@ -214,10 +214,10 @@ public abstract class BlockDiskCacheUnit
cattr.setMaxKeySize(100);
cattr.setBlockSizeBytes(200);
cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
- BlockDiskCache<String, String> diskCache = new BlockDiskCache<>(cattr);
+ BlockDiskCache<String, String> diskCache = new BlockDiskCache<String, String>(cattr);
// DO WORK
- diskCache.update(new CacheElement<>(cacheName, "x", string));
+ diskCache.update(new CacheElement<String, String>(cacheName, "x", string));
// VERIFY
assertNotNull(diskCache.get("x"));
@@ -258,10 +258,10 @@ public abstract class BlockDiskCacheUnit
cattr.setMaxKeySize(100);
cattr.setBlockSizeBytes(200);
cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
- BlockDiskCache<String, byte[]> diskCache = new BlockDiskCache<>(cattr);
+ BlockDiskCache<String, byte[]> diskCache = new BlockDiskCache<String, byte[]>(cattr);
// DO WORK
- diskCache.update(new CacheElement<>(cacheName, "x", bytes));
+ diskCache.update(new CacheElement<String, byte[]>(cacheName, "x", bytes));
// VERIFY
assertNotNull(diskCache.get("x"));
@@ -307,10 +307,10 @@ public abstract class BlockDiskCacheUnit
cattr.setMaxKeySize(100);
cattr.setBlockSizeBytes(500);
cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
- BlockDiskCache<String, X> diskCache = new BlockDiskCache<>(cattr);
+ BlockDiskCache<String, X> diskCache = new BlockDiskCache<String, X>(cattr);
// DO WORK
- diskCache.update(new CacheElement<>(cacheName, "x", before));
+ diskCache.update(new CacheElement<String, X>(cacheName, "x", before));
// VERIFY
assertNotNull(diskCache.get("x"));
@@ -341,18 +341,18 @@ public abstract class BlockDiskCacheUnit
cattr.setMaxKeySize(100);
cattr.setBlockSizeBytes(500);
cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
- BlockDiskCache<String, X> diskCache = new BlockDiskCache<>(cattr);
+ BlockDiskCache<String, X> diskCache = new BlockDiskCache<String, X>(cattr);
diskCache.removeAll();
X value1 = new X();
value1.string = "1234567890";
X value2 = new X();
value2.string = "0987654321";
- diskCache.update(new CacheElement<>(cacheName, "1", value1));
+ diskCache.update(new CacheElement<String, X>(cacheName, "1", value1));
diskCache.dispose();
- diskCache = new BlockDiskCache<>(cattr);
- diskCache.update(new CacheElement<>(cacheName, "2", value2));
+ diskCache = new BlockDiskCache<String, X>(cattr);
+ diskCache.update(new CacheElement<String, X>(cacheName, "2", value2));
diskCache.dispose();
- diskCache = new BlockDiskCache<>(cattr);
+ diskCache = new BlockDiskCache<String, X>(cattr);
assertTrue(diskCache.verifyDisk());
assertEquals(2, diskCache.getKeySet().size());
assertEquals(value1.string, diskCache.get("1").getVal().string);
@@ -382,17 +382,17 @@ public abstract class BlockDiskCacheUnit
cattr.setMaxKeySize(100);
cattr.setBlockSizeBytes(500);
cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
- BlockDiskCache<String, X> diskCache = new BlockDiskCache<>(cattr);
+ BlockDiskCache<String, X> diskCache = new BlockDiskCache<String, X>(cattr);
// DO WORK
for (int i = 0; i < 50; i++)
{
- diskCache.update(new CacheElement<>(cacheName, "x" + i, before));
+ diskCache.update(new CacheElement<String, X>(cacheName, "x" + i, before));
}
diskCache.dispose();
// VERIFY
- diskCache = new BlockDiskCache<>(cattr);
+ diskCache = new BlockDiskCache<String, X>(cattr);
for (int i = 0; i < 50; i++)
{
@@ -419,7 +419,7 @@ public abstract class BlockDiskCacheUnit
cattr.setCacheName("testRemoveItems");
cattr.setMaxKeySize(100);
cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
- BlockDiskCache<String, String> disk = new BlockDiskCache<>(cattr);
+ BlockDiskCache<String, String> disk = new BlockDiskCache<String, String>(cattr);
disk.processRemoveAll();
@@ -428,7 +428,7 @@ public abstract class BlockDiskCacheUnit
{
IElementAttributes eAttr = new ElementAttributes();
eAttr.setIsSpool(true);
- ICacheElement<String, String> element = new CacheElement<>("testRemoveItems", "key:" + i, "data:" + i);
+ ICacheElement<String, String> element = new CacheElement<String, String>("testRemoveItems", "key:" + i, "data:" + i);
element.setElementAttributes(eAttr);
disk.processUpdate(element);
}
@@ -454,7 +454,7 @@ public abstract class BlockDiskCacheUnit
cattr.setCacheName("testRemove_PartialKey");
cattr.setMaxKeySize(100);
cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
- BlockDiskCache<String, String> disk = new BlockDiskCache<>(cattr);
+ BlockDiskCache<String, String> disk = new BlockDiskCache<String, String>(cattr);
disk.processRemoveAll();
@@ -463,7 +463,7 @@ public abstract class BlockDiskCacheUnit
{
IElementAttributes eAttr = new ElementAttributes();
eAttr.setIsSpool(true);
- ICacheElement<String, String> element = new CacheElement<>("testRemove_PartialKey", i + ":key", "data:"
+ ICacheElement<String, String> element = new CacheElement<String, String>("testRemove_PartialKey", i + ":key", "data:"
+ i);
element.setElementAttributes(eAttr);
disk.processUpdate(element);
@@ -498,7 +498,7 @@ public abstract class BlockDiskCacheUnit
cattr.setCacheName("testRemove_Group");
cattr.setMaxKeySize(100);
cattr.setDiskPath("target/test-sandbox/BlockDiskCacheUnitTest");
- BlockDiskCache<GroupAttrName<String>, String> disk = new BlockDiskCache<>(cattr);
+ BlockDiskCache<GroupAttrName<String>, String> disk = new BlockDiskCache<GroupAttrName<String>, String>(cattr);
disk.processRemoveAll();
@@ -509,7 +509,7 @@ public abstract class BlockDiskCacheUnit
for (int i = 0; i < cnt; i++)
{
GroupAttrName<String> groupAttrName = getGroupAttrName(cacheName, groupName, i + ":key");
- CacheElement<GroupAttrName<String>, String> element = new CacheElement<>(cacheName,
+ CacheElement<GroupAttrName<String>, String> element = new CacheElement<GroupAttrName<String>, String>(cacheName,
groupAttrName, "data:" + i);
IElementAttributes eAttr = new ElementAttributes();
@@ -554,7 +554,7 @@ public abstract class BlockDiskCacheUnit
private GroupAttrName<String> getGroupAttrName(String cacheName, String group, String name)
{
GroupId gid = new GroupId(cacheName, group);
- return new GroupAttrName<>(gid, name);
+ return new GroupAttrName<String>(gid, name);
}
/** Holder for a string and byte array. */
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskElementDescriptorUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskElementDescriptorUnitTest.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskElementDescriptorUnitTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskElementDescriptorUnitTest.java Wed May 29 12:18:56 2019
@@ -53,7 +53,7 @@ public class BlockDiskElementDescriptorU
// DO WORK
for ( int i = 0; i < numElements; i++ )
{
- BlockDiskElementDescriptor<Integer> descriptor = new BlockDiskElementDescriptor<>();
+ BlockDiskElementDescriptor<Integer> descriptor = new BlockDiskElementDescriptor<Integer>();
descriptor.setKey( Integer.valueOf( i ) );
descriptor.setBlocks( new int[] { 1, 2 } );
elements[i] = descriptor;
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/DiskTestObjectUtil.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/DiskTestObjectUtil.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/DiskTestObjectUtil.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/DiskTestObjectUtil.java Wed May 29 12:18:56 2019
@@ -109,7 +109,7 @@ public class DiskTestObjectUtil
int size = bytes * 1024;
DiskTestObject tile = new DiskTestObject( Integer.valueOf( i ), new byte[size] );
- ICacheElement<Integer, DiskTestObject> element = new CacheElement<>( cacheName, tile.id, tile );
+ ICacheElement<Integer, DiskTestObject> element = new CacheElement<Integer, DiskTestObject>( cacheName, tile.id, tile );
elements[i] = element;
}
return elements;
@@ -134,7 +134,7 @@ public class DiskTestObjectUtil
int size = ( bytes + 4 ) * 1024;
DiskTestObject tile = new DiskTestObject( Integer.valueOf( i ), new byte[size] );
- ICacheElement<Integer, DiskTestObject> element = new CacheElement<>( cacheName, tile.id, tile );
+ ICacheElement<Integer, DiskTestObject> element = new CacheElement<Integer, DiskTestObject>( cacheName, tile.id, tile );
elements[i] = element;
}
return elements;
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheCountUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheCountUnitTest.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheCountUnitTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheCountUnitTest.java Wed May 29 12:18:56 2019
@@ -42,7 +42,7 @@ public class IndexDiskCacheCountUnitTest
cattr.setMaxKeySize( 5 );
cattr.setMaxPurgatorySize( 0 );
cattr.setDiskPath( "target/test-sandbox/BreakIndexTest" );
- IndexedDiskCache<String, String> disk = new IndexedDiskCache<>( cattr );
+ IndexedDiskCache<String, String> disk = new IndexedDiskCache<String, String>( cattr );
String[] test = { "a", "bb", "ccc", "dddd", "eeeee", "ffffff", "ggggggg", "hhhhhhhhh", "iiiiiiiiii" };
String[] expect = { null, "bb", "ccc", null, null, "ffffff", null, "hhhhhhhhh", "iiiiiiiiii" };
@@ -51,7 +51,7 @@ public class IndexDiskCacheCountUnitTest
for ( int i = 0; i < 6; i++ )
{
- ICacheElement<String, String> element = new CacheElement<>( "testRecycleBin", "key:" + test[i], test[i] );
+ ICacheElement<String, String> element = new CacheElement<String, String>( "testRecycleBin", "key:" + test[i], test[i] );
//System.out.println( "About to add " + "key:" + test[i] + " i = " + i );
disk.processUpdate( element );
}
@@ -66,7 +66,7 @@ public class IndexDiskCacheCountUnitTest
// will not fit.
for ( int i = 7; i < 9; i++ )
{
- ICacheElement<String, String> element = new CacheElement<>( "testRecycleBin", "key:" + test[i], test[i] );
+ ICacheElement<String, String> element = new CacheElement<String, String>( "testRecycleBin", "key:" + test[i], test[i] );
//System.out.println( "About to add " + "key:" + test[i] + " i = " + i );
disk.processUpdate( element );
}
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheSizeUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheSizeUnitTest.java?rev=1860336&r1=1860335&r2=1860336&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheSizeUnitTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheSizeUnitTest.java Wed May 29 12:18:56 2019
@@ -43,7 +43,7 @@ public class IndexDiskCacheSizeUnitTest
cattr.setMaxKeySize( 8); // 1kb DiskTestObject takes 1420 bytes, so 5*1420 = 7100, so to keep 5 ojbects, we need max key size of 8
cattr.setMaxPurgatorySize( 0 );
cattr.setDiskPath( "target/test-sandbox/BreakIndexTest" );
- IndexedDiskCache<String, DiskTestObject> disk = new IndexedDiskCache<>( cattr );
+ IndexedDiskCache<String, DiskTestObject> disk = new IndexedDiskCache<String, DiskTestObject>( cattr );
String[] test = { "a", "bb", "ccc", "dddd", "eeeee", "ffffff", "ggggggg", "hhhhhhhhh", "iiiiiiiiii" };
String[] expect = { null, "bb", "ccc", null, null, "ffffff", null, "hhhhhhhhh", "iiiiiiiiii" };
@@ -52,7 +52,7 @@ public class IndexDiskCacheSizeUnitTest
for ( int i = 0; i < 6; i++ )
{
- ICacheElement<String, DiskTestObject> element = new CacheElement<>( "testRecycleBin", "key:" + test[i], value);
+ ICacheElement<String, DiskTestObject> element = new CacheElement<String, DiskTestObject>( "testRecycleBin", "key:" + test[i], value);
//System.out.println( "About to add " + "key:" + test[i] + " i = " + i );
disk.processUpdate( element );
}
@@ -67,7 +67,7 @@ public class IndexDiskCacheSizeUnitTest
// will not fit.
for ( int i = 7; i < 9; i++ )
{
- ICacheElement<String, DiskTestObject> element = new CacheElement<>( "testRecycleBin", "key:" + test[i], value);
+ ICacheElement<String, DiskTestObject> element = new CacheElement<String, DiskTestObject>( "testRecycleBin", "key:" + test[i], value);
//System.out.println( "About to add " + "key:" + test[i] + " i = " + i );
disk.processUpdate( element );
}