public boolean cancel(boolean mayInterruptIfRunning) { try { return super.cancel(mayInterruptIfRunning); } finally { corrDone(); } }
public T get() throws InterruptedException, ExecutionException { try { return super.get(); } finally { corrDone(); } }
public RspList<T> getNow(RspList<T> valueIfAbsent) { return doAndComplete(() -> super.getNow(valueIfAbsent)); }
public T execute(Buffer data, boolean block_for_results) throws Exception { if(corr == null) return null; sendRequest(data); if(!block_for_results || options.mode() == ResponseMode.GET_NONE) return null; long timeout=options.timeout(); return timeout > 0? waitForCompletion(options.timeout(), TimeUnit.MILLISECONDS) : waitForCompletion(); }
/** Sends a request to a single destination */ public void sendUnicastRequest(Address dest, Buffer data, Request req, RequestOptions opts) throws Exception { if(transport == null) { if(log.isWarnEnabled()) log.warn("transport is not available !"); return; } Header hdr=new Header(Header.REQ, 0, this.corr_id); Message msg=new Message(dest, data).putHeader(this.corr_id, hdr) .setFlag(opts.flags()).setTransientFlag(opts.transientFlags()); if(req != null) { // sync RPC long req_id=REQUEST_ID.getAndIncrement(); req.requestId(req_id); hdr.requestId(req_id); // set the request-id only for *synchronous RPCs* if(log.isTraceEnabled()) log.trace("%s: invoking unicast RPC [req-id=%d] on %s", local_addr, req_id, msg.dest()); requests.putIfAbsent(req_id, req); // make sure no view is received before we add ourself as a view handler (https://issues.jboss.org/browse/JGRP-1428) req.viewChange(view); if(rpc_stats.extendedStats()) req.start_time=System.nanoTime(); } else // async RPC rpc_stats.add(RpcStats.Type.UNICAST, dest, false, 0); transport.down(msg); }
public String toString() { return String.format("%s, target=%s", super.toString(), target); }
/** * View received: mark all responses from members that are not in new_view as suspected */ public void receiveView(View new_view) { view=new_view; // move this before the iteration (JGRP-1428) requests.values().stream().filter(Objects::nonNull).forEach(req -> req.viewChange(new_view)); }
protected void handleResponse(Request req, Address sender, byte[] buf, int offset, int length, boolean is_exception) { Object retval; try { retval=replyFromBuffer(buf, offset, length, marshaller); } catch(Exception e) { log.error(Util.getMessage("FailedUnmarshallingBufferIntoReturnValue"), e); retval=e; is_exception=true; } req.receiveResponse(retval, sender, is_exception); }
/** An entire site is down; mark all requests that point to that site as unreachable (used by RELAY2) */ public void setSiteUnreachable(String site) { requests.values().stream().filter(Objects::nonNull).forEach(req -> req.siteUnreachable(site)); }
req.requestId(req_id); requests.putIfAbsent(req_id, req); req.viewChange(view); if(rpc_stats.extendedStats()) req.start_time=System.nanoTime();
public T execute(Buffer data, boolean block_for_results) throws Exception { if(corr == null) return null; sendRequest(data); if(!block_for_results || options.mode() == ResponseMode.GET_NONE) return null; long timeout=options.timeout(); return timeout > 0? waitForCompletion(options.timeout(), TimeUnit.MILLISECONDS) : waitForCompletion(); }
public String toString() { StringBuilder ret=new StringBuilder(128); ret.append(super.toString()); if(!rsps.isEmpty()) { ret.append(", entries:\n"); for(Map.Entry<Address,Rsp<T>> entry: rsps.entrySet()) { Address mbr=entry.getKey(); Rsp<T> rsp=entry.getValue(); ret.append(mbr).append(": ").append(rsp).append("\n"); } } return ret.toString(); }
/** * View received: mark all responses from members that are not in new_view as suspected */ public void receiveView(View new_view) { view=new_view; // move this before the iteration (JGRP-1428) requests.values().stream().filter(Objects::nonNull).forEach(req -> req.viewChange(new_view)); }
protected void handleResponse(Request req, Address sender, byte[] buf, int offset, int length, boolean is_exception) { Object retval; try { retval=replyFromBuffer(buf, offset, length, marshaller); } catch(Exception e) { log.error(Util.getMessage("FailedUnmarshallingBufferIntoReturnValue"), e); retval=e; is_exception=true; } req.receiveResponse(retval, sender, is_exception); }
/** An entire site is down; mark all requests that point to that site as unreachable (used by RELAY2) */ public void setSiteUnreachable(String site) { requests.values().stream().filter(Objects::nonNull).forEach(req -> req.siteUnreachable(site)); }
/** Sends a request to a single destination */ public void sendUnicastRequest(Address dest, Buffer data, Request req, RequestOptions opts) throws Exception { if(transport == null) { if(log.isWarnEnabled()) log.warn("transport is not available !"); return; } Header hdr=new Header(Header.REQ, 0, this.corr_id); Message msg=new Message(dest, data).putHeader(this.corr_id, hdr) .setFlag(opts.flags()).setTransientFlag(opts.transientFlags()); if(req != null) { // sync RPC long req_id=REQUEST_ID.getAndIncrement(); req.requestId(req_id); hdr.requestId(req_id); // set the request-id only for *synchronous RPCs* if(log.isTraceEnabled()) log.trace("%s: invoking unicast RPC [req-id=%d] on %s", local_addr, req_id, msg.dest()); requests.putIfAbsent(req_id, req); // make sure no view is received before we add ourself as a view handler (https://issues.jboss.org/browse/JGRP-1428) req.viewChange(view); if(rpc_stats.extendedStats()) req.start_time=System.nanoTime(); } else // async RPC rpc_stats.add(RpcStats.Type.UNICAST, dest, false, 0); transport.down(msg); }
public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { try { return super.get(timeout, unit); } finally { corrDone(); } }
public String toString() { return String.format("%s, target=%s", super.toString(), target); }
public T getNow(T valueIfAbsent) { return around(() -> super.getNow(valueIfAbsent)); }
public boolean cancel(boolean mayInterruptIfRunning) { try { return super.cancel(mayInterruptIfRunning); } finally { corrDone(); } }