refactoring

pull/1792/head
Nikita Koksharov 6 years ago
parent 23c3a4e0ea
commit 02f1fd7e20

@ -689,7 +689,7 @@ public abstract class BaseRemoteService {
byte[] id = new byte[17]; byte[] id = new byte[17];
// TODO JDK UPGRADE replace to native ThreadLocalRandom // TODO JDK UPGRADE replace to native ThreadLocalRandom
PlatformDependent.threadLocalRandom().nextBytes(id); PlatformDependent.threadLocalRandom().nextBytes(id);
id[0] = 0; id[0] = 00;
return new RequestId(id); return new RequestId(id);
} }
@ -701,7 +701,7 @@ public abstract class BaseRemoteService {
private void cancelExecution(RemoteInvocationOptions optionsCopy, private void cancelExecution(RemoteInvocationOptions optionsCopy,
boolean mayInterruptIfRunning, RemotePromise<Object> remotePromise) { boolean mayInterruptIfRunning, RemotePromise<Object> remotePromise) {
RMap<String, RemoteServiceCancelRequest> canceledRequests = redisson.getMap(cancelRequestMapName, new CompositeCodec(StringCodec.INSTANCE, codec, codec)); RMap<String, RemoteServiceCancelRequest> canceledRequests = redisson.getMap(cancelRequestMapName, new CompositeCodec(StringCodec.INSTANCE, codec, codec));
canceledRequests.putAsync(remotePromise.getRequestId().toString(), new RemoteServiceCancelRequest(mayInterruptIfRunning, false)); canceledRequests.fastPutAsync(remotePromise.getRequestId().toString(), new RemoteServiceCancelRequest(mayInterruptIfRunning, false));
canceledRequests.expireAsync(60, TimeUnit.SECONDS); canceledRequests.expireAsync(60, TimeUnit.SECONDS);
// subscribe for async result if it's not expected before // subscribe for async result if it's not expected before

@ -362,7 +362,7 @@ public class RedissonRemoteService extends BaseRemoteService implements RRemoteS
// could be removed not from future object // could be removed not from future object
if (future.getNow().isSendResponse()) { if (future.getNow().isSendResponse()) {
RMap<String, RemoteServiceCancelResponse> map = redisson.getMap(cancelResponseMapName, new CompositeCodec(StringCodec.INSTANCE, codec, codec)); RMap<String, RemoteServiceCancelResponse> map = redisson.getMap(cancelResponseMapName, new CompositeCodec(StringCodec.INSTANCE, codec, codec));
map.putAsync(request.getId(), response); map.fastPutAsync(request.getId(), response);
map.expireAsync(60, TimeUnit.SECONDS); map.expireAsync(60, TimeUnit.SECONDS);
} }
} }

@ -50,4 +50,9 @@ public abstract class BaseCodec implements Codec {
return getClass().getClassLoader(); return getClass().getClassLoader();
} }
@Override
public String toString() {
return getClass().getName();
}
} }

Loading…
Cancel
Save