Toggle navigation
Home
java.util.concurrent.atomic.AtomicLong to java.util.concurrent.atomic.AtomicInteger
No. of Instances - 14
No. of Commits - 7
No. of Projects - {'JGroups', 'presto', 'orbit', 'Singularity', 'atomix', 'drill'}
Hierarchy/Composition: SIBLING
Primitive Info: -
NameSpace: Jdk -> Jdk
Mapping:
Add or Remove Method invocation
ByteBuffer.wrap(bytes)
to
pendingResponse
Proxy.newProxyInstance(ref.getClassLoader(),new Class[]{ref},(proxy,method,args) -> { Message message=new Message(); long messageId=messageIdSeed.incrementAndGet(); message.setMessageType(1); message.setPayload(args); message.getHeaders().put("class",ref.getName()); final byte[] bytes=serialize(message); wsSession.getAsyncRemote().sendBinary(pendingResponse); if (method.isAnnotationPresent(OneWay.class)) { return Task.done(); } return null; } )
to
Proxy.newProxyInstance(ref.getClassLoader(),new Class[]{ref},(proxy,method,args) -> { Message message=new Message(); int messageId=messageIdSeed.incrementAndGet(); message.setMessageType(1); message.setPayload(args); message.setHeaders(new HashMap<>()); message.getHeaders().put("class",ref.getName()); message.getHeaders().put("method",method.getName()); message.setMessageId(messageId); final byte[] bytes=serialize(message); final Clock clock=Clock.systemUTC(); long timeoutAt=clock.millis() + 30_000; PendingResponse pendingResponse=new PendingResponse(messageId,timeoutAt); final boolean oneWay=method.isAnnotationPresent(OneWay.class); if (!oneWay) { pendingResponseMap.put(messageId,pendingResponse); pendingResponsesQueue.add(pendingResponse); } final ByteBuffer wrap=ByteBuffer.wrap(bytes); final Future<Void> voidFuture=wsSession.getAsyncRemote().sendBinary(wrap); voidFuture.get(); return pendingResponse; } )