protected void sendRequest(Buffer data, final Collection<Address> targetMembers) throws Exception { try { corr.sendRequest(targetMembers, data, options.mode() == ResponseMode.GET_NONE? null : this, options); } catch(Exception ex) { corrDone(); throw ex; } }
public void sendRequest(Buffer data) throws Exception { try { corr.sendUnicastRequest(target, data, options.mode() == ResponseMode.GET_NONE? null : this, this.options); } catch(Exception ex) { corrDone(); throw ex; } }
protected void initMetadata() { Metadata metadata=cache.get(getPath()); if(metadata != null) this.chunk_size=metadata.getChunkSize(); }
private void mcastPut(K key, V val, short repl_count, long caching_time, boolean synchronous) { try { ResponseMode mode=synchronous? ResponseMode.GET_ALL : ResponseMode.GET_NONE; disp.callRemoteMethods(null, new MethodCall(PUT, key, val, repl_count, caching_time), new RequestOptions(mode, call_timeout)); } catch(Throwable t) { if(log.isWarnEnabled()) log.warn("put() failed", t); } }
public <X extends MessageDispatcher> X correlator(RequestCorrelator c) { if(c == null) return (X)this; stop(); this.corr=c; corr.asyncDispatching(this.async_dispatching).wrapExceptions(this.wrap_exceptions); start(); return (X)this; }
protected Object invokeRpc(short method_id, Address dest, RequestOptions options, Object ... args) throws Exception { MethodCall call=new MethodCall(method_id, args); return disp.callRemoteMethod(dest, call, options); }
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 void remove(String path, boolean synchronous) { if(path == null) return; GridFile.Metadata md=metadata.get(path); if(md == null) return; int num_chunks=md.getLength() / md.getChunkSize() + 1; for(int i=0; i < num_chunks; i++) data.remove(path + ".#" + i, synchronous); } }
public void _remove(String fqn, String key) { Node n; if(fqn == null || key == null) return; n=findNode(fqn); if(n != null) n.removeData(key); }
/** * Returns the data hashmap for a given node. This method can only be used by callers that are inside * the same package. The reason is that callers must not modify the return value, as these modifications * would not be replicated, thus rendering the replicas inconsistent. * @param fqn The fully qualified name of the node * @return HashMap The data hashmap for the given node */ Map<String,Object> get(String fqn) { Node n=findNode(fqn); if(n == null) return null; return n.getData(); }
public boolean isDirectory() { Metadata val=cache.get(getPath()); return val.isDirectory(); }
public void _removeData(String fqn) { Node n; if(fqn == null) return; n=findNode(fqn); if(n != null) n.removeData(); }
/** * Finds a node given its name and returns the value associated with a given key in its {@code data} * map. Returns null if the node was not found in the tree or the key was not found in the hashmap. * @param fqn The fully qualified name of the node. * @param key The key. */ public Object get(String fqn, String key) { Node n=findNode(fqn); if(n == null) return null; return n.getData(key); }