diff --git a/CHANGELOG.md b/CHANGELOG.md
index 259d084..a24e5ba 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Add more unit and integration tests.
+## [0.4.2](https://github.com/appulse-projects/epmd-java/releases/tag/0.4.2) - 2018-03-05
+
+Removed lookup cache, which was full of bugs
+
+### Removed
+
+- Lookup cache of node infos.
+
## [0.4.1](https://github.com/appulse-projects/epmd-java/releases/tag/0.4.1) - 2018-02-16
Minor bug fixes
diff --git a/client/README.md b/client/README.md
index 5d3c2b5..0a3cec7 100644
--- a/client/README.md
+++ b/client/README.md
@@ -14,7 +14,7 @@ Include the dependency to your project's pom.xml file:
io.appulse.epmd.java
client
- 0.4.1
+ 0.4.2
...
@@ -23,7 +23,7 @@ Include the dependency to your project's pom.xml file:
or Gradle:
```groovy
-compile 'io.appulse.epmd.java:client:0.4.1'
+compile 'io.appulse.epmd.java:client:0.4.2'
```
### Create client
diff --git a/client/pom.xml b/client/pom.xml
index 52ee285..77993b0 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -25,7 +25,7 @@ limitations under the License.
io.appulse
epmd-java
- 0.4.1
+ 0.4.2
io.appulse.epmd.java
diff --git a/client/src/main/java/io/appulse/epmd/java/client/EpmdClient.java b/client/src/main/java/io/appulse/epmd/java/client/EpmdClient.java
index 818791c..005eff6 100644
--- a/client/src/main/java/io/appulse/epmd/java/client/EpmdClient.java
+++ b/client/src/main/java/io/appulse/epmd/java/client/EpmdClient.java
@@ -165,10 +165,6 @@ public void close () {
log.debug("EPMD client was closed");
}
- public void clearCaches () {
- lookupService.clearCache();
- }
-
@Override
protected void finalize () throws Throwable {
close();
diff --git a/client/src/main/java/io/appulse/epmd/java/client/LookupService.java b/client/src/main/java/io/appulse/epmd/java/client/LookupService.java
index 9099dd9..8b15e43 100644
--- a/client/src/main/java/io/appulse/epmd/java/client/LookupService.java
+++ b/client/src/main/java/io/appulse/epmd/java/client/LookupService.java
@@ -20,10 +20,7 @@
import static lombok.AccessLevel.PRIVATE;
import java.net.InetAddress;
-import java.util.Map;
import java.util.Optional;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.function.BiFunction;
import io.appulse.epmd.java.core.model.request.GetNodeInfo;
import io.appulse.epmd.java.core.model.response.NodeInfo;
@@ -31,7 +28,6 @@
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
-import lombok.Value;
import lombok.experimental.FieldDefaults;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
@@ -46,30 +42,6 @@
@FieldDefaults(level = PRIVATE, makeFinal = true)
class LookupService {
- private static final Map CACHE;
-
- private static final BiFunction COMPUTE;
-
- static {
- CACHE = new ConcurrentHashMap<>();
-
- COMPUTE = (key, value) -> {
- if (value != null) {
- log.debug("Used cached value {}", value);
- return value;
- }
-
- val request = new GetNodeInfo(key.getNode());
- try (val connection = new Connection(key.getAddress(), key.getPort())) {
- val response = connection.send(request, NodeInfo.class);
- log.debug("Lookup result is {}", response);
- return response.isOk()
- ? response
- : null;
- }
- };
- }
-
@NonNull
InetAddress defaultAddress;
@@ -100,25 +72,12 @@ public Optional lookup (@NonNull String node, @NonNull InetAddress add
log.debug("Looking up node '{}' at '{}:{}'", shortName, address, port);
- val descriptor = new NodeDescriptor(shortName, address, port);
- val nodeInfo = CACHE.compute(descriptor, COMPUTE);
- return ofNullable(nodeInfo);
- }
-
- void clearCache () {
- CACHE.clear();
- }
-
- @Value
- private static class NodeDescriptor {
-
- @NonNull
- String node;
-
- @NonNull
- InetAddress address;
-
- @NonNull
- Integer port;
+ val request = new GetNodeInfo(shortName);
+ try (val connection = new Connection(address, port)) {
+ val response = connection.send(request, NodeInfo.class);
+ log.debug("Lookup result is {}", response);
+ return ofNullable(response)
+ .filter(NodeInfo::isOk);
+ }
}
}
diff --git a/client/src/test/java/io/appulse/epmd/java/client/LocalEpmdClientTest.java b/client/src/test/java/io/appulse/epmd/java/client/LocalEpmdClientTest.java
index 39a9d8e..a313a3b 100644
--- a/client/src/test/java/io/appulse/epmd/java/client/LocalEpmdClientTest.java
+++ b/client/src/test/java/io/appulse/epmd/java/client/LocalEpmdClientTest.java
@@ -66,7 +66,6 @@ public void before () {
@After
public void after () {
if (client != null) {
- client.clearCaches();
client.close();
client = null;
}
diff --git a/core/pom.xml b/core/pom.xml
index f4ee7f6..16eb3c2 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -25,7 +25,7 @@ limitations under the License.
io.appulse
epmd-java
- 0.4.1
+ 0.4.2
io.appulse.epmd.java
diff --git a/pom.xml b/pom.xml
index babe7e8..2920325 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@ limitations under the License.
io.appulse
epmd-java
- 0.4.1
+ 0.4.2
pom
@@ -68,7 +68,7 @@ limitations under the License.
https://github.com/appulse-projects/epmd-java
scm:git:https://github.com/appulse-projects/epmd-java.git
scm:git:https://github.com/appulse-projects/epmd-java.git
- 0.4.1
+ 0.4.2
diff --git a/server/README.md b/server/README.md
index 80582d7..f2a279c 100644
--- a/server/README.md
+++ b/server/README.md
@@ -18,7 +18,7 @@ Include the dependency to your project's pom.xml file:
io.appulse.epmd.java
server
- 0.4.1
+ 0.4.2
...
@@ -27,5 +27,5 @@ Include the dependency to your project's pom.xml file:
or Gradle:
```groovy
-compile 'io.appulse.epmd.java:server:0.4.1'
+compile 'io.appulse.epmd.java:server:0.4.2'
```
diff --git a/server/pom.xml b/server/pom.xml
index bb32bd0..a10582b 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -25,7 +25,7 @@ limitations under the License.
io.appulse
epmd-java
- 0.4.1
+ 0.4.2
io.appulse.epmd.java