code
stringlengths
73
34.1k
label
stringclasses
1 value
public final long set0(int idx, long l) { setWrite(); if( _chk2.set_impl(idx,l) ) return l; (_chk2 = inflate_impl(new NewChunk(this))).set_impl(idx,l); return l; }
java
public final double set0(int idx, double d) { setWrite(); if( _chk2.set_impl(idx,d) ) return d; (_chk2 = inflate_impl(new NewChunk(this))).set_impl(idx,d); return d; }
java
public final float set0(int idx, float f) { setWrite(); if( _chk2.set_impl(idx,f) ) return f; (_chk2 = inflate_impl(new NewChunk(this))).set_impl(idx,f); return f; }
java
public final boolean setNA0(int idx) { setWrite(); if( _chk2.setNA_impl(idx) ) return true; (_chk2 = inflate_impl(new NewChunk(this))).setNA_impl(idx); return true; }
java
protected Frame scoreImpl(Frame adaptFrm) { if (isSupervised()) { int ridx = adaptFrm.find(responseName()); assert ridx == -1 : "Adapted frame should not contain response in scoring method!"; assert nfeatures() == adaptFrm.numCols() : "Number of model features " + nfeatures() + " != number of test...
java
public final float[] score( Frame fr, boolean exact, int row ) { double tmp[] = new double[fr.numCols()]; for( int i=0; i<tmp.length; i++ ) tmp[i] = fr.vecs()[i].at(row); return score(fr.names(),fr.domains(),exact,tmp); }
java
public final float[] score( String names[], String domains[][], boolean exact, double row[] ) { return score(adapt(names,domains,exact),row,new float[nclasses()]); }
java
protected SB toJavaSuper( SB sb ) { sb.nl(); sb.ii(1); sb.i().p("public String[] getNames() { return NAMES; } ").nl(); sb.i().p("public String[][] getDomainValues() { return DOMAINS; }").nl(); String uuid = this.uniqueId != null ? this.uniqueId.getId() : this._key.toString(); sb.i().p("public ...
java
private SB toJavaPredict(SB ccsb, SB fileCtxSb) { // ccsb = classContext ccsb.nl(); ccsb.p(" // Pass in data in a double[], pre-aligned to the Model's requirements.").nl(); ccsb.p(" // Jam predictions into the preds[] array; preds[0] is reserved for the").nl(); ccsb.p(" // main prediction (class for ...
java
protected final void emptyLTrash() { if (_lVecTrash.isEmpty()) return; Futures fs = new Futures(); cleanupTrash(_lVecTrash, fs); fs.blockForPending(); }
java
@Override protected void registered(RequestServer.API_VERSION ver) { super.registered(ver); for (Argument arg : _arguments) { if ( arg._name.equals("activation") || arg._name.equals("initial_weight_distribution") || arg._name.equals("expert_mode") || arg._name.equals("adaptive_rate") ...
java
private DataInfo prepareDataInfo() { final boolean del_enum_resp = classification && !response.isEnum(); final Frame train = FrameTask.DataInfo.prepareFrame(source, autoencoder ? null : response, ignored_cols, classification, ignore_const_cols, true /*drop >20% NA cols*/); final DataInfo dinfo = new FrameTa...
java
Frame updateFrame(Frame target, Frame src) { if (src != target) ltrash(src); return src; }
java
private void lock_data() { source.read_lock(self()); if( validation != null && source._key != null && validation._key !=null && !source._key.equals(validation._key) ) validation.read_lock(self()); }
java
private void unlock_data() { source.unlock(self()); if( validation != null && source._key != null && validation._key != null && !source._key.equals(validation._key) ) validation.unlock(self()); }
java
private Frame reBalance(final Frame fr, boolean local) { int chunks = (int)Math.min( 4 * H2O.NUMCPUS * (local ? 1 : H2O.CLOUD.size()), fr.numRows()); if (fr.anyVec().nChunks() > chunks && !reproducible) { Log.info("Dataset already contains " + fr.anyVec().nChunks() + " chunks. No need to rebalance."); ...
java
private static float computeRowUsageFraction(final long numRows, final long train_samples_per_iteration, final boolean replicate_training_data) { float rowUsageFraction = (float)train_samples_per_iteration / numRows; if (replicate_training_data) rowUsageFraction /= H2O.CLOUD.size(); assert(rowUsageFraction ...
java
public static void crossValidate(Job.ValidatedJob job) { if (job.state != Job.JobState.RUNNING) return; //don't do cross-validation if the full model builder failed if (job.validation != null) throw new IllegalArgumentException("Cannot provide validation dataset and n_folds > 0 at the same time."); if...
java
protected static List<water.ModelMetrics>fetchAll() { return new ArrayList<water.ModelMetrics>(H2O.KeySnapshot.globalSnapshot().fetchAll(water.ModelMetrics.class).values()); }
java
private Response serveOneOrAll(List<water.ModelMetrics> list) { JsonArray metricsArray = new JsonArray(); for (water.ModelMetrics metrics : list) { JsonObject metricsJson = metrics.toJSON(); metricsArray.add(metricsJson); } JsonObject result = new JsonObject(); result.add("metrics", me...
java
public static void scoreTree(double data[], float preds[], CompressedTree[] ts) { for( int c=0; c<ts.length; c++ ) if( ts[c] != null ) preds[ts.length==1?0:c+1] += ts[c].score(data); }
java
public static Request registerRequest(Request req) { assert req.supportedVersions().length > 0; for (API_VERSION ver : req.supportedVersions()) { String href = req.href(ver); assert (! _requests.containsKey(href)) : "Request with href "+href+" already registered"; _requests.put(href,req); ...
java
public static void start() { new Thread( new Runnable() { @Override public void run() { while( true ) { try { // Try to get the NanoHTTP daemon started SERVER = new RequestServer(H2O._apiSocket); break; } catch( Exception ioe ) { ...
java
public final T invoke( Key key ) { RPC<Atomic<T>> rpc = fork(key); return (T)(rpc == null ? this : rpc.get()); // Block for it }
java
public static String[] concat(String[] ...aa) { int l = 0; for (String[] a : aa) l += a.length; String[] r = new String[l]; l = 0; for (String[] a : aa) { System.arraycopy(a, 0, r, l, a.length); l += a.length; } return r; }
java
public static Frame parse(File file) { Key fkey = NFSFileVec.make(file); Key dest = Key.make(file.getName()); Frame frame = ParseDataset2.parse(dest, new Key[] { fkey }); return frame; }
java
public static Frame create(String[] headers, double[][] rows) { Futures fs = new Futures(); Vec[] vecs = new Vec[rows[0].length]; Key keys[] = new Vec.VectorGroup().addVecs(vecs.length); for( int c = 0; c < vecs.length; c++ ) { AppendableVec vec = new AppendableVec(keys[c]); NewChunk chunk =...
java
@Override public Value chunkIdx( int cidx ) { final long nchk = nChunks(); assert 0 <= cidx && cidx < nchk; Key dkey = chunkKey(cidx); Value val1 = DKV.get(dkey);// Check for an existing one... will fetch data as needed if( val1 != null ) return val1; // Found an existing one? // Lazily create a...
java
private static void summarizeAndEnhanceFrame(FrameSummary summary, Frame frame, boolean find_compatible_models, Map<String, Model> all_models, Map<String, Set<String>> all_models_cols) { UniqueId unique_id = frame.getUniqueId(); summary.id = unique_id.getId(); summary.key = unique_id.getKey(); summary.c...
java
private Response serveOneOrAll(Map<String, Frame> framesMap) { // returns empty sets if !this.find_compatible_models Pair<Map<String, Model>, Map<String, Set<String>>> models_info = fetchModels(); Map<String, Model> all_models = models_info.getFirst(); Map<String, Set<String>> all_models_cols = models_i...
java
public static Vec compose(TransfVec origVec, int[][] transfMap, String[] domain, boolean keepOrig) { // Do a mapping from INT -> ENUM -> this vector ENUM int[][] domMap = Utils.compose(new int[][] {origVec._values, origVec._indexes }, transfMap); Vec result = origVec.masterVec().makeTransf(domMap[0], domMap...
java
public static Response redirect(Request req, Key src_key) { return Response.redirect(req, "/2/Inspector", "src_key", src_key.toString()); }
java
public void addr( NewChunk nc ) { long [] tmpl = _ls; _ls = nc._ls; nc._ls = tmpl; int [] tmpi = _xs; _xs = nc._xs; nc._xs = tmpi; tmpi = _id; _id = nc._id; nc._id = tmpi; double[] tmpd = _ds; _ds = nc._ds; nc._ds = tmpd; int tmp = _sparseLen; _sparseLen=nc._sparseLen; nc._sparseLe...
java
void append2( long l, int x ) { if(_id == null || l != 0){ if(_ls == null || _sparseLen == _ls.length) { append2slow(); // again call append2 since calling append2slow might have changed things (eg might have switched to sparse and l could be 0) append2(l,x); return; } ...
java
static public void put( Key key, Value val, Futures fs ) { assert !val.isLockable(); Value res = DKV.put(key,val,fs); assert res == null || !res.isLockable(); }
java
static public void put( Key key, Freezable fr ) { if( fr == null ) UKV.remove(key); else UKV.put(key,new Value(key, fr)); }
java
void remove_task_tracking( int task ) { RPC.RPCCall rpc = _work.get(task); if( rpc == null ) return; // Already stopped tracking // Atomically attempt to remove the 'dt'. If we win, we are the sole // thread running the dt.onAckAck. Also helps GC: the 'dt' is done (sent // to client and we rece...
java
public static Frame frame(String[] names, double[]... rows) { assert names == null || names.length == rows[0].length; Futures fs = new Futures(); Vec[] vecs = new Vec[rows[0].length]; Key keys[] = Vec.VectorGroup.VG_LEN1.addVecs(vecs.length); for( int c = 0; c < vecs.length; c++ ) { Appendable...
java
public static Frame parseFrame(Key okey, File ...files) { assert files.length > 0 : "Ups. No files to parse!"; for (File f : files) if (!f.exists()) throw new RuntimeException("File not found " + f); // Create output key if not specified if(okey == null) okey = Key.make(files[0].getN...
java
private void processCustomDimensionParameters(@SuppressWarnings("rawtypes") GoogleAnalyticsRequest request, List<NameValuePair> postParms) { Map<String, String> customDimParms = new HashMap<String, String>(); for (String defaultCustomDimKey : defaultRequest.customDimentions().keySet()) { customDimParms.pu...
java
private void processCustomMetricParameters(@SuppressWarnings("rawtypes") GoogleAnalyticsRequest request, List<NameValuePair> postParms) { Map<String, String> customMetricParms = new HashMap<String, String>(); for (String defaultCustomMetricKey : defaultRequest.custommMetrics().keySet()) { customMetricParm...
java
public static int clen(int values, int bpv) { int len = (values*bpv) >> 3; return values*bpv % 8 == 0 ? len : len + 1; }
java
public static Value get( H2ONode target, Key key, int priority ) { RPC<TaskGetKey> rpc, old; while( true ) { // Repeat until we get a unique TGK installed per key // Do we have an old TaskGetKey in-progress? rpc = TGKS.get(key); if( rpc != null && rpc._dt._priority >= priority ) ...
java
protected String build(Response response) { StringBuilder sb = new StringBuilder(); sb.append("<div class='container'>"); sb.append("<div class='row-fluid'>"); sb.append("<div class='span12'>"); sb.append(buildJSONResponseBox(response)); if( response._status == Response.Status.done ) response.to...
java
public void addExternalJars(File file) throws IllegalAccessException, InvocationTargetException, MalformedURLException { assert file.exists() : "Unable to find external file: " + file.getAbsolutePath(); if( file.isDirectory() ) { for( File f : file.listFiles() ) addExternalJars(f); } else if( file.get...
java
private void extractInternalFiles() throws IOException { Enumeration entries = _h2oJar.entries(); while( entries.hasMoreElements() ) { ZipEntry e = (ZipEntry) entries.nextElement(); String name = e.getName(); if( e.isDirectory() ) continue; // mkdirs() will handle these if(! name.endsWit...
java
@Override public synchronized Class loadClass( String name, boolean resolve ) throws ClassNotFoundException { assert !name.equals(Weaver.class.getName()); Class z = loadClass2(name); // Do all the work in here if( resolve ) resolveClass(z); // Resolve here instead in the work method return z; }
java
private final Class loadClass2( String name ) throws ClassNotFoundException { Class z = findLoadedClass(name); // Look for pre-existing class if( z != null ) return z; if( _weaver == null ) _weaver = new Weaver(); z = _weaver.weaveAndLoad(name, this); // Try the Happy Class Loader if( z != null )...
java
private RequestArguments.Argument arg(Request R) { if( _arg != null ) return _arg; Class clzz = R.getClass(); // An amazing crazy API from the JDK again. Cannot search for protected // fields without either (1) throwing NoSuchFieldException if you ask in // a subclass, or (2) sorting thro...
java
public static void launchEC2(Class<? extends Job> job, int boxes) throws Exception { EC2 ec2 = new EC2(); ec2.boxes = boxes; Cloud c = ec2.resize(); launch(c, job); }
java
@Override public void compute2() { if(Job.isRunning(_jobKey)) { Timer timer = new Timer(); _stats[0] = new ThreadLocal<hex.singlenoderf.Statistic>(); _stats[1] = new ThreadLocal<hex.singlenoderf.Statistic>(); Data d = _sampler.sample(_data, _seed, _modelKey, _local_mode); ...
java
static void appendKey(Key model, final Key tKey, final Key dtKey, final String tString, final int tree_id) { final int selfIdx = H2O.SELF.index(); new TAtomic<SpeeDRFModel>() { @Override public SpeeDRFModel atomic(SpeeDRFModel old) { if(old == null) return null; return SpeeDRFModel.make(ol...
java
public Key toKey() { AutoBuffer bs = new AutoBuffer(); bs.put4(_data_id); bs.put8(_seed); bs.put1(_producerId); _tree.write(bs); Key key = Key.make((byte)1,Key.DFJ_INTERNAL_USER, H2O.SELF); DKV.put(key,new Value(key, bs.buf())); return key; }
java
public static double classify( AutoBuffer ts, double[] ds, double badat, boolean regression ) { ts.get4(); // Skip tree-id ts.get8(); // Skip seed ts.get1(); // Skip producer id byte b; while( (b = (byte) ts.get1()) != '[' ) { // While not a leaf indicator assert b == '(' || b == 'S'...
java
public TreeModel.CompressedTree compress() { // Log.info(Sys.RANDF, _tree.toString(new StringBuilder(), Integer.MAX_VALUE).toString()); int size = _tree.dtreeSize(); if (_tree instanceof LeafNode) { size += 3; } AutoBuffer ab = new AutoBuffer(size); if( _tree instanceof LeafNode) ab.p...
java
@Override protected void execImpl() { Frame frame = source; if (shuffle) { // FIXME: switch to global shuffle frame = MRUtils.shuffleFramePerChunk(Utils.generateShuffledKey(frame._key), frame, seed); frame.delete_and_lock(null).unlock(null); // save frame to DKV // delete frame on the en...
java
public static <T> String qlink(Class<T> page, Key k, String content) { return qlink(page, "source", k, content ); }
java
public static Object malloc(int elems, long bytes, int type, Object orig, int from ) { return malloc(elems,bytes,type,orig,from,false); }
java
public static boolean tryReserveTaskMem(long m){ if(!CAN_ALLOC)return false; if( m == 0 ) return true; assert m >= 0:"m < 0: " + m; long current = _taskMem.addAndGet(-m); if(current < 0){ _taskMem.addAndGet(m); return false; } return true; }
java
private static int[] determineSeparatorCounts(String from, int single_quote) { int[] result = new int[separators.length]; byte[] bits = from.getBytes(); boolean in_quote = false; for( int j=0; j< bits.length; j++ ) { byte c = bits[j]; if( (c == single_quote) || (c == CHAR_DOUBLE_QUOTE) ) ...
java
private static String[] determineTokens(String from, byte separator, int single_quote) { ArrayList<String> tokens = new ArrayList(); byte[] bits = from.getBytes(); int offset = 0; int quotes = 0; while (offset < bits.length) { while ((offset < bits.length) && (bits[offset] == CHAR_SPACE)) ++of...
java
protected static void summarizeAndEnhanceModel(ModelSummary summary, Model model, boolean find_compatible_frames, Map<String, Frame> all_frames, Map<String, Set<String>> all_frames_cols) { if (model instanceof GLMModel) { summarizeGLMModel(summary, (GLMModel) model); } else if (model instanceof DRF.DRFMod...
java
private static void summarizeModelCommonFields(ModelSummary summary, Model model) { String[] names = model._names; summary.warnings = model.warnings; summary.model_algorithm = model.getClass().toString(); // fallback only // model.job() is a local copy; on multinode clusters we need to get from the D...
java
private static void summarizeGLMModel(ModelSummary summary, hex.glm.GLMModel model) { // add generic fields such as column names summarizeModelCommonFields(summary, model); summary.model_algorithm = "GLM"; JsonObject all_params = (model.get_params()).toJSON(); summary.critical_parameters = whiteli...
java
private static void summarizeDRFModel(ModelSummary summary, hex.drf.DRF.DRFModel model) { // add generic fields such as column names summarizeModelCommonFields(summary, model); summary.model_algorithm = "BigData RF"; JsonObject all_params = (model.get_params()).toJSON(); summary.critical_parameter...
java
private static void summarizeSpeeDRFModel(ModelSummary summary, hex.singlenoderf.SpeeDRFModel model) { // add generic fields such as column names summarizeModelCommonFields(summary, model); summary.model_algorithm = "Random Forest"; JsonObject all_params = (model.get_params()).toJSON(); summary.cr...
java
private static void summarizeDeepLearningModel(ModelSummary summary, hex.deeplearning.DeepLearningModel model) { // add generic fields such as column names summarizeModelCommonFields(summary, model); summary.model_algorithm = "DeepLearning"; JsonObject all_params = (model.get_params()).toJSON(); s...
java
private static void summarizeGBMModel(ModelSummary summary, hex.gbm.GBM.GBMModel model) { // add generic fields such as column names summarizeModelCommonFields(summary, model); summary.model_algorithm = "GBM"; JsonObject all_params = (model.get_params()).toJSON(); summary.critical_parameters = whi...
java
private static void summarizeNBModel(ModelSummary summary, hex.nb.NBModel model) { // add generic fields such as column names summarizeModelCommonFields(summary, model); summary.model_algorithm = "Naive Bayes"; JsonObject all_params = (model.get_params()).toJSON(); summary.critical_parameters = wh...
java
protected Map<String, Model> fetchAll() { return H2O.KeySnapshot.globalSnapshot().fetchAll(water.Model.class); }
java
private Response serveOneOrAll(Map<String, Model> modelsMap) { // returns empty sets if !this.find_compatible_frames Pair<Map<String, Frame>, Map<String, Set<String>>> frames_info = fetchFrames(); Map<String, Frame> all_frames = frames_info.getFirst(); Map<String, Set<String>> all_frames_cols = frames_i...
java
static ParseProgress make( Key[] fkeys ) { long total = 0; for( Key fkey : fkeys ) total += getVec(fkey).length(); return new ParseProgress(0,total); }
java
protected static String xml2jname( String xml ) { // Convert pname to a valid java name StringBuilder nn = new StringBuilder(); char[] cs = xml.toCharArray(); if( !Character.isJavaIdentifierStart(cs[0]) ) nn.append('X'); for( char c : cs ) { if( !Character.isJavaIdentifierPart(c) ) { ...
java
protected static String uniqueClassName(String name) { // Make a unique class name String cname = xml2jname(name); if( CLASS_NAMES.contains(cname) ) { int i=0; while( CLASS_NAMES.contains(cname+i) ) i++; cname = cname+i; } CLASS_NAMES.add(cname); return cname; }
java
public int[] columnMapping( String[] features ) { int[] map = new int[_colNames.length]; for( int i=0; i<_colNames.length; i++ ) { map[i] = -1; // Assume it is missing for( int j=0; j<features.length; j++ ) { if( _colNames[i].equals(features[j]) ) { if( map[i] != -1 ) ...
java
public void setHdfs() { assert onICE(); byte[] mem = memOrLoad(); // Get into stable memory _persist = Value.HDFS|Value.NOTdsk; Persist.I[Value.HDFS].store(this); removeIce(); // Remove from ICE disk assert onHDFS(); // Flip to HDFS _mem = mem; // Close a race with the H2O...
java
public InputStream openStream(ProgressMonitor p) throws IOException { if(onNFS() ) return PersistNFS .openStream(_key ); if(onHDFS()) return PersistHdfs.openStream(_key,p); if(onS3() ) return PersistS3 .openStream(_key,p); if(onTachyon()) return PersistTachyon.openStream(_key,p); if( isFrame() ) ...
java
void lowerActiveGetCount( H2ONode h2o ) { assert _key.home(); // Only the HOME node for a key tracks replicas assert h2o != H2O.SELF;// Do not track self as a replica while( true ) { // Repeat, in case racing GETs are bumping the counter int old = _rwlock.get(); // Read the lock-word a...
java
void startRemotePut() { assert !_key.home(); int x = 0; // assert I am waiting on threads with higher priority? while( (x=_rwlock.get()) != -1 ) // Spin until rwlock==-1 if( x == 1 || RW_CAS(0,1,"remote_need_notify") ) try { ForkJoinPool.managedBlock(this); } catch( InterruptedException e ...
java
public void clear() { for( Placeholder p : _placeholders.values() ) { p.start.removeTill(p.end); } }
java
public void replace(String what, Object with) { if (what.charAt(0)=='$') throw new RuntimeException("$ is now control char that denotes URL encoding!"); for (Placeholder p : _placeholders.get(what)) p.end.insertAndAdvance(with.toString()); for (Placeholder p : _placeholders.get("$"+what)) ...
java
public RString restartGroup(String what) { List<Placeholder> all = _placeholders.get(what); assert all.size() == 1; Placeholder result = all.get(0); if( result.group == null ) { throw new NoSuchElementException("Element " + what + " is not a group."); } result.group.clear(); return re...
java
protected boolean handleAuthHeader(GMS.GmsHeader gms_hdr, AuthHeader auth_hdr, Message msg) { if(needsAuthentication(gms_hdr)) { if(this.auth_token.authenticate(auth_hdr.getToken(), msg)) return true; // authentication passed, send message up the stack else { ...
java
public synchronized void stop() { Thread tmp=runner; runner=null; if(tmp != null) { tmp.interrupt(); try {tmp.join(500);} catch(InterruptedException e) {} } // we may need to do multiple iterations as the iterator works on a copy and tasks might have been...
java
@ManagedOperation(description="Prints the send and receive buffers") public String printBuffers() { StringBuilder sb=new StringBuilder("\n"); synchronized(this) { for(Map.Entry<Address,Connection> entry: conns.entrySet()) { NioConnection val=(NioConnection)entry.getValue(...
java
public void stable(long seqno) { lock.lock(); try { if(seqno <= low) return; if(seqno > hd) throw new IllegalArgumentException("seqno " + seqno + " cannot be bigger than hd (" + hd + ")"); int from=index(low+1), length=(int)(seqno - lo...
java
public void adjustNodes(java.util.List<Address> v) { Node n; boolean removed=false; synchronized(nodes) { for(int i=0; i < nodes.size(); i++) { n=nodes.get(i); if(!v.contains(n.addr)) { System.out.println("adjustNodes(): node " + n...
java
public void start(JChannel ch) throws Exception { channel=ch; channel.setReceiver(this); channel.connect("ChatCluster"); eventLoop(); channel.close(); }
java
public boolean waitForAllResponses(long timeout) { if(timeout <= 0) timeout=2000L; return cond.waitFor(this::hasAllResponses, timeout, TimeUnit.MILLISECONDS); }
java
public int deliveryTableSize() { int retval=0; for(BoundedHashMap<Long,Long> val: delivery_table.values()) retval+=val.size(); return retval; }
java
protected boolean canDeliver(Address sender, long seqno) { BoundedHashMap<Long,Long> seqno_set=delivery_table.get(sender); if(seqno_set == null) { seqno_set=new BoundedHashMap<>(delivery_table_max_size); BoundedHashMap<Long,Long> existing=delivery_table.put(sender,seqno_set); ...
java
public static Subject generateSecuritySubject(String jassLoginConfig, String username, String password) throws LoginException { LoginContext loginCtx = null; try { // "Client" references the JAAS configuration in the jaas.conf file. loginCtx = new LoginContext...
java
public static byte[] initiateSecurityContext(Subject subject, String servicePrincipalName) throws GSSException { GSSManager manager = GSSManager.getInstance(); GSSName serverName = manager.createName(servicePrincipalName, GSSName.NT_HOSTBASED_SERVICE); final GSSContext context = manager.c...
java
public static String validateSecurityContext(Subject subject, final byte[] serviceTicket) throws GSSException { // Accept the context and return the client principal name. return Subject.doAs(subject, (PrivilegedAction<String>)() -> { try { // Identify the server that commun...
java
public int compareTo(ViewId other) { return id > other.id ? 1 : id < other.id ? -1 : creator.compareTo(other.creator); }
java
public <T extends ViewHandler<R>> T processing(boolean flag) { lock.lock(); try { setProcessing(flag); return (T)this; } finally { lock.unlock(); } }
java
protected void process(Collection<R> requests) { for(;;) { while(!requests.isEmpty()) { removeAndProcess(requests); // remove matching requests and process them } lock.lock(); try { if(requests.isEmpty()) { setPr...
java
public void setResult(T obj) { lock.lock(); try { result=obj; hasResult=true; cond.signal(true); } finally { lock.unlock(); } }
java
protected T _getResultWithTimeout(final long timeout) throws TimeoutException { if(timeout <= 0) cond.waitFor(this::hasResult); else if(!cond.waitFor(this::hasResult, timeout, TimeUnit.MILLISECONDS)) throw new TimeoutException(); return result; }
java
public void handleViewChange(View view, Digest digest) { if(gms.isLeaving() && !view.containsMember(gms.local_addr)) return; View prev_view=gms.view(); gms.installView(view, digest); Address prev_coord=prev_view != null? prev_view.getCoord() : null, curr_coord=view.getCoord()...
java