提交 96e4ed2d 编写于 作者: L lyxell

Simplify code using Map::computeIfAbsent

Signed-off-by: Nlyxell <alyxell@kth.se>
上级 90fa5c52
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册