This is an automated email from the ASF dual-hosted git repository. tv pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-jcs.git
The following commit(s) were added to refs/heads/master by this push: new 11da3aaa Remove deprecated code, fix other deprecations 11da3aaa is described below commit 11da3aaa0b34cd82469b7532361decd0dc73d310 Author: Thomas Vandahl <t...@apache.org> AuthorDate: Thu Aug 24 23:22:09 2023 +0200 Remove deprecated code, fix other deprecations --- .../jcs3/auxiliary/disk/PurgatoryElement.java | 9 +- .../auxiliary/disk/indexed/IndexedDiskCache.java | 28 +--- .../jcs3/auxiliary/lateral/LateralCache.java | 13 -- .../auxiliary/lateral/LateralCacheAttributes.java | 24 --- .../auxiliary/lateral/LateralCacheMonitor.java | 13 -- .../lateral/LateralCacheNoWaitFacade.java | 30 ---- .../lateral/LateralElementDescriptor.java | 8 - .../lateral/behavior/ILateralCacheAttributes.java | 18 --- .../lateral/socket/tcp/LateralTCPCacheFactory.java | 18 --- .../socket/tcp/LateralTCPDiscoveryListener.java | 14 -- .../lateral/socket/tcp/LateralTCPListener.java | 130 ---------------- .../lateral/socket/tcp/LateralTCPSender.java | 15 -- .../lateral/socket/tcp/LateralTCPService.java | 60 -------- .../remote/RemoteCacheFailoverRunner.java | 104 ------------- .../remote/behavior/IRemoteCacheConstants.java | 28 ---- .../remote/server/RegistryKeepAliveRunner.java | 163 --------------------- .../remote/server/RemoteCacheServerAttributes.java | 32 ---- .../behavior/IRemoteCacheServerAttributes.java | 18 --- .../jcs3/engine/CacheElementSerialized.java | 86 ++++++++++- .../org/apache/commons/jcs3/engine/CacheGroup.java | 59 -------- .../jcs3/engine/control/CompositeCache.java | 25 ---- .../jcs3/engine/control/CompositeCacheManager.java | 3 +- .../engine/control/event/ElementEventQueue.java | 37 ----- .../jcs3/utils/discovery/UDPCleanupRunner.java | 55 ------- .../jcs3/utils/discovery/UDPDiscoveryManager.java | 23 --- .../jcs3/utils/discovery/UDPDiscoveryReceiver.java | 37 +---- .../jcs3/utils/discovery/UDPDiscoverySender.java | 41 ------ .../utils/discovery/UDPDiscoverySenderThread.java | 149 ------------------- .../jcs3/utils/discovery/UDPDiscoveryService.java | 13 -- .../auxiliary/disk/jdbc/HsqlSetupTableUtil.java | 43 ------ .../jcs3/auxiliary/disk/jdbc/HsqlSetupUtil.java | 81 ++++++++++ .../disk/jdbc/JDBCDiskCacheRemovalUnitTest.java | 56 +++---- .../disk/jdbc/JDBCDiskCacheSharedPoolUnitTest.java | 40 ++--- .../disk/jdbc/JDBCDiskCacheShrinkUnitTest.java | 83 +++-------- .../auxiliary/disk/jdbc/JDBCDiskCacheUnitTest.java | 74 +++------- .../jdbc/hsql/HSQLDiskCacheConcurrentUnitTest.java | 2 - .../mysql/MySQLDiskCacheHsqlBackedUnitTest.java | 40 +---- .../server/RemoteCacheServerFactoryUnitTest.java | 15 -- .../discovery/UDPDiscoverySenderUnitTest.java | 19 +++ src/changes/changes.xml | 5 +- 40 files changed, 274 insertions(+), 1437 deletions(-) diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/PurgatoryElement.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/PurgatoryElement.java index d334e1c6..a8637834 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/PurgatoryElement.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/PurgatoryElement.java @@ -1,7 +1,5 @@ package org.apache.commons.jcs3.auxiliary.disk; -import java.util.Objects; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -21,7 +19,8 @@ import java.util.Objects; * under the License. */ -import org.apache.commons.jcs3.engine.CacheElement; +import java.util.Objects; + import org.apache.commons.jcs3.engine.behavior.ICacheElement; import org.apache.commons.jcs3.engine.behavior.IElementAttributes; @@ -32,8 +31,7 @@ import org.apache.commons.jcs3.engine.behavior.IElementAttributes; * been written to disk. */ public class PurgatoryElement<K, V> - extends CacheElement<K, V> // Remove this superclass in next major release -// implements ICacheElement<K, V> + implements ICacheElement<K, V> { /** Don't change */ private static final long serialVersionUID = -8152034342684135628L; @@ -51,7 +49,6 @@ public class PurgatoryElement<K, V> */ public PurgatoryElement( final ICacheElement<K, V> cacheElement ) { - super(cacheElement.getCacheName(), cacheElement.getKey(), cacheElement.getVal()); this.cacheElement = cacheElement; } diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCache.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCache.java index 4f16181d..2f9a4dc3 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCache.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCache.java @@ -21,12 +21,10 @@ package org.apache.commons.jcs3.auxiliary.disk.indexed; import java.io.File; import java.io.IOException; -import java.io.Serializable; import java.nio.file.Files; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; @@ -175,7 +173,7 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V> // Make a clean file name this.fileName = getCacheName().replaceAll("[^a-zA-Z0-9-_\\.]", "_"); this.keyHash = createInitialKeyMap(); - this.queuedPutList = new ConcurrentSkipListSet<>(new PositionComparator()); + this.queuedPutList = new ConcurrentSkipListSet<>((ded1, ded2) -> Long.compare(ded1.pos, ded2.pos)); this.recycle = new ConcurrentSkipListSet<>(); try @@ -1471,30 +1469,6 @@ public class IndexedDiskCache<K, V> extends AbstractDiskCache<K, V> return dataFile.getFilePath(); } - /** - * Compares IndexedDiskElementDescriptor based on their position. - * <p> - * @deprecated Use lambda instead - */ - @Deprecated - protected static final class PositionComparator implements Comparator<IndexedDiskElementDescriptor>, Serializable - { - /** serialVersionUID */ - private static final long serialVersionUID = -8387365338590814113L; - - /** - * Compares two descriptors based on position. - * <p> - * - * @see java.util.Comparator#compare(Object, Object) - */ - @Override - public int compare(final IndexedDiskElementDescriptor ded1, final IndexedDiskElementDescriptor ded2) - { - return Long.compare(ded1.pos, ded2.pos); - } - } - /** * Class for recycling and lru. This implements the LRU overflow callback, so we can add items * to the recycle bin. This class counts the size element to decide, when to throw away an element diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCache.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCache.java index d4055e22..53142461 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCache.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCache.java @@ -73,19 +73,6 @@ public class LateralCache<K, V> this.monitor = monitor; } - /** - * Constructor for the LateralCache object - * <p> - * @param cattr - * - * @deprecated Causes NPE - */ - @Deprecated - public LateralCache( final ILateralCacheAttributes cattr ) - { - this(cattr, null, null); - } - /** * Update lateral. * <p> diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheAttributes.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheAttributes.java index 48358b05..26c464bd 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheAttributes.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheAttributes.java @@ -186,30 +186,6 @@ public class LateralCacheAttributes return this.transmissionType; } - /** - * Sets the transmissionTypeName attribute of the LateralCacheAttributes object - * @param val The new transmissionTypeName value - * @deprecated - */ - @Override - @Deprecated - public void setTransmissionTypeName( final String val ) - { - this.transmissionType = Type.valueOf(val); - } - - /** - * Gets the transmissionTypeName attribute of the LateralCacheAttributes object - * @return The transmissionTypeName value - * @deprecated - */ - @Override - @Deprecated - public String getTransmissionTypeName() - { - return this.transmissionType.toString(); - } - /** * Sets the outgoingOnlyMode attribute of the ILateralCacheAttributes. When this is true the * lateral cache will only issue put and remove order and will not try to retrieve elements from diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheMonitor.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheMonitor.java index 6f7274ac..e57048f8 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheMonitor.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheMonitor.java @@ -47,19 +47,6 @@ public class LateralCacheMonitor extends AbstractAuxiliaryCacheMonitor */ private final LateralTCPCacheFactory factory; - /** - * Allows close classes, ie testers to set the idle period to something testable. - * <p> - * @param idlePeriod - * - * @deprecated Use setIdlePeriod() - */ - @Deprecated - protected static void forceShortIdlePeriod( final long idlePeriod ) - { - LateralCacheMonitor.setIdlePeriod(idlePeriod); - } - /** * Constructor for the LateralCacheMonitor object * <p> diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheNoWaitFacade.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheNoWaitFacade.java index bc13671f..43205bbd 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheNoWaitFacade.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralCacheNoWaitFacade.java @@ -21,7 +21,6 @@ package org.apache.commons.jcs3.auxiliary.lateral; import java.io.IOException; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -57,13 +56,6 @@ public class LateralCacheNoWaitFacade<K, V> /** The logger */ private static final Log log = LogManager.getLog( LateralCacheNoWaitFacade.class ); - /** - * The queuing facade to the client. - * @deprecated Should not have been public in the first place - */ - @Deprecated - public LateralCacheNoWait<K, V>[] noWaits; - /** * The queuing facade to the client. */ @@ -81,21 +73,6 @@ public class LateralCacheNoWaitFacade<K, V> /** Disposed state of this facade */ private final AtomicBoolean disposed = new AtomicBoolean(false); - /** - * Constructs with the given lateral cache, and fires events to any listeners. - * <p> - * @param listener the cache listener - * @param noWaits the array of noWaits - * @param cattr the configuration - * - * @deprecated Use list constructor - */ - @Deprecated - public LateralCacheNoWaitFacade(final ILateralCacheListener<K, V> listener, final LateralCacheNoWait<K, V>[] noWaits, final ILateralCacheAttributes cattr ) - { - this(listener, Arrays.asList(noWaits), cattr); - } - /** * Constructs with the given lateral cache, and fires events to any listeners. * <p> @@ -104,13 +81,11 @@ public class LateralCacheNoWaitFacade<K, V> * @param cattr the configuration * @since 3.1 */ - @SuppressWarnings("unchecked") // No generic arrays in java public LateralCacheNoWaitFacade(final ILateralCacheListener<K, V> listener, final List<LateralCacheNoWait<K, V>> noWaits, final ILateralCacheAttributes cattr ) { log.debug( "CONSTRUCTING NO WAIT FACADE" ); this.listener = listener; - this.noWaits = noWaits.toArray(new LateralCacheNoWait[0]); this.noWaitMap = new ConcurrentHashMap<>(); noWaits.forEach(noWait -> noWaitMap.put(noWait.getIdentityKey(), noWait)); this.cacheName = cattr.getCacheName(); @@ -158,7 +133,6 @@ public class LateralCacheNoWaitFacade<K, V> * @param noWait * @return true if it wasn't already contained */ - @SuppressWarnings("unchecked") // No generic arrays in Java public synchronized boolean addNoWait( final LateralCacheNoWait<K, V> noWait ) { if ( noWait == null ) @@ -175,8 +149,6 @@ public class LateralCacheNoWaitFacade<K, V> return false; } - noWaits = noWaitMap.values().toArray(new LateralCacheNoWait[0]); - return true; } @@ -204,7 +176,6 @@ public class LateralCacheNoWaitFacade<K, V> * @return true if it was already in the array * @since 3.1 */ - @SuppressWarnings("unchecked") // No generic arrays in java public synchronized boolean removeNoWait(final String tcpServer) { if (tcpServer == null) @@ -213,7 +184,6 @@ public class LateralCacheNoWaitFacade<K, V> } final LateralCacheNoWait<K,V> contained = noWaitMap.remove(tcpServer); - noWaits = noWaitMap.values().toArray(new LateralCacheNoWait[0]); if (contained != null) { diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralElementDescriptor.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralElementDescriptor.java index 012c2403..a55c2f1f 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralElementDescriptor.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/LateralElementDescriptor.java @@ -51,14 +51,6 @@ public class LateralElementDescriptor<K, V> */ public int valHashCode = -1; - /** Constructor for the LateralElementDescriptor object - * @deprecated - */ - @Deprecated // Not used - public LateralElementDescriptor() - { - } - /** * Constructor for the LateralElementDescriptor object * <p> diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/behavior/ILateralCacheAttributes.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/behavior/ILateralCacheAttributes.java index 8930afdb..f7178047 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/behavior/ILateralCacheAttributes.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/behavior/ILateralCacheAttributes.java @@ -151,24 +151,6 @@ public interface ILateralCacheAttributes */ Type getTransmissionType(); - /** - * Sets the transmissionTypeName attribute of the ILateralCacheAttributes object - * <p> - * @param val The new transmissionTypeName value - * @deprecated Use setTransmissionType() - */ - @Deprecated - void setTransmissionTypeName( String val ); - - /** - * Gets the transmissionTypeName attribute of the ILateralCacheAttributes object - * <p> - * @return The transmissionTypeName value - * @deprecated Use getTransmissionType - */ - @Deprecated - String getTransmissionTypeName(); - /** * Sets the putOnlyMode attribute of the ILateralCacheAttributes. When this is true the lateral * cache will only issue put and remove order and will not try to retrieve elements from other diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java index 1ac02fae..67bfcf50 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java @@ -44,7 +44,6 @@ import org.apache.commons.jcs3.log.Log; import org.apache.commons.jcs3.log.LogManager; import org.apache.commons.jcs3.utils.discovery.UDPDiscoveryManager; import org.apache.commons.jcs3.utils.discovery.UDPDiscoveryService; -import org.apache.commons.jcs3.utils.serialization.StandardSerializer; /** * Constructs a LateralCacheNoWaitFacade for the given configuration. Each lateral service / local @@ -213,23 +212,6 @@ public class LateralTCPCacheFactory } } - /** - * Returns an instance of the cache service. - * <p> - * @param <K> cache key type - * @param <V> cache value type - * @param lca configuration for the creation of a new service instance - * - * @return ICacheServiceNonLocal<K, V> - * - * @deprecated Specify serializer - */ - @Deprecated - public <K, V> ICacheServiceNonLocal<K, V> getCSNLInstance( final ITCPLateralCacheAttributes lca ) - { - return getCSNLInstance(lca, new StandardSerializer()); - } - /** * Returns an instance of the cache service. * <p> diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListener.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListener.java index daf34c16..2fcf4ed1 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListener.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListener.java @@ -27,7 +27,6 @@ import java.util.concurrent.CopyOnWriteArrayList; import org.apache.commons.jcs3.auxiliary.lateral.LateralCacheNoWait; import org.apache.commons.jcs3.auxiliary.lateral.LateralCacheNoWaitFacade; import org.apache.commons.jcs3.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes; -import org.apache.commons.jcs3.engine.behavior.ICompositeCacheManager; import org.apache.commons.jcs3.engine.behavior.IElementSerializer; import org.apache.commons.jcs3.engine.control.CompositeCacheManager; import org.apache.commons.jcs3.engine.logging.behavior.ICacheEventLogger; @@ -73,19 +72,6 @@ public class LateralTCPDiscoveryListener /** Reference to the cache element serializer for auxiliary cache creation */ private final IElementSerializer elementSerializer; - /** - * This plugs into the udp discovery system. It will receive add and remove events. - * <p> - * @param factoryName the name of the related cache factory - * @param cacheManager the global cache manager - * @deprecated Use constructor with four parameters - */ - @Deprecated - protected LateralTCPDiscoveryListener( final String factoryName, final ICompositeCacheManager cacheManager ) - { - this(factoryName, (CompositeCacheManager) cacheManager, null, null); - } - /** * This plugs into the udp discovery system. It will receive add and remove events. * <p> diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPListener.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPListener.java index 18d5a03a..28c94b53 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPListener.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPListener.java @@ -20,11 +20,7 @@ package org.apache.commons.jcs3.auxiliary.lateral.socket.tcp; */ import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; import java.net.InetSocketAddress; -import java.net.ServerSocket; -import java.net.Socket; import java.net.SocketAddress; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; @@ -47,7 +43,6 @@ import org.apache.commons.jcs3.engine.behavior.IShutdownObserver; import org.apache.commons.jcs3.engine.control.CompositeCache; import org.apache.commons.jcs3.log.Log; import org.apache.commons.jcs3.log.LogManager; -import org.apache.commons.jcs3.utils.serialization.StandardSerializer; /** * Listens for connections from other TCP lateral caches and handles them. The initialization method @@ -102,33 +97,6 @@ public class LateralTCPListener<K, V> /** is this terminated? */ private final AtomicBoolean terminated = new AtomicBoolean(); - /** - * Gets the instance attribute of the LateralCacheTCPListener class. - * <p> - * @param ilca ITCPLateralCacheAttributes - * @param cacheMgr - * @return The instance value - * @deprecated Specify serializer - */ - @Deprecated - @SuppressWarnings("unchecked") // Need to cast because of common map for all instances - public static <K, V> LateralTCPListener<K, V> - getInstance( final ITCPLateralCacheAttributes ilca, final ICompositeCacheManager cacheMgr) - { - return (LateralTCPListener<K, V>) instances.computeIfAbsent( - String.valueOf( ilca.getTcpListenerPort() ), - k -> { - final LateralTCPListener<K, V> newIns = new LateralTCPListener<>( ilca, new StandardSerializer() ); - - newIns.init(); - newIns.setCacheManager( cacheMgr ); - - log.info("Created new listener {0}", ilca::getTcpListenerPort); - - return newIns; - }); - } - /** * Gets the instance attribute of the LateralCacheTCPListener class. * <p> @@ -467,36 +435,6 @@ public class LateralTCPListener<K, V> return tcpLateralCacheAttributes; } - /** - * Processes commands from the server socket. There should be one listener for each configured - * TCP lateral. - * @deprecated No longer used - */ - @Deprecated - public class ListenerThread - extends Thread - { - /** The socket listener */ - private final ServerSocket serverSocket; - - /** - * Constructor - * - * @param serverSocket - */ - public ListenerThread(final ServerSocket serverSocket) - { - this.serverSocket = serverSocket; - } - - /** Main processing method for the ListenerThread object */ - @Override - public void run() - { - runListener(serverSocket.getChannel()); - } - } - /** * Processes commands from the server socket. There should be one listener for each configured * TCP lateral. @@ -587,74 +525,6 @@ public class LateralTCPListener<K, V> } } - /** - * A Separate thread that runs when a command comes into the LateralTCPReceiver. - * @deprecated No longer used - */ - @Deprecated - public class ConnectionHandler - implements Runnable - { - /** The socket connection, passed in via constructor */ - private final Socket socket; - - /** - * Construct for a given socket - * @param socket - */ - public ConnectionHandler( final Socket socket ) - { - this.socket = socket; - } - - /** - * Main processing method for the LateralTCPReceiverConnection object - */ - @Override - public void run() - { - try (InputStream is = socket.getInputStream()) - { - while ( true ) - { - final LateralElementDescriptor<K, V> led = - serializer.deSerializeFrom(is, null); - - if ( led == null ) - { - log.debug( "LateralElementDescriptor is null" ); - continue; - } - if ( led.getRequesterId() == getListenerId() ) - { - log.debug( "from self" ); - } - else - { - log.debug( "receiving LateralElementDescriptor from another led = {0}", - led ); - - Object obj = handleElement(led); - if (obj != null) - { - OutputStream os = socket.getOutputStream(); - serializer.serializeTo(obj, os); - os.flush(); - } - } - } - } - catch (final IOException e) - { - log.info("Caught {0}, closing connection.", e.getClass().getSimpleName(), e); - } - catch (final ClassNotFoundException e) - { - log.error( "Deserialization failed reading from socket", e ); - } - } - } - /** * A Separate thread that runs when a command comes into the LateralTCPReceiver. */ diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPSender.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPSender.java index 60fad67e..a5a29ad4 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPSender.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPSender.java @@ -34,7 +34,6 @@ import org.apache.commons.jcs3.auxiliary.lateral.socket.tcp.behavior.ITCPLateral import org.apache.commons.jcs3.engine.behavior.IElementSerializer; import org.apache.commons.jcs3.log.Log; import org.apache.commons.jcs3.log.LogManager; -import org.apache.commons.jcs3.utils.serialization.StandardSerializer; /** * This class is based on the log4j SocketAppender class. I'm using a different repair structure, so @@ -61,20 +60,6 @@ public class LateralTCPSender /** Use to synchronize multiple threads that may be trying to get. */ private final Lock lock = new ReentrantLock(true); - /** - * Constructor for the LateralTCPSender object. - * <p> - * @param lca - * @throws IOException - * @deprecated Specify serializer - */ - @Deprecated - public LateralTCPSender( final ITCPLateralCacheAttributes lca ) - throws IOException - { - this(lca, new StandardSerializer()); - } - /** * Constructor for the LateralTCPSender object. * <p> diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPService.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPService.java index 855f3cb8..5a8f8508 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPService.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/lateral/socket/tcp/LateralTCPService.java @@ -19,10 +19,7 @@ package org.apache.commons.jcs3.auxiliary.lateral.socket.tcp; * under the License. */ -import java.io.BufferedReader; import java.io.IOException; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -38,7 +35,6 @@ import org.apache.commons.jcs3.engine.behavior.ICacheServiceNonLocal; import org.apache.commons.jcs3.engine.behavior.IElementSerializer; import org.apache.commons.jcs3.log.Log; import org.apache.commons.jcs3.log.LogManager; -import org.apache.commons.jcs3.utils.serialization.StandardSerializer; /** * A lateral cache service implementation. Does not implement getGroupKey @@ -61,21 +57,6 @@ public class LateralTCPService<K, V> /** use the vmid by default */ private long listenerId = CacheInfo.listenerId; - /** - * Constructor for the LateralTCPService object - * <p> - * @param lca ITCPLateralCacheAttributes the configuration object - * @throws IOException - * - * @deprecated Specify serializer - */ - @Deprecated - public LateralTCPService( final ITCPLateralCacheAttributes lca ) - throws IOException - { - this(lca, new StandardSerializer()); - } - /** * Constructor for the LateralTCPService object * <p> @@ -401,47 +382,6 @@ public class LateralTCPService<K, V> sender.send( led ); } - /** - * Test - * @param args - * - * @deprecated Use unit tests - */ - @Deprecated - public static void main( final String args[] ) - { - try - { - final LateralTCPSender sender = new LateralTCPSender( new TCPLateralCacheAttributes() ); - - // process user input till done - boolean notDone = true; - String message = null; - // wait to dispose - final BufferedReader br = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8)); - - while ( notDone ) - { - System.out.println( "enter message:" ); - message = br.readLine(); - - if (message == null) - { - notDone = false; - continue; - } - - final CacheElement<String, String> ce = new CacheElement<>( "test", "test", message ); - final LateralElementDescriptor<String, String> led = new LateralElementDescriptor<>( ce ); - sender.send( led ); - } - } - catch ( final IOException e ) - { - System.out.println( e.toString() ); - } - } - /** * @param listernId The listernId to set. */ diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheFailoverRunner.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheFailoverRunner.java deleted file mode 100644 index c63d3a0c..00000000 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/RemoteCacheFailoverRunner.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.apache.commons.jcs3.auxiliary.remote; - -/* - * 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 org.apache.commons.jcs3.auxiliary.AbstractAuxiliaryCacheMonitor; - -/** - * The RemoteCacheFailoverRunner tries to establish a connection with a failover - * server, if any are defined. Once a failover connection is made, it will - * attempt to replace the failover with the primary remote server. - * <p> - * It works by switching out the RemoteCacheNoWait inside the Facade. - * <p> - * Client (i.e.) the CompositeCache has reference to a RemoteCacheNoWaitFacade. - * This facade is created by the RemoteCacheFactory. The factory maintains a set - * of managers, one for each remote server. Typically, there will only be one - * manager. - * <p> - * If you use multiple remote servers, you may want to set one or more as - * failovers. If a local cache cannot connect to the primary server, or looses - * its connection to the primary server, it will attempt to restore that - * Connection in the background. If failovers are defined, the Failover runner - * will try to connect to a failover until the primary is restored. - * - * @deprecated Functionality moved to RemoteCacheNoWaitFacade - */ -@Deprecated -public class RemoteCacheFailoverRunner<K, V> extends AbstractAuxiliaryCacheMonitor -{ - /** The facade returned to the composite cache. */ - private final RemoteCacheNoWaitFacade<K, V> facade; - - /** - * Constructor for the RemoteCacheFailoverRunner object. This allows the - * FailoverRunner to modify the facade that the CompositeCache references. - * - * @param facade the facade the CompositeCache talks to. - * @param cacheFactory the cache factory instance - */ - public RemoteCacheFailoverRunner( final RemoteCacheNoWaitFacade<K, V> facade, final RemoteCacheFactory cacheFactory ) - { - super("JCS-RemoteCacheFailoverRunner"); - this.facade = facade; - setIdlePeriod(20000L); - } - - /** - * Clean up all resources before shutdown - */ - @Override - protected void dispose() - { - // empty - } - - /** - * do actual work - */ - @Override - protected void doWork() - { - // empty - } - - - /** - * Main processing method for the RemoteCacheFailoverRunner object. - * <p> - * If we do not have a connection with any failover server, this will try to - * connect one at a time. If no connection can be made, it goes to sleep for - * a while (20 seconds). - * <p> - * Once a connection with a failover is made, we will try to reconnect to - * the primary server. - * <p> - * The primary server is the first server defines in the FailoverServers - * list. - */ - @Override - public void run() - { - // start the main work of connecting to a failover and then restoring - // the primary. - facade.connectAndRestore(); - } - -} diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/behavior/IRemoteCacheConstants.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/behavior/IRemoteCacheConstants.java index c5f910a4..068bd711 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/behavior/IRemoteCacheConstants.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/behavior/IRemoteCacheConstants.java @@ -47,13 +47,6 @@ public interface IRemoteCacheConstants /** Property prefix, should be jcs.remote but this would break existing config. */ String PROPERTY_PREFIX = "remote"; - /** - * Mapping to props file value - * @deprecated Use CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".rmiSocketFactoryTimeoutMillis" - */ - @Deprecated - String SOCKET_TIMEOUT_MILLIS = PROPERTY_PREFIX + ".cache.rmiSocketFactoryTimeoutMillis"; - /** Mapping to props file value */ String REMOTE_CACHE_SERVICE_NAME = PROPERTY_PREFIX + ".cache.service.name"; @@ -62,25 +55,4 @@ public interface IRemoteCacheConstants /** Mapping to props file value */ String TOMCAT_ON = PROPERTY_PREFIX + ".tomcat.on"; - - /** - * Mapping to props file value - * @deprecated Use CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".servicePort" - */ - @Deprecated - String REMOTE_CACHE_SERVICE_PORT = PROPERTY_PREFIX + ".cache.service.port"; - - /** - * Mapping to props file value - * @deprecated Use CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".localClusterConsistency" - */ - @Deprecated - String REMOTE_LOCAL_CLUSTER_CONSISTENCY = PROPERTY_PREFIX + ".cluster.LocalClusterConsistency"; - - /** - * Mapping to props file value - * @deprecated Use CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".allowClusterGet" - */ - @Deprecated - String REMOTE_ALLOW_CLUSTER_GET = PROPERTY_PREFIX + ".cluster.AllowClusterGet"; } diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RegistryKeepAliveRunner.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RegistryKeepAliveRunner.java deleted file mode 100644 index ec369a64..00000000 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RegistryKeepAliveRunner.java +++ /dev/null @@ -1,163 +0,0 @@ -package org.apache.commons.jcs3.auxiliary.remote.server; - -/* - * 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.rmi.Remote; -import java.rmi.RemoteException; -import java.rmi.registry.Registry; - -import org.apache.commons.jcs3.auxiliary.remote.RemoteUtils; -import org.apache.commons.jcs3.engine.logging.behavior.ICacheEventLogger; -import org.apache.commons.jcs3.log.Log; -import org.apache.commons.jcs3.log.LogManager; - -/** - * This class tries to keep the registry alive. If if is able to create a registry, it will also - * rebind the remote cache server. - * @deprecated Functionality moved to RemoteCacheServerFactory - */ -@Deprecated -public class RegistryKeepAliveRunner - implements Runnable -{ - /** The logger */ - private static final Log log = LogManager.getLog( RegistryKeepAliveRunner.class ); - - /** the host on which to start the registry */ - private final String registryHost; - - /** the port on which to start the registry */ - private final int registryPort; - - /** An optional event logger */ - private ICacheEventLogger cacheEventLogger; - - /** the registry */ - private Registry registry; - - /** - * @param registryHost - Hostname of the registry - * @param registryPort - the port on which to start the registry - * @param serviceName - */ - public RegistryKeepAliveRunner( final String registryHost, final int registryPort, final String serviceName ) - { - this.registryHost = registryHost; - this.registryPort = registryPort; - } - - /** - * Tries to lookup the server. If unsuccessful it will rebind the server using the factory - * rebind method. - * <p> - */ - @Override - public void run() - { - checkAndRestoreIfNeeded(); - } - - /** - * Tries to lookup the server. If unsuccessful it will rebind the server using the factory - * rebind method. - */ - protected void checkAndRestoreIfNeeded() - { - RemoteCacheServerFactory.keepAlive(registryHost, registryPort, cacheEventLogger); - } - - /** - * Creates the registry and registers the server. - * <p> - * @param serviceName the service name - */ - protected void createAndRegister( final String serviceName ) - { - createReqistry( serviceName ); - registerServer( serviceName ); - } - - /** - * Try to create the registry. Log errors - * <p> - * @param serviceName the service name - */ - protected void createReqistry( final String serviceName ) - { - // TODO: Refactor method signature. This is ugly but required to keep the binary API compatibility - this.registry = RemoteUtils.createRegistry(registryPort); - - if ( cacheEventLogger != null ) - { - if (this.registry != null) - { - cacheEventLogger.logApplicationEvent( "RegistryKeepAliveRunner", "createRegistry", - "Successfully created registry [" + serviceName + "]." ); - } - else - { - cacheEventLogger.logError( "RegistryKeepAliveRunner", "createRegistry", - "Could not start registry [" + serviceName + "]." ); - } - } - } - - /** - * Try to rebind the server. - * <p> - * @param serviceName the service name - */ - protected void registerServer( final String serviceName ) - { - try - { - // try to rebind anyway - final Remote server = RemoteCacheServerFactory.getRemoteCacheServer(); - RemoteCacheServerFactory.registerServer(serviceName, server); - - final String message = "Successfully rebound server to registry [" + serviceName + "]."; - if ( cacheEventLogger != null ) - { - cacheEventLogger.logApplicationEvent( "RegistryKeepAliveRunner", "registerServer", message ); - } - log.info( message ); - } - catch ( final RemoteException e ) - { - final String message = "Could not rebind server to registry [" + serviceName + "]."; - log.error( message, e ); - if ( cacheEventLogger != null ) - { - cacheEventLogger.logError( "RegistryKeepAliveRunner", "registerServer", message + ":" - + e.getMessage() ); - } - } - } - - /** - * Allows it to be injected. - * <p> - * @param cacheEventLogger - */ - public void setCacheEventLogger( final ICacheEventLogger cacheEventLogger ) - { - this.cacheEventLogger = cacheEventLogger; - } -} diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServerAttributes.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServerAttributes.java index bda89e42..f7c7028d 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServerAttributes.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServerAttributes.java @@ -41,12 +41,6 @@ public class RemoteCacheServerAttributes /** The config file, the initialization is multistage. Remote cache then composite cache. */ private String configFileName = ""; - /** Should we start the registry */ - private final static boolean DEFAULT_START_REGISTRY = true; - - /** Should we start the registry */ - private boolean startRegistry = DEFAULT_START_REGISTRY; - /** Should we try to keep the registry alive */ private final static boolean DEFAULT_USE_REGISTRY_KEEP_ALIVE = true; @@ -138,32 +132,6 @@ public class RemoteCacheServerAttributes this.useRegistryKeepAlive = useRegistryKeepAlive; } - /** - * Should we start the registry - * <p> - * @param startRegistry the startRegistry to set - * @deprecated Always true, to be removed - */ - @Deprecated - @Override - public void setStartRegistry( final boolean startRegistry ) - { - this.startRegistry = startRegistry; - } - - /** - * Should we start the registry - * <p> - * @return the startRegistry - * @deprecated Always true, to be removed - */ - @Deprecated - @Override - public boolean isStartRegistry() - { - return startRegistry; - } - /** * Should we try to keep the registry alive * <p> diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/behavior/IRemoteCacheServerAttributes.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/behavior/IRemoteCacheServerAttributes.java index 830be83e..fcdaccfc 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/behavior/IRemoteCacheServerAttributes.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/behavior/IRemoteCacheServerAttributes.java @@ -85,24 +85,6 @@ public interface IRemoteCacheServerAttributes */ void setUseRegistryKeepAlive( boolean useRegistryKeepAlive ); - /** - * Should we start the registry - * <p> - * @param startRegistry the startRegistry to set - * @deprecated Always true, to be removed - */ - @Deprecated - void setStartRegistry( boolean startRegistry ); - - /** - * Should we start the registry - * <p> - * @return the startRegistry - * @deprecated Always true, to be removed - */ - @Deprecated - boolean isStartRegistry(); - /** * Should we try to keep the registry alive * <p> diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/engine/CacheElementSerialized.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/engine/CacheElementSerialized.java index f7a5dfb9..3f756f0b 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/engine/CacheElementSerialized.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/engine/CacheElementSerialized.java @@ -27,7 +27,6 @@ import org.apache.commons.jcs3.engine.behavior.IElementAttributes; /** Either serialized value or the value should be null; */ public class CacheElementSerialized<K, V> - extends CacheElement<K, V> implements ICacheElementSerialized<K, V> { /** Don't change. */ @@ -36,6 +35,18 @@ public class CacheElementSerialized<K, V> /** The serialized value. */ private final byte[] serializedValue; + /** The name of the cache region. This is a namespace. */ + private final String cacheName; + + /** This is the cache key by which the value can be referenced. */ + private final K key; + + /** + * These attributes hold information about the element and what it is + * allowed to do. + */ + private IElementAttributes attr; + /** * Constructs a usable wrapper. * <p> @@ -44,11 +55,76 @@ public class CacheElementSerialized<K, V> * @param serializedValueArg * @param elementAttributesArg */ - public CacheElementSerialized( final String cacheNameArg, final K keyArg, final byte[] serializedValueArg, - final IElementAttributes elementAttributesArg ) + public CacheElementSerialized( final String cacheName, final K key, final byte[] serializedValue, + final IElementAttributes elementAttributes) + { + this.cacheName = cacheName; + this.key = key; + this.serializedValue = serializedValue; + this.attr = elementAttributes; + } + + /** + * Gets the cacheName attribute of the CacheElement object + * <p> + * @return The cacheName value + */ + @Override + public String getCacheName() + { + return this.cacheName; + } + + /** + * Gets the key attribute of the CacheElement object + * <p> + * @return The key value + */ + @Override + public K getKey() + { + return this.key; + } + + /** + * Gets the val attribute of the CacheElement object + * <p> + * @return The val value + */ + @Override + public V getVal() { - super(cacheNameArg, keyArg, null, elementAttributesArg); - this.serializedValue = serializedValueArg; + return null; + } + + /** + * Sets the attributes attribute of the CacheElement object + * <p> + * @param attr + * The new IElementAttributes value + */ + @Override + public void setElementAttributes( final IElementAttributes attr ) + { + this.attr = attr; + } + + /** + * Gets the IElementAttributes attribute of the CacheElement object + * <p> + * @return The IElementAttributes value, never null + */ + @Override + public IElementAttributes getElementAttributes() + { + // create default attributes if they are null + // this shouldn't happen, but could if a corrupt + // object was sent over the wire. + if ( this.attr == null ) + { + this.attr = new ElementAttributes(); + } + return this.attr; } /** @return byte[] */ diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/engine/CacheGroup.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/engine/CacheGroup.java deleted file mode 100644 index 0c797065..00000000 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/engine/CacheGroup.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.apache.commons.jcs3.engine; - -/* - * 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 org.apache.commons.jcs3.engine.behavior.IElementAttributes; - -/** - * Holder for attributes specific to a group. - * @deprecated The grouping functionality is on the way out. - */ -@Deprecated -public class CacheGroup -{ - /** Element configuration. */ - private IElementAttributes attr; - - /** Constructor for the CacheGroup object */ - public CacheGroup() - { - } - - /** - * Sets the attributes attribute of the CacheGroup object - * <p> - * @param attr - * The new attributes value - */ - public void setElementAttributes( final IElementAttributes attr ) - { - this.attr = attr; - } - - /** - * Gets the attributes attribute of the CacheGroup object - * <p> - * @return The attributes value - */ - public IElementAttributes getElementAttrributes() - { - return attr; - } -} diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/engine/control/CompositeCache.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/engine/control/CompositeCache.java index b99ca36f..c2ed60e7 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/engine/control/CompositeCache.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/engine/control/CompositeCache.java @@ -206,18 +206,6 @@ public class CompositeCache<K, V> .collect(Collectors.toCollection(CopyOnWriteArrayList::new)); } - /** - * This sets the list of auxiliary caches for this region. - * <p> - * @param auxCaches - * @deprecated Use List method - */ - @Deprecated - public void setAuxCaches(final AuxiliaryCache<K, V>[] auxCaches) - { - setAuxCaches(Arrays.asList(auxCaches)); - } - /** * Get the list of auxiliary caches for this region. * <p> @@ -229,19 +217,6 @@ public class CompositeCache<K, V> return this.auxCaches; } - /** - * Get the list of auxiliary caches for this region. - * <p> - * @return an array of auxiliary caches, may be empty, never null - * @deprecated Use List method - */ - @SuppressWarnings("unchecked") // No generic arrays in Java - @Deprecated - public AuxiliaryCache<K, V>[] getAuxCaches() - { - return getAuxCacheList().toArray(new AuxiliaryCache[0]); - } - /** * Standard update method. * <p> diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/engine/control/CompositeCacheManager.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/engine/control/CompositeCacheManager.java index 63d11775..66183701 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/engine/control/CompositeCacheManager.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/engine/control/CompositeCacheManager.java @@ -22,7 +22,6 @@ package org.apache.commons.jcs3.engine.control; import java.io.IOException; import java.io.InputStream; import java.lang.management.ManagementFactory; -import java.security.AccessControlException; import java.util.List; import java.util.Objects; import java.util.Properties; @@ -252,7 +251,7 @@ public class CompositeCacheManager { Runtime.getRuntime().addShutdownHook( shutdownHook ); } - catch ( final AccessControlException e ) + catch ( final SecurityException e ) { log.error( "Could not register shutdown hook.", e ); } diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/engine/control/event/ElementEventQueue.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/engine/control/event/ElementEventQueue.java index 3cb957bf..4c9a1c53 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/engine/control/event/ElementEventQueue.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/engine/control/event/ElementEventQueue.java @@ -96,41 +96,4 @@ public class ElementEventQueue queueProcessor.execute(() -> hand.handleElementEvent(event)); } } - - // /////////////////////////// Inner classes ///////////////////////////// - - /** - * Retries before declaring failure. - * @deprecated No longer used - */ - @Deprecated - protected abstract class AbstractElementEventRunner - implements Runnable - { - /** - * Main processing method for the AbstractElementEvent object - */ - @Override - public void run() - { - try - { - doRun(); - // happy and done. - } - catch ( final IOException e ) - { - // Too bad. The handler has problems. - log.warn( "Giving up element event handling {0}", ElementEventQueue.this, e ); - } - } - - /** - * This will do the work or trigger the work to be done. - * <p> - * @throws IOException - */ - protected abstract void doRun() - throws IOException; - } } diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPCleanupRunner.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPCleanupRunner.java deleted file mode 100644 index 4de39a36..00000000 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPCleanupRunner.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.apache.commons.jcs3.utils.discovery; - -/* - * 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. - */ - -/** - * This class periodically check the lastHeardFrom time on the services. - * <p> - * If they exceed the configurable limit, it removes them from the set. - * </p> - * @deprecated Functionality moved to UDPDiscoveryService - */ -@Deprecated -public class UDPCleanupRunner - implements Runnable -{ - /** UDP discovery service */ - private final UDPDiscoveryService discoveryService; - - /** - * @param service UDPDiscoveryService - */ - public UDPCleanupRunner( final UDPDiscoveryService service ) - { - this.discoveryService = service; - } - - /** - * This goes through the list of services and removes those that we haven't heard from in longer - * than the max idle time. - * <p> - * @see Runnable#run() - */ - @Override - public void run() - { - discoveryService.cleanup(); - } -} diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryManager.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryManager.java index a00ec5db..3c0d217f 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryManager.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryManager.java @@ -27,7 +27,6 @@ import org.apache.commons.jcs3.engine.behavior.IElementSerializer; import org.apache.commons.jcs3.engine.behavior.IProvideScheduler; import org.apache.commons.jcs3.log.Log; import org.apache.commons.jcs3.log.LogManager; -import org.apache.commons.jcs3.utils.serialization.StandardSerializer; /** * This manages UDPDiscovery Services. We should end up with one service per Lateral Cache Manager @@ -60,28 +59,6 @@ public class UDPDiscoveryManager return INSTANCE; } - - /** - * Creates a service for the address and port if one doesn't exist already. - * <p> - * We need to key this using the listener port too. - * TODO think of making one discovery service work for multiple types of clients. - * <p> - * @param discoveryAddress - * @param discoveryPort - * @param servicePort - * @param cacheMgr - * @return UDPDiscoveryService - * @deprecated Specify serializer implementation explicitly, allow to specify udpTTL - */ - @Deprecated - public UDPDiscoveryService getService( final String discoveryAddress, final int discoveryPort, final int servicePort, - final ICompositeCacheManager cacheMgr ) - { - return getService(discoveryAddress, discoveryPort, null, servicePort, 0, - cacheMgr, new StandardSerializer()); - } - /** * Creates a service for the address and port if one doesn't exist already. * <p> diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryReceiver.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryReceiver.java index 573197e9..17da8356 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryReceiver.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryReceiver.java @@ -193,14 +193,12 @@ public class UDPDiscoveryReceiver new ArrayBlockingQueue<>(maxPoolSize); /** - * Wait for multicast message + * Wait for multicast message (used for testing) * * @return the object message * @throws IOException - * @deprecated no longer used */ - @Deprecated - public Object waitForMessage() + protected Object waitForMessage() throws IOException { try @@ -273,7 +271,7 @@ public class UDPDiscoveryReceiver log.debug( "Read object from address [{0}], object=[{1}]", sourceAddress, obj ); - // Just to keep the functionality of the deprecated waitForMessage method + // Just to keep the functionality of the test waitForMessage method synchronized (msgQueue) { // Check if queue full already? @@ -333,35 +331,6 @@ public class UDPDiscoveryReceiver this.serializer = serializer; } - /** - * Separate thread run when a command comes into the UDPDiscoveryReceiver. - * @deprecated No longer used - */ - @Deprecated - public class MessageHandler - implements Runnable - { - /** The message to handle. Passed in during construction. */ - private final UDPDiscoveryMessage message; - - /** - * @param message - */ - public MessageHandler( final UDPDiscoveryMessage message ) - { - this.message = message; - } - - /** - * Process the message. - */ - @Override - public void run() - { - handleMessage(message); - } - } - /** * Separate thread run when a command comes into the UDPDiscoveryReceiver. */ diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoverySender.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoverySender.java index 90f42dfc..81bd3f6c 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoverySender.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoverySender.java @@ -19,7 +19,6 @@ package org.apache.commons.jcs3.utils.discovery; * under the License. */ -import java.io.ByteArrayOutputStream; import java.io.IOException; import java.net.DatagramPacket; import java.net.InetAddress; @@ -33,7 +32,6 @@ import org.apache.commons.jcs3.log.Log; import org.apache.commons.jcs3.log.LogManager; import org.apache.commons.jcs3.utils.discovery.UDPDiscoveryMessage.BroadcastType; import org.apache.commons.jcs3.utils.net.HostNameUtil; -import org.apache.commons.jcs3.utils.serialization.StandardSerializer; /** * This is a generic sender for the UDPDiscovery process. @@ -55,26 +53,6 @@ public class UDPDiscoverySender implements AutoCloseable /** Used to serialize messages */ private final IElementSerializer serializer; - /** - * Constructor for the UDPDiscoverySender object - * <p> - * This sender can be used to send multiple messages. - * <p> - * When you are done sending, you should destroy the socket sender. - * <p> - * @param host - * @param port - * @param udpTTL the Datagram packet time-to-live - * @throws IOException - * @deprecated Specify serializer implementation explicitly - */ - @Deprecated - public UDPDiscoverySender( final String host, final int port, final int udpTTL ) - throws IOException - { - this(null, host, port, udpTTL, new StandardSerializer()); - } - /** * Constructor for the UDPDiscoverySender object * <p> @@ -298,22 +276,3 @@ public class UDPDiscoverySender implements AutoCloseable send( message ); } } - -/** - * This allows us to get the byte array from an output stream. - * - * @deprecated No longer used - */ -@Deprecated -class MyByteArrayOutputStream - extends ByteArrayOutputStream -{ - /** - * Gets the bytes attribute of the MyByteArrayOutputStream object - * @return The bytes value - */ - public byte[] getBytes() - { - return buf; - } -} diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoverySenderThread.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoverySenderThread.java deleted file mode 100644 index e6d3ee9a..00000000 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoverySenderThread.java +++ /dev/null @@ -1,149 +0,0 @@ -package org.apache.commons.jcs3.utils.discovery; - -/* - * 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.IOException; -import java.util.ArrayList; - -import org.apache.commons.jcs3.log.Log; -import org.apache.commons.jcs3.log.LogManager; - -/** - * Used to periodically broadcast our location to other caches that might be listening. - * @deprecated Functionality moved to UDPDiscoveryService - */ -@Deprecated -public class UDPDiscoverySenderThread - implements Runnable -{ - /** The logger. */ - private static final Log log = LogManager.getLog( UDPDiscoverySenderThread.class ); - - /** - * details of the host, port, and service being advertised to listen for TCP socket connections - */ - private final UDPDiscoveryAttributes attributes; - - /** List of known regions. */ - private ArrayList<String> cacheNames = new ArrayList<>(); - - /** - * @param cacheNames The cacheNames to set. - */ - protected void setCacheNames( final ArrayList<String> cacheNames ) - { - log.info( "Resetting cacheNames = [{0}]", cacheNames ); - this.cacheNames = cacheNames; - } - - /** - * @return Returns the cacheNames. - */ - protected ArrayList<String> getCacheNames() - { - return cacheNames; - } - - /** - * Constructs the sender with the port to tell others to connect to. - * <p> - * On construction the sender will request that the other caches let it know their addresses. - * @param attributes host, port, etc. - * @param cacheNames List of strings of the names of the region participating. - */ - public UDPDiscoverySenderThread( final UDPDiscoveryAttributes attributes, final ArrayList<String> cacheNames ) - { - this.attributes = attributes; - - this.cacheNames = cacheNames; - - log.debug( "Creating sender thread for discoveryAddress = [{0}] and " - + "discoveryPort = [{1}] myHostName = [{2}] and port = [{3}]", - attributes::getUdpDiscoveryAddr, - attributes::getUdpDiscoveryPort, - attributes::getServiceAddress, - attributes::getServicePort); - - try (UDPDiscoverySender sender = new UDPDiscoverySender( - attributes.getUdpDiscoveryAddr(), - attributes.getUdpDiscoveryPort(), - attributes.getUdpTTL())) - { - // move this to the run method and determine how often to call it. - sender.requestBroadcast(); - - log.debug( "Sent a request broadcast to the group" ); - } - catch ( final IOException e ) - { - log.error( "Problem sending a Request Broadcast", e ); - } - } - - /** - * Send a message. - */ - @Override - public void run() - { - // create this connection each time. - // more robust - try (UDPDiscoverySender sender = new UDPDiscoverySender( - attributes.getUdpDiscoveryAddr(), - attributes.getUdpDiscoveryPort(), - attributes.getUdpTTL())) - { - sender.passiveBroadcast( attributes.getServiceAddress(), attributes.getServicePort(), cacheNames ); - - // todo we should consider sending a request broadcast every so - // often. - - log.debug( "Called sender to issue a passive broadcast" ); - } - catch ( final IOException e ) - { - log.error( "Problem calling the UDP Discovery Sender [{0}:{1}]", - attributes.getUdpDiscoveryAddr(), - attributes.getUdpDiscoveryPort(), e ); - } - } - - /** - * Issues a remove broadcast to the others. - */ - protected void shutdown() - { - // create this connection each time. - // more robust - try (UDPDiscoverySender sender = new UDPDiscoverySender( - attributes.getUdpDiscoveryAddr(), - attributes.getUdpDiscoveryPort(), - attributes.getUdpTTL())) - { - sender.removeBroadcast( attributes.getServiceAddress(), attributes.getServicePort(), cacheNames ); - - log.debug( "Called sender to issue a remove broadcast in shutdown." ); - } - catch ( final IOException e ) - { - log.error( "Problem calling the UDP Discovery Sender", e ); - } - } -} diff --git a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryService.java b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryService.java index 68aca9b6..028a8c4a 100644 --- a/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryService.java +++ b/commons-jcs3-core/src/main/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoveryService.java @@ -44,7 +44,6 @@ import org.apache.commons.jcs3.log.Log; import org.apache.commons.jcs3.log.LogManager; import org.apache.commons.jcs3.utils.discovery.behavior.IDiscoveryListener; import org.apache.commons.jcs3.utils.net.HostNameUtil; -import org.apache.commons.jcs3.utils.serialization.StandardSerializer; /** * This service creates a listener that can create lateral caches and add them to the no wait list. @@ -92,18 +91,6 @@ public class UDPDiscoveryService /** Handle to cancel the scheduled cleanup task */ private ScheduledFuture<?> cleanupTaskFuture; - /** - * Constructor - * - * @param attributes settings of the service - * @deprecated Specify serializer implementation explicitly - */ - @Deprecated - public UDPDiscoveryService(final UDPDiscoveryAttributes attributes) - { - this(attributes, new StandardSerializer()); - } - /** * Constructor * diff --git a/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/HsqlSetupTableUtil.java b/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/HsqlSetupTableUtil.java deleted file mode 100644 index 400e35c8..00000000 --- a/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/HsqlSetupTableUtil.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.apache.commons.jcs3.auxiliary.disk.jdbc; - -/* - * 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.sql.Connection; -import java.sql.SQLException; - -import org.apache.commons.jcs3.auxiliary.disk.jdbc.hsql.HSQLDiskCacheFactory; - -/** Can use this to setup a table. */ -public class HsqlSetupTableUtil extends HSQLDiskCacheFactory -{ - /** - * SETUP a TABLE FOR CACHE testing - * <p> - * @param cConn - * @param tableName - * - * @throws SQLException if database problems occur - */ - public static void setupTABLE( final Connection cConn, final String tableName ) throws SQLException - { - final HsqlSetupTableUtil util = new HsqlSetupTableUtil(); - util.setupTable(cConn, tableName); - } -} diff --git a/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/HsqlSetupUtil.java b/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/HsqlSetupUtil.java new file mode 100644 index 00000000..e933b17e --- /dev/null +++ b/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/HsqlSetupUtil.java @@ -0,0 +1,81 @@ +package org.apache.commons.jcs3.auxiliary.disk.jdbc; + +/* + * 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.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.Properties; + +import org.apache.commons.jcs3.auxiliary.disk.jdbc.hsql.HSQLDiskCacheFactory; + +/** Can use this to setup a table. */ +public final class HsqlSetupUtil +{ + private static class HSQLDiskCacheFactoryHelper extends HSQLDiskCacheFactory + { + @Override + protected synchronized void setupTable(Connection cConn, String tableName) throws SQLException + { + super.setupTable(cConn, tableName); + } + }; + + private static HSQLDiskCacheFactoryHelper factory = new HSQLDiskCacheFactoryHelper(); + + /** + * Set up a table for cache testing + * <p> + * @param cConn + * @param tableName + * + * @throws SQLException if database problems occur + */ + public static void setupTable( final Connection cConn, final String tableName ) throws SQLException + { + factory.setupTable(cConn, tableName); + } + + /** + * Connect to the database and return a connection. + * + * @param testProperties test database properties + * @param testDBName name of the test database + * + * @return a connection to the database + * + * @throws Exception + */ + public static Connection getTestDatabaseConnection(final Properties testProperties, final String testDBName) + throws Exception + { + System.setProperty( "hsqldb.cache_scale", "8" ); + + final String rafroot = "target/"; + final String driver = testProperties.getProperty("driver", "org.hsqldb.jdbcDriver"); + final String url = testProperties.getProperty("url", "jdbc:hsqldb:"); + final String database = testProperties.getProperty("database", rafroot + testDBName); + final String user = testProperties.getProperty("user", "sa"); + final String password = testProperties.getProperty("password", ""); + + Class.forName(driver).getDeclaredConstructor().newInstance(); + return DriverManager.getConnection(url + database, user, password); + } +} diff --git a/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheRemovalUnitTest.java b/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheRemovalUnitTest.java index 2868b7f2..c7130e48 100644 --- a/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheRemovalUnitTest.java +++ b/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheRemovalUnitTest.java @@ -20,14 +20,30 @@ package org.apache.commons.jcs3.auxiliary.disk.jdbc; */ import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; import java.util.Properties; import org.apache.commons.jcs3.JCS; import org.apache.commons.jcs3.access.CacheAccess; import junit.framework.TestCase; +/* + * 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. + */ /** Tests for the removal functionality. */ public class JDBCDiskCacheRemovalUnitTest @@ -38,12 +54,17 @@ public class JDBCDiskCacheRemovalUnitTest /** * Test setup + * @throws Exception */ @Override - public void setUp() + public void setUp() throws Exception { System.setProperty( "DATABASE_NAME", databaseName ); JCS.setConfigFilename( "/TestJDBCDiskCacheRemoval.ccf" ); + try (Connection con = HsqlSetupUtil.getTestDatabaseConnection(new Properties(), getClass().getSimpleName())) + { + HsqlSetupUtil.setupTable(con, databaseName); + } } /** @@ -56,8 +77,6 @@ public class JDBCDiskCacheRemovalUnitTest throws Exception { // SETUP - setupDatabase(); - final String keyPart1 = "part1"; final String keyPart2 = "part2"; final String region = "testCache1"; @@ -79,31 +98,4 @@ public class JDBCDiskCacheRemovalUnitTest // System.out.println( jcs.getStats() ); } - - /** - * Create the database. - * @throws InstantiationException - * @throws IllegalAccessException - * @throws ClassNotFoundException - * @throws SQLException - */ - private void setupDatabase() - throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException - { - System.setProperty( "hsqldb.cache_scale", "8" ); - - final String rafroot = "target"; - final Properties p = new Properties(); - final String driver = p.getProperty( "driver", "org.hsqldb.jdbcDriver" ); - final String url = p.getProperty( "url", "jdbc:hsqldb:" ); - final String database = p.getProperty( "database", rafroot + "/JDBCDiskCacheRemovalUnitTest" ); - final String user = p.getProperty( "user", "sa" ); - final String password = p.getProperty( "password", "" ); - - new org.hsqldb.jdbcDriver(); - Class.forName( driver ).newInstance(); - final Connection cConn = DriverManager.getConnection( url + database, user, password ); - - HsqlSetupTableUtil.setupTABLE( cConn, databaseName ); - } } diff --git a/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheSharedPoolUnitTest.java b/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheSharedPoolUnitTest.java index 673e21ab..250e1d88 100644 --- a/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheSharedPoolUnitTest.java +++ b/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheSharedPoolUnitTest.java @@ -18,11 +18,7 @@ package org.apache.commons.jcs3.auxiliary.disk.jdbc; * specific language governing permissions and limitations * under the License. */ - -import junit.framework.TestCase; - import java.sql.Connection; -import java.sql.DriverManager; import java.util.HashSet; import java.util.Map; import java.util.Properties; @@ -32,17 +28,26 @@ import org.apache.commons.jcs3.JCS; import org.apache.commons.jcs3.access.CacheAccess; import org.apache.commons.jcs3.engine.behavior.ICacheElement; +import junit.framework.TestCase; + /** * Runs basic tests for the JDBC disk cache using a shared connection pool. */ public class JDBCDiskCacheSharedPoolUnitTest extends TestCase { - /** Test setup */ + /** Test setup + * @throws Exception + */ @Override - public void setUp() + public void setUp() throws Exception { JCS.setConfigFilename( "/TestJDBCDiskCacheSharedPool.ccf" ); + try (Connection con = HsqlSetupUtil.getTestDatabaseConnection(new Properties(), "cache_hsql_db_sharedpool")) + { + HsqlSetupUtil.setupTable(con, "JCS_STORE_0"); + HsqlSetupUtil.setupTable(con, "JCS_STORE_1"); + } } /** @@ -52,24 +57,6 @@ public class JDBCDiskCacheSharedPoolUnitTest public void testSimpleJDBCPutGetWithHSQL() throws Exception { - System.setProperty( "hsqldb.cache_scale", "8" ); - - final String rafroot = "target"; - final Properties p = new Properties(); - final String driver = p.getProperty( "driver", "org.hsqldb.jdbcDriver" ); - final String url = p.getProperty( "url", "jdbc:hsqldb:" ); - final String database = p.getProperty( "database", rafroot + "/cache_hsql_db_sharedpool" ); - final String user = p.getProperty( "user", "sa" ); - final String password = p.getProperty( "password", "" ); - - new org.hsqldb.jdbcDriver(); - Class.forName( driver ).newInstance(); - final Connection cConn = DriverManager.getConnection( url + database, user, password ); - - HsqlSetupTableUtil.setupTABLE( cConn, "JCS_STORE_0" ); - - HsqlSetupTableUtil.setupTABLE( cConn, "JCS_STORE_1" ); - runTestForRegion( "testCache1", 200 ); } @@ -95,14 +82,9 @@ public class JDBCDiskCacheSharedPoolUnitTest jcs.put( i + ":key", region + " data " + i ); } -// System.out.println( jcs.getStats() ); - Thread.sleep( 1000 ); -// System.out.println( jcs.getStats() ); - // Test that all items are in cache - for ( int i = 0; i <= items; i++ ) { final String value = jcs.get( i + ":key" ); diff --git a/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheShrinkUnitTest.java b/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheShrinkUnitTest.java index 93d21b61..2defc112 100644 --- a/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheShrinkUnitTest.java +++ b/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheShrinkUnitTest.java @@ -23,15 +23,13 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import java.sql.Connection; -import java.sql.DriverManager; import java.util.Properties; -import org.apache.commons.jcs3.utils.timing.SleepUtil; import org.apache.commons.jcs3.JCS; import org.apache.commons.jcs3.access.CacheAccess; import org.apache.commons.jcs3.access.exception.CacheException; +import org.apache.commons.jcs3.utils.timing.SleepUtil; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; /** @@ -39,38 +37,18 @@ import org.junit.Test; */ public class JDBCDiskCacheShrinkUnitTest { - /** - * Creates the DB - * - * @throws Exception - */ - @BeforeClass - public static void setupDatabase() throws Exception - { - System.setProperty( "hsqldb.cache_scale", "8" ); - - final String rafroot = "target"; - final Properties p = new Properties(); - final String driver = p.getProperty( "driver", "org.hsqldb.jdbcDriver" ); - final String url = p.getProperty( "url", "jdbc:hsqldb:" ); - final String database = p.getProperty( "database", rafroot + "/JDBCDiskCacheShrinkUnitTest" ); - final String user = p.getProperty( "user", "sa" ); - final String password = p.getProperty( "password", "" ); - - new org.hsqldb.jdbcDriver(); - Class.forName( driver ).newInstance(); - final Connection cConn = DriverManager.getConnection( url + database, user, password ); - - HsqlSetupTableUtil.setupTABLE( cConn, "JCS_STORE_SHRINK" ); - } - /** * Test setup + * @throws Exception */ @Before - public void setUp() + public void setUp() throws Exception { JCS.setConfigFilename( "/TestJDBCDiskCacheShrink.ccf" ); + try (Connection con = HsqlSetupUtil.getTestDatabaseConnection(new Properties(), getClass().getSimpleName())) + { + HsqlSetupUtil.setupTable(con, "JCS_STORE_SHRINK"); + } } /** @@ -88,24 +66,17 @@ public class JDBCDiskCacheShrinkUnitTest final CacheAccess<String, String> jcsExpire = JCS.getInstance( regionExpire ); -// System.out.println( "BEFORE PUT \n" + jcsExpire.getStats() ); - // Add items to cache - - for ( int i = 0; i <= items; i++ ) + for ( int i = 0; i < items; i++ ) { jcsExpire.put( i + ":key", regionExpire + " data " + i ); } -// System.out.println( jcsExpire.getStats() ); - // the shrinker is supposed to run every second SleepUtil.sleepAtLeast( 3000 ); -// System.out.println( jcsExpire.getStats() ); - // Test that all items have been removed from the cache - for ( int i = 0; i <= items; i++ ) + for ( int i = 0; i < items; i++ ) { assertNull( "Removed key should be null: " + i + ":key", jcsExpire.get( i + ":key" ) ); } @@ -126,24 +97,16 @@ public class JDBCDiskCacheShrinkUnitTest final CacheAccess<String, String> jcs = JCS.getInstance( region ); -// System.out.println( "BEFORE PUT \n" + jcs.getStats() ); - // Add items to cache - - for ( int i = 0; i <= items; i++ ) + for ( int i = 0; i < items; i++ ) { jcs.put( i + ":key", region + " data " + i ); } -// System.out.println( jcs.getStats() ); - SleepUtil.sleepAtLeast( 1000 ); -// System.out.println( jcs.getStats() ); - // Test that all items are in cache - - for ( int i = 0; i <= items; i++ ) + for ( int i = 0; i < items; i++ ) { final String value = jcs.get( i + ":key" ); @@ -151,15 +114,13 @@ public class JDBCDiskCacheShrinkUnitTest } // Remove all the items - - for ( int i = 0; i <= items; i++ ) + for ( int i = 0; i < items; i++ ) { jcs.remove( i + ":key" ); } // Verify removal - - for ( int i = 0; i <= items; i++ ) + for ( int i = 0; i < items; i++ ) { assertNull( "Removed key should be null: " + i + ":key", jcs.get( i + ":key" ) ); } @@ -179,24 +140,16 @@ public class JDBCDiskCacheShrinkUnitTest final CacheAccess<String, String> jcs = JCS.getInstance( region ); -// System.out.println( "BEFORE PUT \n" + jcs.getStats() ); - // Add items to cache - - for ( int i = 0; i <= items; i++ ) + for ( int i = 0; i < items; i++ ) { jcs.put( i + ":key", region + " data " + i ); } -// System.out.println( jcs.getStats() ); - SleepUtil.sleepAtLeast( 1000 ); -// System.out.println( jcs.getStats() ); - // Test that all items are in cache - - for ( int i = 0; i <= items; i++ ) + for ( int i = 0; i < items; i++ ) { final String value = jcs.get( i + ":key" ); @@ -204,15 +157,13 @@ public class JDBCDiskCacheShrinkUnitTest } // Remove all the items - - for ( int i = 0; i <= items; i++ ) + for ( int i = 0; i < items; i++ ) { jcs.remove( i + ":key" ); } // Verify removal - - for ( int i = 0; i <= items; i++ ) + for ( int i = 0; i < items; i++ ) { assertNull( "Removed key should be null: " + i + ":key", jcs.get( i + ":key" ) ); } diff --git a/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheUnitTest.java b/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheUnitTest.java index 71c43cf3..c6fb1111 100644 --- a/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheUnitTest.java +++ b/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheUnitTest.java @@ -20,23 +20,22 @@ package org.apache.commons.jcs3.auxiliary.disk.jdbc; */ import java.sql.Connection; -import java.sql.DriverManager; import java.util.HashSet; import java.util.Map; import java.util.Properties; import java.util.Set; import java.util.concurrent.Executors; -import junit.framework.TestCase; - -import org.apache.commons.jcs3.engine.control.MockCompositeCacheManager; import org.apache.commons.jcs3.JCS; import org.apache.commons.jcs3.access.CacheAccess; import org.apache.commons.jcs3.auxiliary.disk.jdbc.dsfactory.DataSourceFactory; import org.apache.commons.jcs3.engine.behavior.ICacheElement; +import org.apache.commons.jcs3.engine.control.MockCompositeCacheManager; import org.apache.commons.jcs3.utils.serialization.StandardSerializer; import org.apache.commons.jcs3.utils.threadpool.DaemonThreadFactory; +import junit.framework.TestCase; + /** * Runs basic tests for the JDBC disk cache. */ @@ -57,21 +56,10 @@ public class JDBCDiskCacheUnitTest public void testSimpleJDBCPutGetWithHSQL() throws Exception { - System.setProperty( "hsqldb.cache_scale", "8" ); - - final String rafroot = "target"; - final Properties p = new Properties(); - final String driver = p.getProperty( "driver", "org.hsqldb.jdbcDriver" ); - final String url = p.getProperty( "url", "jdbc:hsqldb:" ); - final String database = p.getProperty( "database", rafroot + "/cache_hsql_db" ); - final String user = p.getProperty( "user", "sa" ); - final String password = p.getProperty( "password", "" ); - - new org.hsqldb.jdbcDriver(); - Class.forName( driver ).newInstance(); - final Connection cConn = DriverManager.getConnection( url + database, user, password ); - - HsqlSetupTableUtil.setupTABLE( cConn, "JCS_STORE2" ); + try (Connection con = HsqlSetupUtil.getTestDatabaseConnection(new Properties(), "cache_hsql_db")) + { + HsqlSetupUtil.setupTable(con, "JCS_STORE2"); + } runTestForRegion( "testCache1", 200 ); } @@ -89,24 +77,16 @@ public class JDBCDiskCacheUnitTest { final CacheAccess<String, String> jcs = JCS.getInstance( region ); -// System.out.println( "BEFORE PUT \n" + jcs.getStats() ); - // Add items to cache - - for ( int i = 0; i <= items; i++ ) + for ( int i = 0; i < items; i++ ) { jcs.put( i + ":key", region + " data " + i ); } -// System.out.println( jcs.getStats() ); - Thread.sleep( 1000 ); -// System.out.println( jcs.getStats() ); - // Test that all items are in cache - - for ( int i = 0; i <= items; i++ ) + for ( int i = 0; i < items; i++ ) { final String value = jcs.get( i + ":key" ); @@ -115,13 +95,13 @@ public class JDBCDiskCacheUnitTest // Test that getElements returns all the expected values final Set<String> keys = new HashSet<>(); - for ( int i = 0; i <= items; i++ ) + for ( int i = 0; i < items; i++ ) { keys.add( i + ":key" ); } final Map<String, ICacheElement<String, String>> elements = jcs.getCacheElements( keys ); - for ( int i = 0; i <= items; i++ ) + for ( int i = 0; i < items; i++ ) { final ICacheElement<String, String> element = elements.get( i + ":key" ); assertNotNull( "element " + i + ":key is missing", element ); @@ -129,13 +109,13 @@ public class JDBCDiskCacheUnitTest } // Remove all the items - for ( int i = 0; i <= items; i++ ) + for ( int i = 0; i < items; i++ ) { jcs.remove( i + ":key" ); } // Verify removal - for ( int i = 0; i <= items; i++ ) + for ( int i = 0; i < items; i++ ) { assertNull( "Removed key should be null: " + i + ":key", jcs.get( i + ":key" ) ); } @@ -150,23 +130,18 @@ public class JDBCDiskCacheUnitTest throws Exception { // SETUP + System.setProperty( "hsqldb.cache_scale", "8" ); final String poolName = "testInitializePoolAccess_withPoolName"; - final String url = "jdbc:hsqldb:"; - final String userName = "sa"; - final String password = ""; - final int maxActive = 10; - final String driverClassName = "org.hsqldb.jdbcDriver"; - final Properties props = new Properties(); final String prefix = JDBCDiskCacheFactory.POOL_CONFIGURATION_PREFIX + poolName + JDBCDiskCacheFactory.ATTRIBUTE_PREFIX; - props.put( prefix + ".url", url ); - props.put( prefix + ".userName", userName ); - props.put( prefix + ".password", password ); - props.put( prefix + ".maxActive", String.valueOf( maxActive ) ); - props.put( prefix + ".driverClassName", driverClassName ); + props.put( prefix + ".url", "jdbc:hsqldb:target/cache_hsql_db" ); + props.put( prefix + ".userName", "sa" ); + props.put( prefix + ".password", "" ); + props.put( prefix + ".maxActive", String.valueOf(10) ); + props.put( prefix + ".driverClassName", "org.hsqldb.jdbcDriver" ); final JDBCDiskCacheAttributes cattr = new JDBCDiskCacheAttributes(); cattr.setConnectionPoolName( poolName ); @@ -189,16 +164,9 @@ public class JDBCDiskCacheUnitTest assertNotNull( "Should have a data source factory class", result ); assertEquals( "wrong name", poolName, result.getName() ); - System.setProperty( "hsqldb.cache_scale", "8" ); - - final String rafroot = "target"; - final String database = rafroot + "/cache_hsql_db"; - - new org.hsqldb.jdbcDriver(); - Class.forName( driverClassName ).newInstance(); - final Connection cConn = DriverManager.getConnection( url + database, userName, password ); - HsqlSetupTableUtil.setupTABLE( cConn, "JCSTESTTABLE_InitializePoolAccess" ); + final Connection cConn = result.getDataSource().getConnection(); + HsqlSetupUtil.setupTable( cConn, cattr.getTableName()); } } diff --git a/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/hsql/HSQLDiskCacheConcurrentUnitTest.java b/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/hsql/HSQLDiskCacheConcurrentUnitTest.java index 885e7d82..85751f6a 100644 --- a/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/hsql/HSQLDiskCacheConcurrentUnitTest.java +++ b/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/hsql/HSQLDiskCacheConcurrentUnitTest.java @@ -121,8 +121,6 @@ public class HSQLDiskCacheConcurrentUnitTest jcs.put( i + ":key", region + " data " + i ); } -// System.out.println( jcs.getStats() ); - // Test that all items are in cache for ( int i = 0; i <= items; i++ ) { diff --git a/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/mysql/MySQLDiskCacheHsqlBackedUnitTest.java b/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/mysql/MySQLDiskCacheHsqlBackedUnitTest.java index ffc9dcbc..f6ded448 100644 --- a/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/mysql/MySQLDiskCacheHsqlBackedUnitTest.java +++ b/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/mysql/MySQLDiskCacheHsqlBackedUnitTest.java @@ -24,17 +24,16 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import java.sql.Connection; -import java.sql.DriverManager; import java.util.HashSet; import java.util.Map; +import java.util.Properties; import java.util.Set; -import org.apache.commons.jcs3.auxiliary.disk.jdbc.HsqlSetupTableUtil; import org.apache.commons.jcs3.JCS; import org.apache.commons.jcs3.access.CacheAccess; +import org.apache.commons.jcs3.auxiliary.disk.jdbc.HsqlSetupUtil; import org.apache.commons.jcs3.engine.behavior.ICacheElement; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; /** @@ -42,35 +41,18 @@ import org.junit.Test; */ public class MySQLDiskCacheHsqlBackedUnitTest { - /** - * Creates the DB - * <p> - * @throws Exception - */ - @BeforeClass - public static void setupDatabase() throws Exception - { - System.setProperty( "hsqldb.cache_scale", "8" ); - - final String rafroot = "target"; - final String url = "jdbc:hsqldb:"; - final String database = rafroot + "/MySQLDiskCacheHsqlBackedUnitTest"; - final String user = "sa"; - final String password = ""; - - new org.hsqldb.jdbcDriver(); - final Connection cConn = DriverManager.getConnection( url + database, user, password ); - - HsqlSetupTableUtil.setupTABLE( cConn, "JCS_STORE_MYSQL" ); - } - /** * Test setup + * @throws Exception */ @Before - public void setUp() + public void setUp() throws Exception { JCS.setConfigFilename( "/TestMySQLDiskCache.ccf" ); + try (Connection con = HsqlSetupUtil.getTestDatabaseConnection(new Properties(), getClass().getSimpleName())) + { + HsqlSetupUtil.setupTable(con, "JCS_STORE_MYSQL"); + } } /** @@ -96,7 +78,6 @@ public class MySQLDiskCacheHsqlBackedUnitTest throws Exception { final CacheAccess<String, String> jcs = JCS.getInstance( region ); - //System.out.println( "BEFORE PUT \n" + jcs.getStats() ); // Add items to cache for ( int i = 0; i < items; i++ ) @@ -104,9 +85,7 @@ public class MySQLDiskCacheHsqlBackedUnitTest jcs.put( i + ":key", region + " data " + i ); } - //System.out.println( jcs.getStats() ); Thread.sleep( 1000 ); - //System.out.println( jcs.getStats() ); // Test that all items are in cache for ( int i = 0; i < items; i++ ) @@ -138,7 +117,6 @@ public class MySQLDiskCacheHsqlBackedUnitTest } // Verify removal - for ( int i = 0; i < items; i++ ) { assertNull( "Removed key should be null: " + i + ":key", jcs.get( i + ":key" ) ); @@ -158,7 +136,6 @@ public class MySQLDiskCacheHsqlBackedUnitTest final int items = 200; final String region = "testCache2"; final CacheAccess<String, String> jcs = JCS.getInstance( region ); -// System.out.println( "BEFORE PUT \n" + jcs.getStats() ); // DO WORK for ( int i = 0; i < items; i++ ) @@ -172,6 +149,5 @@ public class MySQLDiskCacheHsqlBackedUnitTest // VERIFY assertEquals( "Wrong number returned", 10, matchingResults.size() ); // System.out.println( "matchingResults.keySet() " + matchingResults.keySet() ); -// System.out.println( "\nAFTER TEST \n" + jcs.getStats() ); } } diff --git a/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServerFactoryUnitTest.java b/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServerFactoryUnitTest.java index 4e4599bc..a0e6c28b 100644 --- a/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServerFactoryUnitTest.java +++ b/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServerFactoryUnitTest.java @@ -89,21 +89,6 @@ public class RemoteCacheServerFactoryUnitTest assertEquals( "Wrong useRegistryKeepAlive", useRegistryKeepAlive, result.isUseRegistryKeepAlive() ); } - /** verify that we get the startRegistry value */ - public void testConfigureRemoteCacheServerAttributes_startRegistryPresent() - { - // SETUP - final boolean startRegistry = false; - final Properties props = new Properties(); - props.put( IRemoteCacheConstants.CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".startRegistry", String.valueOf( startRegistry ) ); - - // DO WORK - final RemoteCacheServerAttributes result = RemoteCacheServerFactory.configureRemoteCacheServerAttributes( props ); - - // VERIFY - assertEquals( "Wrong startRegistry", startRegistry, result.isStartRegistry() ); - } - /** verify that we get the registryKeepAliveDelayMillis value */ public void testConfigureRemoteCacheServerAttributes_rmiSocketFactoryTimeoutMillisPresent() { diff --git a/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoverySenderUnitTest.java b/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoverySenderUnitTest.java index 4e403f68..26d1b690 100644 --- a/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoverySenderUnitTest.java +++ b/commons-jcs3-core/src/test/java/org/apache/commons/jcs3/utils/discovery/UDPDiscoverySenderUnitTest.java @@ -1,5 +1,24 @@ package org.apache.commons.jcs3.utils.discovery; +/* + * 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.util.ArrayList; import org.apache.commons.jcs3.utils.discovery.UDPDiscoveryMessage.BroadcastType; diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 28c4490f..1bc28a97 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -21,7 +21,7 @@ <author email="d...@commons.apache.org">Apache Commons Developers</author> </properties> <body> - <release version="3.2.1" date="TBD"> + <release version="4.0" date="TBD"> <action dev="tv" type="update"> Update dependency servlet-api 2.5 to javax.servlet-api 3.1.0 </action> @@ -37,6 +37,9 @@ <action dev="tv" type="update"> From this release on we require Java 17 </action> + <action dev="tv" type="remove"> + Remove all deprecated code + </action> </release> <release version="3.2" date="2023-08-22"> <action dev="tv" type="fix" issue="JCS-234" due-to="Chris Lake">