id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
52,000 | h2oai/h2o-2 | src/main/java/water/Boot.java | Boot.loadClass2 | 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 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 )... | [
"private",
"final",
"Class",
"loadClass2",
"(",
"String",
"name",
")",
"throws",
"ClassNotFoundException",
"{",
"Class",
"z",
"=",
"findLoadedClass",
"(",
"name",
")",
";",
"// Look for pre-existing class",
"if",
"(",
"z",
"!=",
"null",
")",
"return",
"z",
";"... | Run the class lookups in my favorite non-default order. | [
"Run",
"the",
"class",
"lookups",
"in",
"my",
"favorite",
"non",
"-",
"default",
"order",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Boot.java#L432-L446 |
52,001 | h2oai/h2o-2 | src/main/java/water/api/DocGen.java | FieldDoc.arg | 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 | 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... | [
"private",
"RequestArguments",
".",
"Argument",
"arg",
"(",
"Request",
"R",
")",
"{",
"if",
"(",
"_arg",
"!=",
"null",
")",
"return",
"_arg",
";",
"Class",
"clzz",
"=",
"R",
".",
"getClass",
"(",
")",
";",
"// An amazing crazy API from the JDK again. Cannot s... | Specific accessors for input arguments. Not valid for JSON output fields. | [
"Specific",
"accessors",
"for",
"input",
"arguments",
".",
"Not",
"valid",
"for",
"JSON",
"output",
"fields",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/DocGen.java#L104-L123 |
52,002 | h2oai/h2o-2 | h2o-samples/src/main/java/samples/launchers/CloudRemote.java | CloudRemote.launchEC2 | 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 | 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);
} | [
"public",
"static",
"void",
"launchEC2",
"(",
"Class",
"<",
"?",
"extends",
"Job",
">",
"job",
",",
"int",
"boxes",
")",
"throws",
"Exception",
"{",
"EC2",
"ec2",
"=",
"new",
"EC2",
"(",
")",
";",
"ec2",
".",
"boxes",
"=",
"boxes",
";",
"Cloud",
"c... | Starts EC2 machines and builds a cluster. | [
"Starts",
"EC2",
"machines",
"and",
"builds",
"a",
"cluster",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/h2o-samples/src/main/java/samples/launchers/CloudRemote.java#L25-L30 |
52,003 | h2oai/h2o-2 | src/main/java/hex/singlenoderf/Tree.java | Tree.compute2 | @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 | @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);
... | [
"@",
"Override",
"public",
"void",
"compute2",
"(",
")",
"{",
"if",
"(",
"Job",
".",
"isRunning",
"(",
"_jobKey",
")",
")",
"{",
"Timer",
"timer",
"=",
"new",
"Timer",
"(",
")",
";",
"_stats",
"[",
"0",
"]",
"=",
"new",
"ThreadLocal",
"<",
"hex",
... | Actually build the tree | [
"Actually",
"build",
"the",
"tree"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/singlenoderf/Tree.java#L139-L181 |
52,004 | h2oai/h2o-2 | src/main/java/hex/singlenoderf/Tree.java | Tree.appendKey | 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 | 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... | [
"static",
"void",
"appendKey",
"(",
"Key",
"model",
",",
"final",
"Key",
"tKey",
",",
"final",
"Key",
"dtKey",
",",
"final",
"String",
"tString",
",",
"final",
"int",
"tree_id",
")",
"{",
"final",
"int",
"selfIdx",
"=",
"H2O",
".",
"SELF",
".",
"index"... | which serializes "for free". | [
"which",
"serializes",
"for",
"free",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/singlenoderf/Tree.java#L185-L193 |
52,005 | h2oai/h2o-2 | src/main/java/hex/singlenoderf/Tree.java | Tree.toKey | 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 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;
} | [
"public",
"Key",
"toKey",
"(",
")",
"{",
"AutoBuffer",
"bs",
"=",
"new",
"AutoBuffer",
"(",
")",
";",
"bs",
".",
"put4",
"(",
"_data_id",
")",
";",
"bs",
".",
"put8",
"(",
"_seed",
")",
";",
"bs",
".",
"put1",
"(",
"_producerId",
")",
";",
"_tree... | Write the Tree to a random Key homed here. | [
"Write",
"the",
"Tree",
"to",
"a",
"random",
"Key",
"homed",
"here",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/singlenoderf/Tree.java#L609-L618 |
52,006 | h2oai/h2o-2 | src/main/java/hex/singlenoderf/Tree.java | Tree.classify | 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 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'... | [
"public",
"static",
"double",
"classify",
"(",
"AutoBuffer",
"ts",
",",
"double",
"[",
"]",
"ds",
",",
"double",
"badat",
",",
"boolean",
"regression",
")",
"{",
"ts",
".",
"get4",
"(",
")",
";",
"// Skip tree-id",
"ts",
".",
"get8",
"(",
")",
";",
"... | Classify on the compressed tree bytes, from the pre-packed double data | [
"Classify",
"on",
"the",
"compressed",
"tree",
"bytes",
"from",
"the",
"pre",
"-",
"packed",
"double",
"data"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/singlenoderf/Tree.java#L660-L683 |
52,007 | h2oai/h2o-2 | src/main/java/hex/singlenoderf/Tree.java | Tree.compress | 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 | 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... | [
"public",
"TreeModel",
".",
"CompressedTree",
"compress",
"(",
")",
"{",
"// Log.info(Sys.RANDF, _tree.toString(new StringBuilder(), Integer.MAX_VALUE).toString());",
"int",
"size",
"=",
"_tree",
".",
"dtreeSize",
"(",
")",
";",
"if",
"(",
"_tree",
"instanceof",
"LeafN... | Build a compressed-tree struct | [
"Build",
"a",
"compressed",
"-",
"tree",
"struct"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/singlenoderf/Tree.java#L738-L751 |
52,008 | h2oai/h2o-2 | src/main/java/water/api/FrameSplitPage.java | FrameSplitPage.execImpl | @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 | @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... | [
"@",
"Override",
"protected",
"void",
"execImpl",
"(",
")",
"{",
"Frame",
"frame",
"=",
"source",
";",
"if",
"(",
"shuffle",
")",
"{",
"// FIXME: switch to global shuffle",
"frame",
"=",
"MRUtils",
".",
"shuffleFramePerChunk",
"(",
"Utils",
".",
"generateShuffle... | Run the function | [
"Run",
"the",
"function"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/FrameSplitPage.java#L65-L91 |
52,009 | h2oai/h2o-2 | src/main/java/water/util/UIUtils.java | UIUtils.qlink | public static <T> String qlink(Class<T> page, Key k, String content) {
return qlink(page, "source", k, content );
} | java | public static <T> String qlink(Class<T> page, Key k, String content) {
return qlink(page, "source", k, content );
} | [
"public",
"static",
"<",
"T",
">",
"String",
"qlink",
"(",
"Class",
"<",
"T",
">",
"page",
",",
"Key",
"k",
",",
"String",
"content",
")",
"{",
"return",
"qlink",
"(",
"page",
",",
"\"source\"",
",",
"k",
",",
"content",
")",
";",
"}"
] | Return the query link to this page | [
"Return",
"the",
"query",
"link",
"to",
"this",
"page"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/util/UIUtils.java#L10-L12 |
52,010 | h2oai/h2o-2 | src/main/java/water/MemoryManager.java | MemoryManager.malloc | 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 Object malloc(int elems, long bytes, int type, Object orig, int from ) {
return malloc(elems,bytes,type,orig,from,false);
} | [
"public",
"static",
"Object",
"malloc",
"(",
"int",
"elems",
",",
"long",
"bytes",
",",
"int",
"type",
",",
"Object",
"orig",
",",
"int",
"from",
")",
"{",
"return",
"malloc",
"(",
"elems",
",",
"bytes",
",",
"type",
",",
"orig",
",",
"from",
",",
... | Catches OutOfMemory, clears cache & retries. | [
"Catches",
"OutOfMemory",
"clears",
"cache",
"&",
"retries",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/MemoryManager.java#L222-L224 |
52,011 | h2oai/h2o-2 | src/main/java/water/MemoryManager.java | MemoryManager.tryReserveTaskMem | 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 | 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;
} | [
"public",
"static",
"boolean",
"tryReserveTaskMem",
"(",
"long",
"m",
")",
"{",
"if",
"(",
"!",
"CAN_ALLOC",
")",
"return",
"false",
";",
"if",
"(",
"m",
"==",
"0",
")",
"return",
"true",
";",
"assert",
"m",
">=",
"0",
":",
"\"m < 0: \"",
"+",
"m",
... | Try to reserve memory needed for task execution and return true if
succeeded. Tasks have a shared pool of memory which they should ask for
in advance before they even try to allocate it.
This method is another backpressure mechanism to make sure we do not
exhaust system's resources by running too many tasks at the sa... | [
"Try",
"to",
"reserve",
"memory",
"needed",
"for",
"task",
"execution",
"and",
"return",
"true",
"if",
"succeeded",
".",
"Tasks",
"have",
"a",
"shared",
"pool",
"of",
"memory",
"which",
"they",
"should",
"ask",
"for",
"in",
"advance",
"before",
"they",
"ev... | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/MemoryManager.java#L310-L320 |
52,012 | h2oai/h2o-2 | src/main/java/water/parser/CsvParser.java | CsvParser.determineSeparatorCounts | 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 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) )
... | [
"private",
"static",
"int",
"[",
"]",
"determineSeparatorCounts",
"(",
"String",
"from",
",",
"int",
"single_quote",
")",
"{",
"int",
"[",
"]",
"result",
"=",
"new",
"int",
"[",
"separators",
".",
"length",
"]",
";",
"byte",
"[",
"]",
"bits",
"=",
"fro... | Dermines the number of separators in given line. Correctly handles quoted
tokens. | [
"Dermines",
"the",
"number",
"of",
"separators",
"in",
"given",
"line",
".",
"Correctly",
"handles",
"quoted",
"tokens",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/parser/CsvParser.java#L512-L526 |
52,013 | h2oai/h2o-2 | src/main/java/water/parser/CsvParser.java | CsvParser.determineTokens | 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 | 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... | [
"private",
"static",
"String",
"[",
"]",
"determineTokens",
"(",
"String",
"from",
",",
"byte",
"separator",
",",
"int",
"single_quote",
")",
"{",
"ArrayList",
"<",
"String",
">",
"tokens",
"=",
"new",
"ArrayList",
"(",
")",
";",
"byte",
"[",
"]",
"bits"... | Determines the tokens that are inside a line and returns them as strings
in an array. Assumes the given separator. | [
"Determines",
"the",
"tokens",
"that",
"are",
"inside",
"a",
"line",
"and",
"returns",
"them",
"as",
"strings",
"in",
"an",
"array",
".",
"Assumes",
"the",
"given",
"separator",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/parser/CsvParser.java#L531-L576 |
52,014 | h2oai/h2o-2 | src/main/java/water/api/Models.java | Models.summarizeAndEnhanceModel | 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 | 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... | [
"protected",
"static",
"void",
"summarizeAndEnhanceModel",
"(",
"ModelSummary",
"summary",
",",
"Model",
"model",
",",
"boolean",
"find_compatible_frames",
",",
"Map",
"<",
"String",
",",
"Frame",
">",
"all_frames",
",",
"Map",
"<",
"String",
",",
"Set",
"<",
... | Summarize subclasses of water.Model. | [
"Summarize",
"subclasses",
"of",
"water",
".",
"Model",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Models.java#L168-L190 |
52,015 | h2oai/h2o-2 | src/main/java/water/api/Models.java | Models.summarizeModelCommonFields | 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 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... | [
"private",
"static",
"void",
"summarizeModelCommonFields",
"(",
"ModelSummary",
"summary",
",",
"Model",
"model",
")",
"{",
"String",
"[",
"]",
"names",
"=",
"model",
".",
"_names",
";",
"summary",
".",
"warnings",
"=",
"model",
".",
"warnings",
";",
"summar... | Summarize fields which are generic to water.Model. | [
"Summarize",
"fields",
"which",
"are",
"generic",
"to",
"water",
".",
"Model",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Models.java#L196-L231 |
52,016 | h2oai/h2o-2 | src/main/java/water/api/Models.java | Models.summarizeGLMModel | 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 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... | [
"private",
"static",
"void",
"summarizeGLMModel",
"(",
"ModelSummary",
"summary",
",",
"hex",
".",
"glm",
".",
"GLMModel",
"model",
")",
"{",
"// add generic fields such as column names",
"summarizeModelCommonFields",
"(",
"summary",
",",
"model",
")",
";",
"summary",... | Summarize fields which are specific to hex.glm.GLMModel. | [
"Summarize",
"fields",
"which",
"are",
"specific",
"to",
"hex",
".",
"glm",
".",
"GLMModel",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Models.java#L244-L254 |
52,017 | h2oai/h2o-2 | src/main/java/water/api/Models.java | Models.summarizeDRFModel | 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 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... | [
"private",
"static",
"void",
"summarizeDRFModel",
"(",
"ModelSummary",
"summary",
",",
"hex",
".",
"drf",
".",
"DRF",
".",
"DRFModel",
"model",
")",
"{",
"// add generic fields such as column names",
"summarizeModelCommonFields",
"(",
"summary",
",",
"model",
")",
"... | Summarize fields which are specific to hex.drf.DRF.DRFModel. | [
"Summarize",
"fields",
"which",
"are",
"specific",
"to",
"hex",
".",
"drf",
".",
"DRF",
".",
"DRFModel",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Models.java#L267-L277 |
52,018 | h2oai/h2o-2 | src/main/java/water/api/Models.java | Models.summarizeSpeeDRFModel | 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 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... | [
"private",
"static",
"void",
"summarizeSpeeDRFModel",
"(",
"ModelSummary",
"summary",
",",
"hex",
".",
"singlenoderf",
".",
"SpeeDRFModel",
"model",
")",
"{",
"// add generic fields such as column names",
"summarizeModelCommonFields",
"(",
"summary",
",",
"model",
")",
... | Summarize fields which are specific to hex.drf.DRF.SpeeDRFModel. | [
"Summarize",
"fields",
"which",
"are",
"specific",
"to",
"hex",
".",
"drf",
".",
"DRF",
".",
"SpeeDRFModel",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Models.java#L289-L299 |
52,019 | h2oai/h2o-2 | src/main/java/water/api/Models.java | Models.summarizeDeepLearningModel | 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 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... | [
"private",
"static",
"void",
"summarizeDeepLearningModel",
"(",
"ModelSummary",
"summary",
",",
"hex",
".",
"deeplearning",
".",
"DeepLearningModel",
"model",
")",
"{",
"// add generic fields such as column names",
"summarizeModelCommonFields",
"(",
"summary",
",",
"model",... | Summarize fields which are specific to hex.deeplearning.DeepLearningModel. | [
"Summarize",
"fields",
"which",
"are",
"specific",
"to",
"hex",
".",
"deeplearning",
".",
"DeepLearningModel",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Models.java#L311-L321 |
52,020 | h2oai/h2o-2 | src/main/java/water/api/Models.java | Models.summarizeGBMModel | 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 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... | [
"private",
"static",
"void",
"summarizeGBMModel",
"(",
"ModelSummary",
"summary",
",",
"hex",
".",
"gbm",
".",
"GBM",
".",
"GBMModel",
"model",
")",
"{",
"// add generic fields such as column names",
"summarizeModelCommonFields",
"(",
"summary",
",",
"model",
")",
"... | Summarize fields which are specific to hex.gbm.GBM.GBMModel. | [
"Summarize",
"fields",
"which",
"are",
"specific",
"to",
"hex",
".",
"gbm",
".",
"GBM",
".",
"GBMModel",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Models.java#L333-L343 |
52,021 | h2oai/h2o-2 | src/main/java/water/api/Models.java | Models.summarizeNBModel | 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 | 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... | [
"private",
"static",
"void",
"summarizeNBModel",
"(",
"ModelSummary",
"summary",
",",
"hex",
".",
"nb",
".",
"NBModel",
"model",
")",
"{",
"// add generic fields such as column names",
"summarizeModelCommonFields",
"(",
"summary",
",",
"model",
")",
";",
"summary",
... | Summarize fields which are specific to hex.nb.NBModel. | [
"Summarize",
"fields",
"which",
"are",
"specific",
"to",
"hex",
".",
"nb",
".",
"NBModel",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Models.java#L355-L365 |
52,022 | h2oai/h2o-2 | src/main/java/water/api/Models.java | Models.fetchAll | protected Map<String, Model> fetchAll() {
return H2O.KeySnapshot.globalSnapshot().fetchAll(water.Model.class);
} | java | protected Map<String, Model> fetchAll() {
return H2O.KeySnapshot.globalSnapshot().fetchAll(water.Model.class);
} | [
"protected",
"Map",
"<",
"String",
",",
"Model",
">",
"fetchAll",
"(",
")",
"{",
"return",
"H2O",
".",
"KeySnapshot",
".",
"globalSnapshot",
"(",
")",
".",
"fetchAll",
"(",
"water",
".",
"Model",
".",
"class",
")",
";",
"}"
] | Fetch all Models from the KV store. | [
"Fetch",
"all",
"Models",
"from",
"the",
"KV",
"store",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Models.java#L370-L372 |
52,023 | h2oai/h2o-2 | src/main/java/water/api/Models.java | Models.serveOneOrAll | 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 | 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... | [
"private",
"Response",
"serveOneOrAll",
"(",
"Map",
"<",
"String",
",",
"Model",
">",
"modelsMap",
")",
"{",
"// returns empty sets if !this.find_compatible_frames",
"Pair",
"<",
"Map",
"<",
"String",
",",
"Frame",
">",
",",
"Map",
"<",
"String",
",",
"Set",
"... | Fetch all the Models from the KV store, sumamrize and enhance them, and return a map of them. | [
"Fetch",
"all",
"the",
"Models",
"from",
"the",
"KV",
"store",
"sumamrize",
"and",
"enhance",
"them",
"and",
"return",
"a",
"map",
"of",
"them",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Models.java#L386-L415 |
52,024 | h2oai/h2o-2 | src/main/java/water/fvec/ParseDataset2.java | ParseProgress.make | static ParseProgress make( Key[] fkeys ) {
long total = 0;
for( Key fkey : fkeys )
total += getVec(fkey).length();
return new ParseProgress(0,total);
} | java | static ParseProgress make( Key[] fkeys ) {
long total = 0;
for( Key fkey : fkeys )
total += getVec(fkey).length();
return new ParseProgress(0,total);
} | [
"static",
"ParseProgress",
"make",
"(",
"Key",
"[",
"]",
"fkeys",
")",
"{",
"long",
"total",
"=",
"0",
";",
"for",
"(",
"Key",
"fkey",
":",
"fkeys",
")",
"total",
"+=",
"getVec",
"(",
"fkey",
")",
".",
"length",
"(",
")",
";",
"return",
"new",
"P... | Total number of steps is equal to total bytecount across files | [
"Total",
"number",
"of",
"steps",
"is",
"equal",
"to",
"total",
"bytecount",
"across",
"files"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/fvec/ParseDataset2.java#L159-L164 |
52,025 | h2oai/h2o-2 | src/main/java/water/score/ScoreModel.java | ScoreModel.xml2jname | 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 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) ) {
... | [
"protected",
"static",
"String",
"xml2jname",
"(",
"String",
"xml",
")",
"{",
"// Convert pname to a valid java name",
"StringBuilder",
"nn",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"char",
"[",
"]",
"cs",
"=",
"xml",
".",
"toCharArray",
"(",
")",
";",
"... | Convert an XML name to a java name | [
"Convert",
"an",
"XML",
"name",
"to",
"a",
"java",
"name"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/score/ScoreModel.java#L22-L37 |
52,026 | h2oai/h2o-2 | src/main/java/water/score/ScoreModel.java | ScoreModel.uniqueClassName | 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 | 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;
} | [
"protected",
"static",
"String",
"uniqueClassName",
"(",
"String",
"name",
")",
"{",
"// Make a unique class name",
"String",
"cname",
"=",
"xml2jname",
"(",
"name",
")",
";",
"if",
"(",
"CLASS_NAMES",
".",
"contains",
"(",
"cname",
")",
")",
"{",
"int",
"i"... | Make a unique class name for jit'd subclasses of ScoreModel | [
"Make",
"a",
"unique",
"class",
"name",
"for",
"jit",
"d",
"subclasses",
"of",
"ScoreModel"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/score/ScoreModel.java#L44-L54 |
52,027 | h2oai/h2o-2 | src/main/java/water/score/ScoreModel.java | ScoreModel.columnMapping | 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 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 ) ... | [
"public",
"int",
"[",
"]",
"columnMapping",
"(",
"String",
"[",
"]",
"features",
")",
"{",
"int",
"[",
"]",
"map",
"=",
"new",
"int",
"[",
"_colNames",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"_colNames",
".",
... | needs, then this map will contain a -1 for the missing feature index. | [
"needs",
"then",
"this",
"map",
"will",
"contain",
"a",
"-",
"1",
"for",
"the",
"missing",
"feature",
"index",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/score/ScoreModel.java#L61-L74 |
52,028 | h2oai/h2o-2 | src/main/java/water/Value.java | Value.setHdfs | 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 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... | [
"public",
"void",
"setHdfs",
"(",
")",
"{",
"assert",
"onICE",
"(",
")",
";",
"byte",
"[",
"]",
"mem",
"=",
"memOrLoad",
"(",
")",
";",
"// Get into stable memory",
"_persist",
"=",
"Value",
".",
"HDFS",
"|",
"Value",
".",
"NOTdsk",
";",
"Persist",
"."... | Set persistence to HDFS from ICE | [
"Set",
"persistence",
"to",
"HDFS",
"from",
"ICE"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Value.java#L211-L219 |
52,029 | h2oai/h2o-2 | src/main/java/water/Value.java | Value.openStream | 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 | 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() ) ... | [
"public",
"InputStream",
"openStream",
"(",
"ProgressMonitor",
"p",
")",
"throws",
"IOException",
"{",
"if",
"(",
"onNFS",
"(",
")",
")",
"return",
"PersistNFS",
".",
"openStream",
"(",
"_key",
")",
";",
"if",
"(",
"onHDFS",
"(",
")",
")",
"return",
"Per... | Creates a Stream for reading bytes | [
"Creates",
"a",
"Stream",
"for",
"reading",
"bytes"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Value.java#L281-L289 |
52,030 | h2oai/h2o-2 | src/main/java/water/Value.java | Value.lowerActiveGetCount | 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 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... | [
"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"... | Atomically lower active GET count | [
"Atomically",
"lower",
"active",
"GET",
"count"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Value.java#L502-L516 |
52,031 | h2oai/h2o-2 | src/main/java/water/Value.java | Value.startRemotePut | 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 | 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 ... | [
"void",
"startRemotePut",
"(",
")",
"{",
"assert",
"!",
"_key",
".",
"home",
"(",
")",
";",
"int",
"x",
"=",
"0",
";",
"// assert I am waiting on threads with higher priority?",
"while",
"(",
"(",
"x",
"=",
"_rwlock",
".",
"get",
"(",
")",
")",
"!=",
"-"... | Block this thread until all prior remote PUTs complete - to force
remote-PUT ordering on the home node. | [
"Block",
"this",
"thread",
"until",
"all",
"prior",
"remote",
"PUTs",
"complete",
"-",
"to",
"force",
"remote",
"-",
"PUT",
"ordering",
"on",
"the",
"home",
"node",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Value.java#L564-L571 |
52,032 | h2oai/h2o-2 | src/main/java/water/util/RString.java | RString.clear | public void clear() {
for( Placeholder p : _placeholders.values() ) {
p.start.removeTill(p.end);
}
} | java | public void clear() {
for( Placeholder p : _placeholders.values() ) {
p.start.removeTill(p.end);
}
} | [
"public",
"void",
"clear",
"(",
")",
"{",
"for",
"(",
"Placeholder",
"p",
":",
"_placeholders",
".",
"values",
"(",
")",
")",
"{",
"p",
".",
"start",
".",
"removeTill",
"(",
"p",
".",
"end",
")",
";",
"}",
"}"
] | they can be used again. | [
"they",
"can",
"be",
"used",
"again",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/util/RString.java#L273-L277 |
52,033 | h2oai/h2o-2 | src/main/java/water/util/RString.java | RString.replace | 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 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))
... | [
"public",
"void",
"replace",
"(",
"String",
"what",
",",
"Object",
"with",
")",
"{",
"if",
"(",
"what",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"$ is now control char that denotes URL encoding!\"",
")",
"... | another in order. | [
"another",
"in",
"order",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/util/RString.java#L304-L316 |
52,034 | h2oai/h2o-2 | src/main/java/water/util/RString.java | RString.restartGroup | 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 | 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... | [
"public",
"RString",
"restartGroup",
"(",
"String",
"what",
")",
"{",
"List",
"<",
"Placeholder",
">",
"all",
"=",
"_placeholders",
".",
"get",
"(",
"what",
")",
";",
"assert",
"all",
".",
"size",
"(",
")",
"==",
"1",
";",
"Placeholder",
"result",
"=",... | can be filled again. | [
"can",
"be",
"filled",
"again",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/util/RString.java#L320-L330 |
52,035 | belaban/JGroups | src/org/jgroups/protocols/AUTH.java | AUTH.handleAuthHeader | 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 | 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 {
... | [
"protected",
"boolean",
"handleAuthHeader",
"(",
"GMS",
".",
"GmsHeader",
"gms_hdr",
",",
"AuthHeader",
"auth_hdr",
",",
"Message",
"msg",
")",
"{",
"if",
"(",
"needsAuthentication",
"(",
"gms_hdr",
")",
")",
"{",
"if",
"(",
"this",
".",
"auth_token",
".",
... | Handles a GMS header
@param gms_hdr
@param msg
@return true if the message should be passed up, or else false | [
"Handles",
"a",
"GMS",
"header"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/AUTH.java#L214-L227 |
52,036 | belaban/JGroups | src/org/jgroups/util/TimeScheduler3.java | TimeScheduler3.stop | 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 | 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... | [
"public",
"synchronized",
"void",
"stop",
"(",
")",
"{",
"Thread",
"tmp",
"=",
"runner",
";",
"runner",
"=",
"null",
";",
"if",
"(",
"tmp",
"!=",
"null",
")",
"{",
"tmp",
".",
"interrupt",
"(",
")",
";",
"try",
"{",
"tmp",
".",
"join",
"(",
"500"... | Stops the timer, cancelling all tasks | [
"Stops",
"the",
"timer",
"cancelling",
"all",
"tasks"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/TimeScheduler3.java#L158-L190 |
52,037 | belaban/JGroups | src/org/jgroups/blocks/cs/NioBaseServer.java | NioBaseServer.printBuffers | @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 | @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(... | [
"@",
"ManagedOperation",
"(",
"description",
"=",
"\"Prints the send and receive buffers\"",
")",
"public",
"String",
"printBuffers",
"(",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"\"\\n\"",
")",
";",
"synchronized",
"(",
"this",
")",
"{"... | Prints send and receive buffers for all connections | [
"Prints",
"send",
"and",
"receive",
"buffers",
"for",
"all",
"connections"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/cs/NioBaseServer.java#L76-L87 |
52,038 | belaban/JGroups | src/org/jgroups/util/RingBufferSeqno.java | RingBufferSeqno.stable | 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 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... | [
"public",
"void",
"stable",
"(",
"long",
"seqno",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"seqno",
"<=",
"low",
")",
"return",
";",
"if",
"(",
"seqno",
">",
"hd",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\... | Nulls elements between low and seqno and forwards low | [
"Nulls",
"elements",
"between",
"low",
"and",
"seqno",
"and",
"forwards",
"low"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/RingBufferSeqno.java#L278-L301 |
52,039 | belaban/JGroups | src/org/jgroups/demos/wb/GraphPanel.java | GraphPanel.adjustNodes | 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 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... | [
"public",
"void",
"adjustNodes",
"(",
"java",
".",
"util",
".",
"List",
"<",
"Address",
">",
"v",
")",
"{",
"Node",
"n",
";",
"boolean",
"removed",
"=",
"false",
";",
"synchronized",
"(",
"nodes",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
... | Removes nodes that are not in the view | [
"Removes",
"nodes",
"that",
"are",
"not",
"in",
"the",
"view"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/demos/wb/GraphPanel.java#L113-L129 |
52,040 | belaban/JGroups | src/org/jgroups/demos/Chat.java | Chat.start | public void start(JChannel ch) throws Exception {
channel=ch;
channel.setReceiver(this);
channel.connect("ChatCluster");
eventLoop();
channel.close();
} | java | public void start(JChannel ch) throws Exception {
channel=ch;
channel.setReceiver(this);
channel.connect("ChatCluster");
eventLoop();
channel.close();
} | [
"public",
"void",
"start",
"(",
"JChannel",
"ch",
")",
"throws",
"Exception",
"{",
"channel",
"=",
"ch",
";",
"channel",
".",
"setReceiver",
"(",
"this",
")",
";",
"channel",
".",
"connect",
"(",
"\"ChatCluster\"",
")",
";",
"eventLoop",
"(",
")",
";",
... | Method called from other app, injecting channel | [
"Method",
"called",
"from",
"other",
"app",
"injecting",
"channel"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/demos/Chat.java#L24-L30 |
52,041 | belaban/JGroups | src/org/jgroups/util/ResponseCollector.java | ResponseCollector.waitForAllResponses | public boolean waitForAllResponses(long timeout) {
if(timeout <= 0)
timeout=2000L;
return cond.waitFor(this::hasAllResponses, timeout, TimeUnit.MILLISECONDS);
} | java | public boolean waitForAllResponses(long timeout) {
if(timeout <= 0)
timeout=2000L;
return cond.waitFor(this::hasAllResponses, timeout, TimeUnit.MILLISECONDS);
} | [
"public",
"boolean",
"waitForAllResponses",
"(",
"long",
"timeout",
")",
"{",
"if",
"(",
"timeout",
"<=",
"0",
")",
"timeout",
"=",
"2000L",
";",
"return",
"cond",
".",
"waitFor",
"(",
"this",
"::",
"hasAllResponses",
",",
"timeout",
",",
"TimeUnit",
".",
... | Waits until all responses have been received, or until a timeout has elapsed.
@param timeout Number of milliseconds to wait max. This value needs to be greater than 0, or else
it will be adjusted to 2000
@return boolean True if all responses have been received within timeout ms, else false (e.g. if interrupted) | [
"Waits",
"until",
"all",
"responses",
"have",
"been",
"received",
"or",
"until",
"a",
"timeout",
"has",
"elapsed",
"."
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/ResponseCollector.java#L160-L164 |
52,042 | belaban/JGroups | src/org/jgroups/util/ForwardQueue.java | ForwardQueue.deliveryTableSize | public int deliveryTableSize() {
int retval=0;
for(BoundedHashMap<Long,Long> val: delivery_table.values())
retval+=val.size();
return retval;
} | java | public int deliveryTableSize() {
int retval=0;
for(BoundedHashMap<Long,Long> val: delivery_table.values())
retval+=val.size();
return retval;
} | [
"public",
"int",
"deliveryTableSize",
"(",
")",
"{",
"int",
"retval",
"=",
"0",
";",
"for",
"(",
"BoundedHashMap",
"<",
"Long",
",",
"Long",
">",
"val",
":",
"delivery_table",
".",
"values",
"(",
")",
")",
"retval",
"+=",
"val",
".",
"size",
"(",
")"... | Total size of all queues of the delivery table | [
"Total",
"size",
"of",
"all",
"queues",
"of",
"the",
"delivery",
"table"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/ForwardQueue.java#L81-L86 |
52,043 | belaban/JGroups | src/org/jgroups/util/ForwardQueue.java | ForwardQueue.canDeliver | 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 | 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);
... | [
"protected",
"boolean",
"canDeliver",
"(",
"Address",
"sender",
",",
"long",
"seqno",
")",
"{",
"BoundedHashMap",
"<",
"Long",
",",
"Long",
">",
"seqno_set",
"=",
"delivery_table",
".",
"get",
"(",
"sender",
")",
";",
"if",
"(",
"seqno_set",
"==",
"null",
... | Checks if seqno has already been received from sender. This weeds out duplicates.
Note that this method is never called concurrently for the same sender. | [
"Checks",
"if",
"seqno",
"has",
"already",
"been",
"received",
"from",
"sender",
".",
"This",
"weeds",
"out",
"duplicates",
".",
"Note",
"that",
"this",
"method",
"is",
"never",
"called",
"concurrently",
"for",
"the",
"same",
"sender",
"."
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/ForwardQueue.java#L236-L245 |
52,044 | belaban/JGroups | src/org/jgroups/auth/Krb5TokenUtils.java | Krb5TokenUtils.generateSecuritySubject | 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 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... | [
"public",
"static",
"Subject",
"generateSecuritySubject",
"(",
"String",
"jassLoginConfig",
",",
"String",
"username",
",",
"String",
"password",
")",
"throws",
"LoginException",
"{",
"LoginContext",
"loginCtx",
"=",
"null",
";",
"try",
"{",
"// \"Client\" references ... | Authenticate against the KDC using JAAS. | [
"Authenticate",
"against",
"the",
"KDC",
"using",
"JAAS",
"."
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/auth/Krb5TokenUtils.java#L42-L60 |
52,045 | belaban/JGroups | src/org/jgroups/auth/Krb5TokenUtils.java | Krb5TokenUtils.initiateSecurityContext | 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 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... | [
"public",
"static",
"byte",
"[",
"]",
"initiateSecurityContext",
"(",
"Subject",
"subject",
",",
"String",
"servicePrincipalName",
")",
"throws",
"GSSException",
"{",
"GSSManager",
"manager",
"=",
"GSSManager",
".",
"getInstance",
"(",
")",
";",
"GSSName",
"server... | Generate the service ticket that will be passed to the cluster master for authentication | [
"Generate",
"the",
"service",
"ticket",
"that",
"will",
"be",
"passed",
"to",
"the",
"cluster",
"master",
"for",
"authentication"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/auth/Krb5TokenUtils.java#L63-L84 |
52,046 | belaban/JGroups | src/org/jgroups/auth/Krb5TokenUtils.java | Krb5TokenUtils.validateSecurityContext | 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 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... | [
"public",
"static",
"String",
"validateSecurityContext",
"(",
"Subject",
"subject",
",",
"final",
"byte",
"[",
"]",
"serviceTicket",
")",
"throws",
"GSSException",
"{",
"// Accept the context and return the client principal name.",
"return",
"Subject",
".",
"doAs",
"(",
... | Validate the service ticket by extracting the client principal name | [
"Validate",
"the",
"service",
"ticket",
"by",
"extracting",
"the",
"client",
"principal",
"name"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/auth/Krb5TokenUtils.java#L87-L103 |
52,047 | belaban/JGroups | src/org/jgroups/ViewId.java | ViewId.compareTo | public int compareTo(ViewId other) {
return id > other.id ? 1 : id < other.id ? -1 : creator.compareTo(other.creator);
} | java | public int compareTo(ViewId other) {
return id > other.id ? 1 : id < other.id ? -1 : creator.compareTo(other.creator);
} | [
"public",
"int",
"compareTo",
"(",
"ViewId",
"other",
")",
"{",
"return",
"id",
">",
"other",
".",
"id",
"?",
"1",
":",
"id",
"<",
"other",
".",
"id",
"?",
"-",
"1",
":",
"creator",
".",
"compareTo",
"(",
"other",
".",
"creator",
")",
";",
"}"
] | Establishes an order between 2 ViewIds. The comparison is done on the IDs, if they are equal, we use the creator.
@return 0 for equality, value less than 0 if smaller, greater than 0 if greater. | [
"Establishes",
"an",
"order",
"between",
"2",
"ViewIds",
".",
"The",
"comparison",
"is",
"done",
"on",
"the",
"IDs",
"if",
"they",
"are",
"equal",
"we",
"use",
"the",
"creator",
"."
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/ViewId.java#L86-L88 |
52,048 | belaban/JGroups | src/org/jgroups/protocols/pbcast/ViewHandler.java | ViewHandler.processing | public <T extends ViewHandler<R>> T processing(boolean flag) {
lock.lock();
try {
setProcessing(flag);
return (T)this;
}
finally {
lock.unlock();
}
} | java | public <T extends ViewHandler<R>> T processing(boolean flag) {
lock.lock();
try {
setProcessing(flag);
return (T)this;
}
finally {
lock.unlock();
}
} | [
"public",
"<",
"T",
"extends",
"ViewHandler",
"<",
"R",
">",
">",
"T",
"processing",
"(",
"boolean",
"flag",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"setProcessing",
"(",
"flag",
")",
";",
"return",
"(",
"T",
")",
"this",
";",
"... | To be used by testing only! | [
"To",
"be",
"used",
"by",
"testing",
"only!"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/ViewHandler.java#L139-L148 |
52,049 | belaban/JGroups | src/org/jgroups/protocols/pbcast/ViewHandler.java | ViewHandler.process | 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 | 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... | [
"protected",
"void",
"process",
"(",
"Collection",
"<",
"R",
">",
"requests",
")",
"{",
"for",
"(",
";",
";",
")",
"{",
"while",
"(",
"!",
"requests",
".",
"isEmpty",
"(",
")",
")",
"{",
"removeAndProcess",
"(",
"requests",
")",
";",
"// remove matchin... | We're guaranteed that only one thread will be called with this method at any time | [
"We",
"re",
"guaranteed",
"that",
"only",
"one",
"thread",
"will",
"be",
"called",
"with",
"this",
"method",
"at",
"any",
"time"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/ViewHandler.java#L241-L257 |
52,050 | belaban/JGroups | src/org/jgroups/util/Promise.java | Promise.setResult | public void setResult(T obj) {
lock.lock();
try {
result=obj;
hasResult=true;
cond.signal(true);
}
finally {
lock.unlock();
}
} | java | public void setResult(T obj) {
lock.lock();
try {
result=obj;
hasResult=true;
cond.signal(true);
}
finally {
lock.unlock();
}
} | [
"public",
"void",
"setResult",
"(",
"T",
"obj",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"result",
"=",
"obj",
";",
"hasResult",
"=",
"true",
";",
"cond",
".",
"signal",
"(",
"true",
")",
";",
"}",
"finally",
"{",
"lock",
".",
... | Sets the result and notifies any threads waiting for it | [
"Sets",
"the",
"result",
"and",
"notifies",
"any",
"threads",
"waiting",
"for",
"it"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Promise.java#L96-L106 |
52,051 | belaban/JGroups | src/org/jgroups/util/Promise.java | Promise._getResultWithTimeout | 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 | 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;
} | [
"protected",
"T",
"_getResultWithTimeout",
"(",
"final",
"long",
"timeout",
")",
"throws",
"TimeoutException",
"{",
"if",
"(",
"timeout",
"<=",
"0",
")",
"cond",
".",
"waitFor",
"(",
"this",
"::",
"hasResult",
")",
";",
"else",
"if",
"(",
"!",
"cond",
".... | Blocks until a result is available, or timeout milliseconds have elapsed. Needs to be called with lock held
@param timeout in ms
@return An object
@throws TimeoutException If a timeout occurred (implies that timeout > 0) | [
"Blocks",
"until",
"a",
"result",
"is",
"available",
"or",
"timeout",
"milliseconds",
"have",
"elapsed",
".",
"Needs",
"to",
"be",
"called",
"with",
"lock",
"held"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Promise.java#L143-L149 |
52,052 | belaban/JGroups | src/org/jgroups/protocols/pbcast/ServerGmsImpl.java | ServerGmsImpl.handleViewChange | 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 | 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()... | [
"public",
"void",
"handleViewChange",
"(",
"View",
"view",
",",
"Digest",
"digest",
")",
"{",
"if",
"(",
"gms",
".",
"isLeaving",
"(",
")",
"&&",
"!",
"view",
".",
"containsMember",
"(",
"gms",
".",
"local_addr",
")",
")",
"return",
";",
"View",
"prev_... | Called by the GMS when a VIEW is received.
@param view The view to be installed
@param digest If view is a MergeView, the digest contains the seqnos of all members and has to be set by GMS | [
"Called",
"by",
"the",
"GMS",
"when",
"a",
"VIEW",
"is",
"received",
"."
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/ServerGmsImpl.java#L63-L71 |
52,053 | belaban/JGroups | src/org/jgroups/protocols/pbcast/ServerGmsImpl.java | ServerGmsImpl.sendLeaveReqToCoord | protected boolean sendLeaveReqToCoord(final Address coord) {
if(coord == null) {
log.warn("%s: cannot send LEAVE request to null coord", gms.getLocalAddress());
return false;
}
Promise<Address> leave_promise=gms.getLeavePromise();
gms.setLeaving(true);
log... | java | protected boolean sendLeaveReqToCoord(final Address coord) {
if(coord == null) {
log.warn("%s: cannot send LEAVE request to null coord", gms.getLocalAddress());
return false;
}
Promise<Address> leave_promise=gms.getLeavePromise();
gms.setLeaving(true);
log... | [
"protected",
"boolean",
"sendLeaveReqToCoord",
"(",
"final",
"Address",
"coord",
")",
"{",
"if",
"(",
"coord",
"==",
"null",
")",
"{",
"log",
".",
"warn",
"(",
"\"%s: cannot send LEAVE request to null coord\"",
",",
"gms",
".",
"getLocalAddress",
"(",
")",
")",
... | Sends a leave request to coord and blocks until a leave response has been received,
or the leave timeout has elapsed | [
"Sends",
"a",
"leave",
"request",
"to",
"coord",
"and",
"blocks",
"until",
"a",
"leave",
"response",
"has",
"been",
"received",
"or",
"the",
"leave",
"timeout",
"has",
"elapsed"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/ServerGmsImpl.java#L85-L105 |
52,054 | belaban/JGroups | src/org/jgroups/Version.java | Version.isBinaryCompatible | public static boolean isBinaryCompatible(short ver) {
if(version == ver)
return true;
short tmp_major=(short)((ver & MAJOR_MASK) >> MAJOR_SHIFT);
short tmp_minor=(short)((ver & MINOR_MASK) >> MINOR_SHIFT);
return major == tmp_major && minor == tmp_minor;
} | java | public static boolean isBinaryCompatible(short ver) {
if(version == ver)
return true;
short tmp_major=(short)((ver & MAJOR_MASK) >> MAJOR_SHIFT);
short tmp_minor=(short)((ver & MINOR_MASK) >> MINOR_SHIFT);
return major == tmp_major && minor == tmp_minor;
} | [
"public",
"static",
"boolean",
"isBinaryCompatible",
"(",
"short",
"ver",
")",
"{",
"if",
"(",
"version",
"==",
"ver",
")",
"return",
"true",
";",
"short",
"tmp_major",
"=",
"(",
"short",
")",
"(",
"(",
"ver",
"&",
"MAJOR_MASK",
")",
">>",
"MAJOR_SHIFT",... | Checks whether ver is binary compatible with the current version. The rule for binary compatibility is that
the major and minor versions have to match, whereas micro versions can differ.
@param ver
@return | [
"Checks",
"whether",
"ver",
"is",
"binary",
"compatible",
"with",
"the",
"current",
"version",
".",
"The",
"rule",
"for",
"binary",
"compatibility",
"is",
"that",
"the",
"major",
"and",
"minor",
"versions",
"have",
"to",
"match",
"whereas",
"micro",
"versions"... | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/Version.java#L143-L149 |
52,055 | belaban/JGroups | src/org/jgroups/stack/RouterStub.java | RouterStub.connect | public void connect(String group, Address addr, String logical_name, PhysicalAddress phys_addr) throws Exception {
synchronized(this) {
_doConnect();
}
try {
writeRequest(new GossipData(GossipType.REGISTER, group, addr, logical_name, phys_addr));
}
catch(E... | java | public void connect(String group, Address addr, String logical_name, PhysicalAddress phys_addr) throws Exception {
synchronized(this) {
_doConnect();
}
try {
writeRequest(new GossipData(GossipType.REGISTER, group, addr, logical_name, phys_addr));
}
catch(E... | [
"public",
"void",
"connect",
"(",
"String",
"group",
",",
"Address",
"addr",
",",
"String",
"logical_name",
",",
"PhysicalAddress",
"phys_addr",
")",
"throws",
"Exception",
"{",
"synchronized",
"(",
"this",
")",
"{",
"_doConnect",
"(",
")",
";",
"}",
"try",
... | Registers mbr with the GossipRouter under the given group, with the given logical name and physical address.
Establishes a connection to the GossipRouter and sends a CONNECT message.
@param group The group cluster) name under which to register the member
@param addr The address of the member
@param logical_name The log... | [
"Registers",
"mbr",
"with",
"the",
"GossipRouter",
"under",
"the",
"given",
"group",
"with",
"the",
"given",
"logical",
"name",
"and",
"physical",
"address",
".",
"Establishes",
"a",
"connection",
"to",
"the",
"GossipRouter",
"and",
"sends",
"a",
"CONNECT",
"m... | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/stack/RouterStub.java#L118-L128 |
52,056 | belaban/JGroups | src/org/jgroups/stack/IpAddress.java | IpAddress.compareTo | public int compareTo(Address o) {
int h1, h2, rc; // added Nov 7 2005, makes sense with canonical addresses
if(this == o) return 0;
if(!(o instanceof IpAddress))
throw new ClassCastException("comparison between different classes: the other object is " +
(o != nul... | java | public int compareTo(Address o) {
int h1, h2, rc; // added Nov 7 2005, makes sense with canonical addresses
if(this == o) return 0;
if(!(o instanceof IpAddress))
throw new ClassCastException("comparison between different classes: the other object is " +
(o != nul... | [
"public",
"int",
"compareTo",
"(",
"Address",
"o",
")",
"{",
"int",
"h1",
",",
"h2",
",",
"rc",
";",
"// added Nov 7 2005, makes sense with canonical addresses",
"if",
"(",
"this",
"==",
"o",
")",
"return",
"0",
";",
"if",
"(",
"!",
"(",
"o",
"instanceof",... | implements the java.lang.Comparable interface
@see java.lang.Comparable
@param o - the Object to be compared
@return a negative integer, zero, or a positive integer as this object is less than,
equal to, or greater than the specified object.
@exception java.lang.ClassCastException - if the specified object's type preve... | [
"implements",
"the",
"java",
".",
"lang",
".",
"Comparable",
"interface"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/stack/IpAddress.java#L103-L119 |
52,057 | belaban/JGroups | src/org/jgroups/Membership.java | Membership.add | public Membership add(Collection<Address> v) {
if(v != null)
v.forEach(this::add);
return this;
} | java | public Membership add(Collection<Address> v) {
if(v != null)
v.forEach(this::add);
return this;
} | [
"public",
"Membership",
"add",
"(",
"Collection",
"<",
"Address",
">",
"v",
")",
"{",
"if",
"(",
"v",
"!=",
"null",
")",
"v",
".",
"forEach",
"(",
"this",
"::",
"add",
")",
";",
"return",
"this",
";",
"}"
] | Adds a list of members to this membership
@param v - a listof addresses
@throws ClassCastException if v contains objects that don't implement the Address interface | [
"Adds",
"a",
"list",
"of",
"members",
"to",
"this",
"membership"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/Membership.java#L85-L89 |
52,058 | belaban/JGroups | src/org/jgroups/Membership.java | Membership.remove | public Membership remove(Address old_member) {
if(old_member != null) {
synchronized(members) {
members.remove(old_member);
}
}
return this;
} | java | public Membership remove(Address old_member) {
if(old_member != null) {
synchronized(members) {
members.remove(old_member);
}
}
return this;
} | [
"public",
"Membership",
"remove",
"(",
"Address",
"old_member",
")",
"{",
"if",
"(",
"old_member",
"!=",
"null",
")",
"{",
"synchronized",
"(",
"members",
")",
"{",
"members",
".",
"remove",
"(",
"old_member",
")",
";",
"}",
"}",
"return",
"this",
";",
... | Removes an member from the membership. If this member doesn't exist, no action will be
performed on the existing membership
@param old_member
- the member to be removed | [
"Removes",
"an",
"member",
"from",
"the",
"membership",
".",
"If",
"this",
"member",
"doesn",
"t",
"exist",
"no",
"action",
"will",
"be",
"performed",
"on",
"the",
"existing",
"membership"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/Membership.java#L99-L106 |
52,059 | belaban/JGroups | src/org/jgroups/Membership.java | Membership.remove | public Membership remove(Collection<Address> v) {
if(v != null) {
synchronized(members) {
members.removeAll(v);
}
}
return this;
} | java | public Membership remove(Collection<Address> v) {
if(v != null) {
synchronized(members) {
members.removeAll(v);
}
}
return this;
} | [
"public",
"Membership",
"remove",
"(",
"Collection",
"<",
"Address",
">",
"v",
")",
"{",
"if",
"(",
"v",
"!=",
"null",
")",
"{",
"synchronized",
"(",
"members",
")",
"{",
"members",
".",
"removeAll",
"(",
"v",
")",
";",
"}",
"}",
"return",
"this",
... | Removes all the members contained in v from this membership
@param v a list of all the members to be removed | [
"Removes",
"all",
"the",
"members",
"contained",
"in",
"v",
"from",
"this",
"membership"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/Membership.java#L114-L121 |
52,060 | belaban/JGroups | src/org/jgroups/Membership.java | Membership.merge | public Membership merge(Collection<Address> new_mems, Collection<Address> suspects) {
remove(suspects);
return add(new_mems);
} | java | public Membership merge(Collection<Address> new_mems, Collection<Address> suspects) {
remove(suspects);
return add(new_mems);
} | [
"public",
"Membership",
"merge",
"(",
"Collection",
"<",
"Address",
">",
"new_mems",
",",
"Collection",
"<",
"Address",
">",
"suspects",
")",
"{",
"remove",
"(",
"suspects",
")",
";",
"return",
"add",
"(",
"new_mems",
")",
";",
"}"
] | Merges membership with the new members and removes suspects.
The Merge method will remove all the suspects and add in the new members.
It will do it in the order
1. Remove suspects
2. Add new members
the order is very important to notice.
@param new_mems - a vector containing a list of members (Address) to be added to... | [
"Merges",
"membership",
"with",
"the",
"new",
"members",
"and",
"removes",
"suspects",
".",
"The",
"Merge",
"method",
"will",
"remove",
"all",
"the",
"suspects",
"and",
"add",
"in",
"the",
"new",
"members",
".",
"It",
"will",
"do",
"it",
"in",
"the",
"or... | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/Membership.java#L183-L186 |
52,061 | belaban/JGroups | src/org/jgroups/Membership.java | Membership.contains | public boolean contains(Address member) {
if(member == null) return false;
synchronized(members) {
return members.contains(member);
}
} | java | public boolean contains(Address member) {
if(member == null) return false;
synchronized(members) {
return members.contains(member);
}
} | [
"public",
"boolean",
"contains",
"(",
"Address",
"member",
")",
"{",
"if",
"(",
"member",
"==",
"null",
")",
"return",
"false",
";",
"synchronized",
"(",
"members",
")",
"{",
"return",
"members",
".",
"contains",
"(",
"member",
")",
";",
"}",
"}"
] | Returns true if the provided member belongs to this membership
@param member
@return true if the member belongs to this membership | [
"Returns",
"true",
"if",
"the",
"provided",
"member",
"belongs",
"to",
"this",
"membership"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/Membership.java#L195-L200 |
52,062 | belaban/JGroups | src/org/jgroups/blocks/ReplicatedTree.java | ReplicatedTree.getChildrenNames | public Set getChildrenNames(String fqn) {
Node n=findNode(fqn);
Map m;
if(n == null) return null;
m=n.getChildren();
if(m != null)
return m.keySet();
else
return null;
} | java | public Set getChildrenNames(String fqn) {
Node n=findNode(fqn);
Map m;
if(n == null) return null;
m=n.getChildren();
if(m != null)
return m.keySet();
else
return null;
} | [
"public",
"Set",
"getChildrenNames",
"(",
"String",
"fqn",
")",
"{",
"Node",
"n",
"=",
"findNode",
"(",
"fqn",
")",
";",
"Map",
"m",
";",
"if",
"(",
"n",
"==",
"null",
")",
"return",
"null",
";",
"m",
"=",
"n",
".",
"getChildren",
"(",
")",
";",
... | Returns all children of a given node
@param fqn The fully qualified name of the node
@return Set A list of child names (as Strings) | [
"Returns",
"all",
"children",
"of",
"a",
"given",
"node"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/ReplicatedTree.java#L360-L370 |
52,063 | belaban/JGroups | src/org/jgroups/blocks/LazyRemovalCache.java | LazyRemovalCache.containsKeys | public boolean containsKeys(Collection<K> keys) {
for(K key: keys)
if(!map.containsKey(key))
return false;
return true;
} | java | public boolean containsKeys(Collection<K> keys) {
for(K key: keys)
if(!map.containsKey(key))
return false;
return true;
} | [
"public",
"boolean",
"containsKeys",
"(",
"Collection",
"<",
"K",
">",
"keys",
")",
"{",
"for",
"(",
"K",
"key",
":",
"keys",
")",
"if",
"(",
"!",
"map",
".",
"containsKey",
"(",
"key",
")",
")",
"return",
"false",
";",
"return",
"true",
";",
"}"
] | Returns true if all of the keys in keys are present. Returns false if one or more of the keys are absent | [
"Returns",
"true",
"if",
"all",
"of",
"the",
"keys",
"in",
"keys",
"are",
"present",
".",
"Returns",
"false",
"if",
"one",
"or",
"more",
"of",
"the",
"keys",
"are",
"absent"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/LazyRemovalCache.java#L71-L76 |
52,064 | belaban/JGroups | src/org/jgroups/blocks/LazyRemovalCache.java | LazyRemovalCache.nonRemovedValues | public Set<V> nonRemovedValues() {
return map.values().stream().filter(entry -> !entry.removable).map(entry -> entry.val).collect(Collectors.toSet());
} | java | public Set<V> nonRemovedValues() {
return map.values().stream().filter(entry -> !entry.removable).map(entry -> entry.val).collect(Collectors.toSet());
} | [
"public",
"Set",
"<",
"V",
">",
"nonRemovedValues",
"(",
")",
"{",
"return",
"map",
".",
"values",
"(",
")",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"entry",
"->",
"!",
"entry",
".",
"removable",
")",
".",
"map",
"(",
"entry",
"->",
"entry",
... | Adds all value which have not been marked as removable to the returned set
@return | [
"Adds",
"all",
"value",
"which",
"have",
"not",
"been",
"marked",
"as",
"removable",
"to",
"the",
"returned",
"set"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/LazyRemovalCache.java#L190-L192 |
52,065 | belaban/JGroups | src/org/jgroups/blocks/LazyRemovalCache.java | LazyRemovalCache.removeMarkedElements | public void removeMarkedElements(boolean force) {
long curr_time=System.nanoTime();
for(Iterator<Map.Entry<K,Entry<V>>> it=map.entrySet().iterator(); it.hasNext();) {
Map.Entry<K, Entry<V>> entry=it.next();
Entry<V> tmp=entry.getValue();
if(tmp == null)
... | java | public void removeMarkedElements(boolean force) {
long curr_time=System.nanoTime();
for(Iterator<Map.Entry<K,Entry<V>>> it=map.entrySet().iterator(); it.hasNext();) {
Map.Entry<K, Entry<V>> entry=it.next();
Entry<V> tmp=entry.getValue();
if(tmp == null)
... | [
"public",
"void",
"removeMarkedElements",
"(",
"boolean",
"force",
")",
"{",
"long",
"curr_time",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"for",
"(",
"Iterator",
"<",
"Map",
".",
"Entry",
"<",
"K",
",",
"Entry",
"<",
"V",
">",
">",
">",
"it",
... | Removes elements marked as removable
@param force If set to true, all elements marked as 'removable' will get removed, regardless of expiration | [
"Removes",
"elements",
"marked",
"as",
"removable"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/LazyRemovalCache.java#L244-L255 |
52,066 | belaban/JGroups | src/org/jgroups/util/MatchingPromise.java | MatchingPromise.setResult | public void setResult(T result) {
lock.lock();
try {
if(Objects.equals(expected_result, result))
super.setResult(result);
}
finally {
lock.unlock();
}
} | java | public void setResult(T result) {
lock.lock();
try {
if(Objects.equals(expected_result, result))
super.setResult(result);
}
finally {
lock.unlock();
}
} | [
"public",
"void",
"setResult",
"(",
"T",
"result",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"Objects",
".",
"equals",
"(",
"expected_result",
",",
"result",
")",
")",
"super",
".",
"setResult",
"(",
"result",
")",
";",
"... | Sets the result only if expected_result matches result | [
"Sets",
"the",
"result",
"only",
"if",
"expected_result",
"matches",
"result"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/MatchingPromise.java#L22-L31 |
52,067 | belaban/JGroups | src/org/jgroups/protocols/S3_PING.java | S3_PING.sanitize | protected static String sanitize(final String name) {
String retval=name;
retval=retval.replace('/', '-');
retval=retval.replace('\\', '-');
return retval;
} | java | protected static String sanitize(final String name) {
String retval=name;
retval=retval.replace('/', '-');
retval=retval.replace('\\', '-');
return retval;
} | [
"protected",
"static",
"String",
"sanitize",
"(",
"final",
"String",
"name",
")",
"{",
"String",
"retval",
"=",
"name",
";",
"retval",
"=",
"retval",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"retval",
"=",
"retval",
".",
"replace",
"("... | Sanitizes bucket and folder names according to AWS guidelines | [
"Sanitizes",
"bucket",
"and",
"folder",
"names",
"according",
"to",
"AWS",
"guidelines"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/S3_PING.java#L278-L283 |
52,068 | belaban/JGroups | src/org/jgroups/blocks/executor/ExecutionRunner.java | ExecutionRunner.getCurrentRunningTasks | public Map<Thread, Runnable> getCurrentRunningTasks() {
Map<Thread, Runnable> map = new HashMap<>();
for (Entry<Thread, Holder<Runnable>> entry : _runnables.entrySet()) {
map.put(entry.getKey(), entry.getValue().value);
}
return map;
} | java | public Map<Thread, Runnable> getCurrentRunningTasks() {
Map<Thread, Runnable> map = new HashMap<>();
for (Entry<Thread, Holder<Runnable>> entry : _runnables.entrySet()) {
map.put(entry.getKey(), entry.getValue().value);
}
return map;
} | [
"public",
"Map",
"<",
"Thread",
",",
"Runnable",
">",
"getCurrentRunningTasks",
"(",
")",
"{",
"Map",
"<",
"Thread",
",",
"Runnable",
">",
"map",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"Thread",
",",
"Holder",
"<",
"Run... | Returns a copy of the runners being used with the runner and what threads.
If a thread is not currently running a task it will return with a null
value. This map is a copy and can be modified if necessary without
causing issues.
@return map of all threads that are active with this runner. If the
thread is currently r... | [
"Returns",
"a",
"copy",
"of",
"the",
"runners",
"being",
"used",
"with",
"the",
"runner",
"and",
"what",
"threads",
".",
"If",
"a",
"thread",
"is",
"not",
"currently",
"running",
"a",
"task",
"it",
"will",
"return",
"with",
"a",
"null",
"value",
".",
"... | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/executor/ExecutionRunner.java#L153-L159 |
52,069 | belaban/JGroups | src/org/jgroups/util/BoundedList.java | BoundedList.add | public boolean add(T obj) {
if(obj == null) return false;
while(size() >= max_capacity && size() > 0) {
poll();
}
return super.add(obj);
} | java | public boolean add(T obj) {
if(obj == null) return false;
while(size() >= max_capacity && size() > 0) {
poll();
}
return super.add(obj);
} | [
"public",
"boolean",
"add",
"(",
"T",
"obj",
")",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"return",
"false",
";",
"while",
"(",
"size",
"(",
")",
">=",
"max_capacity",
"&&",
"size",
"(",
")",
">",
"0",
")",
"{",
"poll",
"(",
")",
";",
"}",
... | Adds an element at the tail. Removes an object from the head if capacity is exceeded
@param obj The object to be added | [
"Adds",
"an",
"element",
"at",
"the",
"tail",
".",
"Removes",
"an",
"object",
"from",
"the",
"head",
"if",
"capacity",
"is",
"exceeded"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/BoundedList.java#L30-L36 |
52,070 | belaban/JGroups | src/org/jgroups/fork/ForkChannel.java | ForkChannel.getFORK | protected static FORK getFORK(JChannel ch, ProtocolStack.Position position, Class<? extends Protocol> neighbor,
boolean create_fork_if_absent) throws Exception {
ProtocolStack stack=ch.getProtocolStack();
FORK fork=stack.findProtocol(FORK.class);
if(fork == null... | java | protected static FORK getFORK(JChannel ch, ProtocolStack.Position position, Class<? extends Protocol> neighbor,
boolean create_fork_if_absent) throws Exception {
ProtocolStack stack=ch.getProtocolStack();
FORK fork=stack.findProtocol(FORK.class);
if(fork == null... | [
"protected",
"static",
"FORK",
"getFORK",
"(",
"JChannel",
"ch",
",",
"ProtocolStack",
".",
"Position",
"position",
",",
"Class",
"<",
"?",
"extends",
"Protocol",
">",
"neighbor",
",",
"boolean",
"create_fork_if_absent",
")",
"throws",
"Exception",
"{",
"Protoco... | Creates a new FORK protocol, or returns the existing one, or throws an exception. Never returns null. | [
"Creates",
"a",
"new",
"FORK",
"protocol",
"or",
"returns",
"the",
"existing",
"one",
"or",
"throws",
"an",
"exception",
".",
"Never",
"returns",
"null",
"."
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/fork/ForkChannel.java#L272-L284 |
52,071 | belaban/JGroups | src/org/jgroups/fork/ForkChannel.java | ForkChannel.copyFields | protected void copyFields() {
for(Field field: copied_fields) {
Object value=Util.getField(field,main_channel);
Util.setField(field, this, value);
}
} | java | protected void copyFields() {
for(Field field: copied_fields) {
Object value=Util.getField(field,main_channel);
Util.setField(field, this, value);
}
} | [
"protected",
"void",
"copyFields",
"(",
")",
"{",
"for",
"(",
"Field",
"field",
":",
"copied_fields",
")",
"{",
"Object",
"value",
"=",
"Util",
".",
"getField",
"(",
"field",
",",
"main_channel",
")",
";",
"Util",
".",
"setField",
"(",
"field",
",",
"t... | Copies state from main-channel to this fork-channel | [
"Copies",
"state",
"from",
"main",
"-",
"channel",
"to",
"this",
"fork",
"-",
"channel"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/fork/ForkChannel.java#L298-L303 |
52,072 | belaban/JGroups | src/org/jgroups/JChannelProbeHandler.java | JChannelProbeHandler.dumpAttrsSelectedProtocol | protected Map<String,Map<String,Object>> dumpAttrsSelectedProtocol(String protocol_name, List<String> attrs) {
return ch.dumpStats(protocol_name, attrs);
} | java | protected Map<String,Map<String,Object>> dumpAttrsSelectedProtocol(String protocol_name, List<String> attrs) {
return ch.dumpStats(protocol_name, attrs);
} | [
"protected",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"dumpAttrsSelectedProtocol",
"(",
"String",
"protocol_name",
",",
"List",
"<",
"String",
">",
"attrs",
")",
"{",
"return",
"ch",
".",
"dumpStats",
"(",
"protocol_name",
... | Dumps attributes and their values of a given protocol.
@param protocol_name The name of the protocol
@param attrs A list of attributes that need to be returned. If null, all attributes of the given protocol will
be returned
@return A map of protocol names as keys and maps (of attribute names and values) as values | [
"Dumps",
"attributes",
"and",
"their",
"values",
"of",
"a",
"given",
"protocol",
"."
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/JChannelProbeHandler.java#L193-L195 |
52,073 | belaban/JGroups | src/org/jgroups/JChannelProbeHandler.java | JChannelProbeHandler.handleOperation | protected void handleOperation(Map<String, String> map, String operation) throws Exception {
int index=operation.indexOf('.');
if(index == -1)
throw new IllegalArgumentException("operation " + operation + " is missing the protocol name");
String prot_name=operation.substring(0, index... | java | protected void handleOperation(Map<String, String> map, String operation) throws Exception {
int index=operation.indexOf('.');
if(index == -1)
throw new IllegalArgumentException("operation " + operation + " is missing the protocol name");
String prot_name=operation.substring(0, index... | [
"protected",
"void",
"handleOperation",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"map",
",",
"String",
"operation",
")",
"throws",
"Exception",
"{",
"int",
"index",
"=",
"operation",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"index",
"=... | Invokes an operation and puts the return value into map
@param map
@param operation Protocol.OperationName[args], e.g. STABLE.foo[arg1 arg2 arg3] | [
"Invokes",
"an",
"operation",
"and",
"puts",
"the",
"return",
"value",
"into",
"map"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/JChannelProbeHandler.java#L241-L283 |
52,074 | belaban/JGroups | src/org/jgroups/protocols/SenderSendsBundler.java | SenderSendsBundler.send | public void send(Message msg) throws Exception {
num_senders.incrementAndGet();
long size=msg.size();
lock.lock();
try {
if(count + size >= transport.getMaxBundleSize())
sendBundledMessages();
addMessage(msg, size);
// at this point,... | java | public void send(Message msg) throws Exception {
num_senders.incrementAndGet();
long size=msg.size();
lock.lock();
try {
if(count + size >= transport.getMaxBundleSize())
sendBundledMessages();
addMessage(msg, size);
// at this point,... | [
"public",
"void",
"send",
"(",
"Message",
"msg",
")",
"throws",
"Exception",
"{",
"num_senders",
".",
"incrementAndGet",
"(",
")",
";",
"long",
"size",
"=",
"msg",
".",
"size",
"(",
")",
";",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(... | current senders adding msgs to the bundler | [
"current",
"senders",
"adding",
"msgs",
"to",
"the",
"bundler"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/SenderSendsBundler.java#L14-L33 |
52,075 | belaban/JGroups | src/org/jgroups/util/Table.java | Table.getNumDeliverable | public int getNumDeliverable() {
NumDeliverable visitor=new NumDeliverable();
lock.lock();
try {
forEach(hd+1, hr, visitor);
return visitor.getResult();
}
finally {
lock.unlock();
}
} | java | public int getNumDeliverable() {
NumDeliverable visitor=new NumDeliverable();
lock.lock();
try {
forEach(hd+1, hr, visitor);
return visitor.getResult();
}
finally {
lock.unlock();
}
} | [
"public",
"int",
"getNumDeliverable",
"(",
")",
"{",
"NumDeliverable",
"visitor",
"=",
"new",
"NumDeliverable",
"(",
")",
";",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"forEach",
"(",
"hd",
"+",
"1",
",",
"hr",
",",
"visitor",
")",
";",
"retur... | Returns the number of messages that can be delivered | [
"Returns",
"the",
"number",
"of",
"messages",
"that",
"can",
"be",
"delivered"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Table.java#L167-L177 |
52,076 | belaban/JGroups | src/org/jgroups/util/Table.java | Table.add | public boolean add(final List<LongTuple<T>> list, boolean remove_added_elements) {
return add(list, remove_added_elements, null);
} | java | public boolean add(final List<LongTuple<T>> list, boolean remove_added_elements) {
return add(list, remove_added_elements, null);
} | [
"public",
"boolean",
"add",
"(",
"final",
"List",
"<",
"LongTuple",
"<",
"T",
">",
">",
"list",
",",
"boolean",
"remove_added_elements",
")",
"{",
"return",
"add",
"(",
"list",
",",
"remove_added_elements",
",",
"null",
")",
";",
"}"
] | Adds elements from list to the table, removes elements from list that were not added to the table
@param list
@return True if at least 1 element was added successfully. This guarantees that the list has at least 1 element | [
"Adds",
"elements",
"from",
"list",
"to",
"the",
"table",
"removes",
"elements",
"from",
"list",
"that",
"were",
"not",
"added",
"to",
"the",
"table"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Table.java#L244-L246 |
52,077 | belaban/JGroups | src/org/jgroups/util/Table.java | Table.add | public boolean add(final List<LongTuple<T>> list, boolean remove_added_elements, T const_value) {
if(list == null || list.isEmpty())
return false;
boolean added=false;
// find the highest seqno (unfortunately, the list is not ordered by seqno)
long highest_seqno=findHighestSe... | java | public boolean add(final List<LongTuple<T>> list, boolean remove_added_elements, T const_value) {
if(list == null || list.isEmpty())
return false;
boolean added=false;
// find the highest seqno (unfortunately, the list is not ordered by seqno)
long highest_seqno=findHighestSe... | [
"public",
"boolean",
"add",
"(",
"final",
"List",
"<",
"LongTuple",
"<",
"T",
">",
">",
"list",
",",
"boolean",
"remove_added_elements",
",",
"T",
"const_value",
")",
"{",
"if",
"(",
"list",
"==",
"null",
"||",
"list",
".",
"isEmpty",
"(",
")",
")",
... | Adds elements from the list to the table
@param list The list of tuples of seqnos and elements. If remove_added_elements is true, if elements could
not be added to the table (e.g. because they were already present or the seqno was < HD), those
elements will be removed from list
@param remove_added_elements If true, ele... | [
"Adds",
"elements",
"from",
"the",
"list",
"to",
"the",
"table"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Table.java#L257-L282 |
52,078 | belaban/JGroups | src/org/jgroups/util/Table.java | Table.get | public T get(long seqno) {
lock.lock();
try {
if(seqno - low <= 0 || seqno - hr > 0)
return null;
int row_index=computeRow(seqno);
if(row_index < 0 || row_index >= matrix.length)
return null;
T[] row=matrix[row_index];
... | java | public T get(long seqno) {
lock.lock();
try {
if(seqno - low <= 0 || seqno - hr > 0)
return null;
int row_index=computeRow(seqno);
if(row_index < 0 || row_index >= matrix.length)
return null;
T[] row=matrix[row_index];
... | [
"public",
"T",
"get",
"(",
"long",
"seqno",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"seqno",
"-",
"low",
"<=",
"0",
"||",
"seqno",
"-",
"hr",
">",
"0",
")",
"return",
"null",
";",
"int",
"row_index",
"=",
"computeRo... | Returns an element at seqno
@param seqno
@return | [
"Returns",
"an",
"element",
"at",
"seqno"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Table.java#L290-L307 |
52,079 | belaban/JGroups | src/org/jgroups/util/Table.java | Table._get | public T _get(long seqno) {
lock.lock();
try {
int row_index=computeRow(seqno);
if(row_index < 0 || row_index >= matrix.length)
return null;
T[] row=matrix[row_index];
if(row == null)
return null;
int index=compu... | java | public T _get(long seqno) {
lock.lock();
try {
int row_index=computeRow(seqno);
if(row_index < 0 || row_index >= matrix.length)
return null;
T[] row=matrix[row_index];
if(row == null)
return null;
int index=compu... | [
"public",
"T",
"_get",
"(",
"long",
"seqno",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"int",
"row_index",
"=",
"computeRow",
"(",
"seqno",
")",
";",
"if",
"(",
"row_index",
"<",
"0",
"||",
"row_index",
">=",
"matrix",
".",
"length"... | To be used only for testing; doesn't do any index or sanity checks
@param seqno
@return | [
"To",
"be",
"used",
"only",
"for",
"testing",
";",
"doesn",
"t",
"do",
"any",
"index",
"or",
"sanity",
"checks"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Table.java#L315-L330 |
52,080 | belaban/JGroups | src/org/jgroups/util/Table.java | Table.remove | public T remove(boolean nullify) {
lock.lock();
try {
int row_index=computeRow(hd+1);
if(row_index < 0 || row_index >= matrix.length)
return null;
T[] row=matrix[row_index];
if(row == null)
return null;
int index... | java | public T remove(boolean nullify) {
lock.lock();
try {
int row_index=computeRow(hd+1);
if(row_index < 0 || row_index >= matrix.length)
return null;
T[] row=matrix[row_index];
if(row == null)
return null;
int index... | [
"public",
"T",
"remove",
"(",
"boolean",
"nullify",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"int",
"row_index",
"=",
"computeRow",
"(",
"hd",
"+",
"1",
")",
";",
"if",
"(",
"row_index",
"<",
"0",
"||",
"row_index",
">=",
"matrix",... | Removes the next non-null element and nulls the index if nullify=true | [
"Removes",
"the",
"next",
"non",
"-",
"null",
"element",
"and",
"nulls",
"the",
"index",
"if",
"nullify",
"=",
"true"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Table.java#L338-L365 |
52,081 | belaban/JGroups | src/org/jgroups/util/Table.java | Table.removeMany | public <R> R removeMany(boolean nullify, int max_results, Predicate<T> filter,
Supplier<R> result_creator, BiConsumer<R,T> accumulator) {
lock.lock();
try {
Remover<R> remover=new Remover<>(nullify, max_results, filter, result_creator, accumulator);
fo... | java | public <R> R removeMany(boolean nullify, int max_results, Predicate<T> filter,
Supplier<R> result_creator, BiConsumer<R,T> accumulator) {
lock.lock();
try {
Remover<R> remover=new Remover<>(nullify, max_results, filter, result_creator, accumulator);
fo... | [
"public",
"<",
"R",
">",
"R",
"removeMany",
"(",
"boolean",
"nullify",
",",
"int",
"max_results",
",",
"Predicate",
"<",
"T",
">",
"filter",
",",
"Supplier",
"<",
"R",
">",
"result_creator",
",",
"BiConsumer",
"<",
"R",
",",
"T",
">",
"accumulator",
")... | Removes elements from the table and adds them to the result created by result_creator. Between 0 and max_results
elements are removed. If no elements were removed, processing will be set to true while the table lock is held.
@param nullify if true, the x,y location of the removed element in the matrix will be nulled
@p... | [
"Removes",
"elements",
"from",
"the",
"table",
"and",
"adds",
"them",
"to",
"the",
"result",
"created",
"by",
"result_creator",
".",
"Between",
"0",
"and",
"max_results",
"elements",
"are",
"removed",
".",
"If",
"no",
"elements",
"were",
"removed",
"processing... | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Table.java#L388-L399 |
52,082 | belaban/JGroups | src/org/jgroups/util/Table.java | Table.findHighestSeqno | protected long findHighestSeqno(List<LongTuple<T>> list) {
long seqno=-1;
for(LongTuple<T> tuple: list) {
long val=tuple.getVal1();
if(val - seqno > 0)
seqno=val;
}
return seqno;
} | java | protected long findHighestSeqno(List<LongTuple<T>> list) {
long seqno=-1;
for(LongTuple<T> tuple: list) {
long val=tuple.getVal1();
if(val - seqno > 0)
seqno=val;
}
return seqno;
} | [
"protected",
"long",
"findHighestSeqno",
"(",
"List",
"<",
"LongTuple",
"<",
"T",
">",
">",
"list",
")",
"{",
"long",
"seqno",
"=",
"-",
"1",
";",
"for",
"(",
"LongTuple",
"<",
"T",
">",
"tuple",
":",
"list",
")",
"{",
"long",
"val",
"=",
"tuple",
... | list must not be null or empty | [
"list",
"must",
"not",
"be",
"null",
"or",
"empty"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Table.java#L561-L569 |
52,083 | belaban/JGroups | src/org/jgroups/util/Table.java | Table.getMissing | public SeqnoList getMissing(int max_msgs) {
lock.lock();
try {
if(size == 0)
return null;
long start_seqno=getHighestDeliverable() +1;
int capacity=(int)(hr - start_seqno);
int max_size=max_msgs > 0? Math.min(max_msgs, capacity) : capacity;... | java | public SeqnoList getMissing(int max_msgs) {
lock.lock();
try {
if(size == 0)
return null;
long start_seqno=getHighestDeliverable() +1;
int capacity=(int)(hr - start_seqno);
int max_size=max_msgs > 0? Math.min(max_msgs, capacity) : capacity;... | [
"public",
"SeqnoList",
"getMissing",
"(",
"int",
"max_msgs",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"size",
"==",
"0",
")",
"return",
"null",
";",
"long",
"start_seqno",
"=",
"getHighestDeliverable",
"(",
")",
"+",
"1",
... | Returns a list of missing messages
@param max_msgs If > 0, the max number of missing messages to be returned (oldest first), else no limit
@return A SeqnoList of missing messages, or null if no messages are missing | [
"Returns",
"a",
"list",
"of",
"missing",
"messages"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Table.java#L667-L685 |
52,084 | belaban/JGroups | src/org/jgroups/util/Table.java | Table.dump | public String dump() {
lock.lock();
try {
return stream(low, hr).filter(Objects::nonNull).map(Object::toString)
.collect(Collectors.joining(", "));
}
finally {
lock.unlock();
}
} | java | public String dump() {
lock.lock();
try {
return stream(low, hr).filter(Objects::nonNull).map(Object::toString)
.collect(Collectors.joining(", "));
}
finally {
lock.unlock();
}
} | [
"public",
"String",
"dump",
"(",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"stream",
"(",
"low",
",",
"hr",
")",
".",
"filter",
"(",
"Objects",
"::",
"nonNull",
")",
".",
"map",
"(",
"Object",
"::",
"toString",
")",
".",... | Dumps the seqnos in the table as a list | [
"Dumps",
"the",
"seqnos",
"in",
"the",
"table",
"as",
"a",
"list"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Table.java#L704-L713 |
52,085 | belaban/JGroups | src/org/jgroups/util/Table.java | Table.getRow | @GuardedBy("lock")
protected T[] getRow(int index) {
T[] row=matrix[index];
if(row == null) {
row=(T[])new Object[elements_per_row];
matrix[index]=row;
}
return row;
} | java | @GuardedBy("lock")
protected T[] getRow(int index) {
T[] row=matrix[index];
if(row == null) {
row=(T[])new Object[elements_per_row];
matrix[index]=row;
}
return row;
} | [
"@",
"GuardedBy",
"(",
"\"lock\"",
")",
"protected",
"T",
"[",
"]",
"getRow",
"(",
"int",
"index",
")",
"{",
"T",
"[",
"]",
"row",
"=",
"matrix",
"[",
"index",
"]",
";",
"if",
"(",
"row",
"==",
"null",
")",
"{",
"row",
"=",
"(",
"T",
"[",
"]"... | Returns a row. Creates a new row and inserts it at index if the row at index doesn't exist
@param index
@return A row | [
"Returns",
"a",
"row",
".",
"Creates",
"a",
"new",
"row",
"and",
"inserts",
"it",
"at",
"index",
"if",
"the",
"row",
"at",
"index",
"doesn",
"t",
"exist"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Table.java#L722-L730 |
52,086 | belaban/JGroups | src/org/jgroups/protocols/KeyExchange.java | KeyExchange.getSecretKeyFromAbove | protected Tuple<SecretKey,byte[]> getSecretKeyFromAbove() {
return (Tuple<SecretKey,byte[]>)up_prot.up(new Event(Event.GET_SECRET_KEY));
} | java | protected Tuple<SecretKey,byte[]> getSecretKeyFromAbove() {
return (Tuple<SecretKey,byte[]>)up_prot.up(new Event(Event.GET_SECRET_KEY));
} | [
"protected",
"Tuple",
"<",
"SecretKey",
",",
"byte",
"[",
"]",
">",
"getSecretKeyFromAbove",
"(",
")",
"{",
"return",
"(",
"Tuple",
"<",
"SecretKey",
",",
"byte",
"[",
"]",
">",
")",
"up_prot",
".",
"up",
"(",
"new",
"Event",
"(",
"Event",
".",
"GET_... | Fetches the secret key from a protocol above us
@return The secret key and its version | [
"Fetches",
"the",
"secret",
"key",
"from",
"a",
"protocol",
"above",
"us"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/KeyExchange.java#L56-L58 |
52,087 | belaban/JGroups | src/org/jgroups/protocols/KeyExchange.java | KeyExchange.setSecretKeyAbove | protected void setSecretKeyAbove(Tuple<SecretKey,byte[]> key) {
up_prot.up(new Event(Event.SET_SECRET_KEY, key));
} | java | protected void setSecretKeyAbove(Tuple<SecretKey,byte[]> key) {
up_prot.up(new Event(Event.SET_SECRET_KEY, key));
} | [
"protected",
"void",
"setSecretKeyAbove",
"(",
"Tuple",
"<",
"SecretKey",
",",
"byte",
"[",
"]",
">",
"key",
")",
"{",
"up_prot",
".",
"up",
"(",
"new",
"Event",
"(",
"Event",
".",
"SET_SECRET_KEY",
",",
"key",
")",
")",
";",
"}"
] | Sets the secret key in a protocol above us
@param key The secret key and its version | [
"Sets",
"the",
"secret",
"key",
"in",
"a",
"protocol",
"above",
"us"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/KeyExchange.java#L63-L65 |
52,088 | belaban/JGroups | src/org/jgroups/conf/ConfiguratorFactory.java | ConfiguratorFactory.getStackConfigurator | public static ProtocolStackConfigurator getStackConfigurator(File file) throws Exception {
checkJAXPAvailability();
InputStream input=getConfigStream(file);
return XmlConfigurator.getInstance(input);
} | java | public static ProtocolStackConfigurator getStackConfigurator(File file) throws Exception {
checkJAXPAvailability();
InputStream input=getConfigStream(file);
return XmlConfigurator.getInstance(input);
} | [
"public",
"static",
"ProtocolStackConfigurator",
"getStackConfigurator",
"(",
"File",
"file",
")",
"throws",
"Exception",
"{",
"checkJAXPAvailability",
"(",
")",
";",
"InputStream",
"input",
"=",
"getConfigStream",
"(",
"file",
")",
";",
"return",
"XmlConfigurator",
... | Returns a protocol stack configurator based on the XML configuration provided by the specified File.
@param file a File with a JGroups XML configuration.
@return a {@code ProtocolStackConfigurator} containing the stack configuration.
@throws Exception if problems occur during the configuration of the protocol stack. | [
"Returns",
"a",
"protocol",
"stack",
"configurator",
"based",
"on",
"the",
"XML",
"configuration",
"provided",
"by",
"the",
"specified",
"File",
"."
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/conf/ConfiguratorFactory.java#L42-L46 |
52,089 | belaban/JGroups | src/org/jgroups/conf/ConfiguratorFactory.java | ConfiguratorFactory.getStackConfigurator | public static ProtocolStackConfigurator getStackConfigurator(URL url) throws Exception {
checkForNullConfiguration(url);
checkJAXPAvailability();
return XmlConfigurator.getInstance(url);
} | java | public static ProtocolStackConfigurator getStackConfigurator(URL url) throws Exception {
checkForNullConfiguration(url);
checkJAXPAvailability();
return XmlConfigurator.getInstance(url);
} | [
"public",
"static",
"ProtocolStackConfigurator",
"getStackConfigurator",
"(",
"URL",
"url",
")",
"throws",
"Exception",
"{",
"checkForNullConfiguration",
"(",
"url",
")",
";",
"checkJAXPAvailability",
"(",
")",
";",
"return",
"XmlConfigurator",
".",
"getInstance",
"("... | Returns a protocol stack configurator based on the XML configuration provided at the specified URL.
@param url a URL pointing to a JGroups XML configuration.
@return a {@code ProtocolStackConfigurator} containing the stack configuration.
@throws Exception if problems occur during the configuration of the protocol stac... | [
"Returns",
"a",
"protocol",
"stack",
"configurator",
"based",
"on",
"the",
"XML",
"configuration",
"provided",
"at",
"the",
"specified",
"URL",
"."
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/conf/ConfiguratorFactory.java#L59-L63 |
52,090 | belaban/JGroups | src/org/jgroups/conf/ConfiguratorFactory.java | ConfiguratorFactory.getStackConfigurator | public static ProtocolStackConfigurator getStackConfigurator(Element element) throws Exception {
checkForNullConfiguration(element);
return XmlConfigurator.getInstance(element);
} | java | public static ProtocolStackConfigurator getStackConfigurator(Element element) throws Exception {
checkForNullConfiguration(element);
return XmlConfigurator.getInstance(element);
} | [
"public",
"static",
"ProtocolStackConfigurator",
"getStackConfigurator",
"(",
"Element",
"element",
")",
"throws",
"Exception",
"{",
"checkForNullConfiguration",
"(",
"element",
")",
";",
"return",
"XmlConfigurator",
".",
"getInstance",
"(",
"element",
")",
";",
"}"
] | Returns a protocol stack configurator based on the XML configuration provided by the specified XML element.
@param element a XML element containing a JGroups XML configuration.
@return a {@code ProtocolStackConfigurator} containing the stack configuration.
@throws Exception if problems occur during the configuration o... | [
"Returns",
"a",
"protocol",
"stack",
"configurator",
"based",
"on",
"the",
"XML",
"configuration",
"provided",
"by",
"the",
"specified",
"XML",
"element",
"."
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/conf/ConfiguratorFactory.java#L72-L75 |
52,091 | belaban/JGroups | src/org/jgroups/conf/ConfiguratorFactory.java | ConfiguratorFactory.getStackConfigurator | public static ProtocolStackConfigurator getStackConfigurator(String properties) throws Exception {
if(properties == null)
properties=Global.DEFAULT_PROTOCOL_STACK;
// Attempt to treat the properties string as a pointer to an XML configuration.
XmlConfigurator configurator = null;
... | java | public static ProtocolStackConfigurator getStackConfigurator(String properties) throws Exception {
if(properties == null)
properties=Global.DEFAULT_PROTOCOL_STACK;
// Attempt to treat the properties string as a pointer to an XML configuration.
XmlConfigurator configurator = null;
... | [
"public",
"static",
"ProtocolStackConfigurator",
"getStackConfigurator",
"(",
"String",
"properties",
")",
"throws",
"Exception",
"{",
"if",
"(",
"properties",
"==",
"null",
")",
"properties",
"=",
"Global",
".",
"DEFAULT_PROTOCOL_STACK",
";",
"// Attempt to treat the p... | Returns a protocol stack configurator based on the provided properties string.
@param properties a string representing a system resource containing a JGroups XML configuration, a URL pointing
to a JGroups XML configuration or a string representing a file name that contains a JGroups
XML configuration. | [
"Returns",
"a",
"protocol",
"stack",
"configurator",
"based",
"on",
"the",
"provided",
"properties",
"string",
"."
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/conf/ConfiguratorFactory.java#L83-L96 |
52,092 | belaban/JGroups | src/org/jgroups/conf/ConfiguratorFactory.java | ConfiguratorFactory.getConfigStream | public static InputStream getConfigStream(String properties) throws IOException {
InputStream configStream = null;
// Check to see if the properties string is the name of a file.
try {
configStream=new FileInputStream(properties);
}
catch(FileNotFoundException | Acce... | java | public static InputStream getConfigStream(String properties) throws IOException {
InputStream configStream = null;
// Check to see if the properties string is the name of a file.
try {
configStream=new FileInputStream(properties);
}
catch(FileNotFoundException | Acce... | [
"public",
"static",
"InputStream",
"getConfigStream",
"(",
"String",
"properties",
")",
"throws",
"IOException",
"{",
"InputStream",
"configStream",
"=",
"null",
";",
"// Check to see if the properties string is the name of a file.",
"try",
"{",
"configStream",
"=",
"new",
... | Returns a JGroups XML configuration InputStream based on the provided properties string.
@param properties a string representing a system resource containing a JGroups XML configuration, a string
representing a URL pointing to a JGroups ML configuration, or a string representing
a file name that contains a JGroups XML... | [
"Returns",
"a",
"JGroups",
"XML",
"configuration",
"InputStream",
"based",
"on",
"the",
"provided",
"properties",
"string",
"."
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/conf/ConfiguratorFactory.java#L122-L147 |
52,093 | belaban/JGroups | src/org/jgroups/conf/ConfiguratorFactory.java | ConfiguratorFactory.checkJAXPAvailability | static void checkJAXPAvailability() {
try {
XmlConfigurator.class.getName();
}
catch (NoClassDefFoundError error) {
Error tmp=new NoClassDefFoundError(JAXP_MISSING_ERROR_MSG);
tmp.initCause(error);
throw tmp;
}
} | java | static void checkJAXPAvailability() {
try {
XmlConfigurator.class.getName();
}
catch (NoClassDefFoundError error) {
Error tmp=new NoClassDefFoundError(JAXP_MISSING_ERROR_MSG);
tmp.initCause(error);
throw tmp;
}
} | [
"static",
"void",
"checkJAXPAvailability",
"(",
")",
"{",
"try",
"{",
"XmlConfigurator",
".",
"class",
".",
"getName",
"(",
")",
";",
"}",
"catch",
"(",
"NoClassDefFoundError",
"error",
")",
"{",
"Error",
"tmp",
"=",
"new",
"NoClassDefFoundError",
"(",
"JAXP... | Checks the availability of the JAXP classes on the classpath.
@throws NoClassDefFoundError if the required JAXP classes are not availabile on the classpath. | [
"Checks",
"the",
"availability",
"of",
"the",
"JAXP",
"classes",
"on",
"the",
"classpath",
"."
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/conf/ConfiguratorFactory.java#L231-L240 |
52,094 | belaban/JGroups | src/org/jgroups/util/RspList.java | RspList.getValue | public T getValue(Object key) {
Rsp<T> rsp=get(key);
return rsp != null? rsp.getValue() : null;
} | java | public T getValue(Object key) {
Rsp<T> rsp=get(key);
return rsp != null? rsp.getValue() : null;
} | [
"public",
"T",
"getValue",
"(",
"Object",
"key",
")",
"{",
"Rsp",
"<",
"T",
">",
"rsp",
"=",
"get",
"(",
"key",
")",
";",
"return",
"rsp",
"!=",
"null",
"?",
"rsp",
".",
"getValue",
"(",
")",
":",
"null",
";",
"}"
] | Returns the value associated with address key
@param key
@return Object value | [
"Returns",
"the",
"value",
"associated",
"with",
"address",
"key"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/RspList.java#L35-L38 |
52,095 | belaban/JGroups | src/org/jgroups/util/RspList.java | RspList.getFirst | public T getFirst() {
Optional<Rsp<T>> retval=values().stream().filter(rsp -> rsp.getValue() != null).findFirst();
return retval.isPresent()? retval.get().getValue() : null;
} | java | public T getFirst() {
Optional<Rsp<T>> retval=values().stream().filter(rsp -> rsp.getValue() != null).findFirst();
return retval.isPresent()? retval.get().getValue() : null;
} | [
"public",
"T",
"getFirst",
"(",
")",
"{",
"Optional",
"<",
"Rsp",
"<",
"T",
">>",
"retval",
"=",
"values",
"(",
")",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"rsp",
"->",
"rsp",
".",
"getValue",
"(",
")",
"!=",
"null",
")",
".",
"findFirst",
... | Returns the first value in the response set. This is random, but we try to return a non-null value first | [
"Returns",
"the",
"first",
"value",
"in",
"the",
"response",
"set",
".",
"This",
"is",
"random",
"but",
"we",
"try",
"to",
"return",
"a",
"non",
"-",
"null",
"value",
"first"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/RspList.java#L66-L69 |
52,096 | belaban/JGroups | src/org/jgroups/util/RspList.java | RspList.getResults | public List<T> getResults() {
return values().stream().filter(rsp -> rsp.wasReceived() && rsp.getValue() != null)
.collect(() -> new ArrayList<>(size()), (list,rsp) -> list.add(rsp.getValue()), (l,r) -> {});
} | java | public List<T> getResults() {
return values().stream().filter(rsp -> rsp.wasReceived() && rsp.getValue() != null)
.collect(() -> new ArrayList<>(size()), (list,rsp) -> list.add(rsp.getValue()), (l,r) -> {});
} | [
"public",
"List",
"<",
"T",
">",
"getResults",
"(",
")",
"{",
"return",
"values",
"(",
")",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"rsp",
"->",
"rsp",
".",
"wasReceived",
"(",
")",
"&&",
"rsp",
".",
"getValue",
"(",
")",
"!=",
"null",
")",
... | Returns the results from non-suspected members that are not null. | [
"Returns",
"the",
"results",
"from",
"non",
"-",
"suspected",
"members",
"that",
"are",
"not",
"null",
"."
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/RspList.java#L75-L78 |
52,097 | belaban/JGroups | src/org/jgroups/util/DefaultThreadFactory.java | DefaultThreadFactory.renameThread | public void renameThread(String base_name, Thread thread, String addr, String cluster_name) {
String thread_name=getThreadName(base_name, thread, addr, cluster_name);
if(thread_name != null)
thread.setName(thread_name);
} | java | public void renameThread(String base_name, Thread thread, String addr, String cluster_name) {
String thread_name=getThreadName(base_name, thread, addr, cluster_name);
if(thread_name != null)
thread.setName(thread_name);
} | [
"public",
"void",
"renameThread",
"(",
"String",
"base_name",
",",
"Thread",
"thread",
",",
"String",
"addr",
",",
"String",
"cluster_name",
")",
"{",
"String",
"thread_name",
"=",
"getThreadName",
"(",
"base_name",
",",
"thread",
",",
"addr",
",",
"cluster_na... | Names a thread according to base_name, cluster name and local address. If includeClusterName and includeLocalAddress
are null, but cluster_name is set, then we assume we have a shared transport and name the thread shared=clusterName.
In the latter case, clusterName points to the singleton_name of TP.
@param base_name
@... | [
"Names",
"a",
"thread",
"according",
"to",
"base_name",
"cluster",
"name",
"and",
"local",
"address",
".",
"If",
"includeClusterName",
"and",
"includeLocalAddress",
"are",
"null",
"but",
"cluster_name",
"is",
"set",
"then",
"we",
"assume",
"we",
"have",
"a",
"... | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/DefaultThreadFactory.java#L88-L92 |
52,098 | belaban/JGroups | src/org/jgroups/util/RingBuffer.java | RingBuffer.put | public RingBuffer<T> put(T element) throws InterruptedException {
if(element == null)
return this;
lock.lock();
try {
while(count == buf.length)
not_full.await();
buf[wi]=element;
if(++wi == buf.length)
wi=0;
... | java | public RingBuffer<T> put(T element) throws InterruptedException {
if(element == null)
return this;
lock.lock();
try {
while(count == buf.length)
not_full.await();
buf[wi]=element;
if(++wi == buf.length)
wi=0;
... | [
"public",
"RingBuffer",
"<",
"T",
">",
"put",
"(",
"T",
"element",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"element",
"==",
"null",
")",
"return",
"this",
";",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"while",
"(",
"count",
"=="... | Tries to add a new element at the current write index and advances the write index. If the write index is at the
same position as the read index, this will block until the read index is advanced.
@param element the element to be added. Must not be null, or else this operation returns immediately | [
"Tries",
"to",
"add",
"a",
"new",
"element",
"at",
"the",
"current",
"write",
"index",
"and",
"advances",
"the",
"write",
"index",
".",
"If",
"the",
"write",
"index",
"is",
"at",
"the",
"same",
"position",
"as",
"the",
"read",
"index",
"this",
"will",
... | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/RingBuffer.java#L100-L118 |
52,099 | belaban/JGroups | src/org/jgroups/util/RingBuffer.java | RingBuffer.drainTo | public int drainTo(T[] c) {
int num=Math.min(count, c.length); // count may increase in the mean time, but that's ok
if(num == 0)
return num;
int read_index=ri; // no lock as we're the only reader
for(int i=0; i < num; i++) {
int real_index=realIndex(read_index +i... | java | public int drainTo(T[] c) {
int num=Math.min(count, c.length); // count may increase in the mean time, but that's ok
if(num == 0)
return num;
int read_index=ri; // no lock as we're the only reader
for(int i=0; i < num; i++) {
int real_index=realIndex(read_index +i... | [
"public",
"int",
"drainTo",
"(",
"T",
"[",
"]",
"c",
")",
"{",
"int",
"num",
"=",
"Math",
".",
"min",
"(",
"count",
",",
"c",
".",
"length",
")",
";",
"// count may increase in the mean time, but that's ok",
"if",
"(",
"num",
"==",
"0",
")",
"return",
... | Removes messages and adds them to c.
@param c The array to add messages to.
@return The number of messages removed and added to c. This is min(count, c.length). If no messages are present,
this method returns immediately | [
"Removes",
"messages",
"and",
"adds",
"them",
"to",
"c",
"."
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/RingBuffer.java#L214-L226 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.