From 6d4b14390374e55a3acfa5390f6d60fbb986895c Mon Sep 17 00:00:00 2001 From: Peter Lawrey Date: Sun, 30 Nov 2014 22:43:32 +0200 Subject: [PATCH] Remove double and triple blank lines --- README.md | 61 +------------------ pom.xml | 4 -- .../chronicle/hash/ChronicleHashBuilder.java | 1 - .../hash/ChronicleHashErrorListeners.java | 1 - .../hash/RemoteCallTimeoutException.java | 1 - .../hash/replication/AbstractReplication.java | 2 - .../hash/replication/ReplicationChannel.java | 1 - .../hash/replication/ReplicationHub.java | 2 - .../TcpTransportAndNetworkConfig.java | 2 - .../hash/replication/ThrottlingConfig.java | 4 -- .../hash/replication/UdpTransportConfig.java | 2 - .../internal/CharSequenceReader.java | 1 - .../internal/CopyingMetaBytesInterop.java | 2 - .../map/AbstractChannelReplicator.java | 14 ----- .../map/AbstractChronicleMapBuilder.java | 8 --- .../chronicle/map/ChannelProvider.java | 4 -- .../openhft/chronicle/map/ChronicleMap.java | 4 -- .../chronicle/map/ChronicleMapBuilder.java | 10 --- .../chronicle/map/ChronicleMapBuilderI.java | 7 --- .../chronicle/map/CloseablesManager.java | 2 - .../net/openhft/chronicle/map/Function.java | 1 - .../chronicle/map/Int24Int24MultiMap.java | 1 - .../openhft/chronicle/map/IntIntMultiMap.java | 2 - .../openhft/chronicle/map/NodeDiscovery.java | 32 ---------- .../OffHeapUpdatableChronicleMapBuilder.java | 5 -- .../OnHeapUpdatableChronicleMapBuilder.java | 3 - .../openhft/chronicle/map/ReaderWithSize.java | 1 - .../net/openhft/chronicle/map/Replica.java | 5 -- .../chronicle/map/ReplicatedChronicleMap.java | 11 +--- .../map/ReplicationHubFindByName.java | 10 --- .../openhft/chronicle/map/SharedSegment.java | 2 - .../chronicle/map/ShortShortMultiMap.java | 2 - .../chronicle/map/StatelessChronicleMap.java | 52 ---------------- .../openhft/chronicle/map/TcpReplicator.java | 39 ------------ .../chronicle/map/UdpChannelReplicator.java | 8 --- .../openhft/chronicle/map/UdpReplicator.java | 6 -- .../chronicle/map/VanillaChronicleMap.java | 9 --- .../openhft/chronicle/map/WriteContext.java | 1 - .../openhft/chronicle/map/WriterWithSize.java | 3 - .../chronicle/set/ChronicleSetBuilder.java | 1 - .../net/openhft/chronicle/map/Builder.java | 3 - .../chronicle/map/CHMTestIterator1.java | 2 - .../chronicle/map/CHMUseCasesTest.java | 4 -- .../chronicle/map/ChannelReplicationTest.java | 10 ++- .../map/ChronicleMapImportExportTest.java | 14 ----- .../chronicle/map/ChronicleMapTest.java | 23 ------- .../chronicle/map/ConcurrentMap8Test.java | 5 -- .../chronicle/map/DemoChronicleMapTest.java | 3 - .../chronicle/map/EntryCountMapTest.java | 1 - ...tListenerTestWithTCPSocketReplication.java | 16 ----- .../net/openhft/chronicle/map/GuavaTest.java | 1 - .../chronicle/map/IntIntMultiMapTest.java | 1 - .../chronicle/map/IntValueMapTest.java | 1 - .../openhft/chronicle/map/MapByNameTest.java | 4 -- .../map/NodeDiscoveryBroadcasterTest.java | 10 --- .../map/PostChannelCreationTest.java | 8 --- .../map/ReplicatedChronicleMapTest.java | 3 - .../chronicle/map/ReplicationCheckingMap.java | 7 --- .../openhft/chronicle/map/SerializerTest.java | 9 --- .../chronicle/map/SingleMapChannelTest.java | 9 --- .../TCPSocketReplication3VoidValueTest.java | 4 -- ...cketReplication3wayPutReturnsNullTest.java | 5 -- .../map/TCPSocketReplication3wayTest.java | 6 -- .../map/TCPSocketReplication4WayMapTest.java | 8 --- .../TCPSocketReplicationBootStrapTest.java | 5 -- .../map/TCPSocketReplicationIntValueTest.java | 8 --- .../map/TCPSocketReplicationNativeTest.java | 7 --- ...CPSocketReplicationPostConnectionTest.java | 8 --- .../map/TCPSocketReplicationTest.java | 7 --- .../chronicle/map/TestBooleanValues.java | 1 - .../map/TimeBasedReplicationTest.java | 16 ----- .../map/TwoMapOnDifferentServersTest.java | 4 -- .../map/UDPSocketReplicationTest.java | 3 - .../map/example/ChannelReplicationTest.java | 33 ---------- .../OpenJDKAndHashMapExamplesTest.java | 2 - .../fromdocs/StringEncodingExamplesTest.java | 1 - .../map/jrs166/map/ChronicleMapTest.java | 18 ------ .../chronicle/map/jrs166/map/LoopHelpers.java | 2 - .../chronicle/map/jrs166/map/MapCheck.java | 8 --- .../jrs166/map/StatelessChronicleMapTest.java | 7 --- .../SetForTCPSocketReplication3wayTest.java | 8 --- .../openhft/lang/values/IntValue$$Native.java | 3 - .../lang/values/LongValue$$Native.java | 5 -- 83 files changed, 9 insertions(+), 621 deletions(-) diff --git a/README.md b/README.md index 4c2335a9c..12f2d5da2 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,6 @@ requirements. - [Contact Us](sales@higherfrequencytrading.com)* Replicate your Key Value Store across your network, with consistency, durability and performance. ![Chronicle Map](http://openhft.net/wp-content/uploads/2014/07/ChronicleMap_200px.png) - #### Maven Artifact Download ```xml @@ -20,7 +19,6 @@ Replicate your Key Value Store across your network, with consistency, durability ``` Click here to get the [Latest Version Number](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22net.openhft%22%20AND%20a%3A%22chronicle-map%22) - #### Contents * [Should I use Chronicle Queue or Chronicle Map](https://github.com/OpenHFT/Chronicle-Map#should-i-use-chronicle-queue-or-chronicle-map) @@ -120,8 +118,6 @@ This will naturally drop updates and is a more natural choice for low bandwidth SharedHashMap was the old name given to ChronicleMap, Since the last release of SharedHashMap we have added a lot of new features to ChronicleMap, most of these are listed in this readme. - - ## Getting Started #### Tutorial 1 - Creating an instance of Chronicle Map @@ -197,9 +193,6 @@ or value objects that are created through, a directClass interface, for example Object graphs can also be included as long as the outer object supports Serializable, Externalizable or BytesMarshallable. - - - #### Java Class Construction Creating an instance of Chronicle Map is a little more complexed than just calling a constructor. @@ -301,8 +294,7 @@ To illustrate this with an example - On Ubuntu we can create a 100 TB chronicle `ls -l` say the process virtual size / file size is 100 TB, however the resident memory via `du` says the size is 71 MB after adding 10000 entries. You can see the size actually used with du. - -### Chronicle Map Interface +### Chronicle Map Interface The Chronicle Map interface adds a few methods above an beyond the standard ConcurrentMap, the ChronicleMapBuilder can also be used to return the ChronicleMap, see the example below : @@ -319,7 +311,6 @@ supports the following methods : - [`ReadContext getUsingLocked(@NotNull K key, @NotNull V usingValue);`] (https://github.com/OpenHFT/Chronicle-Map#off-heap-storage-and-how-using-a-proxy-object-can-improve-performance) - [`WriteContext acquireUsingLocked(@NotNull K key, @NotNull V usingValue);`] (https://github.com/OpenHFT/Chronicle-Map#acquireusinglocked) - These methods let you provide the object which the data will be written to, even if the object is immutable. For example @@ -403,15 +394,12 @@ public interface BondVOInterface { long getIssueDate(); void setIssueDate(long issueDate); /* time in millis */ - long getMaturityDate(); void setMaturityDate(long maturityDate); /* time in millis */ - double getCoupon(); void setCoupon(double coupon); - String getSymbol(); void setSymbol(@MaxSize(20) String symbol); ... @@ -481,7 +469,6 @@ for(int i=1;i<=10;i++) { } ``` - so when you call : ``` java @@ -504,7 +491,6 @@ try (ReadContext context = map.getUsingLocked(key,bond)) { } // the lock is released here because close() is called - ``` To ensure that you can read the 'issueDate' and 'symbol' can be read atomically, these values @@ -545,7 +531,6 @@ if you are only accessing ChronicleMap from a single thread and you are not doin and don't care about atomic reads, then its simpler ( and faster ) to use acquireUsing() otherwise we recommend acquireUsingLocked(key,value) - because acquireUsing can end up creating an entry the acquireUsingLocked(key,value) method holds a segment write lock, this is unlike the getUsing(key,using) method that holds a segment read lock. @@ -567,7 +552,6 @@ if after you have read the 'issueDate' and 'symbol' and you wish to remove the business logic, it more efficient to use the 'context' to remove the entry, as the contents is already aware when the entry is in memory. - ## Oversized Entries Support It is possible for the size of your entry to be twice as large as the maximum entry size, @@ -610,15 +594,12 @@ so we have designed it so you don't have to close() it. WARNING : If you call close too early before you have finished working with the map, this can cause your JVM to crash. Close MUST BE the last thing that you do with the map. - - # TCP / UDP Replication Chronicle Hash Map supports both TCP and UDP replication ![TCP/IP Replication](http://openhft.net/wp-content/uploads/2014/07/Chronicle-Map-TCP-Replication_simple_02.jpg) - ### TCP / UDP Background. TCP/IP is a reliable protocol, what this means is unless you have a network failure or hardware outage the data is guaranteed to arrive. TCP/IP provides point to point connectivity. So in effect @@ -723,7 +704,6 @@ map = ChronicleMapBuilder ``` - ### Bootstrapping When a node is connected over the network to an active grid of nodes. It must first receive any data that it does not have from the other nodes. Eventually, all the nodes in the grid have to hold a @@ -782,7 +762,6 @@ this, in other words its a bidirectional connection. ![TCP/IP Replication 3Way](http://openhft.net/wp-content/uploads/2014/09/Screen-Shot-2014-10-27-at-18.19.05.png) - Below is example how to set up tcpConfig for 3 host ```java @@ -798,7 +777,6 @@ String hostServer3 = "localhost"; // change this to your host int serverPort3 = 8078; // change this to your port InetSocketAddress inetSocketAddress3 = new InetSocketAddress(hostServer3, serverPort3); - // this is to go on server 1 TcpTransportAndNetworkConfig tcpConfigServer1 = TcpTransportAndNetworkConfig.of(serverPort1); @@ -825,8 +803,6 @@ is dropped and re-established. ![Chronicle Maps Network Distributed](http://openhft.net/wp-content/uploads/2014/07/Chronicle-Map_channels_diagram_02.jpg) - - Chronicle Map TCP Replication lets you distribute a single Chronicle Map, to a number of servers across your network. Replication is point to point and the data transfer is bidirectional, so in the example of just two servers, they only have to be connected via a single tcp socket connection and @@ -844,7 +820,6 @@ update. Put simply: * Each host mustbe given a unique identifier. * Each map must be given a unique channel. - ``` java int maxEntrySize = 1024; byte identifier= 2; @@ -898,7 +873,6 @@ If you inadvertently got the chronicle channels around the wrong way, then chron to replicate the wrong maps data. The chronicle channels don't have to be in order but they must be unique for each map you have. - ### Channels and ReplicationChannel - Example ``` java @@ -914,7 +888,6 @@ unique for each map you have. .of(8086, new InetSocketAddress("localhost", 8087)) .heartBeatInterval(1, SECONDS); - hubOnServer1 = ReplicationHub.builder() .tcpTransportAndNetwork(tcpConfig) .createWithId(identifier); @@ -952,14 +925,12 @@ unique for each map you have. .tcpTransportAndNetwork(tcpConfig) .createWithId(identifier); - // this demotes favoriteColour short channel1 = (short) 1; favoriteColourServer2 = smallStringToStringMapBuilder.instance() .replicatedViaChannel(hubOnServer2.createChannel(channel1)).create(); - favoriteColourServer2.put("rob", "blue"); // this demotes favoriteComputer @@ -972,7 +943,6 @@ unique for each map you have. favoriteComputerServer2.put("daniel", "mac"); } - // allow time for the recompilation to resolve for (int t = 0; t < 2500; t++) { if (favoriteComputerServer2.equals(favoriteComputerServer1) && @@ -981,7 +951,6 @@ unique for each map you have. Thread.sleep(1); } - assertEquals(favoriteComputerServer1, favoriteComputerServer2); Assert.assertEquals(3, favoriteComputerServer2.size()); @@ -1045,7 +1014,6 @@ replication, when you set up TCP Replication you must define a port for the repl run on, the port you choose is up to you, but you should pick a free port that is not currently being used by another application. In this example we choose the port 8076 - ``` java // sets the server to run on localhost:8076 .replication((byte) 2, TcpTransportAndNetworkConfig.of(8076)) @@ -1100,8 +1068,6 @@ and also for the `remove()` method .removeReturnsNull ``` - - ``` java statelessClientMap = ChronicleMapBuilder.of(Integer.class, CharSequence.class) .putReturnsNull(true) @@ -1112,7 +1078,6 @@ statelessClientMap = ChronicleMapBuilder.of(Integer.class, CharSequence.class) For the very best performance you should also set these properties on the server as well - ``` java ChronicleMapBuilder.of(Integer.class, CharSequence.class) .replication((byte) 2, TcpTransportAndNetworkConfig.of(8076)) @@ -1121,8 +1086,6 @@ ChronicleMapBuilder.of(Integer.class, CharSequence.class) .create(); ``` - - ##### Close its always important to close `ChronicleMap`'s and `ChronicleSet` 's when you have finished with them @@ -1132,7 +1095,6 @@ serverMap.close(); statelessMap.close(); ``` - # Known Issues ##### Memory issue on Windows @@ -1258,7 +1220,6 @@ between them, this is how we could set it up } ``` - # Example : Replicating data between process on different servers via TCP/IP Lets assume that we had two server, lets call them server1 and server2, if we wished to share a map @@ -1275,7 +1236,6 @@ import java.util.concurrent.TimeUnit; public class YourClass { - @Test public void test() throws IOException, InterruptedException { @@ -1295,7 +1255,6 @@ public class YourClass { .entries(20000L) .replication((byte) 1, tcpConfig); - map1 = map1Builder.create(); } // ---------- SERVER2 on the same server as ---------- @@ -1341,9 +1300,7 @@ LAN, UDP won’t miss updates. But UDP does not support guaranteed delivery, we a TCP connection along side to ensure the data becomes eventually consistent. Note : It is possible to use Chronicle without the TCP replication and just use UDP ( that’s if you like living dangerously ! ) - - -``` java +``` java import org.junit.Assert; import org.junit.Test; @@ -1355,7 +1312,6 @@ import java.util.concurrent.TimeUnit; public class YourClass { - @Test public void test() throws IOException, InterruptedException { @@ -1376,7 +1332,6 @@ public class YourClass { // a maximum of 1024 bits per millisecond .throttlingConfig(ThrottlingConfig.throttle(1024, TimeUnit.MILLISECONDS)); - UdpTransportConfig udpConfig = UdpTransportConfig .of(Inet4Address.getByName("255.255.255.255"), udpPort); @@ -1388,7 +1343,6 @@ public class YourClass { .udpTransport(udpConfig) .createWithId((byte) 1)); - map1 = map1Builder.create(); } // ---------- SERVER2 2 on the same server as ---------- @@ -1451,7 +1405,6 @@ and just like map it support shared memory and TCP replication. # Performance Topics - There are general principles we can give direction on - for specific advise we believe consulting to be the most productive solution. @@ -1466,7 +1419,6 @@ types. - we support code generation of efficient custom serializes - See the examples where you provide an interface as the data type, the map will generate the implementation. - ### Improving the performance of Chronicle Maps Serialization Are you finding that when using Chronicle Map the serialisation is slow, but you have a large object graph, @@ -1484,8 +1436,7 @@ of object relationships between the maps, by using for example integers or longs. This works especially well as integers and longs have a good hash distribution. - -### Tuning Chronicle Map with Large Data +### Tuning Chronicle Map with Large Data Generally speaking `ChronicleMap` is slower then ConcurrentHashMap for a small number of entries, but for a large number of entries ConcurrentHashMap doesn't scale as well as Chronicle Map, especially @@ -1525,7 +1476,6 @@ memory accesses so you might get around 65 lookups per second. For 100-200K oper expect around 1600 seconds or 25-50 minutes. If you use an SSD, it can get around 230 K IOPS, or about 115 K `ChronicleMap` lookups per second. - ### Lock contention If you see the following warning : @@ -1585,10 +1535,6 @@ For large key/values it is not total memory use but other factors which matter s support short lived tasks without having to use TCP. - data can be replicated across machines. - - - - ### ConcurrentHashMap v ChronicleMap ConcurrentHashMap ( CHM ) outperforms `ChronicleMap` ( CM ) on throughput. If you don't need the extra features SharedHashMap gives you, it is not worth the extra complexity it brings. @@ -1603,7 +1549,6 @@ It can be used to reduce or eliminate GCs. The following performance test consists of string keys of the form "u:0123456789" and an int counter. The update increments the counter once in each thread, creating an new entry if required. - | Number of entries | Chronicle* Throughput | Chronicle RSS | HashMap* Throughput | HashMap Worst GC pause | HashMap RSS | |------------------:|---------------:|---------:|---------------:|-------------------:|--------:| | 10 million | 30 Mupd/s | ½ GB | 155 Mupd/s | 2.5 secs | 9 GB | diff --git a/pom.xml b/pom.xml index 2c53d7373..f846e93d8 100644 --- a/pom.xml +++ b/pom.xml @@ -80,8 +80,6 @@ - - xstream xstream @@ -114,7 +112,6 @@ - junit junit @@ -187,5 +184,4 @@ master - diff --git a/src/main/java/net/openhft/chronicle/hash/ChronicleHashBuilder.java b/src/main/java/net/openhft/chronicle/hash/ChronicleHashBuilder.java index ced83ebca..8cec3130c 100755 --- a/src/main/java/net/openhft/chronicle/hash/ChronicleHashBuilder.java +++ b/src/main/java/net/openhft/chronicle/hash/ChronicleHashBuilder.java @@ -450,6 +450,5 @@ public interface ChronicleHashBuilder keyBuilder; SerializationBuilder valueBuilder; @@ -157,7 +156,6 @@ abstract class AbstractChronicleMapBuilder(prepareValueBytes, valueSize()); } - /** * Non-public because should be called only after {@link #preMapConstruction(boolean)} */ @@ -775,13 +770,11 @@ abstract class AbstractChronicleMapBuilder bootstrapOnlyLocalEntries(boolean bootstapOnlyLocalEntries) { this.bootstrapOnlyLocalEntries = bootstapOnlyLocalEntries; diff --git a/src/main/java/net/openhft/chronicle/map/ChannelProvider.java b/src/main/java/net/openhft/chronicle/map/ChannelProvider.java index e57ab02b0..57ac1dcbf 100644 --- a/src/main/java/net/openhft/chronicle/map/ChannelProvider.java +++ b/src/main/java/net/openhft/chronicle/map/ChannelProvider.java @@ -18,7 +18,6 @@ package net.openhft.chronicle.map; - import net.openhft.chronicle.hash.replication.ReplicationHub; import net.openhft.chronicle.hash.replication.TcpTransportAndNetworkConfig; import net.openhft.chronicle.hash.replication.UdpTransportConfig; @@ -323,7 +322,6 @@ final class ChannelProvider implements Closeable { private static ByteBufferBytes toBootstrapMessage(int chronicleChannel, final long lastModificationTime, final byte localIdentifier) { - final ByteBufferBytes writeBuffer = new ByteBufferBytes(ByteBuffer.allocate(1 + 1 + 2 + 8)); writeBuffer.writeByte(BOOTSTRAP_MESSAGE); writeBuffer.writeByte(localIdentifier); @@ -411,7 +409,6 @@ final class ChannelProvider implements Closeable { */ class SystemQueue { - final Replica asReplica = new Replica() { @Override @@ -423,7 +420,6 @@ final class ChannelProvider implements Closeable { public ModificationIterator acquireModificationIterator( final byte remoteIdentifier, final ModificationNotifier modificationNotifier) { - final ModificationIterator result = systemModificationIterator.get(remoteIdentifier); if (result != null) diff --git a/src/main/java/net/openhft/chronicle/map/ChronicleMap.java b/src/main/java/net/openhft/chronicle/map/ChronicleMap.java index 8059da9f1..fb5cd53e3 100755 --- a/src/main/java/net/openhft/chronicle/map/ChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/ChronicleMap.java @@ -187,7 +187,6 @@ public interface ChronicleMap extends ConcurrentMap, ChronicleHash { */ V acquireUsing(@NotNull K key, V usingValue); - @NotNull WriteContext acquireUsingLocked(@NotNull K key, @NotNull V usingValue); @@ -228,7 +227,6 @@ public interface ChronicleMap extends ConcurrentMap, ChronicleHash { */ Future getLater(@NotNull K key); - /** * Associates the specified value with the specified key in this map (optional operation). If * the map previously contained a mapping for the key, the old value is replaced by the @@ -247,7 +245,6 @@ public interface ChronicleMap extends ConcurrentMap, ChronicleHash { */ Future putLater(@NotNull K key, @NotNull V value); - /** * Removes the mapping for a key from this map if it is present (optional operation). More * formally, if this map contains a mapping from key k to value v such that @@ -309,6 +306,5 @@ public interface ChronicleMap extends ConcurrentMap, ChronicleHash { */ void putAll(File fromFile) throws IOException; - } diff --git a/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java b/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java index e499fc74d..abe880e61 100755 --- a/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java +++ b/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java @@ -76,12 +76,10 @@ public final class ChronicleMapBuilder implements ChronicleMapBuilderI implements ChronicleMapBuilderI keySize(int keySize) { delegate.keySize(keySize); return this; } - @Override public ChronicleMapBuilder constantKeySizeBySample(K sampleKey) { delegate.constantKeySizeBySample(sampleKey); @@ -235,7 +231,6 @@ public final class ChronicleMapBuilder implements ChronicleMapBuilderI implements ChronicleMapBuilderI implements ChronicleMapBuilderI implements ChronicleMapBuilderI implements ChronicleMapBuilderI> statelessClient(InetSocketAddress remoteAddress) { return delegate.statelessClient(remoteAddress); @@ -503,7 +494,6 @@ public final class ChronicleMapBuilder implements ChronicleMapBuilderI createPersistedTo(File file) throws IOException { return delegate.createPersistedTo(file); diff --git a/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilderI.java b/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilderI.java index 617bb3144..ac81e54bb 100755 --- a/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilderI.java +++ b/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilderI.java @@ -26,7 +26,6 @@ import java.util.concurrent.TimeUnit; */ public interface ChronicleMapBuilderI extends Serializable { - /** * {@inheritDoc} With respect to {@linkplain #entryAndValueAlignment(Alignment) alignment}. * @@ -58,7 +57,6 @@ public interface ChronicleMapBuilderI extends Serializable { */ ChronicleMapBuilderI entryAndValueAlignment(Alignment alignment); - /** * {@inheritDoc} Also, it overrides any previous {@link #prepareValueBytesOnAcquire} configuration to this * {@code ChronicleMapBuilder}. @@ -71,7 +69,6 @@ public interface ChronicleMapBuilderI extends Serializable { */ ChronicleMapBuilderI defaultValue(V defaultValue); - /** * Configures the procedure which is called on the bytes, which later the returned value is pointing to, * if the key is absent, on {@link ChronicleMap#acquireUsing(Object, Object) acquireUsing()} call on maps, @@ -90,7 +87,6 @@ public interface ChronicleMapBuilderI extends Serializable { ChronicleMapBuilderI prepareValueBytesOnAcquire( @NotNull PrepareValueBytes prepareValueBytes); - /** * {@inheritDoc} * @@ -147,7 +143,6 @@ public interface ChronicleMapBuilderI extends Serializable { * @see #constantKeySizeBySample(Object) */ - ChronicleMapBuilderI constantValueSizeBySample( @NotNull V sampleValue); @@ -203,7 +198,6 @@ public interface ChronicleMapBuilderI extends Serializable { ChronicleMapBuilderI valueMarshaller( @NotNull BytesMarshaller valueMarshaller); - /** * Configures the marshallers, used to serialize/deserialize values to/from off-heap memory in maps, * created by this builder. See the @@ -313,5 +307,4 @@ public interface ChronicleMapBuilderI extends Serializable { String name(); - } diff --git a/src/main/java/net/openhft/chronicle/map/CloseablesManager.java b/src/main/java/net/openhft/chronicle/map/CloseablesManager.java index a2024a95d..fde2bf3c1 100755 --- a/src/main/java/net/openhft/chronicle/map/CloseablesManager.java +++ b/src/main/java/net/openhft/chronicle/map/CloseablesManager.java @@ -31,7 +31,6 @@ final class CloseablesManager implements Closeable { private final List closeables = new ArrayList<>(); - public synchronized void add(Closeable closeable) { if (closeable == null) @@ -79,7 +78,6 @@ final class CloseablesManager implements Closeable { } } - public synchronized boolean isEmpty() { return closeables.isEmpty(); } diff --git a/src/main/java/net/openhft/chronicle/map/Function.java b/src/main/java/net/openhft/chronicle/map/Function.java index a7f24600c..27828199a 100644 --- a/src/main/java/net/openhft/chronicle/map/Function.java +++ b/src/main/java/net/openhft/chronicle/map/Function.java @@ -22,5 +22,4 @@ public interface Function extends Serializable { */ R apply(T t); - } diff --git a/src/main/java/net/openhft/chronicle/map/Int24Int24MultiMap.java b/src/main/java/net/openhft/chronicle/map/Int24Int24MultiMap.java index 76e9e1e82..2260b1d94 100644 --- a/src/main/java/net/openhft/chronicle/map/Int24Int24MultiMap.java +++ b/src/main/java/net/openhft/chronicle/map/Int24Int24MultiMap.java @@ -250,7 +250,6 @@ class Int24Int24MultiMap implements MultiMap { bytes.writeInt48(prevPos, entry(searchHash, newValue)); } - @Override public void putAfterFailedSearch(long value) { checkValueForPut(value); diff --git a/src/main/java/net/openhft/chronicle/map/IntIntMultiMap.java b/src/main/java/net/openhft/chronicle/map/IntIntMultiMap.java index 29c1ceb55..37000c770 100644 --- a/src/main/java/net/openhft/chronicle/map/IntIntMultiMap.java +++ b/src/main/java/net/openhft/chronicle/map/IntIntMultiMap.java @@ -18,7 +18,6 @@ package net.openhft.chronicle.map; -import net.openhft.lang.Maths; import net.openhft.lang.collection.ATSDirectBitSet; import net.openhft.lang.collection.DirectBitSet; import net.openhft.lang.io.Bytes; @@ -251,7 +250,6 @@ class IntIntMultiMap implements MultiMap { bytes.writeLong(prevPos, entry(searchHash, newValue)); } - @Override public void putAfterFailedSearch(long value) { checkValueForPut(value); diff --git a/src/main/java/net/openhft/chronicle/map/NodeDiscovery.java b/src/main/java/net/openhft/chronicle/map/NodeDiscovery.java index f7b693816..97007d76b 100644 --- a/src/main/java/net/openhft/chronicle/map/NodeDiscovery.java +++ b/src/main/java/net/openhft/chronicle/map/NodeDiscovery.java @@ -75,12 +75,10 @@ public class NodeDiscovery { } - private final DiscoveryNodeBytesMarshallable discoveryNodeBytesMarshallable; private final AtomicReference nodeDiscoveryEventListenerAtomicReference = new AtomicReference(); - private KnownNodes knownNodes; public NodeDiscovery() throws IOException { @@ -105,7 +103,6 @@ public class NodeDiscovery { discoveryNodeBytesMarshallable.setModificationNotifier(nodeDiscoveryBroadcaster); } - public synchronized ReplicationHubFindByName mapByName() throws IOException, InterruptedException { @@ -150,7 +147,6 @@ public class NodeDiscovery { countDownLatch.get().countDown(); } - }; nodeDiscoveryEventListenerAtomicReference.set(nodeDiscoveryEventListener); @@ -220,7 +216,6 @@ public class NodeDiscovery { break; } - // we should make a local copy as this may change final RemoteNodeValidator remoteNodeValidator = new RemoteNodeValidator() { @@ -253,7 +248,6 @@ public class NodeDiscovery { LOG.info("Using Remote identifier=" + identifier); nodeDiscoveryEventListenerAtomicReference.set(null); - TcpTransportAndNetworkConfig tcpConfig = TcpTransportAndNetworkConfig.of(8123, new InetSocketAddress("192.168.1.253", 8123)); @@ -286,7 +280,6 @@ public class NodeDiscovery { return addresses; } - /** * bitwise OR's the two bit sets or put another way, merges the source bitset into the destination bitset * and returns the destination @@ -311,12 +304,10 @@ public class NodeDiscovery { return destination; } - static byte proposeRandomUnusedIdentifier(final DirectBitSet knownIdentifiers, boolean isFirstTime) throws UnknownHostException { byte possible; - // the first time, rather than choosing a random number, we will choose the last value of the IP // address as our random number, ( or at least something that is based upon it) if (isFirstTime) { @@ -463,7 +454,6 @@ class NodeDiscoveryBroadcaster extends UdpChannelReplicator { externalizable.readMarshallable(out); } - } static class UdpSocketChannelEntryWriter implements EntryWriter { @@ -487,7 +477,6 @@ class NodeDiscoveryBroadcaster extends UdpChannelReplicator { in = new ByteBufferBytes(out); } - /** * @param socketChannel the socketChannel that we will write to * @throws InterruptedException @@ -526,7 +515,6 @@ class NodeDiscoveryBroadcaster extends UdpChannelReplicator { } - class KnownNodes implements BytesMarshallable { private Bytes activeIdentifiersBitSetBytes; @@ -540,7 +528,6 @@ class KnownNodes implements BytesMarshallable { this.atsDirectBitSet = new ATSDirectBitSet(this.activeIdentifiersBitSetBytes); } - public Set addressAndPorts() { return addressAndPorts; } @@ -559,7 +546,6 @@ class KnownNodes implements BytesMarshallable { return atsDirectBitSet; } - @Override public void readMarshallable(@net.openhft.lang.model.constraints.NotNull Bytes in) throws IllegalStateException { short size = in.readShort(); @@ -606,7 +592,6 @@ class KnownNodes implements BytesMarshallable { } } - class AddressAndPort implements Comparable, BytesMarshallable { private byte[] address; private short port; @@ -656,7 +641,6 @@ class AddressAndPort implements Comparable, BytesMarshallable { return result; } - @Override public int compareTo(AddressAndPort o) { int i = 0; @@ -668,7 +652,6 @@ class AddressAndPort implements Comparable, BytesMarshallable { return Short.compare(port, o.port); } - @Override public String toString() { return "{" + @@ -696,10 +679,8 @@ class AddressAndPort implements Comparable, BytesMarshallable { return sb.toString(); - } - @Override public void readMarshallable(@net.openhft.lang.model.constraints.NotNull Bytes in) throws IllegalStateException { short len = in.readShort(); @@ -722,7 +703,6 @@ class AddressAndPort implements Comparable, BytesMarshallable { } } - class DiscoveryNodeBytesMarshallable implements BytesMarshallable { private AddressAndPort sourceAddressAndPort = new AddressAndPort(); @@ -788,7 +768,6 @@ class DiscoveryNodeBytesMarshallable implements BytesMarshallable { proposedIdentifiersWithHost.writeMarshallable(out); - } private boolean writeBootstrap(Bytes out) { @@ -838,7 +817,6 @@ class DiscoveryNodeBytesMarshallable implements BytesMarshallable { } } - @Override public void readMarshallable(@net.openhft.lang.model.constraints.NotNull Bytes in) throws IllegalStateException { @@ -863,7 +841,6 @@ class DiscoveryNodeBytesMarshallable implements BytesMarshallable { return; } - // the host and port the message came from this.sourceAddressAndPort.readMarshallable(in); if (sourceAddressAndPort.equals(ourAddressAndPort)) @@ -879,7 +856,6 @@ class DiscoveryNodeBytesMarshallable implements BytesMarshallable { listener.onRemoteNodeEvent(remoteNode, proposedIdentifiersWithHost); } - public void onChange() { if (modificationNotifier != null) modificationNotifier.onChange(); @@ -906,7 +882,6 @@ class DiscoveryNodeBytesMarshallable implements BytesMarshallable { this.timestamp = System.currentTimeMillis(); } - AddressAndPort addressAndPort() { return addressAndPort; } @@ -957,7 +932,6 @@ class DiscoveryNodeBytesMarshallable implements BytesMarshallable { } } - /** * sends a bootstrap message to the other nodes in the grid, the bootstrap message contains the host:port * and perhaps even proposed identifier of the node that sent it. @@ -970,7 +944,6 @@ class DiscoveryNodeBytesMarshallable implements BytesMarshallable { onChange(); } - } interface NodeDiscoveryEventListener { @@ -1061,7 +1034,6 @@ class ConcurrentExpiryMap>> queue = new ConcurrentLinkedQueue>>(); @@ -1069,7 +1041,6 @@ class ConcurrentExpiryMap throw new UnsupportedOperationException("not supported for this combination of key/value type"); } - public ChronicleMapBuilderI valueMarshallers(@NotNull BytesWriter valueWriter, @NotNull BytesReader valueReader) { throw new UnsupportedOperationException("not supported for this combination of key/value type"); } - public ChronicleMapBuilderI valueSizeMarshaller(@NotNull SizeMarshaller valueSizeMarshaller) { throw new UnsupportedOperationException("not supported for this combination of key/value type"); } - - @Override public OffHeapUpdatableChronicleMapBuilder constantValueSizeBySample(V sampleValue) { throw new UnsupportedOperationException("not supported for this combination of key/value type"); } - } diff --git a/src/main/java/net/openhft/chronicle/map/OnHeapUpdatableChronicleMapBuilder.java b/src/main/java/net/openhft/chronicle/map/OnHeapUpdatableChronicleMapBuilder.java index 285a80a33..3b07010f0 100644 --- a/src/main/java/net/openhft/chronicle/map/OnHeapUpdatableChronicleMapBuilder.java +++ b/src/main/java/net/openhft/chronicle/map/OnHeapUpdatableChronicleMapBuilder.java @@ -31,7 +31,6 @@ import org.jetbrains.annotations.NotNull; import java.io.Externalizable; import java.io.Serializable; - /** * {@code ChronicleMapOnHeapUpdatableBuilder} is intended to be used to configure {@link ChronicleMap}s with * non-{@link Byteable} values, which don't point to off-heap memory directly, including primitives ({@link @@ -276,10 +275,8 @@ final class OnHeapUpdatableChronicleMapBuilder throw new UnsupportedOperationException("not supported for this combination of key/value type"); } - public OnHeapUpdatableChronicleMapBuilder entryAndValueAlignment(Alignment a) { throw new UnsupportedOperationException("not supported for this combination of key/value type"); } - } diff --git a/src/main/java/net/openhft/chronicle/map/ReaderWithSize.java b/src/main/java/net/openhft/chronicle/map/ReaderWithSize.java index 0c02ac82b..13bf6f831 100644 --- a/src/main/java/net/openhft/chronicle/map/ReaderWithSize.java +++ b/src/main/java/net/openhft/chronicle/map/ReaderWithSize.java @@ -23,7 +23,6 @@ import net.openhft.lang.threadlocal.Provider; import net.openhft.lang.threadlocal.ThreadLocalCopies; import org.jetbrains.annotations.Nullable; - final class ReaderWithSize { private final SizeMarshaller sizeMarshaller; private final BytesReader originalReader; diff --git a/src/main/java/net/openhft/chronicle/map/Replica.java b/src/main/java/net/openhft/chronicle/map/Replica.java index 172077921..7215cf457 100644 --- a/src/main/java/net/openhft/chronicle/map/Replica.java +++ b/src/main/java/net/openhft/chronicle/map/Replica.java @@ -68,7 +68,6 @@ interface Replica extends Closeable { */ long lastModificationTime(byte remoteIdentifier); - /** * notifies when there is a changed to the modification iterator */ @@ -85,7 +84,6 @@ interface Replica extends Closeable { void onChange(); } - /** * Holds a record of which entries have modification. Each remote map supported will require a * corresponding ModificationIterator instance @@ -119,7 +117,6 @@ interface Replica extends Closeable { void dirtyEntries(long fromTimeStamp); } - /** * supports reading and writing serialize entries */ @@ -151,7 +148,6 @@ interface Replica extends Closeable { } - /** * provides a key and value from NativeBytes, this can be used in conjunction with the modification * iterator to get the key and value out of the NativeBytes @@ -167,7 +163,6 @@ interface Replica extends Closeable { */ K key(@NotNull Bytes entry, K usingKey); - /** * gets the value from the entry * diff --git a/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java b/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java index e042f52e9..e83088693 100644 --- a/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java @@ -18,7 +18,6 @@ package net.openhft.chronicle.map; - import net.openhft.chronicle.hash.replication.TimeProvider; import net.openhft.chronicle.hash.serialization.BytesInterop; import net.openhft.chronicle.hash.serialization.BytesReader; @@ -37,7 +36,8 @@ import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.*; +import java.io.Closeable; +import java.io.IOException; import java.util.Iterator; import java.util.Set; import java.util.concurrent.CopyOnWriteArraySet; @@ -166,7 +166,6 @@ final class ReplicatedChronicleMap implements FindByName { private final Map map; private final ReplicationHub replicationHub; - public static class ChronicleMapBuilderWithChannelId implements Serializable { ChronicleHashBuilder, ?> chronicleMapBuilder; int channelId; @@ -58,7 +56,6 @@ class ReplicationHubFindByName implements FindByName { */ public ReplicationHubFindByName(ReplicationHub replicationHub) throws IOException { - LOG.info("connecting to replicationHub=" + replicationHub); this.replicationHub = replicationHub; @@ -92,7 +89,6 @@ class ReplicationHubFindByName implements FindByName { } - }; this.map = (Map) of(CharSequence.class, ChronicleMapBuilderWithChannelId.class) @@ -106,7 +102,6 @@ class ReplicationHubFindByName implements FindByName { LOG.debug("map=" + map); } - public T create(ChronicleMapBuilder builder) throws IllegalArgumentException, IOException, TimeoutException, InterruptedException { @@ -122,13 +117,11 @@ class ReplicationHubFindByName implements FindByName { } - public T from(String name) throws IllegalArgumentException, IOException, TimeoutException, InterruptedException { return (T) replicatedViaChannel(name).create(); } - ChronicleMapBuilderWithChannelId get(String name) throws IllegalArgumentException, TimeoutException, InterruptedException { @@ -140,7 +133,6 @@ class ReplicationHubFindByName implements FindByName { return chronicleMapBuilder; } - /** * * waits until map1 and map2 show the same value * @@ -160,7 +152,6 @@ class ReplicationHubFindByName implements FindByName { } - private ChronicleHashInstanceConfig replicatedViaChannel(String name) throws TimeoutException, InterruptedException { ChronicleMapBuilderWithChannelId builder = get(name); return toReplicatedViaChannel(builder.chronicleMapBuilder, builder.channelId); @@ -196,5 +187,4 @@ class ReplicationHubFindByName implements FindByName { return builder.instance().replicatedViaChannel(replicationHub.createChannel((short) withChannelId)); } - } diff --git a/src/main/java/net/openhft/chronicle/map/SharedSegment.java b/src/main/java/net/openhft/chronicle/map/SharedSegment.java index eb294a940..496332344 100644 --- a/src/main/java/net/openhft/chronicle/map/SharedSegment.java +++ b/src/main/java/net/openhft/chronicle/map/SharedSegment.java @@ -18,7 +18,6 @@ package net.openhft.chronicle.map; -import net.openhft.lang.io.NativeBytes; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -47,5 +46,4 @@ interface SharedSegment { long offsetFromPos(long pos); - } diff --git a/src/main/java/net/openhft/chronicle/map/ShortShortMultiMap.java b/src/main/java/net/openhft/chronicle/map/ShortShortMultiMap.java index 325028e97..14b2b990f 100644 --- a/src/main/java/net/openhft/chronicle/map/ShortShortMultiMap.java +++ b/src/main/java/net/openhft/chronicle/map/ShortShortMultiMap.java @@ -18,7 +18,6 @@ package net.openhft.chronicle.map; - import net.openhft.lang.collection.ATSDirectBitSet; import net.openhft.lang.collection.DirectBitSet; import net.openhft.lang.io.Bytes; @@ -91,7 +90,6 @@ class ShortShortMultiMap implements MultiMap { assert positions.isSet(value) : "Shouldn't remove absent value"; } - private static long maskUnsetKey(long key) { return (key &= MASK) != UNSET_KEY ? key : HASH_INSTEAD_OF_UNSET_KEY; } diff --git a/src/main/java/net/openhft/chronicle/map/StatelessChronicleMap.java b/src/main/java/net/openhft/chronicle/map/StatelessChronicleMap.java index 85d9f1a7f..670658164 100644 --- a/src/main/java/net/openhft/chronicle/map/StatelessChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/StatelessChronicleMap.java @@ -51,7 +51,6 @@ import static net.openhft.chronicle.map.StatelessChronicleMap.EventId.*; */ class StatelessChronicleMap implements ChronicleMap, Closeable, Cloneable { - public static final String START_OF = "Attempt to write "; private static final Logger LOG = LoggerFactory.getLogger(StatelessChronicleMap.class); public static final byte STATELESS_CLIENT_IDENTIFIER = (byte) -127; @@ -80,7 +79,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon private ExecutorService executorService; - static enum EventId { HEARTBEAT, STATEFUL_UPDATE, @@ -136,7 +134,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon bytes = new ByteBufferBytes(buffer.slice()); } - @Override public Future getLater(@NotNull final K key) { return lazyExecutorService().submit(new Callable() { @@ -181,7 +178,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon throw new UnsupportedOperationException(); } - private ExecutorService lazyExecutorService() { if (executorService == null) { @@ -196,7 +192,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon return executorService; } - private SocketChannel lazyConnect(final long timeoutMs, final InetSocketAddress remoteAddress) throws IOException { @@ -219,7 +214,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon result.connect(config.remoteAddress()); result.socket().setTcpNoDelay(true); - doHandShaking(result); break; } catch (IOException e) { @@ -234,7 +228,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon return result; } - /** * attempts a single connect without a timeout and eat any IOException used typically in the * constructor, its possible the server is not running with this instance is created, {@link @@ -265,7 +258,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon } - /** * closes the existing connections and establishes a new closeables */ @@ -278,7 +270,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon closeables = new CloseablesManager(); } - /** * initiates a very simple level of handshaking with the remote server, we send a special ID of * -127 ( when the server receives this it knows its dealing with a stateless client, receive @@ -348,7 +339,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon return transactionID; } - public synchronized V putIfAbsent(K key, V value) { if (key == null || value == null) throw new NullPointerException(); @@ -358,7 +348,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon return readValue(sizeLocation, copies); } - public synchronized boolean remove(Object key, Object value) { if (key == null) throw new NullPointerException(); @@ -373,7 +362,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon return blockingFetch(sizeLocation).readBoolean(); } - public synchronized boolean replace(K key, V oldValue, V newValue) { if (key == null || oldValue == null || newValue == null) throw new NullPointerException(); @@ -387,7 +375,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon return blockingFetch(sizeLocation).readBoolean(); } - public synchronized V replace(K key, V value) { if (key == null || value == null) throw new NullPointerException(); @@ -400,12 +387,10 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon return readValue(sizeLocation, copies); } - public synchronized int size() { return (int) longSize(); } - /** * calling this method should be avoided at all cost, as the entire {@code object} is * serialized. This equals can be used to compare map that extends ChronicleMap. So two @@ -435,7 +420,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon } - @Override public synchronized int hashCode() { return blockingFetch(writeEventAnSkip(HASH_CODE)).readInt(); @@ -446,12 +430,10 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon .class); } - public synchronized boolean isEmpty() { return blockingFetch(writeEventAnSkip(IS_EMPTY)).readBoolean(); } - public synchronized boolean containsKey(Object key) { if (key == null) throw keyNotNullNPE(); @@ -467,7 +449,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon return new NullPointerException("key can not be null"); } - public synchronized boolean containsValue(Object value) { if (value == null) throw new NullPointerException(); @@ -478,12 +459,10 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon return blockingFetch(sizeLocation).readBoolean(); } - public synchronized long longSize() { return blockingFetch(writeEventAnSkip(LONG_SIZE)).readLong(); } - public synchronized V get(Object key) { final long sizeLocation = writeEventAnSkip(GET); ThreadLocalCopies copies = writeKey((K) key); @@ -498,7 +477,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon "clients"); } - public synchronized V acquireUsing(@NotNull K key, V usingValue) { throw new UnsupportedOperationException("acquireUsing() is not supported for stateless " + "clients"); @@ -517,7 +495,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon throw new UnsupportedOperationException(); } - public synchronized V remove(Object key) { if (key == null) @@ -525,7 +502,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon final long sizeLocation = removeReturnsNull ? writeEvent(REMOVE_WITHOUT_ACC) : writeEventAnSkip(REMOVE); - ThreadLocalCopies copies = writeKey((K) key); if (removeReturnsNull) { @@ -536,7 +512,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon return readValue(sizeLocation, copies); } - public synchronized V put(K key, V value) { if (key == null || value == null) throw new NullPointerException(); @@ -555,7 +530,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon } - public synchronized R mapForKey(K key, @NotNull Function function) { final long sizeLocation = writeEventAnSkip(MAP_FOR_KEY); writeKey(key); @@ -575,7 +549,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon return (R) reader.readObject(); } - private synchronized void writeObject(@NotNull Object function) { long start = bytes.position(); for (; ; ) { @@ -597,7 +570,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon } } - public synchronized void putAll(Map map) { final long sizeLocation = putReturnsNull ? writeEvent(PUT_ALL_WITHOUT_ACC) : @@ -612,7 +584,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon } - private synchronized void sendWithoutAcc(final Bytes bytes, long sizeLocation) { writeSizeAt(sizeLocation); long timeoutTime = config.timeoutMs() + System.currentTimeMillis(); @@ -637,7 +608,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon } } - private synchronized void writeEntriesForPutAll(Map map) { final int numberOfEntries = map.size(); @@ -665,7 +635,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon // as the volume of data could cause us to have to resize our buffers resizeIfRequired(numberOfEntries, numberOfEntriesReadSoFar, start); - final Class keyClass = key.getClass(); if (!kClass.isAssignableFrom(keyClass)) { throw new ClassCastException("key=" + key + " is of type=" + keyClass + " " + @@ -675,14 +644,12 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon writeKeyInLoop(key, keyWriter, copies); - final Class valueClass = value.getClass(); if (!vClass.isAssignableFrom(valueClass)) throw new ClassCastException("value=" + value + " is of type=" + valueClass + " and " + "should be of type=" + vClass); - writeValueInLoop(value, valueWriter, copies); final int len = (int) (bytes.position() - start); @@ -714,7 +681,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon return (long) ((double) bytes.position() / percentageComplete); } - private void resizeBuffer(int size, long start) { if (LOG.isDebugEnabled()) @@ -755,14 +721,12 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon bytes.position(start); } - public synchronized void clear() { // get the data back from the server blockingFetch(writeEventAnSkip(CLEAR)); } - @NotNull public Collection values() { final long sizeLocation = writeEventAnSkip(VALUES); @@ -797,7 +761,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon return result; } - @NotNull public synchronized Set> entrySet() { final long sizeLocation = writeEventAnSkip(ENTRY_SET); @@ -835,7 +798,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon in = blockingFetchReadOnly(timeoutTime, transactionId); } - return result.entrySet(); } @@ -848,7 +810,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon } } - @NotNull public synchronized Set keySet() { final long sizeLocation = writeEventAnSkip(KEY_SET); @@ -888,15 +849,12 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon buffer.clear(); bytes.clear(); - bytes.write((byte) event.ordinal()); long sizeLocation = markSizeLocation(); - return sizeLocation; } - /** * skips for the transactionid * @@ -912,7 +870,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon return sizeLocation; } - class Entry implements Map.Entry { final K key; @@ -982,7 +939,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon } - private Bytes blockingFetch0(long sizeLocation, final long transactionId, long startTime) { try { @@ -997,7 +953,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon } - private Bytes blockingFetchThrowable(long sizeLocation, long timeOutMs, final long transactionId, final long startTime) throws IOException { final long timeoutTime = startTime + timeOutMs; @@ -1043,7 +998,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon } - private Bytes blockingFetch(long timeoutTime, long transactionId) throws IOException { // the number of bytes in the response @@ -1095,7 +1049,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon return bytes; } - private Bytes receive(int requiredNumberOfBytes, long timeoutTime) throws IOException { while (bytes.buffer().position() < requiredNumberOfBytes) { @@ -1128,7 +1081,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon buffer.clear(); } - private void checkTimeout(long timeoutTime) { if (timeoutTime < System.currentTimeMillis()) throw new RemoteCallTimeoutException(); @@ -1143,20 +1095,17 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon bytes.position(pos); } - private void writeSizeAt(long locationOfSize) { final long size = bytes.position() - locationOfSize; bytes.writeInt(locationOfSize, (int) size - SIZE_OF_SIZE); } - private long markSizeLocation() { final long position = bytes.position(); bytes.skip(SIZE_OF_SIZE); return position; } - private ThreadLocalCopies writeKey(K key) { return writeKey(key, null); } @@ -1221,7 +1170,6 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon } } - private ThreadLocalCopies writeValueInLoop(V value, Object writer, ThreadLocalCopies copies) { long start = bytes.position(); for (; ; ) { diff --git a/src/main/java/net/openhft/chronicle/map/TcpReplicator.java b/src/main/java/net/openhft/chronicle/map/TcpReplicator.java index f801648b2..dbedfa002 100644 --- a/src/main/java/net/openhft/chronicle/map/TcpReplicator.java +++ b/src/main/java/net/openhft/chronicle/map/TcpReplicator.java @@ -173,7 +173,6 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable final SelectionKey[] keys = selectedKeys.flip(); - try { for (int i = 0; i < keys.length && keys[i] != null; i++) { final SelectionKey key = keys[i]; @@ -289,7 +288,6 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable return selector.select(selectorTimeout); } - /** * checks that we receive heartbeats and send out heart beats. * @@ -411,7 +409,6 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable closeEarlyAndQuietly(key.channel()); } - /** * called when the selector receives a OP_CONNECT message */ @@ -491,7 +488,6 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable closeables.add(channel); } - channel.configureBlocking(false); channel.socket().setReuseAddress(true); channel.socket().setTcpNoDelay(true); @@ -542,7 +538,6 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable if (attached.remoteIdentifier == Byte.MIN_VALUE) { - final byte remoteIdentifier = reader.identifierFromBuffer(); if (remoteIdentifier == STATELESS_CLIENT) { @@ -584,7 +579,6 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable LOG.debug("handshaking for localIdentifier=" + localIdentifier + "," + "remoteIdentifier=" + remoteIdentifier); - attached.remoteModificationIterator = replica.acquireModificationIterator(remoteIdentifier, attached); @@ -791,7 +785,6 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable SelectableChannel doConnect() throws IOException, InterruptedException { - final ServerSocketChannel serverChannel = openServerSocketChannel(); serverChannel.socket().setReceiveBufferSize(BUFFER_SIZE); @@ -805,7 +798,6 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable closeables.add(serverSocket); } - serverSocket.setReuseAddress(true); serverSocket.bind(details.address()); @@ -840,7 +832,6 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable this.details = details; } - @Override public String toString() { return "ClientConnector{" + details + '}'; @@ -909,7 +900,6 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable } } - } /** @@ -954,7 +944,6 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable TcpReplicator.this.opWriteUpdater.set(remoteIdentifier); } - } /** @@ -984,7 +973,6 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable uncompletedWork = null; } - /** * writes the timestamp into the buffer * @@ -1062,7 +1050,6 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable int size = (int) in.position(); out.limit(size); - final int len = socketChannel.write(out); if (LOG.isDebugEnabled()) @@ -1099,7 +1086,6 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable in.writeLong(localHeartbeatInterval); } - /** * removes back in the OP_WRITE from the selector, otherwise it'll spin loop. The OP_WRITE * will get added back in as soon as we have data to write @@ -1126,7 +1112,6 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable } } - public boolean doWork() { return uncompletedWork.doWork(in); } @@ -1147,7 +1132,6 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable private long sizeInBytes; private byte state; - private TcpSocketChannelEntryReader() { in = ByteBuffer.allocateDirect(replicationConfig.packetSize() + maxEntrySizeBytes); out = new ByteBufferBytes(in.slice()); @@ -1155,7 +1139,6 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable in.clear(); } - void resizeBuffer(long size) { assert size < Integer.MAX_VALUE; @@ -1165,7 +1148,6 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable final ByteBuffer buffer = ByteBuffer.allocateDirect((int) size).order(ByteOrder.nativeOrder()); - final int inPosition = in.position(); long outPosition = out.position(); @@ -1293,7 +1275,6 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable } - /** * compacts the buffer and updates the {@code in} and {@code out} accordingly */ @@ -1351,7 +1332,6 @@ class StatelessServerConnector { public static final int SIZE_OF_IS_EXCEPTION = 1; public static final int HEADER_SIZE = SIZE_OF_SIZE + SIZE_OF_IS_EXCEPTION + SIZE_OF_TRANSACTION_ID; - private final ReaderWithSize keyReaderWithSize; private final WriterWithSize keyWriterWithSize; private final ReaderWithSize valueReaderWithSize; @@ -1359,7 +1339,6 @@ class StatelessServerConnector { private final VanillaChronicleMap map; private double maxEntrySizeBytes; - StatelessServerConnector( SerializationBuilder keySerializationBuilder, SerializationBuilder valueSerializationBuilder, @@ -1377,7 +1356,6 @@ class StatelessServerConnector { @NotNull final Bytes writer, @NotNull final ByteBufferBytes reader) { - final StatelessChronicleMap.EventId event = VALUES[eventId]; // these methods don't return a result @@ -1405,7 +1383,6 @@ class StatelessServerConnector { final long sizeLocation = reflectTransactionId(reader, writer); - // these methods return a result switch (event) { @@ -1468,7 +1445,6 @@ class StatelessServerConnector { } - public Work mapForKey(ByteBufferBytes reader, Bytes writer, long sizeLocation) { final K key = keyReaderWithSize.read(reader, null); final Function function = (Function) reader.readObject(); @@ -1538,7 +1514,6 @@ class StatelessServerConnector { return null; } - private Work longSize(Bytes reader, Bytes writer, final long sizeLocation) { try { @@ -1550,7 +1525,6 @@ class StatelessServerConnector { return null; } - private Work hashCode(Bytes reader, Bytes writer, final long sizeLocation) { try { @@ -1563,7 +1537,6 @@ class StatelessServerConnector { return null; } - private Work toString(Bytes reader, Bytes writer, final long sizeLocation) { final String str; @@ -1587,7 +1560,6 @@ class StatelessServerConnector { return null; } - private Work sendException(Bytes writer, long sizeLocation, Throwable e) { // move the position to ignore any bytes written so far @@ -1599,7 +1571,6 @@ class StatelessServerConnector { return null; } - private Work isEmpty(Bytes reader, Bytes writer, final long sizeLocation) { try { @@ -1657,7 +1628,6 @@ class StatelessServerConnector { } - private Work put(Bytes reader) { if (MAP_SUPPORTS_BYTES) { map.put(reader); @@ -1701,7 +1671,6 @@ class StatelessServerConnector { return null; } - private Work remove(Bytes reader, Bytes writer, final long sizeLocation) { try { if (MAP_SUPPORTS_BYTES) { @@ -1746,7 +1715,6 @@ class StatelessServerConnector { return null; } - private Work clear(Bytes reader, Bytes writer, final long sizeLocation) { try { @@ -1759,7 +1727,6 @@ class StatelessServerConnector { return null; } - private Work values(Bytes reader, Bytes writer) { final long transactionId = reader.readLong(); @@ -1895,7 +1862,6 @@ class StatelessServerConnector { valueWriterWithSize.writeInLoop(out, next.getValue(), valueWriter, copies); } - writeHeader(out, sizeLocation, count, false); return true; } @@ -1903,7 +1869,6 @@ class StatelessServerConnector { }; } - private Work putIfAbsent(Bytes reader, Bytes writer, final long sizeLocation) { try { if (MAP_SUPPORTS_BYTES) { @@ -1922,7 +1887,6 @@ class StatelessServerConnector { return null; } - private Work replace(Bytes reader, Bytes writer, final long sizeLocation) { try { if (MAP_SUPPORTS_BYTES) { @@ -1976,13 +1940,11 @@ class StatelessServerConnector { return result; } - private Work sendException(Bytes reader, Bytes writer, Throwable e) { final long sizeLocation = reflectTransactionId(reader, writer); return sendException(writer, sizeLocation, e); } - private long header(Bytes writer, final long transactionId) { final long sizeLocation = writer.position(); @@ -2023,4 +1985,3 @@ class StatelessServerConnector { } - diff --git a/src/main/java/net/openhft/chronicle/map/UdpChannelReplicator.java b/src/main/java/net/openhft/chronicle/map/UdpChannelReplicator.java index 09442521c..e0723a2ef 100644 --- a/src/main/java/net/openhft/chronicle/map/UdpChannelReplicator.java +++ b/src/main/java/net/openhft/chronicle/map/UdpChannelReplicator.java @@ -39,7 +39,6 @@ import static java.net.StandardSocketOptions.SO_REUSEADDR; import static java.nio.channels.SelectionKey.OP_READ; import static java.nio.channels.SelectionKey.OP_WRITE; - /** * The UdpReplicator attempts to read the data ( but it does not enforce or grantee delivery ), * typically, you should use the UdpReplicator if you have a large number of nodes, and you wish to @@ -85,7 +84,6 @@ class UdpChannelReplicator extends AbstractChannelReplicator implements Replica. serverConnector = new ServerConnector(); } - void setWriter(EntryWriter writer) { this.writer = writer; } @@ -169,7 +167,6 @@ class UdpChannelReplicator extends AbstractChannelReplicator implements Replica. } } - private DatagramChannel connectClient() throws IOException { final DatagramChannel client = address.isMulticastAddress() ? DatagramChannel.open(address.getAddress().length == 4 ? INET : INET6) : @@ -240,7 +237,6 @@ class UdpChannelReplicator extends AbstractChannelReplicator implements Replica. } } - private class ServerConnector extends AbstractConnector { private final InetSocketAddress socketAddress; @@ -293,12 +289,10 @@ class UdpChannelReplicator extends AbstractChannelReplicator implements Replica. return server; } - } } - interface EntryReader { void readAll(@NotNull final DatagramChannel socketChannel) throws IOException, InterruptedException; } @@ -307,5 +301,3 @@ interface EntryWriter { int writeAll(@NotNull final DatagramChannel socketChannel) throws InterruptedException, IOException; } - - diff --git a/src/main/java/net/openhft/chronicle/map/UdpReplicator.java b/src/main/java/net/openhft/chronicle/map/UdpReplicator.java index d535ceb3b..7a177ddb7 100644 --- a/src/main/java/net/openhft/chronicle/map/UdpReplicator.java +++ b/src/main/java/net/openhft/chronicle/map/UdpReplicator.java @@ -29,7 +29,6 @@ import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.DatagramChannel; - /** * The UdpReplicator attempts to read the data ( but it does not enforce or grantee delivery ), typically, you * should use the UdpReplicator if you have a large number of nodes, and you wish to receive the data before @@ -178,10 +177,5 @@ final class UdpReplicator extends UdpChannelReplicator implements Replica.Modifi } } - } - - - - diff --git a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java index 7b5f138b1..32a892c39 100755 --- a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java @@ -493,7 +493,6 @@ class VanillaChronicleMap, segmentHash, replaceIfPresent, readValue, resultUnused); } - enum LockType {READ_LOCK, WRITE_LOCK} @Override @@ -698,7 +697,6 @@ class VanillaChronicleMap, } - private XStreamConverter xStreamConverter; /** @@ -709,7 +707,6 @@ class VanillaChronicleMap, (xStreamConverter = new XStreamConverter()); } - private class XStreamConverter { private Bytes buffer; @@ -849,7 +846,6 @@ class VanillaChronicleMap, } } - @NotNull @Override public final WriteContext acquireUsingLocked(@NotNull K key, @NotNull V usingValue) { @@ -975,7 +971,6 @@ class VanillaChronicleMap, key, keySizeMarshaller.readSize(key)); } - private > boolean containsKey(ThreadLocalCopies copies, MKBI metaKeyInterop, KBI keyInterop, KB key, long keySize) { @@ -1170,7 +1165,6 @@ class VanillaChronicleMap, readValueToLazyBytes, false); } - private , RV, VB extends RV, VBI, MVBI extends MetaBytesInterop> Object remove(ThreadLocalCopies copies, SegmentState segmentState, @@ -1496,7 +1490,6 @@ class VanillaChronicleMap, assert booleanResult || expectedValue == null; } - // these methods should be package local, not public or private. class Segment implements SharedSegment { /* @@ -1564,7 +1557,6 @@ class VanillaChronicleMap, return index; } - /* Methods with private access modifier considered private to Segment * class, although Java allows to access them from outer class anyway. */ @@ -2437,7 +2429,6 @@ class VanillaChronicleMap, return new WriteThroughEntry(key, value); } - boolean isDeleted(long pos) { return false; } diff --git a/src/main/java/net/openhft/chronicle/map/WriteContext.java b/src/main/java/net/openhft/chronicle/map/WriteContext.java index 9b3537ace..91019b0de 100644 --- a/src/main/java/net/openhft/chronicle/map/WriteContext.java +++ b/src/main/java/net/openhft/chronicle/map/WriteContext.java @@ -29,7 +29,6 @@ public interface WriteContext extends Context { */ void dontPutOnClose(); - /** * this is simular by more efficient than calling map.remove("key") as the entry is already available to * the WriteContext diff --git a/src/main/java/net/openhft/chronicle/map/WriterWithSize.java b/src/main/java/net/openhft/chronicle/map/WriterWithSize.java index 62f01cbc3..4c946e7dd 100644 --- a/src/main/java/net/openhft/chronicle/map/WriterWithSize.java +++ b/src/main/java/net/openhft/chronicle/map/WriterWithSize.java @@ -22,7 +22,6 @@ import net.openhft.chronicle.hash.serialization.internal.MetaBytesWriter; import net.openhft.chronicle.hash.serialization.internal.MetaProvider; import net.openhft.lang.io.Bytes; import net.openhft.lang.threadlocal.Provider; -import net.openhft.lang.threadlocal.StatefulCopyable; import net.openhft.lang.threadlocal.ThreadLocalCopies; import org.jetbrains.annotations.Nullable; @@ -41,8 +40,6 @@ final class WriterWithSize { metaWriterProvider = serializationBuilder.metaInteropProvider(); } - - ThreadLocalCopies getCopies(ThreadLocalCopies copies) { copies = writerProvider.getCopies(copies); return metaWriterProvider.getCopies(copies); diff --git a/src/main/java/net/openhft/chronicle/set/ChronicleSetBuilder.java b/src/main/java/net/openhft/chronicle/set/ChronicleSetBuilder.java index 9f3fe647f..7430fe1c9 100755 --- a/src/main/java/net/openhft/chronicle/set/ChronicleSetBuilder.java +++ b/src/main/java/net/openhft/chronicle/set/ChronicleSetBuilder.java @@ -319,6 +319,5 @@ public class ChronicleSetBuilder return this; } - } diff --git a/src/test/java/net/openhft/chronicle/map/Builder.java b/src/test/java/net/openhft/chronicle/map/Builder.java index 5ae788bce..79d4ffc3c 100644 --- a/src/test/java/net/openhft/chronicle/map/Builder.java +++ b/src/test/java/net/openhft/chronicle/map/Builder.java @@ -18,7 +18,6 @@ package net.openhft.chronicle.map; - import net.openhft.chronicle.hash.replication.TcpTransportAndNetworkConfig; import java.io.File; @@ -59,7 +58,6 @@ public class Builder { return file; } - public static > T newMapVoid( final byte identifier, final int serverPort, @@ -80,5 +78,4 @@ public class Builder { .replication(identifier, tcpConfig); } - } diff --git a/src/test/java/net/openhft/chronicle/map/CHMTestIterator1.java b/src/test/java/net/openhft/chronicle/map/CHMTestIterator1.java index 6a815f783..264edc73e 100644 --- a/src/test/java/net/openhft/chronicle/map/CHMTestIterator1.java +++ b/src/test/java/net/openhft/chronicle/map/CHMTestIterator1.java @@ -42,7 +42,6 @@ public class CHMTestIterator1 { chm.put("k5", alValue.incrementAndGet());*/ //chm.keySet(); - for (int i = 0; i < runs; i++) { chm.put("k" + alKey.incrementAndGet(), alValue.incrementAndGet()); } @@ -59,5 +58,4 @@ public class CHMTestIterator1 { } } - } \ No newline at end of file diff --git a/src/test/java/net/openhft/chronicle/map/CHMUseCasesTest.java b/src/test/java/net/openhft/chronicle/map/CHMUseCasesTest.java index 00a98d214..02f9579bb 100644 --- a/src/test/java/net/openhft/chronicle/map/CHMUseCasesTest.java +++ b/src/test/java/net/openhft/chronicle/map/CHMUseCasesTest.java @@ -477,7 +477,6 @@ public class CHMUseCasesTest { assertBBEquals(ByteBuffer.wrap(new byte[]{12, 10, 11, 11}), map.get(key1)); - map.put(key1, value1); map.put(key2, value2); ByteBuffer valueA = ByteBuffer.allocateDirect(8); @@ -500,7 +499,6 @@ public class CHMUseCasesTest { assertBBEquals(value2, valueB); } - try (WriteContext wc = map.acquireUsingLocked(key1, valueA)) { assertBBEquals(value1, valueA); appendMode(valueA); @@ -591,7 +589,6 @@ public class CHMUseCasesTest { } } - private void assertBBEquals(ByteBuffer bb1, ByteBuffer bb2) { assertEquals(bb1.remaining(), bb2.remaining()); for (int i = 0; i < bb1.remaining(); i++) @@ -1421,7 +1418,6 @@ public class CHMUseCasesTest { } - @Test public void testListValue() { try (ChronicleMap> map = ChronicleMapBuilder diff --git a/src/test/java/net/openhft/chronicle/map/ChannelReplicationTest.java b/src/test/java/net/openhft/chronicle/map/ChannelReplicationTest.java index fee93f167..e75f095f6 100644 --- a/src/test/java/net/openhft/chronicle/map/ChannelReplicationTest.java +++ b/src/test/java/net/openhft/chronicle/map/ChannelReplicationTest.java @@ -18,10 +18,12 @@ package net.openhft.chronicle.map; - import net.openhft.chronicle.hash.replication.ReplicationHub; import net.openhft.chronicle.hash.replication.TcpTransportAndNetworkConfig; -import org.junit.*; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; import java.io.Closeable; import java.io.IOException; @@ -104,7 +106,6 @@ public class ChannelReplicationTest { StatelessClientTest.checkThreadsShutdown(threads); } - @Test public void test() throws IOException, InterruptedException { @@ -132,7 +133,6 @@ public class ChannelReplicationTest { } - /** * waits until map1 and map2 show the same value * @@ -152,5 +152,3 @@ public class ChannelReplicationTest { } - - diff --git a/src/test/java/net/openhft/chronicle/map/ChronicleMapImportExportTest.java b/src/test/java/net/openhft/chronicle/map/ChronicleMapImportExportTest.java index e8eefc106..9db2fabbe 100644 --- a/src/test/java/net/openhft/chronicle/map/ChronicleMapImportExportTest.java +++ b/src/test/java/net/openhft/chronicle/map/ChronicleMapImportExportTest.java @@ -18,7 +18,6 @@ import static org.junit.Assert.assertEquals; */ public class ChronicleMapImportExportTest { - public static final String TMP = System.getProperty("java.io.tmpdir"); @Test @@ -47,10 +46,8 @@ public class ChronicleMapImportExportTest { file.delete(); } - } - @Test public void testWithMapValue() throws IOException, InterruptedException { @@ -81,7 +78,6 @@ public class ChronicleMapImportExportTest { } - @Test public void testWithMapOfMapValue() throws IOException, InterruptedException { @@ -112,10 +108,8 @@ public class ChronicleMapImportExportTest { file.delete(); } - } - @Test public void testWithIntegerAndDouble() throws IOException, InterruptedException { @@ -126,10 +120,8 @@ public class ChronicleMapImportExportTest { .class) .create()) { - expected.put(1, 1.0); - expected.getAll(file); try (ChronicleMap actual = ChronicleMapBuilder.of(Integer.class, Double @@ -144,10 +136,8 @@ public class ChronicleMapImportExportTest { file.delete(); } - } - @Test public void testWithCharSeq() throws IOException, InterruptedException { @@ -159,10 +149,8 @@ public class ChronicleMapImportExportTest { .class) .create()) { - expected.put("hello", "world"); - expected.getAll(file); try (ChronicleMap actual = ChronicleMapBuilder.of(CharSequence.class, CharSequence @@ -177,7 +165,6 @@ public class ChronicleMapImportExportTest { file.delete(); } - } @Ignore("this type of off heap reference is not currently supported") @@ -216,7 +203,6 @@ public class ChronicleMapImportExportTest { file.delete(); } - } } diff --git a/src/test/java/net/openhft/chronicle/map/ChronicleMapTest.java b/src/test/java/net/openhft/chronicle/map/ChronicleMapTest.java index 5d0e96998..33893a3e5 100755 --- a/src/test/java/net/openhft/chronicle/map/ChronicleMapTest.java +++ b/src/test/java/net/openhft/chronicle/map/ChronicleMapTest.java @@ -186,7 +186,6 @@ public class ChronicleMapTest { .minSegments(1024) .removeReturnsNull(true).create(); - for (int i = 1; i < 1024; i++) { map.put("key" + i, "value"); assertEquals(i, map.size()); @@ -208,7 +207,6 @@ public class ChronicleMapTest { .entrySize(count) .minSegments(2).create(); - for (int i = 1; i < count; i++) { map.put(i, i); assertEquals(i, map.size()); @@ -278,7 +276,6 @@ public class ChronicleMapTest { ChronicleMapBuilder.of(CharSequence.class, CharSequence.class) .minSegments(2).create(); - map.put("key1", "one"); map.put("key2", "two"); assertEquals(2, map.size()); @@ -385,26 +382,22 @@ public class ChronicleMapTest { ChronicleMapBuilder.of(CharSequence.class, CharSequence.class) .minSegments(2).create(); - map.put("key1", "one"); map.put("key2", "two"); assertEquals("one", map.get("key1")); assertEquals("two", map.get("key2")); - // a false remove final boolean wasRemoved1 = map.remove("key1", "three"); assertFalse(wasRemoved1); - assertEquals(null, map.get("key1"), "one"); assertEquals("two", map.get("key2"), "two"); map.put("key1", "one"); - final boolean wasRemoved2 = map.remove("key1", "three"); assertFalse(wasRemoved2); @@ -539,7 +532,6 @@ public class ChronicleMapTest { testAcquireFromMultipleThreads(getSharedMap(entries, 128, 24, OF_8_BYTES)); } - public void testAcquireFromMultipleThreads(ChronicleMap map) throws Exception { @@ -1406,7 +1398,6 @@ public class ChronicleMapTest { } } - @Ignore("JIRA raised for failing test HCOLL-222") @Test public void testPutLongValue() throws IOException { @@ -1432,7 +1423,6 @@ public class ChronicleMapTest { LongValue value = nativeLongValue(); - // this will add the entry try (WriteContext context = map.acquireUsingLocked("one", value)) { assertEquals(0, context.value().getValue()); @@ -1448,7 +1438,6 @@ public class ChronicleMapTest { assertEquals(1, context.value().getValue()); } - // this will remove the entry try (WriteContext context = map.acquireUsingLocked("one", value)) { assert value == context.value(); @@ -1461,13 +1450,11 @@ public class ChronicleMapTest { assertEquals(null, context.value()); } - try (WriteContext context = map.acquireUsingLocked("one", value)) { assert value == context.value(); assertEquals(0, context.value().getValue()); } - try (WriteContext context = map.acquireUsingLocked("one", value)) { assert value == context.value(); context.value().addValue(1); @@ -1482,7 +1469,6 @@ public class ChronicleMapTest { map.close(); } - @Test(expected = IllegalArgumentException.class) public void testAcquireUsingLockedWithString() throws IOException { @@ -1492,22 +1478,17 @@ public class ChronicleMapTest { .defaultValue("") .entrySize(16); - try (final ChronicleMap map = builder.create()) { - // this will add the entry try (WriteContext context = map.acquireUsingLocked("one", "")) { // do nothing } - } - } - @Test public void testOnheapAcquireUsingLockedStringBuilder() throws IOException { @@ -1528,7 +1509,6 @@ public class ChronicleMapTest { } } - @Test public void testOnheapAcquireUsingLocked() throws IOException { ChronicleMapBuilder builder = ChronicleMapBuilder @@ -1541,7 +1521,6 @@ public class ChronicleMapTest { LongValue value = DataValueClasses.newDirectReference(LongValue.class); - try (ReadContext context = map.getUsingLocked("one", value)) { assertEquals(false, context.present()); assertEquals(null, context.value()); @@ -1563,7 +1542,6 @@ public class ChronicleMapTest { assertEquals(11, context.value().getValue()); } - // this will remove the entry try (WriteContext context = map.acquireUsingLocked("one", value)) { context.removeEntry(); @@ -1600,4 +1578,3 @@ public class ChronicleMapTest { } } - diff --git a/src/test/java/net/openhft/chronicle/map/ConcurrentMap8Test.java b/src/test/java/net/openhft/chronicle/map/ConcurrentMap8Test.java index 3c1b31f1e..e993da2f6 100644 --- a/src/test/java/net/openhft/chronicle/map/ConcurrentMap8Test.java +++ b/src/test/java/net/openhft/chronicle/map/ConcurrentMap8Test.java @@ -44,7 +44,6 @@ public class ConcurrentMap8Test extends JSR166TestCase { final ChronicleMapOnHeapUpdatableBuilder builder = ChronicleMapBuilder.of(Long.class, Long.class); - //// don't include this, just to check it is as expected. assertEquals(8, builder.minSegments()); //// end of test @@ -56,18 +55,15 @@ public class ConcurrentMap8Test extends JSR166TestCase { throw new IllegalStateException(e); } - // return new ConcurrentMap(5); } private static ConcurrentMap newIntegerStringMap() { - final ChronicleMapOnHeapUpdatableBuilder builder = ChronicleMapBuilder.of(Integer.class, String.class); - //// don't include this, just to check it is as expected. assertEquals(8, builder.minSegments()); //// end of test @@ -80,7 +76,6 @@ public class ConcurrentMap8Test extends JSR166TestCase { throw new IllegalStateException(e); } - } *//** diff --git a/src/test/java/net/openhft/chronicle/map/DemoChronicleMapTest.java b/src/test/java/net/openhft/chronicle/map/DemoChronicleMapTest.java index 1ce97dcf9..59a10358c 100755 --- a/src/test/java/net/openhft/chronicle/map/DemoChronicleMapTest.java +++ b/src/test/java/net/openhft/chronicle/map/DemoChronicleMapTest.java @@ -24,7 +24,6 @@ public class DemoChronicleMapTest { .entries(maxEntries) .createPersistedTo(file)) { - IntValue key = DataValueClasses.newDirectInstance(IntValue.class); DemoOrderVOInterface value = DataValueClasses.newDirectReference(DemoOrderVOInterface.class); @@ -55,7 +54,6 @@ public class DemoChronicleMapTest { } } - @Test public void testMapLocked() throws Exception { File file = File.createTempFile("DummyOrders", ".test"); @@ -68,7 +66,6 @@ public class DemoChronicleMapTest { .entries(maxEntries) .createPersistedTo(file)) { - IntValue key = DataValueClasses.newDirectInstance(IntValue.class); DemoOrderVOInterface value = DataValueClasses.newDirectReference(DemoOrderVOInterface.class); diff --git a/src/test/java/net/openhft/chronicle/map/EntryCountMapTest.java b/src/test/java/net/openhft/chronicle/map/EntryCountMapTest.java index f98d29ee3..0129f5048 100644 --- a/src/test/java/net/openhft/chronicle/map/EntryCountMapTest.java +++ b/src/test/java/net/openhft/chronicle/map/EntryCountMapTest.java @@ -198,5 +198,4 @@ public class EntryCountMapTest { return sum; } - } diff --git a/src/test/java/net/openhft/chronicle/map/EventListenerTestWithTCPSocketReplication.java b/src/test/java/net/openhft/chronicle/map/EventListenerTestWithTCPSocketReplication.java index ff3fe3a21..2b038895b 100644 --- a/src/test/java/net/openhft/chronicle/map/EventListenerTestWithTCPSocketReplication.java +++ b/src/test/java/net/openhft/chronicle/map/EventListenerTestWithTCPSocketReplication.java @@ -37,7 +37,6 @@ import java.util.concurrent.atomic.AtomicReference; */ public class EventListenerTestWithTCPSocketReplication { - ChronicleMap map1; ChronicleMap map2; @@ -69,7 +68,6 @@ public class EventListenerTestWithTCPSocketReplication { } }; - @After public void tearDown() throws InterruptedException { @@ -89,11 +87,9 @@ public class EventListenerTestWithTCPSocketReplication { System.gc(); } - @Test public void testAdded() throws IOException, InterruptedException { - // ---------- SERVER1 1 ---------- { @@ -123,10 +119,8 @@ public class EventListenerTestWithTCPSocketReplication { Assert.assertEquals(Integer.valueOf(5), keyRef.get()); Assert.assertEquals("EXAMPLE", valueRef.get()); - } - @Test public void testRemoteNotifyPutLargerValue() throws IOException, InterruptedException { @@ -139,7 +133,6 @@ public class EventListenerTestWithTCPSocketReplication { map1 = map1Builder.create(); - } // ---------- SERVER2 2 on the same server as ---------- @@ -149,12 +142,10 @@ public class EventListenerTestWithTCPSocketReplication { map2.put(5, "WILL_GET_OVER-WRITTEN"); } - // we will stores some data into one map here map1.put(5, "EXAMPLE"); waitTillReplicated(); - Assert.assertTrue("The eventListener.onPut should have been called", putWasCalled.get()); Assert.assertEquals(Integer.valueOf(5), keyRef.get()); Assert.assertEquals("EXAMPLE", valueRef.get()); @@ -162,11 +153,9 @@ public class EventListenerTestWithTCPSocketReplication { } - @Test public void testRemoteNotifyPutSmallerValue() throws IOException, InterruptedException { - // ---------- SERVER1 1 ---------- { @@ -183,13 +172,11 @@ public class EventListenerTestWithTCPSocketReplication { map2.put(5, "small"); } - // we will stores some data into one map here map1.put(5, "EXAMPLE"); waitTillReplicated(); - Assert.assertTrue("The eventListener.onPut should have been called", putWasCalled.get()); Assert.assertEquals(Integer.valueOf(5), keyRef.get()); Assert.assertEquals("small", replacedValueRef.get()); @@ -197,7 +184,6 @@ public class EventListenerTestWithTCPSocketReplication { } - @Test @Ignore("TODO Failing test") public void testRemoteNotifyRemove() throws IOException, InterruptedException { @@ -211,7 +197,6 @@ public class EventListenerTestWithTCPSocketReplication { map1 = map1Builder.create(); - } // ---------- SERVER2 2 on the same server as ---------- @@ -247,7 +232,6 @@ public class EventListenerTestWithTCPSocketReplication { .eventListener(eventListener); } - private void waitTillReplicated() throws InterruptedException { int t = 0; for (; t < 5000; t++) { diff --git a/src/test/java/net/openhft/chronicle/map/GuavaTest.java b/src/test/java/net/openhft/chronicle/map/GuavaTest.java index e6f48ad95..10e6f6d48 100644 --- a/src/test/java/net/openhft/chronicle/map/GuavaTest.java +++ b/src/test/java/net/openhft/chronicle/map/GuavaTest.java @@ -32,7 +32,6 @@ import java.util.Map; import static com.google.common.collect.testing.features.MapFeature.*; - public class GuavaTest extends TestCase { public static Test suite() { diff --git a/src/test/java/net/openhft/chronicle/map/IntIntMultiMapTest.java b/src/test/java/net/openhft/chronicle/map/IntIntMultiMapTest.java index 8369e0c7b..907e6238e 100644 --- a/src/test/java/net/openhft/chronicle/map/IntIntMultiMapTest.java +++ b/src/test/java/net/openhft/chronicle/map/IntIntMultiMapTest.java @@ -18,7 +18,6 @@ package net.openhft.chronicle.map; - import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; import net.openhft.lang.collection.SingleThreadedDirectBitSet; diff --git a/src/test/java/net/openhft/chronicle/map/IntValueMapTest.java b/src/test/java/net/openhft/chronicle/map/IntValueMapTest.java index 7cba0cd86..7c723db40 100644 --- a/src/test/java/net/openhft/chronicle/map/IntValueMapTest.java +++ b/src/test/java/net/openhft/chronicle/map/IntValueMapTest.java @@ -28,7 +28,6 @@ import java.nio.ByteBuffer; import static org.junit.Assert.assertEquals; - /** * @author Rob Austin. */ diff --git a/src/test/java/net/openhft/chronicle/map/MapByNameTest.java b/src/test/java/net/openhft/chronicle/map/MapByNameTest.java index c4ed5e881..10b2ab75f 100644 --- a/src/test/java/net/openhft/chronicle/map/MapByNameTest.java +++ b/src/test/java/net/openhft/chronicle/map/MapByNameTest.java @@ -32,7 +32,6 @@ import static junit.framework.Assert.assertEquals; */ public class MapByNameTest { - private ReplicationHubFindByName findMapByName; @Before @@ -66,7 +65,6 @@ public class MapByNameTest { // findMapByName.get("hello"); // } - @Test @Ignore("currently work in progress") public void testConnectByName() throws IOException, InterruptedException, TimeoutException { @@ -89,7 +87,6 @@ public class MapByNameTest { public static void main(String... args) throws IOException, InterruptedException, TimeoutException { NodeDiscovery nodeDiscovery = new NodeDiscovery(); - final ReplicationHubFindByName mapByName = nodeDiscovery.mapByName(); Thread.sleep(2000); @@ -105,7 +102,6 @@ public class MapByNameTest { // final ChronicleMap map = mapByName.from("myMap5"); - // allow time for replication Thread.sleep(2000); System.out.print(map); diff --git a/src/test/java/net/openhft/chronicle/map/NodeDiscoveryBroadcasterTest.java b/src/test/java/net/openhft/chronicle/map/NodeDiscoveryBroadcasterTest.java index c1c11b867..085780062 100644 --- a/src/test/java/net/openhft/chronicle/map/NodeDiscoveryBroadcasterTest.java +++ b/src/test/java/net/openhft/chronicle/map/NodeDiscoveryBroadcasterTest.java @@ -35,11 +35,9 @@ public class NodeDiscoveryBroadcasterTest extends TestCase { public static final int SERVER2_IDENTIFER = 10; public static final int PROPOSED_IDENTIFIER = 5; - @Test public void testsTheSerializationOfTheNodeDiscovery() throws IOException, InterruptedException { - AtomicReference ref = new AtomicReference(); final AddressAndPort ourAddressAndPort1 = new AddressAndPort(InetAddress.getLocalHost() .getAddress(), @@ -81,7 +79,6 @@ public class NodeDiscoveryBroadcasterTest extends TestCase { // add our identifier and host:port to the list of known identifiers - // SERVER 2 - is the node already in the cluster // read the bootstrap along with the host and port it came from { @@ -101,7 +98,6 @@ public class NodeDiscoveryBroadcasterTest extends TestCase { // RemoteNodes remoteNodes = new RemoteNodes(bitSetBytes); - udpData.clear(); // broadcasts in response to the bootstrap all the host:ports and identifiers that it knows about @@ -111,7 +107,6 @@ public class NodeDiscoveryBroadcasterTest extends TestCase { } - // SERER1 // receive @@ -160,7 +155,6 @@ public class NodeDiscoveryBroadcasterTest extends TestCase { (new DiscoveryNodeBytesMarshallable.ProposedNodes(server1AddressAndPort, (byte) PROPOSED_IDENTIFIER))); } - // SERVER 2 // write/broadcast the the response to receiving a bootstrap message { @@ -169,7 +163,6 @@ public class NodeDiscoveryBroadcasterTest extends TestCase { // RemoteNodes remoteNodes = new RemoteNodes(bitSetBytes); - udpData.clear(); // broadcasts in response to the bootstrap all the host:ports and identifiers that it knows about @@ -179,7 +172,6 @@ public class NodeDiscoveryBroadcasterTest extends TestCase { } - // SERVER 1 // read the bootstrap along with all the proposed identifiers ( this will include our // PROPOSED_IDENTIFIER and any that come from other server @@ -198,8 +190,6 @@ public class NodeDiscoveryBroadcasterTest extends TestCase { } - } - } diff --git a/src/test/java/net/openhft/chronicle/map/PostChannelCreationTest.java b/src/test/java/net/openhft/chronicle/map/PostChannelCreationTest.java index d7d95e72f..614a61910 100644 --- a/src/test/java/net/openhft/chronicle/map/PostChannelCreationTest.java +++ b/src/test/java/net/openhft/chronicle/map/PostChannelCreationTest.java @@ -18,7 +18,6 @@ package net.openhft.chronicle.map; - import net.openhft.chronicle.hash.replication.ReplicationHub; import net.openhft.chronicle.hash.replication.TcpTransportAndNetworkConfig; import org.junit.After; @@ -57,7 +56,6 @@ public class PostChannelCreationTest { return file; } - @Before public void setup() throws IOException { @@ -79,7 +77,6 @@ public class PostChannelCreationTest { .instance().replicatedViaChannel(hubA.createChannel((short) 2)).create(); } - { final TcpTransportAndNetworkConfig tcpConfig = TcpTransportAndNetworkConfig .of(8087, new InetSocketAddress("localhost", 8086)) @@ -98,7 +95,6 @@ public class PostChannelCreationTest { .instance().replicatedViaChannel(hubB.createChannel((short) 2)).create(); } - } @After @@ -114,7 +110,6 @@ public class PostChannelCreationTest { System.gc(); } - /** * sets up a 2 clusters ( notionally one for each host ), and replicates 2 Chronicle Maps between them * @@ -138,7 +133,6 @@ public class PostChannelCreationTest { } - /** * waits until map1 and map2 show the same value * @@ -158,5 +152,3 @@ public class PostChannelCreationTest { } - - diff --git a/src/test/java/net/openhft/chronicle/map/ReplicatedChronicleMapTest.java b/src/test/java/net/openhft/chronicle/map/ReplicatedChronicleMapTest.java index 3504253c2..0d5364399 100644 --- a/src/test/java/net/openhft/chronicle/map/ReplicatedChronicleMapTest.java +++ b/src/test/java/net/openhft/chronicle/map/ReplicatedChronicleMapTest.java @@ -41,14 +41,12 @@ public class ReplicatedChronicleMapTest extends JSR166TestCase { } - ChronicleMap newShmStringString() throws IOException { return ChronicleMapBuilder.of(CharSequence.class, CharSequence.class) .create(); } - /** * Returns a new map from Integers 1-5 to Strings "A"-"E". */ @@ -119,7 +117,6 @@ public class ReplicatedChronicleMapTest extends JSR166TestCase { assertFalse(map.containsValue("Z")); } - /** * Inserted elements that are subclasses of the same Comparable * class are found. diff --git a/src/test/java/net/openhft/chronicle/map/ReplicationCheckingMap.java b/src/test/java/net/openhft/chronicle/map/ReplicationCheckingMap.java index ee30862a1..94f72aea3 100644 --- a/src/test/java/net/openhft/chronicle/map/ReplicationCheckingMap.java +++ b/src/test/java/net/openhft/chronicle/map/ReplicationCheckingMap.java @@ -104,7 +104,6 @@ public class ReplicationCheckingMap implements ChronicleMap { } - Assert.assertEquals(map1, map2); System.out.print(map1); System.out.print(map2); @@ -112,7 +111,6 @@ public class ReplicationCheckingMap implements ChronicleMap { if (r1 != null) Assert.assertEquals(r1.toString(), r2.toString()); - return (R) r1; } @@ -133,7 +131,6 @@ public class ReplicationCheckingMap implements ChronicleMap { @Override public boolean containsKey(final Object key) { - return check(new Call() { @Override public Object method(ConcurrentMap map) { @@ -160,7 +157,6 @@ public class ReplicationCheckingMap implements ChronicleMap { @Override public V get(final Object key) { - return check(new Call() { @Override public Object method(ConcurrentMap map) { @@ -195,7 +191,6 @@ public class ReplicationCheckingMap implements ChronicleMap { @Override public Set keySet() { - return check(new Call() { @Override public Object method(ConcurrentMap map) { @@ -210,7 +205,6 @@ public class ReplicationCheckingMap implements ChronicleMap { @Override public Collection values() { - return check(new Call() { @Override public Collection method(ConcurrentMap map) { @@ -326,5 +320,4 @@ public class ReplicationCheckingMap implements ChronicleMap { Object method(ConcurrentMap map); } - } diff --git a/src/test/java/net/openhft/chronicle/map/SerializerTest.java b/src/test/java/net/openhft/chronicle/map/SerializerTest.java index ea21e7f9a..988658fe4 100644 --- a/src/test/java/net/openhft/chronicle/map/SerializerTest.java +++ b/src/test/java/net/openhft/chronicle/map/SerializerTest.java @@ -47,7 +47,6 @@ public class SerializerTest { testReadWriteValue(new MyTestClassObjectGraph(3)); } - @Test public void testKeyMarshallable() throws Exception { testReadWriteKey("Test"); @@ -64,7 +63,6 @@ public class SerializerTest { testReadWriteKey(new MyTestClassObjectGraph(3)); } - public void testReadWriteValue(Object value) throws Exception { Class valueClass = value.getClass(); @@ -72,12 +70,10 @@ public class SerializerTest { final ByteBufferBytes out = new ByteBufferBytes(ByteBuffer.allocateDirect(1024)); ByteBufferBytes in = out.slice(); - ChronicleMapBuilder cBuilder = ChronicleMapBuilder.of(Integer.class, valueClass); OnHeapUpdatableChronicleMapBuilder builder = (OnHeapUpdatableChronicleMapBuilder) cBuilder.delegate; - builder.preMapConstruction(false); WriterWithSize valueWriterWithSize = new WriterWithSize(builder.valueBuilder); @@ -88,12 +84,10 @@ public class SerializerTest { long position = out.position(); in.limit(position); - Object actual = valueReaderWithSize.read(in, null); Assert.assertEquals(actual, value); } - public void testReadWriteKey(Object key) throws Exception { Class clazz = key.getClass(); @@ -120,7 +114,6 @@ public class SerializerTest { } - } public static class MyTestClassExternalizable implements Externalizable { @@ -129,7 +122,6 @@ public class SerializerTest { public MyTestClassExternalizable() { } - MyTestClassExternalizable(int a) { this.a = a; } @@ -263,5 +255,4 @@ public class SerializerTest { } } - } \ No newline at end of file diff --git a/src/test/java/net/openhft/chronicle/map/SingleMapChannelTest.java b/src/test/java/net/openhft/chronicle/map/SingleMapChannelTest.java index 4a16a5ceb..3c841203a 100644 --- a/src/test/java/net/openhft/chronicle/map/SingleMapChannelTest.java +++ b/src/test/java/net/openhft/chronicle/map/SingleMapChannelTest.java @@ -18,7 +18,6 @@ package net.openhft.chronicle.map; - import net.openhft.chronicle.hash.replication.ReplicationHub; import net.openhft.chronicle.hash.replication.TcpTransportAndNetworkConfig; import org.junit.After; @@ -55,7 +54,6 @@ public class SingleMapChannelTest { return file; } - @Before public void setup() throws IOException { @@ -76,7 +74,6 @@ public class SingleMapChannelTest { .instance().replicatedViaChannel(hubA.createChannel((short) 1)).create(); } - { final TcpTransportAndNetworkConfig tcpConfig = TcpTransportAndNetworkConfig .of(8087, new InetSocketAddress("localhost", 8086)) @@ -107,7 +104,6 @@ public class SingleMapChannelTest { System.gc(); } - @Test public void test() throws IOException, InterruptedException { @@ -118,13 +114,10 @@ public class SingleMapChannelTest { Assert.assertEquals("map1a=map1b", map1a, map1b); - assertTrue("map1a.empty", !map1a.isEmpty()); - } - /** * waits until map1 and map2 show the same value * @@ -144,5 +137,3 @@ public class SingleMapChannelTest { } - - diff --git a/src/test/java/net/openhft/chronicle/map/TCPSocketReplication3VoidValueTest.java b/src/test/java/net/openhft/chronicle/map/TCPSocketReplication3VoidValueTest.java index 54b4fa4bb..e807e25dd 100755 --- a/src/test/java/net/openhft/chronicle/map/TCPSocketReplication3VoidValueTest.java +++ b/src/test/java/net/openhft/chronicle/map/TCPSocketReplication3VoidValueTest.java @@ -75,7 +75,6 @@ public class TCPSocketReplication3VoidValueTest { StatelessClientTest.checkThreadsShutdown(threads); } - @Test public void test3() throws IOException, InterruptedException { @@ -111,7 +110,6 @@ public class TCPSocketReplication3VoidValueTest { } - @Test public void testClear() throws IOException, InterruptedException { @@ -147,5 +145,3 @@ public class TCPSocketReplication3VoidValueTest { } - - diff --git a/src/test/java/net/openhft/chronicle/map/TCPSocketReplication3wayPutReturnsNullTest.java b/src/test/java/net/openhft/chronicle/map/TCPSocketReplication3wayPutReturnsNullTest.java index 5b172675e..e25494f66 100755 --- a/src/test/java/net/openhft/chronicle/map/TCPSocketReplication3wayPutReturnsNullTest.java +++ b/src/test/java/net/openhft/chronicle/map/TCPSocketReplication3wayPutReturnsNullTest.java @@ -40,7 +40,6 @@ import static org.junit.Assert.assertTrue; public class TCPSocketReplication3wayPutReturnsNullTest { - private ChronicleMap map1; private ChronicleMap map2; private ChronicleMap map3; @@ -57,7 +56,6 @@ public class TCPSocketReplication3wayPutReturnsNullTest { .replication(identifier, tcpConfig).create(); } - @Before public void setup() throws IOException { map1 = newTcpSocketShmIntString((byte) 1, 8026, new InetSocketAddress("localhost", 8027), @@ -129,7 +127,6 @@ public class TCPSocketReplication3wayPutReturnsNullTest { } - @Test public void testPutIfAbsent() throws IOException, InterruptedException { @@ -168,5 +165,3 @@ public class TCPSocketReplication3wayPutReturnsNullTest { } } - - diff --git a/src/test/java/net/openhft/chronicle/map/TCPSocketReplication3wayTest.java b/src/test/java/net/openhft/chronicle/map/TCPSocketReplication3wayTest.java index 25a751f42..d5386c5ad 100755 --- a/src/test/java/net/openhft/chronicle/map/TCPSocketReplication3wayTest.java +++ b/src/test/java/net/openhft/chronicle/map/TCPSocketReplication3wayTest.java @@ -38,7 +38,6 @@ import static org.junit.Assert.*; public class TCPSocketReplication3wayTest { - private ChronicleMap map1; private ChronicleMap map2; private ChronicleMap map3; @@ -74,7 +73,6 @@ public class TCPSocketReplication3wayTest { StatelessClientTest.checkThreadsShutdown(threads); } - @Test public void test3() throws IOException, InterruptedException { @@ -113,7 +111,6 @@ public class TCPSocketReplication3wayTest { } - @Test public void testClear() throws IOException, InterruptedException { @@ -137,7 +134,6 @@ public class TCPSocketReplication3wayTest { } - @Test public void testPutIfAbsent() throws IOException, InterruptedException { @@ -176,5 +172,3 @@ public class TCPSocketReplication3wayTest { } } - - diff --git a/src/test/java/net/openhft/chronicle/map/TCPSocketReplication4WayMapTest.java b/src/test/java/net/openhft/chronicle/map/TCPSocketReplication4WayMapTest.java index a9c211472..f3fed2f50 100644 --- a/src/test/java/net/openhft/chronicle/map/TCPSocketReplication4WayMapTest.java +++ b/src/test/java/net/openhft/chronicle/map/TCPSocketReplication4WayMapTest.java @@ -18,7 +18,6 @@ package net.openhft.chronicle.map; - import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -52,7 +51,6 @@ public class TCPSocketReplication4WayMapTest { identifier, serverPort, endpoints).create(); } - @Before public void setup() throws IOException { @@ -89,7 +87,6 @@ public class TCPSocketReplication4WayMapTest { StatelessClientTest.checkThreadsShutdown(threads); } - @Test public void test() throws IOException, InterruptedException { Thread.sleep(1000); @@ -108,7 +105,6 @@ public class TCPSocketReplication4WayMapTest { } - @Test public void testBufferOverflow() throws IOException, InterruptedException { Thread.sleep(1000); @@ -126,7 +122,6 @@ public class TCPSocketReplication4WayMapTest { } - @Test public void testBufferOverflowPutIfAbsent() throws IOException, InterruptedException { Thread.sleep(1000); @@ -149,7 +144,6 @@ public class TCPSocketReplication4WayMapTest { } - /** * waits until map1 and map2 show the same value * @@ -174,5 +168,3 @@ public class TCPSocketReplication4WayMapTest { } - - diff --git a/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationBootStrapTest.java b/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationBootStrapTest.java index babd79f1a..ac06b72bd 100644 --- a/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationBootStrapTest.java +++ b/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationBootStrapTest.java @@ -88,7 +88,6 @@ public class TCPSocketReplicationBootStrapTest { } - @Test public void testBootstrapAndHeartbeat() throws IOException, InterruptedException { @@ -121,7 +120,6 @@ public class TCPSocketReplicationBootStrapTest { map2a.close(); - { // restart map 2 but does not connect it to map1 final ChronicleMap map2b = ChronicleMapBuilder.of(Integer.class, @@ -141,7 +139,6 @@ public class TCPSocketReplicationBootStrapTest { waitTillEqual(20000000); assertEquals("ADDED WHEN DISCONNECTED TO MAP1", map1.get(11)); - } @After @@ -187,5 +184,3 @@ public class TCPSocketReplicationBootStrapTest { } - - diff --git a/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationIntValueTest.java b/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationIntValueTest.java index 065c921a4..59f8cb9b8 100644 --- a/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationIntValueTest.java +++ b/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationIntValueTest.java @@ -70,7 +70,6 @@ public class TCPSocketReplicationIntValueTest { s_port += 2; } - @After public void tearDown() throws InterruptedException { @@ -97,7 +96,6 @@ public class TCPSocketReplicationIntValueTest { StatelessClientTest.checkThreadsShutdown(threads); } - @Test public void test3() throws IOException, InterruptedException { @@ -116,7 +114,6 @@ public class TCPSocketReplicationIntValueTest { return value; } - // see https://higherfrequencytrading.atlassian.net/browse/HCOLL-148 @Test public void test() throws IOException, InterruptedException { @@ -141,7 +138,6 @@ public class TCPSocketReplicationIntValueTest { } - @Test public void testBufferOverflow() throws IOException, InterruptedException { @@ -173,7 +169,6 @@ public class TCPSocketReplicationIntValueTest { assertEquals(map1, map2); } - // TODO test this with larger sizes. @Test(timeout = 12000) @Ignore("Doesn't work, maps need to check equality.") @@ -189,7 +184,6 @@ public class TCPSocketReplicationIntValueTest { final int select = rnd.nextInt(2); final ChronicleMap map = select > 0 ? map1 : map2; - if (rnd.nextBoolean()) { map.put(set(rnd.nextInt(Builder.SIZE)), "test"); } else { @@ -210,5 +204,3 @@ public class TCPSocketReplicationIntValueTest { } - - diff --git a/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationNativeTest.java b/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationNativeTest.java index 7113afa67..a91205cf3 100644 --- a/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationNativeTest.java +++ b/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationNativeTest.java @@ -42,11 +42,9 @@ import static org.junit.Assert.assertTrue; public class TCPSocketReplicationNativeTest { - private ChronicleMap map1; private ChronicleMap map2; - @Before public void setup() throws IOException { InetSocketAddress endpoint = new InetSocketAddress("localhost", 8077); @@ -101,7 +99,6 @@ public class TCPSocketReplicationNativeTest { value.setValue(10); } - // allow time for the recompilation to resolve waitTillEqual(5000); @@ -110,7 +107,6 @@ public class TCPSocketReplicationNativeTest { } - @Test public void test2Puts() throws IOException, InterruptedException { @@ -152,8 +148,5 @@ public class TCPSocketReplicationNativeTest { } - } - - diff --git a/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationPostConnectionTest.java b/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationPostConnectionTest.java index bad7fa475..1befdc59f 100644 --- a/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationPostConnectionTest.java +++ b/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationPostConnectionTest.java @@ -57,7 +57,6 @@ public class TCPSocketReplicationPostConnectionTest { @Test public void testPostConnection() throws IOException, InterruptedException { - map1 = TCPSocketReplication4WayMapTest.newTcpSocketShmIntString((byte) 1, 8076); map1.put(5, "EXAMPLE-2"); Thread.sleep(1); @@ -74,7 +73,6 @@ public class TCPSocketReplicationPostConnectionTest { @Test public void testPostConnectionNoSleep() throws IOException, InterruptedException { - map1 = TCPSocketReplication4WayMapTest.newTcpSocketShmIntString((byte) 1, 8076); map1.put(5, "EXAMPLE-2"); map2 = TCPSocketReplication4WayMapTest.newTcpSocketShmIntString((byte) 2, 8077, new InetSocketAddress("localhost", 8076)); @@ -102,14 +100,12 @@ public class TCPSocketReplicationPostConnectionTest { } - Thread.sleep(1); map1.put(6, "EXAMPLE-1"); // recreate map2 with new unique file map2 = map2aBuilder.createPersistedTo(Builder.getPersistenceFile()); - // allow time for the recompilation to resolve waitTillEqual(5000); @@ -119,7 +115,6 @@ public class TCPSocketReplicationPostConnectionTest { } - @After public void tearDown() { @@ -134,7 +129,6 @@ public class TCPSocketReplicationPostConnectionTest { System.gc(); } - /** * * waits until map1 and map2 show the same value * @@ -153,5 +147,3 @@ public class TCPSocketReplicationPostConnectionTest { } - - diff --git a/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationTest.java b/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationTest.java index a4cf4d736..071e28fa9 100644 --- a/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationTest.java +++ b/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationTest.java @@ -42,7 +42,6 @@ import static org.junit.Assert.assertTrue; public class TCPSocketReplicationTest { - static int s_port = 12050; private ChronicleMap map1; private ChronicleMap map2; @@ -95,7 +94,6 @@ public class TCPSocketReplicationTest { assertTrue(!map1.isEmpty()); } - @Test public void test() throws IOException, InterruptedException { @@ -119,7 +117,6 @@ public class TCPSocketReplicationTest { } - @Test public void testBufferOverflow() throws IOException, InterruptedException { @@ -164,7 +161,6 @@ public class TCPSocketReplicationTest { final int select = rnd.nextInt(2); final ChronicleMap map = select > 0 ? map1 : map2; - switch (rnd.nextInt(2)) { case 0: map.put(rnd.nextInt(Builder.SIZE), "test"); @@ -181,8 +177,5 @@ public class TCPSocketReplicationTest { } - } - - diff --git a/src/test/java/net/openhft/chronicle/map/TestBooleanValues.java b/src/test/java/net/openhft/chronicle/map/TestBooleanValues.java index 4eba46b99..20f10db07 100644 --- a/src/test/java/net/openhft/chronicle/map/TestBooleanValues.java +++ b/src/test/java/net/openhft/chronicle/map/TestBooleanValues.java @@ -23,7 +23,6 @@ import org.junit.Test; import java.io.IOException; - /** * @author Rob Austin. */ diff --git a/src/test/java/net/openhft/chronicle/map/TimeBasedReplicationTest.java b/src/test/java/net/openhft/chronicle/map/TimeBasedReplicationTest.java index c11820845..eaa80d695 100644 --- a/src/test/java/net/openhft/chronicle/map/TimeBasedReplicationTest.java +++ b/src/test/java/net/openhft/chronicle/map/TimeBasedReplicationTest.java @@ -37,7 +37,6 @@ import static org.junit.Assert.*; */ public class TimeBasedReplicationTest extends JSR166TestCase { - public static final byte IDENTIFIER = 1; private static File getPersistenceFile() { @@ -59,7 +58,6 @@ public class TimeBasedReplicationTest extends JSR166TestCase { StatelessClientTest.checkThreadsShutdown(threads); } - @Test public void testIgnoreALatePut() throws IOException { @@ -80,7 +78,6 @@ public class TimeBasedReplicationTest extends JSR166TestCase { // now test assume that we receive a late update to the map, the following update should be ignored late(timeProvider); - map.put("key-1", "value-2"); // we'll now flip the time back to the current in order to do the read the result @@ -109,7 +106,6 @@ public class TimeBasedReplicationTest extends JSR166TestCase { // now test assume that we receive a late update to the map, the following update should be ignored late(timeProvider); - final Object o = map.putIfAbsent("key-1", "value-2"); assertEquals(o, null); @@ -132,18 +128,15 @@ public class TimeBasedReplicationTest extends JSR166TestCase { current(timeProvider); - // we do a put at the current time map.put("key-1", "value-1"); assertEquals(1, map.size()); assertEquals("value-1", map.get("key-1")); - // now test assume that we receive a late update to the map, // the following update should be ignored late(timeProvider); - final Object o = map.replace("key-1", "value-2"); assertEquals(o, null); @@ -175,10 +168,8 @@ public class TimeBasedReplicationTest extends JSR166TestCase { // now test assume that we receive a late update to the map, the following update should be ignored late(timeProvider); - assertEquals(null, map.replace("key-1", "value-2")); - // we'll now flip the time back to the current in order to do the read the result current(timeProvider); assertEquals(1, map.size()); @@ -206,7 +197,6 @@ public class TimeBasedReplicationTest extends JSR166TestCase { // now test assume that we receive a late update to the map, the following update should be ignored late(timeProvider); - assertEquals(false, map.remove("key-1", "value-1")); // we'll now flip the time back to the current in order to do the read the result @@ -247,7 +237,6 @@ public class TimeBasedReplicationTest extends JSR166TestCase { } - @Test public void testIgnoreWithRemoteRemove() throws IOException { @@ -281,11 +270,9 @@ public class TimeBasedReplicationTest extends JSR166TestCase { } } - @Test public void testIgnoreWithRemotePut() throws IOException { - final TimeProvider timeProvider = Mockito.mock(TimeProvider.class); try (ReplicatedChronicleMap map = (ReplicatedChronicleMap) ChronicleMapBuilder.of (CharSequence.class, CharSequence.class) @@ -306,7 +293,6 @@ public class TimeBasedReplicationTest extends JSR166TestCase { final long late = System.currentTimeMillis() - TimeUnit.SECONDS.toMillis(5); assertEquals(null, map.put("key-1", "value-2", IDENTIFIER, late)); - // we'll now flip the time back to the current in order to do the read the result current(timeProvider); @@ -316,7 +302,6 @@ public class TimeBasedReplicationTest extends JSR166TestCase { } } - @Test public void testRemoveFollowedByLatePut() throws IOException { @@ -347,7 +332,6 @@ public class TimeBasedReplicationTest extends JSR166TestCase { } } - @Test public void testPutRemovePut() throws IOException { diff --git a/src/test/java/net/openhft/chronicle/map/TwoMapOnDifferentServersTest.java b/src/test/java/net/openhft/chronicle/map/TwoMapOnDifferentServersTest.java index 01c8e715d..3c11977dd 100644 --- a/src/test/java/net/openhft/chronicle/map/TwoMapOnDifferentServersTest.java +++ b/src/test/java/net/openhft/chronicle/map/TwoMapOnDifferentServersTest.java @@ -37,7 +37,6 @@ import static org.junit.Assert.assertTrue; */ public class TwoMapOnDifferentServersTest { - private ChronicleMap map1; private ChronicleMap map2; @@ -48,7 +47,6 @@ public class TwoMapOnDifferentServersTest { TcpTransportAndNetworkConfig.of(8076, new InetSocketAddress("localhost", 8077)) .heartBeatInterval(1, SECONDS).autoReconnectedUponDroppedConnection(true); - map1 = ChronicleMapBuilder.of(Integer.class, CharSequence.class) .entries(20000) .replication((byte) 1, tcpConfig).create(); @@ -98,7 +96,6 @@ public class TwoMapOnDifferentServersTest { assertTrue(!map1.isEmpty()); } - /** * * waits until map1 and map2 show the same value * @@ -115,5 +112,4 @@ public class TwoMapOnDifferentServersTest { } - } \ No newline at end of file diff --git a/src/test/java/net/openhft/chronicle/map/UDPSocketReplicationTest.java b/src/test/java/net/openhft/chronicle/map/UDPSocketReplicationTest.java index b1dac4869..2e8e741e0 100644 --- a/src/test/java/net/openhft/chronicle/map/UDPSocketReplicationTest.java +++ b/src/test/java/net/openhft/chronicle/map/UDPSocketReplicationTest.java @@ -75,7 +75,6 @@ public class UDPSocketReplicationTest { System.gc(); } - /* @Test @Ignore public void testBufferOverflow() throws IOException, InterruptedException { @@ -90,5 +89,3 @@ public class UDPSocketReplicationTest { } - - diff --git a/src/test/java/net/openhft/chronicle/map/example/ChannelReplicationTest.java b/src/test/java/net/openhft/chronicle/map/example/ChannelReplicationTest.java index 30b7bf2ac..c4c19398b 100644 --- a/src/test/java/net/openhft/chronicle/map/example/ChannelReplicationTest.java +++ b/src/test/java/net/openhft/chronicle/map/example/ChannelReplicationTest.java @@ -44,11 +44,9 @@ public class ChannelReplicationTest { private ChronicleMap favoriteColourServer2; private ChronicleMap favoriteColourServer1; - private ReplicationHub hubOnServer1; private ReplicationHub hubOnServer2; - @Test public void test() throws IOException, InterruptedException { @@ -64,7 +62,6 @@ public class ChannelReplicationTest { .of(8086, new InetSocketAddress("localhost", 8087)) .heartBeatInterval(1, SECONDS).autoReconnectedUponDroppedConnection(true); - hubOnServer1 = ReplicationHub.builder() .tcpTransportAndNetwork(tcpConfig) .createWithId(identifier); @@ -103,14 +100,12 @@ public class ChannelReplicationTest { .tcpTransportAndNetwork(tcpConfig) .createWithId(identifier); - // this demotes favoriteColour short channel1 = (short) 1; favoriteColourServer2 = smallStringToStringMapBuilder.instance() .replicatedViaChannel(hubOnServer2.createChannel(channel1)).create(); - favoriteColourServer2.put("rob", "blue"); // this demotes favoriteComputer @@ -123,7 +118,6 @@ public class ChannelReplicationTest { favoriteComputerServer2.put("daniel", "mac"); } - // allow time for the recompilation to resolve for (int t = 0; t < 2500; t++) { if (favoriteComputerServer2.equals(favoriteComputerServer1) && @@ -132,31 +126,25 @@ public class ChannelReplicationTest { Thread.sleep(1); } - assertEquals(favoriteComputerServer1, favoriteComputerServer2); Assert.assertEquals(3, favoriteComputerServer2.size()); - assertEquals(favoriteColourServer1, favoriteColourServer2); Assert.assertEquals(2, favoriteColourServer1.size()); - favoriteColourServer1.close(); favoriteComputerServer2.close(); favoriteColourServer2.close(); favoriteComputerServer1.close(); } - @Test public void testPublishOnOneMapOnlyBootstrapTwice() throws IOException, InterruptedException { - ChronicleMap favoriteComputerServer3; ChronicleMap favoriteColourServer3; - // server 1 with identifier = 1 { ChronicleMapBuilder smallStringToStringMapBuilder = @@ -169,7 +157,6 @@ public class ChannelReplicationTest { .of(8086) .heartBeatInterval(1, SECONDS).autoReconnectedUponDroppedConnection(true); - hubOnServer1 = ReplicationHub.builder() .tcpTransportAndNetwork(tcpConfig) .createWithId(identifier); @@ -190,7 +177,6 @@ public class ChannelReplicationTest { favoriteComputerServer1.put("peter", "dell"); - } // server 2 with identifier = 2 @@ -218,7 +204,6 @@ public class ChannelReplicationTest { favoriteColourServer2 = instance.create(); } - { ChronicleMapBuilder smallStringToStringMapBuilder = ChronicleMapBuilder.of(CharSequence.class, CharSequence.class) @@ -235,7 +220,6 @@ public class ChannelReplicationTest { .tcpTransportAndNetwork(tcpConfig) .createWithId(identifier); - // this demotes favoriteColour short channel1 = (short) 1; @@ -248,10 +232,8 @@ public class ChannelReplicationTest { favoriteComputerServer3 = smallStringToStringMapBuilder.instance() .replicatedViaChannel(hubOnServer3.createChannel(channel2)).create(); - } - // allow time for the recompilation to resolve for (int t = 0; t < 250000; t++) { if (favoriteComputerServer1.equals(favoriteComputerServer3) && @@ -261,11 +243,9 @@ public class ChannelReplicationTest { Thread.sleep(1); } - assertEquals(favoriteComputerServer3, favoriteComputerServer1); assertEquals(favoriteColourServer2, favoriteColourServer3); - Assert.assertEquals(1, favoriteColourServer3.size()); Assert.assertEquals(1, favoriteComputerServer1.size()); @@ -275,13 +255,10 @@ public class ChannelReplicationTest { favoriteComputerServer1.close(); favoriteColourServer1.close(); - favoriteColourServer2.close(); - } - @Test public void testPublishOnOneMapOnly() throws IOException, InterruptedException { @@ -298,7 +275,6 @@ public class ChannelReplicationTest { .heartBeatInterval(1, SECONDS) .autoReconnectedUponDroppedConnection(true); - hubOnServer1 = ReplicationHub.builder() .tcpTransportAndNetwork(tcpConfig) .createWithId(identifier); @@ -337,14 +313,12 @@ public class ChannelReplicationTest { .tcpTransportAndNetwork(tcpConfig) .createWithId(identifier); - // this demotes favoriteColour short channel1 = (short) 1; favoriteColourServer2 = smallStringToStringMapBuilder.instance() .replicatedViaChannel(hubOnServer2.createChannel(channel1)).create(); - // this demotes favoriteComputer short channel2 = (short) 2; @@ -352,7 +326,6 @@ public class ChannelReplicationTest { .replicatedViaChannel(hubOnServer2.createChannel(channel2)).create(); } - // allow time for the recompilation to resolve for (int t = 0; t < 2500; t++) { if (favoriteComputerServer2.equals(favoriteComputerServer1) && @@ -361,15 +334,12 @@ public class ChannelReplicationTest { Thread.sleep(1); } - assertEquals(favoriteComputerServer1, favoriteComputerServer2); Assert.assertEquals(1, favoriteComputerServer2.size()); - assertEquals(favoriteColourServer1, favoriteColourServer2); Assert.assertEquals(1, favoriteColourServer1.size()); - favoriteColourServer1.close(); favoriteComputerServer2.close(); favoriteColourServer2.close(); @@ -377,6 +347,3 @@ public class ChannelReplicationTest { } } - - - diff --git a/src/test/java/net/openhft/chronicle/map/fromdocs/OpenJDKAndHashMapExamplesTest.java b/src/test/java/net/openhft/chronicle/map/fromdocs/OpenJDKAndHashMapExamplesTest.java index c2cfed303..8c7bea72d 100644 --- a/src/test/java/net/openhft/chronicle/map/fromdocs/OpenJDKAndHashMapExamplesTest.java +++ b/src/test/java/net/openhft/chronicle/map/fromdocs/OpenJDKAndHashMapExamplesTest.java @@ -39,7 +39,6 @@ import static org.junit.Assert.assertEquals; public class OpenJDKAndHashMapExamplesTest { private static final SimpleDateFormat YYYYMMDD = new SimpleDateFormat("yyyyMMdd"); - private static final String TMP = System.getProperty("java.io.tmpdir"); private static long parseYYYYMMDD(String s) { @@ -125,7 +124,6 @@ public class OpenJDKAndHashMapExamplesTest { // now perform thread safe operations on my reference bond.addAtomicMaturityDate(16 * 24 * 3600 * 1000L); //20440331 - bond.addAtomicCoupon(-1 * bond.getCoupon()); //MT-safe! now a Zero Coupon Bond. // cleanup. diff --git a/src/test/java/net/openhft/chronicle/map/fromdocs/StringEncodingExamplesTest.java b/src/test/java/net/openhft/chronicle/map/fromdocs/StringEncodingExamplesTest.java index fb2dd851d..c5750a666 100644 --- a/src/test/java/net/openhft/chronicle/map/fromdocs/StringEncodingExamplesTest.java +++ b/src/test/java/net/openhft/chronicle/map/fromdocs/StringEncodingExamplesTest.java @@ -181,7 +181,6 @@ public class StringEncodingExamplesTest { testCustomKeyMarshaller(gbkStringMarshaller); } - @Test public void testNoEncodingMarshaller() throws IOException { Utf16Marshaller noEncodingMarshaller = diff --git a/src/test/java/net/openhft/chronicle/map/jrs166/map/ChronicleMapTest.java b/src/test/java/net/openhft/chronicle/map/jrs166/map/ChronicleMapTest.java index 13a9a6f01..3310b689e 100644 --- a/src/test/java/net/openhft/chronicle/map/jrs166/map/ChronicleMapTest.java +++ b/src/test/java/net/openhft/chronicle/map/jrs166/map/ChronicleMapTest.java @@ -37,10 +37,8 @@ import static org.junit.Assert.*; * Pat Fisher, Mike Judd. */ - public class ChronicleMapTest extends JSR166TestCase { - private static File getPersistenceFile() { String TMP = System.getProperty("java.io.tmpdir"); File file = new File(TMP + "/chm-test" + System.nanoTime()); @@ -54,15 +52,11 @@ public class ChronicleMapTest extends JSR166TestCase { } - - - static ChronicleMap newShmListBoolean(int size) throws IOException { return ChronicleMapBuilder.of(ArrayList.class, CharSequence.class) .entries(size).create(); } - static ChronicleMap newShmListBoolean() throws IOException { return ChronicleMapBuilder.of(ArrayList.class, CharSequence.class).create(); } @@ -72,7 +66,6 @@ public class ChronicleMapTest extends JSR166TestCase { .entries(size).create(); } - static ChronicleMap newShmIntString() throws IOException { return ChronicleMapBuilder.of(Integer.class, CharSequence.class).create(); } @@ -97,8 +90,6 @@ public class ChronicleMapTest extends JSR166TestCase { return map; } - - /** * clear removes all pairs */ @@ -159,8 +150,6 @@ public class ChronicleMapTest extends JSR166TestCase { } } - - /** * isEmpty is true of empty map and false for non-empty */ @@ -300,7 +289,6 @@ public class ChronicleMapTest extends JSR166TestCase { assertTrue(empty.containsKey(four)); assertTrue(empty.containsKey(five)); - } } } @@ -529,7 +517,6 @@ public class ChronicleMapTest extends JSR166TestCase { } } - /** * replace(null, x) throws NPE */ @@ -556,7 +543,6 @@ public class ChronicleMapTest extends JSR166TestCase { } } - /** * putIfAbsent(x, null) throws NPE */ @@ -645,10 +631,6 @@ public class ChronicleMapTest extends JSR166TestCase { } } - - - - // classes for testing Comparable fallbacks static class BI implements Comparable { private final int value; diff --git a/src/test/java/net/openhft/chronicle/map/jrs166/map/LoopHelpers.java b/src/test/java/net/openhft/chronicle/map/jrs166/map/LoopHelpers.java index 15cda484d..04e1a3e8a 100644 --- a/src/test/java/net/openhft/chronicle/map/jrs166/map/LoopHelpers.java +++ b/src/test/java/net/openhft/chronicle/map/jrs166/map/LoopHelpers.java @@ -83,7 +83,6 @@ class LoopHelpers { return x * 134775813 + 1; } - /** * Yet another random number generator */ @@ -123,7 +122,6 @@ class LoopHelpers { return x; } - public static String rightJustify(long n) { // There's probably a better way to do this... String field = " "; diff --git a/src/test/java/net/openhft/chronicle/map/jrs166/map/MapCheck.java b/src/test/java/net/openhft/chronicle/map/jrs166/map/MapCheck.java index e97ce82af..fbf312339 100644 --- a/src/test/java/net/openhft/chronicle/map/jrs166/map/MapCheck.java +++ b/src/test/java/net/openhft/chronicle/map/jrs166/map/MapCheck.java @@ -60,7 +60,6 @@ public class MapCheck { if (args.length == 0) System.out.println("Usage: MapCheck mapclass [int|float|string|object] [trials] [size] [serialtest]"); - if (args.length > 1) { String et = args[1].toLowerCase(); if (et.startsWith("i")) @@ -85,7 +84,6 @@ public class MapCheck { while ((size & 3) != 0) ++size; - System.out.print(" elements: " + eclass.getName()); System.out.print(" trials: " + numTests); System.out.print(" size: " + size); @@ -120,7 +118,6 @@ public class MapCheck { return file; } - static Map newMap() { try { return ChronicleMapBuilder.of(Object.class, Object.class).create(); @@ -186,7 +183,6 @@ public class MapCheck { closeMap(m); } - static void getTest(String nm, int n, Map s, Object[] key, int expect) { int sum = 0; timer.start(nm, n); @@ -200,7 +196,6 @@ public class MapCheck { checkSum += sum; } - // unused static void getTestBoxed(String nm, int n, Map s, Object[] key, int expect) { int sum = 0; @@ -287,7 +282,6 @@ public class MapCheck { checkSum += sum; } - static Object kitTest(Map s, int size) { Object last = null; int sum = 0; @@ -561,7 +555,6 @@ public class MapCheck { reallyAssert(s.size() == size); } - static void initializeKeys(Object[] key, Object[] absent, int size) { // Object cannot be used as it cannot be serialized. if (eclass == Object.class || eclass == Integer.class) { @@ -663,7 +656,6 @@ public class MapCheck { } } - static void randomWords(Object[] ws, int origin, int size) { for (int i = origin; i < size; ++i) { int k = 0; diff --git a/src/test/java/net/openhft/chronicle/map/jrs166/map/StatelessChronicleMapTest.java b/src/test/java/net/openhft/chronicle/map/jrs166/map/StatelessChronicleMapTest.java index bfe097626..26155b49b 100755 --- a/src/test/java/net/openhft/chronicle/map/jrs166/map/StatelessChronicleMapTest.java +++ b/src/test/java/net/openhft/chronicle/map/jrs166/map/StatelessChronicleMapTest.java @@ -45,7 +45,6 @@ import static org.junit.Assert.*; * Pat Fisher, Mike Judd. */ - public class StatelessChronicleMapTest extends JSR166TestCase { public static final int SIZE = 1024; @@ -251,7 +250,6 @@ public class StatelessChronicleMapTest extends JSR166TestCase { .entries(SIZE) .replication((byte) 2, TcpTransportAndNetworkConfig.of(port)).create(); - final ChronicleMap statelessMap = ChronicleMapBuilder .of(CharSequence.class, CharSequence.class) .statelessClient(new InetSocketAddress("localhost", port)) @@ -269,7 +267,6 @@ public class StatelessChronicleMapTest extends JSR166TestCase { .replication((byte) 2, TcpTransportAndNetworkConfig.of(port)) .create(); - final ChronicleMap statelessMap = ChronicleMapBuilder .of(byte[].class, byte[].class) .putReturnsNull(true) @@ -541,7 +538,6 @@ public class StatelessChronicleMapTest extends JSR166TestCase { assertTrue(empty.containsKey(four)); assertTrue(empty.containsKey(five)); - } } } @@ -765,7 +761,6 @@ public class StatelessChronicleMapTest extends JSR166TestCase { } } - /** * replace(null, x) throws NPE */ @@ -790,7 +785,6 @@ public class StatelessChronicleMapTest extends JSR166TestCase { } } - /** * putIfAbsent(x, null) throws NPE */ @@ -961,6 +955,5 @@ public class StatelessChronicleMapTest extends JSR166TestCase { } } - } diff --git a/src/test/java/net/openhft/chronicle/set/SetForTCPSocketReplication3wayTest.java b/src/test/java/net/openhft/chronicle/set/SetForTCPSocketReplication3wayTest.java index 53815741f..f52f3a4b0 100644 --- a/src/test/java/net/openhft/chronicle/set/SetForTCPSocketReplication3wayTest.java +++ b/src/test/java/net/openhft/chronicle/set/SetForTCPSocketReplication3wayTest.java @@ -41,12 +41,10 @@ import static org.junit.Assert.assertTrue; public class SetForTCPSocketReplication3wayTest { - private ChronicleSet set1; private ChronicleSet set2; private ChronicleSet set3; - private static > T newTcpSocketIntSet( final byte identifier, final int serverPort, @@ -57,7 +55,6 @@ public class SetForTCPSocketReplication3wayTest { .createPersistedTo(getPersistenceFile()); } - @Before public void setup() throws IOException { set1 = newTcpSocketIntSet((byte) 1, 18076, new InetSocketAddress("localhost", 18077), @@ -79,7 +76,6 @@ public class SetForTCPSocketReplication3wayTest { System.gc(); } - @Test public void test3() throws IOException, InterruptedException { @@ -118,7 +114,6 @@ public class SetForTCPSocketReplication3wayTest { } - @Test public void testClear() throws IOException, InterruptedException { @@ -144,7 +139,6 @@ public class SetForTCPSocketReplication3wayTest { } - private void waitTillEqual(final int timeOutMs) throws InterruptedException { int t = 0; for (; t < timeOutMs; t++) { @@ -158,5 +152,3 @@ public class SetForTCPSocketReplication3wayTest { } } - - diff --git a/src/test/java/net/openhft/lang/values/IntValue$$Native.java b/src/test/java/net/openhft/lang/values/IntValue$$Native.java index 19a6415a0..465d733db 100644 --- a/src/test/java/net/openhft/lang/values/IntValue$$Native.java +++ b/src/test/java/net/openhft/lang/values/IntValue$$Native.java @@ -29,11 +29,9 @@ import static net.openhft.lang.Compare.isEqual; public class IntValue$$Native implements IntValue, BytesMarshallable, Byteable, Copyable { private static final int VALUE = 0; - private Bytes _bytes; private long _offset; - public void setValue(int $) { _bytes.writeInt(_offset + VALUE, $); } @@ -42,7 +40,6 @@ public class IntValue$$Native implements IntValue, BytesMarshallable, Byteable, return _bytes.readInt(_offset + VALUE); } - public void setOrderedValue(int $) { _bytes.writeOrderedInt(_offset + VALUE, $); } diff --git a/src/test/java/net/openhft/lang/values/LongValue$$Native.java b/src/test/java/net/openhft/lang/values/LongValue$$Native.java index 9cdfd314f..8e737b3a7 100644 --- a/src/test/java/net/openhft/lang/values/LongValue$$Native.java +++ b/src/test/java/net/openhft/lang/values/LongValue$$Native.java @@ -29,12 +29,9 @@ import static net.openhft.lang.Compare.isEqual; public class LongValue$$Native implements LongValue, BytesMarshallable, Byteable, Copyable { private static final int VALUE = 0; - private Bytes _bytes; private long _offset; - - public void setValue(long $) { _bytes.writeLong(_offset + VALUE, $); } @@ -43,8 +40,6 @@ public class LongValue$$Native implements LongValue, BytesMarshallable, Byteable return _bytes.readLong(_offset + VALUE); } - - public void setOrderedValue(long $) { _bytes.writeOrderedLong(_offset + VALUE, $); }