Simplify code using Map::computeIfAbsent

Signed-off-by: lyxell <alyxell@kth.se>
pull/3753/head
lyxell 4 years ago
parent 90fa5c524b
commit 96e4ed2d49

@ -67,12 +67,7 @@ public abstract class BaseRemoteProxy {
private final Map<Class<?>, String> requestQueueNameCache = new ConcurrentHashMap<>();
public String getRequestQueueName(Class<?> remoteInterface) {
String str = requestQueueNameCache.get(remoteInterface);
if (str == null) {
str = "{" + name + ":" + remoteInterface.getName() + "}";
requestQueueNameCache.put(remoteInterface, str);
}
return str;
return requestQueueNameCache.computeIfAbsent(remoteInterface, k -> "{" + name + ":" + k.getName() + "}");
}
protected RFuture<RemoteServiceAck> tryPollAckAgainAsync(RemoteInvocationOptions optionsCopy,

@ -92,12 +92,7 @@ public abstract class BaseRemoteService {
public String getRequestQueueName(Class<?> remoteInterface) {
String str = requestQueueNameCache.get(remoteInterface);
if (str == null) {
str = "{" + name + ":" + remoteInterface.getName() + "}";
requestQueueNameCache.put(remoteInterface, str);
}
return str;
return requestQueueNameCache.computeIfAbsent(remoteInterface, k -> "{" + name + ":" + k.getName() + "}");
}
protected ByteBuf encode(Object obj) {

Loading…
Cancel
Save