repo stringclasses 11 values | path stringlengths 41 214 | func_name stringlengths 7 82 | original_string stringlengths 77 11.9k | language stringclasses 1 value | code stringlengths 77 11.9k | code_tokens listlengths 22 1.57k | docstring stringlengths 2 2.27k | docstring_tokens listlengths 1 352 | sha stringclasses 11 values | url stringlengths 129 319 | partition stringclasses 1 value | summary stringlengths 7 191 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java | Graph.translateVertexValues | public <NEW> Graph<K, NEW, EV> translateVertexValues(TranslateFunction<VV, NEW> translator) throws Exception {
return run(new TranslateVertexValues<>(translator));
} | java | public <NEW> Graph<K, NEW, EV> translateVertexValues(TranslateFunction<VV, NEW> translator) throws Exception {
return run(new TranslateVertexValues<>(translator));
} | [
"public",
"<",
"NEW",
">",
"Graph",
"<",
"K",
",",
"NEW",
",",
"EV",
">",
"translateVertexValues",
"(",
"TranslateFunction",
"<",
"VV",
",",
"NEW",
">",
"translator",
")",
"throws",
"Exception",
"{",
"return",
"run",
"(",
"new",
"TranslateVertexValues",
"<... | Translate {@link Vertex} values using the given {@link MapFunction}.
@param translator implements conversion from {@code VV} to {@code NEW}
@param <NEW> new vertex value type
@return graph with translated vertex values
@throws Exception | [
"Translate",
"{",
"@link",
"Vertex",
"}",
"values",
"using",
"the",
"given",
"{",
"@link",
"MapFunction",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L642-L644 | train | Translates the vertex values of the graph. | [
30522,
2270,
1026,
2047,
1028,
10629,
1026,
1047,
1010,
2047,
1010,
23408,
1028,
17637,
16874,
10288,
10175,
15808,
1006,
17637,
11263,
27989,
1026,
1058,
2615,
1010,
2047,
1028,
11403,
1007,
11618,
6453,
1063,
2709,
2448,
1006,
2047,
17637,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-formats/flink-parquet/src/main/java/org/apache/flink/formats/parquet/utils/ParquetRecordReader.java | ParquetRecordReader.reachEnd | public boolean reachEnd() throws IOException {
// check if we have a read row that was not returned yet
if (readRecord != null && !readRecordReturned) {
return false;
}
// check if there are more rows to be read
if (numReadRecords >= numTotalRecords) {
return true;
}
// try to read next row
return !readNextRecord();
} | java | public boolean reachEnd() throws IOException {
// check if we have a read row that was not returned yet
if (readRecord != null && !readRecordReturned) {
return false;
}
// check if there are more rows to be read
if (numReadRecords >= numTotalRecords) {
return true;
}
// try to read next row
return !readNextRecord();
} | [
"public",
"boolean",
"reachEnd",
"(",
")",
"throws",
"IOException",
"{",
"// check if we have a read row that was not returned yet",
"if",
"(",
"readRecord",
"!=",
"null",
"&&",
"!",
"readRecordReturned",
")",
"{",
"return",
"false",
";",
"}",
"// check if there are mor... | Checks if the record reader returned all records.
This method must be called before a record can be returned.
@return False if there are more records to be read. True if all records have been returned. | [
"Checks",
"if",
"the",
"record",
"reader",
"returned",
"all",
"records",
".",
"This",
"method",
"must",
"be",
"called",
"before",
"a",
"record",
"can",
"be",
"returned",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-parquet/src/main/java/org/apache/flink/formats/parquet/utils/ParquetRecordReader.java#L197-L208 | train | Checks if the underlying stream is reached the end of the file. | [
30522,
2270,
22017,
20898,
3362,
10497,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
1013,
1013,
4638,
2065,
2057,
2031,
1037,
3191,
5216,
2008,
2001,
2025,
2513,
2664,
2065,
1006,
3191,
2890,
27108,
2094,
999,
1027,
19701,
1004,
1004,
999... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/join/SortMergeFullOuterJoinIterator.java | SortMergeFullOuterJoinIterator.bufferRows1 | private void bufferRows1() throws IOException {
BinaryRow copy = key1.copy();
buffer1.reset();
do {
buffer1.add(row1);
} while (nextRow1() && keyComparator.compare(key1, copy) == 0);
buffer1.complete();
} | java | private void bufferRows1() throws IOException {
BinaryRow copy = key1.copy();
buffer1.reset();
do {
buffer1.add(row1);
} while (nextRow1() && keyComparator.compare(key1, copy) == 0);
buffer1.complete();
} | [
"private",
"void",
"bufferRows1",
"(",
")",
"throws",
"IOException",
"{",
"BinaryRow",
"copy",
"=",
"key1",
".",
"copy",
"(",
")",
";",
"buffer1",
".",
"reset",
"(",
")",
";",
"do",
"{",
"buffer1",
".",
"add",
"(",
"row1",
")",
";",
"}",
"while",
"... | Buffer rows from iterator1 with same key. | [
"Buffer",
"rows",
"from",
"iterator1",
"with",
"same",
"key",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/join/SortMergeFullOuterJoinIterator.java#L127-L134 | train | Buffer rows 1. | [
30522,
2797,
11675,
17698,
10524,
2015,
2487,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
12441,
10524,
6100,
1027,
3145,
2487,
1012,
6100,
1006,
1007,
1025,
17698,
2487,
1012,
25141,
1006,
1007,
1025,
2079,
1063,
17698,
2487,
1012,
5587,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/io/IOUtil.java | IOUtil.readBytes | public static byte[] readBytes(String path)
{
try
{
if (IOAdapter == null) return readBytesFromFileInputStream(new FileInputStream(path));
InputStream is = IOAdapter.open(path);
if (is instanceof FileInputStream)
return readBytesFromFileInputStream((FileInputStream) is);
else
return readBytesFromOtherInputStream(is);
}
catch (Exception e)
{
logger.warning("读取" + path + "时发生异常" + e);
}
return null;
} | java | public static byte[] readBytes(String path)
{
try
{
if (IOAdapter == null) return readBytesFromFileInputStream(new FileInputStream(path));
InputStream is = IOAdapter.open(path);
if (is instanceof FileInputStream)
return readBytesFromFileInputStream((FileInputStream) is);
else
return readBytesFromOtherInputStream(is);
}
catch (Exception e)
{
logger.warning("读取" + path + "时发生异常" + e);
}
return null;
} | [
"public",
"static",
"byte",
"[",
"]",
"readBytes",
"(",
"String",
"path",
")",
"{",
"try",
"{",
"if",
"(",
"IOAdapter",
"==",
"null",
")",
"return",
"readBytesFromFileInputStream",
"(",
"new",
"FileInputStream",
"(",
"path",
")",
")",
";",
"InputStream",
"... | 将整个文件读取为字节数组
@param path
@return | [
"将整个文件读取为字节数组"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/io/IOUtil.java#L174-L192 | train | read bytes from file | [
30522,
2270,
10763,
24880,
1031,
1033,
3191,
3762,
4570,
1006,
5164,
4130,
1007,
1063,
3046,
1063,
2065,
1006,
22834,
8447,
13876,
2121,
1027,
1027,
19701,
1007,
2709,
3191,
3762,
4570,
19699,
5358,
8873,
19856,
18780,
21422,
1006,
2047,
53... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/io/CsvReader.java | CsvReader.ignoreComments | public CsvReader ignoreComments(String commentPrefix) {
if (commentPrefix == null || commentPrefix.length() == 0) {
throw new IllegalArgumentException("The comment prefix must not be null or an empty string");
}
this.commentPrefix = commentPrefix;
return this;
} | java | public CsvReader ignoreComments(String commentPrefix) {
if (commentPrefix == null || commentPrefix.length() == 0) {
throw new IllegalArgumentException("The comment prefix must not be null or an empty string");
}
this.commentPrefix = commentPrefix;
return this;
} | [
"public",
"CsvReader",
"ignoreComments",
"(",
"String",
"commentPrefix",
")",
"{",
"if",
"(",
"commentPrefix",
"==",
"null",
"||",
"commentPrefix",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The comment pref... | Configures the string that starts comments.
By default comments will be treated as invalid lines.
This function only recognizes comments which start at the beginning of the line!
@param commentPrefix The string that starts the comments.
@return The CSV reader instance itself, to allow for fluent function chaining. | [
"Configures",
"the",
"string",
"that",
"starts",
"comments",
".",
"By",
"default",
"comments",
"will",
"be",
"treated",
"as",
"invalid",
"lines",
".",
"This",
"function",
"only",
"recognizes",
"comments",
"which",
"start",
"at",
"the",
"beginning",
"of",
"the"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/io/CsvReader.java#L156-L163 | train | Ignore comments from the file. | [
30522,
2270,
20116,
12229,
9648,
2099,
8568,
9006,
8163,
1006,
5164,
7615,
28139,
8873,
2595,
1007,
1063,
2065,
1006,
7615,
28139,
8873,
2595,
1027,
1027,
19701,
1064,
1064,
7615,
28139,
8873,
2595,
1012,
3091,
1006,
1007,
1027,
1027,
1014,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducerBase.java | FlinkKafkaProducerBase.getKafkaProducer | @VisibleForTesting
protected <K, V> KafkaProducer<K, V> getKafkaProducer(Properties props) {
return new KafkaProducer<>(props);
} | java | @VisibleForTesting
protected <K, V> KafkaProducer<K, V> getKafkaProducer(Properties props) {
return new KafkaProducer<>(props);
} | [
"@",
"VisibleForTesting",
"protected",
"<",
"K",
",",
"V",
">",
"KafkaProducer",
"<",
"K",
",",
"V",
">",
"getKafkaProducer",
"(",
"Properties",
"props",
")",
"{",
"return",
"new",
"KafkaProducer",
"<>",
"(",
"props",
")",
";",
"}"
] | Used for testing only. | [
"Used",
"for",
"testing",
"only",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducerBase.java#L203-L206 | train | Returns a KafkaProducer instance. | [
30522,
1030,
5710,
13028,
4355,
2075,
5123,
1026,
1047,
1010,
1058,
1028,
10556,
24316,
9331,
14127,
18796,
2099,
1026,
1047,
1010,
1058,
1028,
2131,
2912,
24316,
9331,
14127,
18796,
2099,
1006,
5144,
24387,
1007,
1063,
2709,
2047,
10556,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | client-adapter/launcher/src/main/java/com/alibaba/otter/canal/adapter/launcher/monitor/remote/DbRemoteConfigLoader.java | DbRemoteConfigLoader.startMonitor | @Override
public void startMonitor() {
// 监听application.yml变化
executor.scheduleWithFixedDelay(() -> {
try {
loadRemoteConfig();
} catch (Throwable e) {
logger.error("scan remote application.yml failed", e);
}
}, 10, 3, TimeUnit.SECONDS);
// 监听adapter变化
executor.scheduleWithFixedDelay(() -> {
try {
loadRemoteAdapterConfigs();
} catch (Throwable e) {
logger.error("scan remote adapter configs failed", e);
}
}, 10, 3, TimeUnit.SECONDS);
} | java | @Override
public void startMonitor() {
// 监听application.yml变化
executor.scheduleWithFixedDelay(() -> {
try {
loadRemoteConfig();
} catch (Throwable e) {
logger.error("scan remote application.yml failed", e);
}
}, 10, 3, TimeUnit.SECONDS);
// 监听adapter变化
executor.scheduleWithFixedDelay(() -> {
try {
loadRemoteAdapterConfigs();
} catch (Throwable e) {
logger.error("scan remote adapter configs failed", e);
}
}, 10, 3, TimeUnit.SECONDS);
} | [
"@",
"Override",
"public",
"void",
"startMonitor",
"(",
")",
"{",
"// 监听application.yml变化\r",
"executor",
".",
"scheduleWithFixedDelay",
"(",
"(",
")",
"->",
"{",
"try",
"{",
"loadRemoteConfig",
"(",
")",
";",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
... | 启动监听数据库变化 | [
"启动监听数据库变化"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/launcher/src/main/java/com/alibaba/otter/canal/adapter/launcher/monitor/remote/DbRemoteConfigLoader.java#L218-L237 | train | Start the monitor. | [
30522,
1030,
2058,
15637,
2270,
11675,
2707,
8202,
15660,
1006,
1007,
1063,
1013,
1013,
100,
100,
4646,
1012,
1061,
19968,
100,
100,
4654,
8586,
16161,
2099,
1012,
6134,
24415,
23901,
9247,
4710,
1006,
1006,
1007,
1011,
1028,
1063,
3046,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/server/TransportRequestHandler.java | TransportRequestHandler.processStreamUpload | private void processStreamUpload(final UploadStream req) {
assert (req.body() == null);
try {
RpcResponseCallback callback = new RpcResponseCallback() {
@Override
public void onSuccess(ByteBuffer response) {
respond(new RpcResponse(req.requestId, new NioManagedBuffer(response)));
}
@Override
public void onFailure(Throwable e) {
respond(new RpcFailure(req.requestId, Throwables.getStackTraceAsString(e)));
}
};
TransportFrameDecoder frameDecoder = (TransportFrameDecoder)
channel.pipeline().get(TransportFrameDecoder.HANDLER_NAME);
ByteBuffer meta = req.meta.nioByteBuffer();
StreamCallbackWithID streamHandler = rpcHandler.receiveStream(reverseClient, meta, callback);
if (streamHandler == null) {
throw new NullPointerException("rpcHandler returned a null streamHandler");
}
StreamCallbackWithID wrappedCallback = new StreamCallbackWithID() {
@Override
public void onData(String streamId, ByteBuffer buf) throws IOException {
streamHandler.onData(streamId, buf);
}
@Override
public void onComplete(String streamId) throws IOException {
try {
streamHandler.onComplete(streamId);
callback.onSuccess(ByteBuffer.allocate(0));
} catch (Exception ex) {
IOException ioExc = new IOException("Failure post-processing complete stream;" +
" failing this rpc and leaving channel active", ex);
callback.onFailure(ioExc);
streamHandler.onFailure(streamId, ioExc);
}
}
@Override
public void onFailure(String streamId, Throwable cause) throws IOException {
callback.onFailure(new IOException("Destination failed while reading stream", cause));
streamHandler.onFailure(streamId, cause);
}
@Override
public String getID() {
return streamHandler.getID();
}
};
if (req.bodyByteCount > 0) {
StreamInterceptor<RequestMessage> interceptor = new StreamInterceptor<>(
this, wrappedCallback.getID(), req.bodyByteCount, wrappedCallback);
frameDecoder.setInterceptor(interceptor);
} else {
wrappedCallback.onComplete(wrappedCallback.getID());
}
} catch (Exception e) {
logger.error("Error while invoking RpcHandler#receive() on RPC id " + req.requestId, e);
respond(new RpcFailure(req.requestId, Throwables.getStackTraceAsString(e)));
// We choose to totally fail the channel, rather than trying to recover as we do in other
// cases. We don't know how many bytes of the stream the client has already sent for the
// stream, it's not worth trying to recover.
channel.pipeline().fireExceptionCaught(e);
} finally {
req.meta.release();
}
} | java | private void processStreamUpload(final UploadStream req) {
assert (req.body() == null);
try {
RpcResponseCallback callback = new RpcResponseCallback() {
@Override
public void onSuccess(ByteBuffer response) {
respond(new RpcResponse(req.requestId, new NioManagedBuffer(response)));
}
@Override
public void onFailure(Throwable e) {
respond(new RpcFailure(req.requestId, Throwables.getStackTraceAsString(e)));
}
};
TransportFrameDecoder frameDecoder = (TransportFrameDecoder)
channel.pipeline().get(TransportFrameDecoder.HANDLER_NAME);
ByteBuffer meta = req.meta.nioByteBuffer();
StreamCallbackWithID streamHandler = rpcHandler.receiveStream(reverseClient, meta, callback);
if (streamHandler == null) {
throw new NullPointerException("rpcHandler returned a null streamHandler");
}
StreamCallbackWithID wrappedCallback = new StreamCallbackWithID() {
@Override
public void onData(String streamId, ByteBuffer buf) throws IOException {
streamHandler.onData(streamId, buf);
}
@Override
public void onComplete(String streamId) throws IOException {
try {
streamHandler.onComplete(streamId);
callback.onSuccess(ByteBuffer.allocate(0));
} catch (Exception ex) {
IOException ioExc = new IOException("Failure post-processing complete stream;" +
" failing this rpc and leaving channel active", ex);
callback.onFailure(ioExc);
streamHandler.onFailure(streamId, ioExc);
}
}
@Override
public void onFailure(String streamId, Throwable cause) throws IOException {
callback.onFailure(new IOException("Destination failed while reading stream", cause));
streamHandler.onFailure(streamId, cause);
}
@Override
public String getID() {
return streamHandler.getID();
}
};
if (req.bodyByteCount > 0) {
StreamInterceptor<RequestMessage> interceptor = new StreamInterceptor<>(
this, wrappedCallback.getID(), req.bodyByteCount, wrappedCallback);
frameDecoder.setInterceptor(interceptor);
} else {
wrappedCallback.onComplete(wrappedCallback.getID());
}
} catch (Exception e) {
logger.error("Error while invoking RpcHandler#receive() on RPC id " + req.requestId, e);
respond(new RpcFailure(req.requestId, Throwables.getStackTraceAsString(e)));
// We choose to totally fail the channel, rather than trying to recover as we do in other
// cases. We don't know how many bytes of the stream the client has already sent for the
// stream, it's not worth trying to recover.
channel.pipeline().fireExceptionCaught(e);
} finally {
req.meta.release();
}
} | [
"private",
"void",
"processStreamUpload",
"(",
"final",
"UploadStream",
"req",
")",
"{",
"assert",
"(",
"req",
".",
"body",
"(",
")",
"==",
"null",
")",
";",
"try",
"{",
"RpcResponseCallback",
"callback",
"=",
"new",
"RpcResponseCallback",
"(",
")",
"{",
"... | Handle a request from the client to upload a stream of data. | [
"Handle",
"a",
"request",
"from",
"the",
"client",
"to",
"upload",
"a",
"stream",
"of",
"data",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/server/TransportRequestHandler.java#L172-L240 | train | Process a stream upload request. | [
30522,
2797,
11675,
2832,
21422,
6279,
11066,
1006,
2345,
2039,
11066,
21422,
2128,
4160,
1007,
1063,
20865,
1006,
2128,
4160,
1012,
2303,
1006,
1007,
1027,
1027,
19701,
1007,
1025,
3046,
1063,
1054,
15042,
6072,
26029,
3366,
9289,
20850,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java | SlotManager.internalRequestSlot | private void internalRequestSlot(PendingSlotRequest pendingSlotRequest) throws ResourceManagerException {
final ResourceProfile resourceProfile = pendingSlotRequest.getResourceProfile();
TaskManagerSlot taskManagerSlot = findMatchingSlot(resourceProfile);
if (taskManagerSlot != null) {
allocateSlot(taskManagerSlot, pendingSlotRequest);
} else {
Optional<PendingTaskManagerSlot> pendingTaskManagerSlotOptional = findFreeMatchingPendingTaskManagerSlot(resourceProfile);
if (!pendingTaskManagerSlotOptional.isPresent()) {
pendingTaskManagerSlotOptional = allocateResource(resourceProfile);
}
pendingTaskManagerSlotOptional.ifPresent(pendingTaskManagerSlot -> assignPendingTaskManagerSlot(pendingSlotRequest, pendingTaskManagerSlot));
}
} | java | private void internalRequestSlot(PendingSlotRequest pendingSlotRequest) throws ResourceManagerException {
final ResourceProfile resourceProfile = pendingSlotRequest.getResourceProfile();
TaskManagerSlot taskManagerSlot = findMatchingSlot(resourceProfile);
if (taskManagerSlot != null) {
allocateSlot(taskManagerSlot, pendingSlotRequest);
} else {
Optional<PendingTaskManagerSlot> pendingTaskManagerSlotOptional = findFreeMatchingPendingTaskManagerSlot(resourceProfile);
if (!pendingTaskManagerSlotOptional.isPresent()) {
pendingTaskManagerSlotOptional = allocateResource(resourceProfile);
}
pendingTaskManagerSlotOptional.ifPresent(pendingTaskManagerSlot -> assignPendingTaskManagerSlot(pendingSlotRequest, pendingTaskManagerSlot));
}
} | [
"private",
"void",
"internalRequestSlot",
"(",
"PendingSlotRequest",
"pendingSlotRequest",
")",
"throws",
"ResourceManagerException",
"{",
"final",
"ResourceProfile",
"resourceProfile",
"=",
"pendingSlotRequest",
".",
"getResourceProfile",
"(",
")",
";",
"TaskManagerSlot",
... | Tries to allocate a slot for the given slot request. If there is no slot available, the
resource manager is informed to allocate more resources and a timeout for the request is
registered.
@param pendingSlotRequest to allocate a slot for
@throws ResourceManagerException if the resource manager cannot allocate more resource | [
"Tries",
"to",
"allocate",
"a",
"slot",
"for",
"the",
"given",
"slot",
"request",
".",
"If",
"there",
"is",
"no",
"slot",
"available",
"the",
"resource",
"manager",
"is",
"informed",
"to",
"allocate",
"more",
"resources",
"and",
"a",
"timeout",
"for",
"the... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java#L709-L724 | train | Internal method to allocate a slot for the given request. | [
30522,
2797,
11675,
4722,
2890,
15500,
14540,
4140,
1006,
14223,
14540,
4140,
2890,
15500,
14223,
14540,
4140,
2890,
15500,
1007,
11618,
7692,
24805,
4590,
10288,
24422,
1063,
2345,
7692,
21572,
8873,
2571,
7692,
21572,
8873,
2571,
1027,
1422... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/GroupReduceDriver.java | GroupReduceDriver.prepare | @Override
public void prepare() throws Exception {
TaskConfig config = this.taskContext.getTaskConfig();
if (config.getDriverStrategy() != DriverStrategy.SORTED_GROUP_REDUCE) {
throw new Exception("Unrecognized driver strategy for GroupReduce driver: " + config.getDriverStrategy().name());
}
final Counter numRecordsIn = this.taskContext.getMetricGroup().getIOMetricGroup().getNumRecordsInCounter();
this.serializer = this.taskContext.<IT>getInputSerializer(0).getSerializer();
this.comparator = this.taskContext.getDriverComparator(0);
this.input = new CountingMutableObjectIterator<>(this.taskContext.<IT>getInput(0), numRecordsIn);
ExecutionConfig executionConfig = taskContext.getExecutionConfig();
this.objectReuseEnabled = executionConfig.isObjectReuseEnabled();
if (LOG.isDebugEnabled()) {
LOG.debug("GroupReduceDriver object reuse: " + (this.objectReuseEnabled ? "ENABLED" : "DISABLED") + ".");
}
} | java | @Override
public void prepare() throws Exception {
TaskConfig config = this.taskContext.getTaskConfig();
if (config.getDriverStrategy() != DriverStrategy.SORTED_GROUP_REDUCE) {
throw new Exception("Unrecognized driver strategy for GroupReduce driver: " + config.getDriverStrategy().name());
}
final Counter numRecordsIn = this.taskContext.getMetricGroup().getIOMetricGroup().getNumRecordsInCounter();
this.serializer = this.taskContext.<IT>getInputSerializer(0).getSerializer();
this.comparator = this.taskContext.getDriverComparator(0);
this.input = new CountingMutableObjectIterator<>(this.taskContext.<IT>getInput(0), numRecordsIn);
ExecutionConfig executionConfig = taskContext.getExecutionConfig();
this.objectReuseEnabled = executionConfig.isObjectReuseEnabled();
if (LOG.isDebugEnabled()) {
LOG.debug("GroupReduceDriver object reuse: " + (this.objectReuseEnabled ? "ENABLED" : "DISABLED") + ".");
}
} | [
"@",
"Override",
"public",
"void",
"prepare",
"(",
")",
"throws",
"Exception",
"{",
"TaskConfig",
"config",
"=",
"this",
".",
"taskContext",
".",
"getTaskConfig",
"(",
")",
";",
"if",
"(",
"config",
".",
"getDriverStrategy",
"(",
")",
"!=",
"DriverStrategy",... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/GroupReduceDriver.java#L89-L107 | train | Prepare the task context. | [
30522,
1030,
2058,
15637,
2270,
11675,
7374,
1006,
1007,
11618,
6453,
1063,
4708,
8663,
8873,
2290,
9530,
8873,
2290,
1027,
2023,
1012,
4708,
8663,
18209,
1012,
2131,
10230,
2243,
8663,
8873,
2290,
1006,
1007,
1025,
2065,
1006,
9530,
8873,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/template/engine/thymeleaf/ThymeleafEngine.java | ThymeleafEngine.createEngine | private static org.thymeleaf.TemplateEngine createEngine(TemplateConfig config) {
if (null == config) {
config = new TemplateConfig();
}
ITemplateResolver resolver = null;
switch (config.getResourceMode()) {
case CLASSPATH:
final ClassLoaderTemplateResolver classLoaderResolver = new ClassLoaderTemplateResolver();
classLoaderResolver.setCharacterEncoding(config.getCharsetStr());
classLoaderResolver.setTemplateMode(TemplateMode.HTML);
classLoaderResolver.setPrefix(StrUtil.addSuffixIfNot(config.getPath(), "/"));
resolver = classLoaderResolver;
break;
case FILE:
final FileTemplateResolver fileResolver = new FileTemplateResolver();
fileResolver.setCharacterEncoding(config.getCharsetStr());
fileResolver.setTemplateMode(TemplateMode.HTML);
fileResolver.setPrefix(StrUtil.addSuffixIfNot(config.getPath(), "/"));
resolver = fileResolver;
break;
case WEB_ROOT:
final FileTemplateResolver webRootResolver = new FileTemplateResolver();
webRootResolver.setCharacterEncoding(config.getCharsetStr());
webRootResolver.setTemplateMode(TemplateMode.HTML);
webRootResolver.setPrefix(StrUtil.addSuffixIfNot(FileUtil.getAbsolutePath(FileUtil.file(FileUtil.getWebRoot(), config.getPath())), "/"));
resolver = webRootResolver;
break;
case STRING:
resolver = new StringTemplateResolver();
break;
case COMPOSITE:
resolver = new DefaultTemplateResolver();
break;
default:
resolver = new DefaultTemplateResolver();
break;
}
final org.thymeleaf.TemplateEngine engine = new org.thymeleaf.TemplateEngine();
engine.setTemplateResolver(resolver);
return engine;
} | java | private static org.thymeleaf.TemplateEngine createEngine(TemplateConfig config) {
if (null == config) {
config = new TemplateConfig();
}
ITemplateResolver resolver = null;
switch (config.getResourceMode()) {
case CLASSPATH:
final ClassLoaderTemplateResolver classLoaderResolver = new ClassLoaderTemplateResolver();
classLoaderResolver.setCharacterEncoding(config.getCharsetStr());
classLoaderResolver.setTemplateMode(TemplateMode.HTML);
classLoaderResolver.setPrefix(StrUtil.addSuffixIfNot(config.getPath(), "/"));
resolver = classLoaderResolver;
break;
case FILE:
final FileTemplateResolver fileResolver = new FileTemplateResolver();
fileResolver.setCharacterEncoding(config.getCharsetStr());
fileResolver.setTemplateMode(TemplateMode.HTML);
fileResolver.setPrefix(StrUtil.addSuffixIfNot(config.getPath(), "/"));
resolver = fileResolver;
break;
case WEB_ROOT:
final FileTemplateResolver webRootResolver = new FileTemplateResolver();
webRootResolver.setCharacterEncoding(config.getCharsetStr());
webRootResolver.setTemplateMode(TemplateMode.HTML);
webRootResolver.setPrefix(StrUtil.addSuffixIfNot(FileUtil.getAbsolutePath(FileUtil.file(FileUtil.getWebRoot(), config.getPath())), "/"));
resolver = webRootResolver;
break;
case STRING:
resolver = new StringTemplateResolver();
break;
case COMPOSITE:
resolver = new DefaultTemplateResolver();
break;
default:
resolver = new DefaultTemplateResolver();
break;
}
final org.thymeleaf.TemplateEngine engine = new org.thymeleaf.TemplateEngine();
engine.setTemplateResolver(resolver);
return engine;
} | [
"private",
"static",
"org",
".",
"thymeleaf",
".",
"TemplateEngine",
"createEngine",
"(",
"TemplateConfig",
"config",
")",
"{",
"if",
"(",
"null",
"==",
"config",
")",
"{",
"config",
"=",
"new",
"TemplateConfig",
"(",
")",
";",
"}",
"ITemplateResolver",
"res... | 创建引擎
@param config 模板配置
@return {@link TemplateEngine} | [
"创建引擎"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/thymeleaf/ThymeleafEngine.java#L66-L108 | train | Creates a new engine based on the given template config. | [
30522,
2797,
10763,
8917,
1012,
15177,
10199,
5243,
2546,
1012,
23561,
13159,
3170,
3443,
13159,
3170,
1006,
23561,
8663,
8873,
2290,
9530,
8873,
2290,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
9530,
8873,
2290,
1007,
1063,
9530,
8873,
229... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java | AllWindowedStream.max | public SingleOutputStreamOperator<T> max(String field) {
return aggregate(new ComparableAggregator<>(field, input.getType(), AggregationFunction.AggregationType.MAX, false, input.getExecutionConfig()));
} | java | public SingleOutputStreamOperator<T> max(String field) {
return aggregate(new ComparableAggregator<>(field, input.getType(), AggregationFunction.AggregationType.MAX, false, input.getExecutionConfig()));
} | [
"public",
"SingleOutputStreamOperator",
"<",
"T",
">",
"max",
"(",
"String",
"field",
")",
"{",
"return",
"aggregate",
"(",
"new",
"ComparableAggregator",
"<>",
"(",
"field",
",",
"input",
".",
"getType",
"(",
")",
",",
"AggregationFunction",
".",
"Aggregation... | Applies an aggregation that that gives the maximum value of the pojo data
stream at the given field expression for every window. A field expression
is either the name of a public field or a getter method with parentheses
of the {@link DataStream DataStreams} underlying type. A dot can be used to drill
down into objects, as in {@code "field1.getInnerField2()" }.
@param field The field expression based on which the aggregation will be applied.
@return The transformed DataStream. | [
"Applies",
"an",
"aggregation",
"that",
"that",
"gives",
"the",
"maximum",
"value",
"of",
"the",
"pojo",
"data",
"stream",
"at",
"the",
"given",
"field",
"expression",
"for",
"every",
"window",
".",
"A",
"field",
"expression",
"is",
"either",
"the",
"name",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java#L1498-L1500 | train | Max aggregation for Comparable type | [
30522,
2270,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
1056,
1028,
4098,
1006,
5164,
2492,
1007,
1063,
2709,
9572,
1006,
2047,
12435,
8490,
17603,
20697,
2953,
1026,
1028,
1006,
2492,
1010,
7953,
1012,
2131,
13874,
1006,
1007,
1010,
2804... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/net/NetworkUtils.java | NetworkUtils.getIp4NonLoopbackAddressOfThisMachine | public InetAddress getIp4NonLoopbackAddressOfThisMachine() {
for (NetworkInterface iface : networkInterfaceProvider.getNetworkInterfaces()) {
final InetAddress ip4NonLoopback = iface.getIp4NonLoopBackOnly();
if (ip4NonLoopback != null) {
return ip4NonLoopback;
}
}
throw new WebDriverException("Could not find a non-loopback ip4 address for this machine");
} | java | public InetAddress getIp4NonLoopbackAddressOfThisMachine() {
for (NetworkInterface iface : networkInterfaceProvider.getNetworkInterfaces()) {
final InetAddress ip4NonLoopback = iface.getIp4NonLoopBackOnly();
if (ip4NonLoopback != null) {
return ip4NonLoopback;
}
}
throw new WebDriverException("Could not find a non-loopback ip4 address for this machine");
} | [
"public",
"InetAddress",
"getIp4NonLoopbackAddressOfThisMachine",
"(",
")",
"{",
"for",
"(",
"NetworkInterface",
"iface",
":",
"networkInterfaceProvider",
".",
"getNetworkInterfaces",
"(",
")",
")",
"{",
"final",
"InetAddress",
"ip4NonLoopback",
"=",
"iface",
".",
"ge... | Returns a non-loopback IP4 hostname of the local host.
@return A string hostName | [
"Returns",
"a",
"non",
"-",
"loopback",
"IP4",
"hostname",
"of",
"the",
"local",
"host",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/net/NetworkUtils.java#L98-L106 | train | Get the IP4 address of the non - loopback network interface that is not loopback. | [
30522,
2270,
1999,
12928,
14141,
8303,
2131,
11514,
2549,
8540,
4135,
7361,
5963,
4215,
16200,
24137,
6199,
23108,
21046,
2638,
1006,
1007,
1063,
2005,
1006,
2897,
18447,
2121,
12172,
2065,
10732,
1024,
2897,
30524,
1999,
12928,
14141,
8303,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java | ConfigFileApplicationListener.addPropertySources | protected void addPropertySources(ConfigurableEnvironment environment,
ResourceLoader resourceLoader) {
RandomValuePropertySource.addToEnvironment(environment);
new Loader(environment, resourceLoader).load();
} | java | protected void addPropertySources(ConfigurableEnvironment environment,
ResourceLoader resourceLoader) {
RandomValuePropertySource.addToEnvironment(environment);
new Loader(environment, resourceLoader).load();
} | [
"protected",
"void",
"addPropertySources",
"(",
"ConfigurableEnvironment",
"environment",
",",
"ResourceLoader",
"resourceLoader",
")",
"{",
"RandomValuePropertySource",
".",
"addToEnvironment",
"(",
"environment",
")",
";",
"new",
"Loader",
"(",
"environment",
",",
"re... | Add config file property sources to the specified environment.
@param environment the environment to add source to
@param resourceLoader the resource loader
@see #addPostProcessors(ConfigurableApplicationContext) | [
"Add",
"config",
"file",
"property",
"sources",
"to",
"the",
"specified",
"environment",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java#L210-L214 | train | Add property sources to the environment. | [
30522,
5123,
11675,
5587,
30524,
1012,
5587,
3406,
2368,
21663,
2239,
3672,
1006,
4044,
1007,
1025,
2047,
7170,
2121,
1006,
4044,
1010,
7692,
11066,
2121,
1007,
1012,
7170,
1006,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/annotation/AnnotationUtil.java | AnnotationUtil.getRetentionPolicy | public static RetentionPolicy getRetentionPolicy(Class<? extends Annotation> annotationType) {
final Retention retention = annotationType.getAnnotation(Retention.class);
if (null == retention) {
return RetentionPolicy.CLASS;
}
return retention.value();
} | java | public static RetentionPolicy getRetentionPolicy(Class<? extends Annotation> annotationType) {
final Retention retention = annotationType.getAnnotation(Retention.class);
if (null == retention) {
return RetentionPolicy.CLASS;
}
return retention.value();
} | [
"public",
"static",
"RetentionPolicy",
"getRetentionPolicy",
"(",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
")",
"{",
"final",
"Retention",
"retention",
"=",
"annotationType",
".",
"getAnnotation",
"(",
"Retention",
".",
"class",
")",
";",... | 获取注解类的保留时间,可选值 SOURCE(源码时),CLASS(编译时),RUNTIME(运行时),默认为 CLASS
@param annotationType 注解类
@return 保留时间枚举 | [
"获取注解类的保留时间,可选值",
"SOURCE(源码时),CLASS(编译时),RUNTIME(运行时),默认为",
"CLASS"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/annotation/AnnotationUtil.java#L147-L153 | train | Gets the retention policy from an annotation. | [
30522,
2270,
10763,
20125,
18155,
2594,
2100,
2131,
13465,
4765,
3258,
18155,
2594,
2100,
1006,
2465,
1026,
1029,
8908,
5754,
17287,
3508,
1028,
5754,
17287,
3508,
13874,
1007,
1063,
2345,
20125,
20125,
1027,
5754,
17287,
3508,
13874,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.readLines | public static void readLines(Reader reader, LineHandler lineHandler) throws IORuntimeException {
Assert.notNull(reader);
Assert.notNull(lineHandler);
// 从返回的内容中读取所需内容
final BufferedReader bReader = getReader(reader);
String line = null;
try {
while ((line = bReader.readLine()) != null) {
lineHandler.handle(line);
}
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | java | public static void readLines(Reader reader, LineHandler lineHandler) throws IORuntimeException {
Assert.notNull(reader);
Assert.notNull(lineHandler);
// 从返回的内容中读取所需内容
final BufferedReader bReader = getReader(reader);
String line = null;
try {
while ((line = bReader.readLine()) != null) {
lineHandler.handle(line);
}
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | [
"public",
"static",
"void",
"readLines",
"(",
"Reader",
"reader",
",",
"LineHandler",
"lineHandler",
")",
"throws",
"IORuntimeException",
"{",
"Assert",
".",
"notNull",
"(",
"reader",
")",
";",
"Assert",
".",
"notNull",
"(",
"lineHandler",
")",
";",
"// 从返回的内容... | 按行读取数据,针对每行的数据做处理<br>
{@link Reader}自带编码定义,因此读取数据的编码跟随其编码。
@param reader {@link Reader}
@param lineHandler 行处理接口,实现handle方法用于编辑一行的数据后入到指定地方
@throws IORuntimeException IO异常 | [
"按行读取数据,针对每行的数据做处理<br",
">",
"{",
"@link",
"Reader",
"}",
"自带编码定义,因此读取数据的编码跟随其编码。"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L714-L728 | train | Reads the lines from the specified reader and calls the specified LineHandler for each line. | [
30522,
2270,
10763,
11675,
3191,
12735,
1006,
8068,
8068,
1010,
2240,
11774,
3917,
2240,
11774,
3917,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
20865,
1012,
2025,
30524,
5164,
2240,
1027,
19701,
1025,
3046,
1063,
2096,
1006,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontendParser.java | CliFrontendParser.getRunOptionsWithoutDeprecatedOptions | private static Options getRunOptionsWithoutDeprecatedOptions(Options options) {
Options o = getProgramSpecificOptionsWithoutDeprecatedOptions(options);
o.addOption(SAVEPOINT_PATH_OPTION);
return o.addOption(SAVEPOINT_ALLOW_NON_RESTORED_OPTION);
} | java | private static Options getRunOptionsWithoutDeprecatedOptions(Options options) {
Options o = getProgramSpecificOptionsWithoutDeprecatedOptions(options);
o.addOption(SAVEPOINT_PATH_OPTION);
return o.addOption(SAVEPOINT_ALLOW_NON_RESTORED_OPTION);
} | [
"private",
"static",
"Options",
"getRunOptionsWithoutDeprecatedOptions",
"(",
"Options",
"options",
")",
"{",
"Options",
"o",
"=",
"getProgramSpecificOptionsWithoutDeprecatedOptions",
"(",
"options",
")",
";",
"o",
".",
"addOption",
"(",
"SAVEPOINT_PATH_OPTION",
")",
";... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontendParser.java#L242-L246 | train | Returns the options that are not deprecated. | [
30522,
2797,
10763,
7047,
2131,
15532,
7361,
9285,
24415,
5833,
3207,
28139,
12921,
7361,
9285,
1006,
7047,
7047,
1007,
1063,
7047,
1051,
1027,
2131,
21572,
13113,
13102,
8586,
18513,
7361,
9285,
24415,
5833,
3207,
28139,
12921,
7361,
9285,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/JobGraph.java | JobGraph.addUserJarBlobKey | public void addUserJarBlobKey(PermanentBlobKey key) {
if (key == null) {
throw new IllegalArgumentException();
}
if (!userJarBlobKeys.contains(key)) {
userJarBlobKeys.add(key);
}
} | java | public void addUserJarBlobKey(PermanentBlobKey key) {
if (key == null) {
throw new IllegalArgumentException();
}
if (!userJarBlobKeys.contains(key)) {
userJarBlobKeys.add(key);
}
} | [
"public",
"void",
"addUserJarBlobKey",
"(",
"PermanentBlobKey",
"key",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"if",
"(",
"!",
"userJarBlobKeys",
".",
"contains",
"(",
"key",
")",
... | Adds the BLOB referenced by the key to the JobGraph's dependencies.
@param key
path of the JAR file required to run the job on a task manager | [
"Adds",
"the",
"BLOB",
"referenced",
"by",
"the",
"key",
"to",
"the",
"JobGraph",
"s",
"dependencies",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/JobGraph.java#L540-L548 | train | Add a BlobKey to the UserJarBlobKey list. | [
30522,
2270,
11675,
5587,
20330,
16084,
16558,
16429,
14839,
1006,
4568,
16558,
16429,
14839,
3145,
1007,
1063,
2065,
1006,
3145,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1007,
1025,
1065,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/Img.java | Img.flip | public Img flip() {
final BufferedImage image = getValidSrcImg();
int width = image.getWidth();
int height = image.getHeight();
final BufferedImage targetImg = new BufferedImage(width, height, getTypeInt());
Graphics2D graphics2d = targetImg.createGraphics();
graphics2d.drawImage(image, 0, 0, width, height, width, 0, 0, height, null);
graphics2d.dispose();
this.targetImage = targetImg;
return this;
} | java | public Img flip() {
final BufferedImage image = getValidSrcImg();
int width = image.getWidth();
int height = image.getHeight();
final BufferedImage targetImg = new BufferedImage(width, height, getTypeInt());
Graphics2D graphics2d = targetImg.createGraphics();
graphics2d.drawImage(image, 0, 0, width, height, width, 0, 0, height, null);
graphics2d.dispose();
this.targetImage = targetImg;
return this;
} | [
"public",
"Img",
"flip",
"(",
")",
"{",
"final",
"BufferedImage",
"image",
"=",
"getValidSrcImg",
"(",
")",
";",
"int",
"width",
"=",
"image",
".",
"getWidth",
"(",
")",
";",
"int",
"height",
"=",
"image",
".",
"getHeight",
"(",
")",
";",
"final",
"B... | 水平翻转图像
@return this | [
"水平翻转图像"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/Img.java#L489-L499 | train | Flips the image. | [
30522,
2270,
10047,
2290,
11238,
1006,
1007,
1063,
2345,
17698,
2098,
9581,
3351,
3746,
1027,
2131,
10175,
9821,
11890,
5714,
2290,
1006,
1007,
1025,
20014,
9381,
1027,
3746,
1012,
2131,
9148,
11927,
2232,
1006,
1007,
1025,
20014,
4578,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java | ColumnVector.getDoubles | public double[] getDoubles(int rowId, int count) {
double[] res = new double[count];
for (int i = 0; i < count; i++) {
res[i] = getDouble(rowId + i);
}
return res;
} | java | public double[] getDoubles(int rowId, int count) {
double[] res = new double[count];
for (int i = 0; i < count; i++) {
res[i] = getDouble(rowId + i);
}
return res;
} | [
"public",
"double",
"[",
"]",
"getDoubles",
"(",
"int",
"rowId",
",",
"int",
"count",
")",
"{",
"double",
"[",
"]",
"res",
"=",
"new",
"double",
"[",
"count",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
... | Gets double type values from [rowId, rowId + count). The return values for the null slots
are undefined and can be anything. | [
"Gets",
"double",
"type",
"values",
"from",
"[",
"rowId",
"rowId",
"+",
"count",
")",
".",
"The",
"return",
"values",
"for",
"the",
"null",
"slots",
"are",
"undefined",
"and",
"can",
"be",
"anything",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java#L200-L206 | train | Gets the double array from the specified row. | [
30522,
2270,
3313,
1031,
1033,
2131,
26797,
13510,
1006,
20014,
5216,
3593,
1010,
20014,
4175,
1007,
1063,
3313,
1031,
1033,
24501,
1027,
2047,
3313,
1031,
4175,
1033,
1025,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
4175,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | example/src/main/java/io/netty/example/http/upload/HttpUploadClient.java | HttpUploadClient.formpost | private static List<InterfaceHttpData> formpost(
Bootstrap bootstrap,
String host, int port, URI uriSimple, File file, HttpDataFactory factory,
List<Entry<String, String>> headers) throws Exception {
// XXX /formpost
// Start the connection attempt.
ChannelFuture future = bootstrap.connect(SocketUtils.socketAddress(host, port));
// Wait until the connection attempt succeeds or fails.
Channel channel = future.sync().channel();
// Prepare the HTTP request.
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, uriSimple.toASCIIString());
// Use the PostBody encoder
HttpPostRequestEncoder bodyRequestEncoder =
new HttpPostRequestEncoder(factory, request, false); // false => not multipart
// it is legal to add directly header or cookie into the request until finalize
for (Entry<String, String> entry : headers) {
request.headers().set(entry.getKey(), entry.getValue());
}
// add Form attribute
bodyRequestEncoder.addBodyAttribute("getform", "POST");
bodyRequestEncoder.addBodyAttribute("info", "first value");
bodyRequestEncoder.addBodyAttribute("secondinfo", "secondvalue ���&");
bodyRequestEncoder.addBodyAttribute("thirdinfo", textArea);
bodyRequestEncoder.addBodyAttribute("fourthinfo", textAreaLong);
bodyRequestEncoder.addBodyFileUpload("myfile", file, "application/x-zip-compressed", false);
// finalize request
request = bodyRequestEncoder.finalizeRequest();
// Create the bodylist to be reused on the last version with Multipart support
List<InterfaceHttpData> bodylist = bodyRequestEncoder.getBodyListAttributes();
// send request
channel.write(request);
// test if request was chunked and if so, finish the write
if (bodyRequestEncoder.isChunked()) { // could do either request.isChunked()
// either do it through ChunkedWriteHandler
channel.write(bodyRequestEncoder);
}
channel.flush();
// Do not clear here since we will reuse the InterfaceHttpData on the next request
// for the example (limit action on client side). Take this as a broadcast of the same
// request on both Post actions.
//
// On standard program, it is clearly recommended to clean all files after each request
// bodyRequestEncoder.cleanFiles();
// Wait for the server to close the connection.
channel.closeFuture().sync();
return bodylist;
} | java | private static List<InterfaceHttpData> formpost(
Bootstrap bootstrap,
String host, int port, URI uriSimple, File file, HttpDataFactory factory,
List<Entry<String, String>> headers) throws Exception {
// XXX /formpost
// Start the connection attempt.
ChannelFuture future = bootstrap.connect(SocketUtils.socketAddress(host, port));
// Wait until the connection attempt succeeds or fails.
Channel channel = future.sync().channel();
// Prepare the HTTP request.
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, uriSimple.toASCIIString());
// Use the PostBody encoder
HttpPostRequestEncoder bodyRequestEncoder =
new HttpPostRequestEncoder(factory, request, false); // false => not multipart
// it is legal to add directly header or cookie into the request until finalize
for (Entry<String, String> entry : headers) {
request.headers().set(entry.getKey(), entry.getValue());
}
// add Form attribute
bodyRequestEncoder.addBodyAttribute("getform", "POST");
bodyRequestEncoder.addBodyAttribute("info", "first value");
bodyRequestEncoder.addBodyAttribute("secondinfo", "secondvalue ���&");
bodyRequestEncoder.addBodyAttribute("thirdinfo", textArea);
bodyRequestEncoder.addBodyAttribute("fourthinfo", textAreaLong);
bodyRequestEncoder.addBodyFileUpload("myfile", file, "application/x-zip-compressed", false);
// finalize request
request = bodyRequestEncoder.finalizeRequest();
// Create the bodylist to be reused on the last version with Multipart support
List<InterfaceHttpData> bodylist = bodyRequestEncoder.getBodyListAttributes();
// send request
channel.write(request);
// test if request was chunked and if so, finish the write
if (bodyRequestEncoder.isChunked()) { // could do either request.isChunked()
// either do it through ChunkedWriteHandler
channel.write(bodyRequestEncoder);
}
channel.flush();
// Do not clear here since we will reuse the InterfaceHttpData on the next request
// for the example (limit action on client side). Take this as a broadcast of the same
// request on both Post actions.
//
// On standard program, it is clearly recommended to clean all files after each request
// bodyRequestEncoder.cleanFiles();
// Wait for the server to close the connection.
channel.closeFuture().sync();
return bodylist;
} | [
"private",
"static",
"List",
"<",
"InterfaceHttpData",
">",
"formpost",
"(",
"Bootstrap",
"bootstrap",
",",
"String",
"host",
",",
"int",
"port",
",",
"URI",
"uriSimple",
",",
"File",
"file",
",",
"HttpDataFactory",
"factory",
",",
"List",
"<",
"Entry",
"<",... | Standard post without multipart but already support on Factory (memory management)
@return the list of HttpData object (attribute and file) to be reused on next post | [
"Standard",
"post",
"without",
"multipart",
"but",
"already",
"support",
"on",
"Factory",
"(",
"memory",
"management",
")"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/example/src/main/java/io/netty/example/http/upload/HttpUploadClient.java#L204-L260 | train | Form post a file to a server. | [
30522,
2797,
10763,
2862,
1026,
8278,
11039,
25856,
2850,
2696,
1028,
2433,
19894,
1006,
6879,
6494,
2361,
6879,
6494,
2361,
1010,
5164,
3677,
1010,
20014,
3417,
1010,
24471,
2072,
24471,
17417,
23344,
1010,
5371,
5371,
1010,
8299,
2850,
26... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/server/OneForOneStreamManager.java | OneForOneStreamManager.registerStream | public long registerStream(String appId, Iterator<ManagedBuffer> buffers, Channel channel) {
long myStreamId = nextStreamId.getAndIncrement();
streams.put(myStreamId, new StreamState(appId, buffers, channel));
return myStreamId;
} | java | public long registerStream(String appId, Iterator<ManagedBuffer> buffers, Channel channel) {
long myStreamId = nextStreamId.getAndIncrement();
streams.put(myStreamId, new StreamState(appId, buffers, channel));
return myStreamId;
} | [
"public",
"long",
"registerStream",
"(",
"String",
"appId",
",",
"Iterator",
"<",
"ManagedBuffer",
">",
"buffers",
",",
"Channel",
"channel",
")",
"{",
"long",
"myStreamId",
"=",
"nextStreamId",
".",
"getAndIncrement",
"(",
")",
";",
"streams",
".",
"put",
"... | Registers a stream of ManagedBuffers which are served as individual chunks one at a time to
callers. Each ManagedBuffer will be release()'d after it is transferred on the wire. If a
client connection is closed before the iterator is fully drained, then the remaining buffers
will all be release()'d.
If an app ID is provided, only callers who've authenticated with the given app ID will be
allowed to fetch from this stream.
This method also associates the stream with a single client connection, which is guaranteed
to be the only reader of the stream. Once the connection is closed, the stream will never
be used again, enabling cleanup by `connectionTerminated`. | [
"Registers",
"a",
"stream",
"of",
"ManagedBuffers",
"which",
"are",
"served",
"as",
"individual",
"chunks",
"one",
"at",
"a",
"time",
"to",
"callers",
".",
"Each",
"ManagedBuffer",
"will",
"be",
"release",
"()",
"d",
"after",
"it",
"is",
"transferred",
"on",... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/server/OneForOneStreamManager.java#L198-L202 | train | Registers a new stream. | [
30522,
2270,
2146,
18687,
25379,
1006,
5164,
10439,
3593,
1010,
2009,
6906,
4263,
1026,
3266,
8569,
12494,
1028,
17698,
2015,
1010,
3149,
3149,
1007,
1063,
2146,
2026,
21422,
3593,
1027,
2279,
21422,
3593,
1012,
2131,
5685,
2378,
16748,
367... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-log/src/main/java/cn/hutool/log/StaticLog.java | StaticLog.debug | public static void debug(Log log, String format, Object... arguments) {
if (false == log(log, Level.DEBUG, null, format, arguments)) {
log.debug(format, arguments);
}
} | java | public static void debug(Log log, String format, Object... arguments) {
if (false == log(log, Level.DEBUG, null, format, arguments)) {
log.debug(format, arguments);
}
} | [
"public",
"static",
"void",
"debug",
"(",
"Log",
"log",
",",
"String",
"format",
",",
"Object",
"...",
"arguments",
")",
"{",
"if",
"(",
"false",
"==",
"log",
"(",
"log",
",",
"Level",
".",
"DEBUG",
",",
"null",
",",
"format",
",",
"arguments",
")",
... | Debug等级日志,小于Info
@param log 日志对象
@param format 格式文本,{} 代表变量
@param arguments 变量对应的参数 | [
"Debug等级日志,小于Info"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/StaticLog.java#L64-L68 | train | Logs a message at the DEBUG level. | [
30522,
2270,
10763,
11675,
2139,
8569,
2290,
1006,
8833,
8833,
1010,
5164,
4289,
1010,
4874,
1012,
1012,
1012,
9918,
1007,
1063,
2065,
1006,
6270,
1027,
1027,
8833,
1006,
8833,
1010,
2504,
1012,
2139,
8569,
2290,
1010,
19701,
1010,
4289,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/schema/LogicSchemas.java | LogicSchemas.getLogicSchema | public LogicSchema getLogicSchema(final String schemaName) {
return Strings.isNullOrEmpty(schemaName) ? null : logicSchemas.get(schemaName);
} | java | public LogicSchema getLogicSchema(final String schemaName) {
return Strings.isNullOrEmpty(schemaName) ? null : logicSchemas.get(schemaName);
} | [
"public",
"LogicSchema",
"getLogicSchema",
"(",
"final",
"String",
"schemaName",
")",
"{",
"return",
"Strings",
".",
"isNullOrEmpty",
"(",
"schemaName",
")",
"?",
"null",
":",
"logicSchemas",
".",
"get",
"(",
"schemaName",
")",
";",
"}"
] | Get logic schema.
@param schemaName schema name
@return sharding schema | [
"Get",
"logic",
"schema",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/schema/LogicSchemas.java#L142-L144 | train | Gets the logic schema. | [
30522,
2270,
7961,
22842,
2863,
2131,
27179,
22842,
2863,
1006,
2345,
5164,
8040,
28433,
18442,
1007,
1063,
2709,
7817,
1012,
3475,
18083,
5686,
27718,
2100,
1006,
8040,
28433,
18442,
1007,
1029,
19701,
1024,
7961,
22842,
9335,
1012,
2131,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | security/src/main/java/com/networknt/security/JwtIssuer.java | JwtIssuer.getDefaultJwtClaims | public static JwtClaims getDefaultJwtClaims() {
JwtClaims claims = new JwtClaims();
claims.setIssuer(jwtConfig.getIssuer());
claims.setAudience(jwtConfig.getAudience());
claims.setExpirationTimeMinutesInTheFuture(jwtConfig.getExpiredInMinutes());
claims.setGeneratedJwtId(); // a unique identifier for the token
claims.setIssuedAtToNow(); // when the token was issued/created (now)
claims.setNotBeforeMinutesInThePast(2); // time before which the token is not yet valid (2 minutes ago)
claims.setClaim("version", jwtConfig.getVersion());
return claims;
} | java | public static JwtClaims getDefaultJwtClaims() {
JwtClaims claims = new JwtClaims();
claims.setIssuer(jwtConfig.getIssuer());
claims.setAudience(jwtConfig.getAudience());
claims.setExpirationTimeMinutesInTheFuture(jwtConfig.getExpiredInMinutes());
claims.setGeneratedJwtId(); // a unique identifier for the token
claims.setIssuedAtToNow(); // when the token was issued/created (now)
claims.setNotBeforeMinutesInThePast(2); // time before which the token is not yet valid (2 minutes ago)
claims.setClaim("version", jwtConfig.getVersion());
return claims;
} | [
"public",
"static",
"JwtClaims",
"getDefaultJwtClaims",
"(",
")",
"{",
"JwtClaims",
"claims",
"=",
"new",
"JwtClaims",
"(",
")",
";",
"claims",
".",
"setIssuer",
"(",
"jwtConfig",
".",
"getIssuer",
"(",
")",
")",
";",
"claims",
".",
"setAudience",
"(",
"jw... | Construct a default JwtClaims
@return JwtClaims | [
"Construct",
"a",
"default",
"JwtClaims"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/security/src/main/java/com/networknt/security/JwtIssuer.java#L99-L112 | train | Returns the default jwt claims. | [
30522,
2270,
10763,
1046,
26677,
25154,
2015,
2131,
3207,
7011,
11314,
3501,
26677,
25154,
2015,
1006,
1007,
1063,
1046,
26677,
25154,
2015,
4447,
1027,
2047,
1046,
26677,
25154,
2015,
1006,
1007,
1025,
4447,
1012,
2275,
14643,
13094,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dependency/perceptron/parser/KBeamArcEagerDependencyParser.java | KBeamArcEagerDependencyParser.evaluate | public double[] evaluate(String testCorpus) throws IOException, ExecutionException, InterruptedException
{
Options options = parser.options;
options.goldFile = testCorpus;
File tmpTemplate = File.createTempFile("pred-" + new Date().getTime(), ".conll");
tmpTemplate.deleteOnExit();
options.predFile = tmpTemplate.getAbsolutePath();
options.outputFile = options.predFile;
File scoreFile = File.createTempFile("score-" + new Date().getTime(), ".txt");
scoreFile.deleteOnExit();
parser.parseConllFile(testCorpus, options.outputFile, options.rootFirst, options.beamWidth, true,
options.lowercase, 1, false, scoreFile.getAbsolutePath());
return Evaluator.evaluate(options.goldFile, options.predFile, options.punctuations);
} | java | public double[] evaluate(String testCorpus) throws IOException, ExecutionException, InterruptedException
{
Options options = parser.options;
options.goldFile = testCorpus;
File tmpTemplate = File.createTempFile("pred-" + new Date().getTime(), ".conll");
tmpTemplate.deleteOnExit();
options.predFile = tmpTemplate.getAbsolutePath();
options.outputFile = options.predFile;
File scoreFile = File.createTempFile("score-" + new Date().getTime(), ".txt");
scoreFile.deleteOnExit();
parser.parseConllFile(testCorpus, options.outputFile, options.rootFirst, options.beamWidth, true,
options.lowercase, 1, false, scoreFile.getAbsolutePath());
return Evaluator.evaluate(options.goldFile, options.predFile, options.punctuations);
} | [
"public",
"double",
"[",
"]",
"evaluate",
"(",
"String",
"testCorpus",
")",
"throws",
"IOException",
",",
"ExecutionException",
",",
"InterruptedException",
"{",
"Options",
"options",
"=",
"parser",
".",
"options",
";",
"options",
".",
"goldFile",
"=",
"testCorp... | 标准化评测
@param testCorpus 测试语料
@return 包含UF、LF的数组
@throws IOException
@throws ExecutionException
@throws InterruptedException | [
"标准化评测"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/perceptron/parser/KBeamArcEagerDependencyParser.java#L96-L109 | train | Evaluate the CIS corpus. | [
30522,
2270,
3313,
1031,
1033,
16157,
1006,
5164,
3231,
24586,
2271,
1007,
11618,
22834,
10288,
24422,
1010,
7781,
10288,
24422,
1010,
7153,
10288,
24422,
1063,
7047,
7047,
1027,
11968,
8043,
1012,
7047,
1025,
7047,
1012,
2751,
8873,
2571,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/memory/MemoryManager.java | MemoryManager.releaseAll | public void releaseAll(Object owner) {
if (owner == null) {
return;
}
// -------------------- BEGIN CRITICAL SECTION -------------------
synchronized (lock) {
if (isShutDown) {
throw new IllegalStateException("Memory manager has been shut down.");
}
// get all segments
final Set<MemorySegment> segments = allocatedSegments.remove(owner);
// all segments may have been freed previously individually
if (segments == null || segments.isEmpty()) {
return;
}
// free each segment
if (isPreAllocated) {
for (MemorySegment seg : segments) {
memoryPool.returnSegmentToPool(seg);
}
}
else {
for (MemorySegment seg : segments) {
seg.free();
}
numNonAllocatedPages += segments.size();
}
segments.clear();
}
// -------------------- END CRITICAL SECTION -------------------
} | java | public void releaseAll(Object owner) {
if (owner == null) {
return;
}
// -------------------- BEGIN CRITICAL SECTION -------------------
synchronized (lock) {
if (isShutDown) {
throw new IllegalStateException("Memory manager has been shut down.");
}
// get all segments
final Set<MemorySegment> segments = allocatedSegments.remove(owner);
// all segments may have been freed previously individually
if (segments == null || segments.isEmpty()) {
return;
}
// free each segment
if (isPreAllocated) {
for (MemorySegment seg : segments) {
memoryPool.returnSegmentToPool(seg);
}
}
else {
for (MemorySegment seg : segments) {
seg.free();
}
numNonAllocatedPages += segments.size();
}
segments.clear();
}
// -------------------- END CRITICAL SECTION -------------------
} | [
"public",
"void",
"releaseAll",
"(",
"Object",
"owner",
")",
"{",
"if",
"(",
"owner",
"==",
"null",
")",
"{",
"return",
";",
"}",
"// -------------------- BEGIN CRITICAL SECTION -------------------",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"isShutDown",
... | Releases all memory segments for the given owner.
@param owner The owner memory segments are to be released. | [
"Releases",
"all",
"memory",
"segments",
"for",
"the",
"given",
"owner",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/memory/MemoryManager.java#L472-L507 | train | Releases all memory segments allocated by the given owner. | [
30522,
2270,
11675,
2713,
8095,
1006,
4874,
3954,
1007,
1063,
2065,
1006,
3954,
1027,
1027,
19701,
1007,
1063,
2709,
1025,
1065,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/drivers/parameter/Util.java | Util.checkParameter | public static void checkParameter(boolean condition, @Nullable Object errorMessage) {
if (!condition) {
throw new ProgramParametrizationException(String.valueOf(errorMessage));
}
} | java | public static void checkParameter(boolean condition, @Nullable Object errorMessage) {
if (!condition) {
throw new ProgramParametrizationException(String.valueOf(errorMessage));
}
} | [
"public",
"static",
"void",
"checkParameter",
"(",
"boolean",
"condition",
",",
"@",
"Nullable",
"Object",
"errorMessage",
")",
"{",
"if",
"(",
"!",
"condition",
")",
"{",
"throw",
"new",
"ProgramParametrizationException",
"(",
"String",
".",
"valueOf",
"(",
"... | Checks the given boolean condition, and throws an {@code ProgramParametrizationException} if
the condition is not met (evaluates to {@code false}). The exception will have the
given error message.
@param condition The condition to check
@param errorMessage The message for the {@code ProgramParametrizationException} that is thrown if the check fails.
@throws ProgramParametrizationException Thrown, if the condition is violated.
@see Preconditions#checkNotNull(Object, String) | [
"Checks",
"the",
"given",
"boolean",
"condition",
"and",
"throws",
"an",
"{",
"@code",
"ProgramParametrizationException",
"}",
"if",
"the",
"condition",
"is",
"not",
"met",
"(",
"evaluates",
"to",
"{",
"@code",
"false",
"}",
")",
".",
"The",
"exception",
"wi... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/drivers/parameter/Util.java#L49-L53 | train | Check parameter. | [
30522,
2270,
10763,
11675,
4638,
28689,
22828,
1006,
22017,
20898,
4650,
1010,
1030,
19701,
3085,
4874,
7561,
7834,
3736,
3351,
1007,
1063,
2065,
1006,
999,
4650,
1007,
1063,
5466,
2047,
2565,
28689,
11368,
26910,
10288,
24422,
1006,
30524,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/server/TransportRequestHandler.java | TransportRequestHandler.respond | private ChannelFuture respond(Encodable result) {
SocketAddress remoteAddress = channel.remoteAddress();
return channel.writeAndFlush(result).addListener(future -> {
if (future.isSuccess()) {
logger.trace("Sent result {} to client {}", result, remoteAddress);
} else {
logger.error(String.format("Error sending result %s to %s; closing connection",
result, remoteAddress), future.cause());
channel.close();
}
});
} | java | private ChannelFuture respond(Encodable result) {
SocketAddress remoteAddress = channel.remoteAddress();
return channel.writeAndFlush(result).addListener(future -> {
if (future.isSuccess()) {
logger.trace("Sent result {} to client {}", result, remoteAddress);
} else {
logger.error(String.format("Error sending result %s to %s; closing connection",
result, remoteAddress), future.cause());
channel.close();
}
});
} | [
"private",
"ChannelFuture",
"respond",
"(",
"Encodable",
"result",
")",
"{",
"SocketAddress",
"remoteAddress",
"=",
"channel",
".",
"remoteAddress",
"(",
")",
";",
"return",
"channel",
".",
"writeAndFlush",
"(",
"result",
")",
".",
"addListener",
"(",
"future",
... | Responds to a single message with some Encodable object. If a failure occurs while sending,
it will be logged and the channel closed. | [
"Responds",
"to",
"a",
"single",
"message",
"with",
"some",
"Encodable",
"object",
".",
"If",
"a",
"failure",
"occurs",
"while",
"sending",
"it",
"will",
"be",
"logged",
"and",
"the",
"channel",
"closed",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/server/TransportRequestHandler.java#L256-L267 | train | Sends a response to the server. | [
30522,
2797,
3149,
11263,
11244,
6869,
1006,
4372,
3597,
20782,
2765,
1007,
1063,
22278,
4215,
16200,
4757,
6556,
4215,
16200,
4757,
1027,
3149,
1012,
6556,
4215,
16200,
4757,
1006,
1007,
1025,
2709,
3149,
1012,
4339,
5685,
10258,
20668,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/tsdb/DatabaseTableMeta.java | DatabaseTableMeta.dumpTableMeta | private boolean dumpTableMeta(MysqlConnection connection, final CanalEventFilter filter) {
try {
ResultSetPacket packet = connection.query("show databases");
List<String> schemas = new ArrayList<String>();
for (String schema : packet.getFieldValues()) {
schemas.add(schema);
}
for (String schema : schemas) {
// filter views
packet = connection.query("show full tables from `" + schema + "` where Table_type = 'BASE TABLE'");
List<String> tables = new ArrayList<String>();
for (String table : packet.getFieldValues()) {
if ("BASE TABLE".equalsIgnoreCase(table)) {
continue;
}
String fullName = schema + "." + table;
if (blackFilter == null || !blackFilter.filter(fullName)) {
if (filter == null || filter.filter(fullName)) {
tables.add(table);
}
}
}
if (tables.isEmpty()) {
continue;
}
StringBuilder sql = new StringBuilder();
for (String table : tables) {
sql.append("show create table `" + schema + "`.`" + table + "`;");
}
List<ResultSetPacket> packets = connection.queryMulti(sql.toString());
for (ResultSetPacket onePacket : packets) {
if (onePacket.getFieldValues().size() > 1) {
String oneTableCreateSql = onePacket.getFieldValues().get(1);
memoryTableMeta.apply(INIT_POSITION, schema, oneTableCreateSql, null);
}
}
}
return true;
} catch (IOException e) {
throw new CanalParseException(e);
}
} | java | private boolean dumpTableMeta(MysqlConnection connection, final CanalEventFilter filter) {
try {
ResultSetPacket packet = connection.query("show databases");
List<String> schemas = new ArrayList<String>();
for (String schema : packet.getFieldValues()) {
schemas.add(schema);
}
for (String schema : schemas) {
// filter views
packet = connection.query("show full tables from `" + schema + "` where Table_type = 'BASE TABLE'");
List<String> tables = new ArrayList<String>();
for (String table : packet.getFieldValues()) {
if ("BASE TABLE".equalsIgnoreCase(table)) {
continue;
}
String fullName = schema + "." + table;
if (blackFilter == null || !blackFilter.filter(fullName)) {
if (filter == null || filter.filter(fullName)) {
tables.add(table);
}
}
}
if (tables.isEmpty()) {
continue;
}
StringBuilder sql = new StringBuilder();
for (String table : tables) {
sql.append("show create table `" + schema + "`.`" + table + "`;");
}
List<ResultSetPacket> packets = connection.queryMulti(sql.toString());
for (ResultSetPacket onePacket : packets) {
if (onePacket.getFieldValues().size() > 1) {
String oneTableCreateSql = onePacket.getFieldValues().get(1);
memoryTableMeta.apply(INIT_POSITION, schema, oneTableCreateSql, null);
}
}
}
return true;
} catch (IOException e) {
throw new CanalParseException(e);
}
} | [
"private",
"boolean",
"dumpTableMeta",
"(",
"MysqlConnection",
"connection",
",",
"final",
"CanalEventFilter",
"filter",
")",
"{",
"try",
"{",
"ResultSetPacket",
"packet",
"=",
"connection",
".",
"query",
"(",
"\"show databases\"",
")",
";",
"List",
"<",
"String",... | 初始化的时候dump一下表结构 | [
"初始化的时候dump一下表结构"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/tsdb/DatabaseTableMeta.java#L197-L243 | train | Dump table meta. | [
30522,
2797,
22017,
20898,
15653,
10880,
11368,
2050,
1006,
2026,
2015,
4160,
22499,
10087,
7542,
4434,
1010,
2345,
5033,
18697,
3372,
8873,
21928,
11307,
1007,
1063,
3046,
1063,
3463,
3388,
23947,
3388,
14771,
1027,
4434,
1012,
23032,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/logging/LogLevelMapping.java | LogLevelMapping.getName | public static String getName(Level level) {
Level normalized = normalize(level);
return normalized == Level.FINE ? DEBUG : normalized.getName();
} | java | public static String getName(Level level) {
Level normalized = normalize(level);
return normalized == Level.FINE ? DEBUG : normalized.getName();
} | [
"public",
"static",
"String",
"getName",
"(",
"Level",
"level",
")",
"{",
"Level",
"normalized",
"=",
"normalize",
"(",
"level",
")",
";",
"return",
"normalized",
"==",
"Level",
".",
"FINE",
"?",
"DEBUG",
":",
"normalized",
".",
"getName",
"(",
")",
";",... | Converts the JDK level to a name supported by Selenium.
@param level log level to get the string name of
@return string name representation of the level selenium supports | [
"Converts",
"the",
"JDK",
"level",
"to",
"a",
"name",
"supported",
"by",
"Selenium",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/logging/LogLevelMapping.java#L76-L79 | train | Returns the name of the given level. | [
30522,
2270,
10763,
5164,
2131,
18442,
1006,
2504,
2504,
1007,
1063,
2504,
3671,
3550,
1027,
3671,
4697,
1006,
2504,
1007,
1025,
2709,
3671,
3550,
1027,
1027,
2504,
1012,
2986,
1029,
2139,
8569,
2290,
1024,
3671,
3550,
1012,
2131,
18442,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/digest/HMac.java | HMac.digest | public byte[] digest(byte[] data) {
byte[] result;
try {
result = mac.doFinal(data);
} finally {
mac.reset();
}
return result;
} | java | public byte[] digest(byte[] data) {
byte[] result;
try {
result = mac.doFinal(data);
} finally {
mac.reset();
}
return result;
} | [
"public",
"byte",
"[",
"]",
"digest",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"byte",
"[",
"]",
"result",
";",
"try",
"{",
"result",
"=",
"mac",
".",
"doFinal",
"(",
"data",
")",
";",
"}",
"finally",
"{",
"mac",
".",
"reset",
"(",
")",
";",
... | 生成摘要
@param data 数据bytes
@return 摘要bytes | [
"生成摘要"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/digest/HMac.java#L173-L181 | train | Computes the MD5 digest of the given byte array. | [
30522,
2270,
24880,
1031,
1033,
17886,
1006,
24880,
1031,
1033,
2951,
1007,
1063,
24880,
1031,
1033,
2765,
1025,
3046,
1063,
2765,
1027,
6097,
1012,
2079,
16294,
2389,
1006,
2951,
1007,
1025,
1065,
2633,
1063,
6097,
1012,
25141,
1006,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/operators/AbstractUdfOperator.java | AbstractUdfOperator.emptyClassArray | protected static <U> Class<U>[] emptyClassArray() {
@SuppressWarnings("unchecked")
Class<U>[] array = new Class[0];
return array;
} | java | protected static <U> Class<U>[] emptyClassArray() {
@SuppressWarnings("unchecked")
Class<U>[] array = new Class[0];
return array;
} | [
"protected",
"static",
"<",
"U",
">",
"Class",
"<",
"U",
">",
"[",
"]",
"emptyClassArray",
"(",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Class",
"<",
"U",
">",
"[",
"]",
"array",
"=",
"new",
"Class",
"[",
"0",
"]",
";",
"retur... | Generic utility function that returns an empty class array.
@param <U> The type of the classes.
@return An empty array of type <tt>Class<U></tt>. | [
"Generic",
"utility",
"function",
"that",
"returns",
"an",
"empty",
"class",
"array",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/AbstractUdfOperator.java#L154-L158 | train | Returns an empty Class array. | [
30522,
5123,
10763,
1026,
1057,
1028,
2465,
1026,
1057,
1028,
1031,
1033,
4064,
26266,
2906,
9447,
1006,
1007,
1063,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2465,
1026,
1057,
1028,
1031,
1033,
9140,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.setHost | @Deprecated
public static void setHost(HttpMessage message, String value) {
message.headers().set(HttpHeaderNames.HOST, value);
} | java | @Deprecated
public static void setHost(HttpMessage message, String value) {
message.headers().set(HttpHeaderNames.HOST, value);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"setHost",
"(",
"HttpMessage",
"message",
",",
"String",
"value",
")",
"{",
"message",
".",
"headers",
"(",
")",
".",
"set",
"(",
"HttpHeaderNames",
".",
"HOST",
",",
"value",
")",
";",
"}"
] | @deprecated Use {@link #set(CharSequence, Object)} instead.
@see #setHost(HttpMessage, CharSequence) | [
"@deprecated",
"Use",
"{",
"@link",
"#set",
"(",
"CharSequence",
"Object",
")",
"}",
"instead",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L1024-L1027 | train | Sets the Host header of the given message. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
11675,
6662,
14122,
1006,
8299,
7834,
3736,
3351,
4471,
1010,
5164,
3643,
1007,
1063,
4471,
1012,
20346,
2015,
1006,
1007,
1012,
2275,
1006,
8299,
4974,
11795,
14074,
2015,
1012,
3677,
1010,
364... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducer.java | FlinkKafkaProducer.abortTransactions | private void abortTransactions(Set<String> transactionalIds) {
for (String transactionalId : transactionalIds) {
try (FlinkKafkaInternalProducer<byte[], byte[]> kafkaProducer =
initTransactionalProducer(transactionalId, false)) {
// it suffice to call initTransactions - this will abort any lingering transactions
kafkaProducer.initTransactions();
}
}
} | java | private void abortTransactions(Set<String> transactionalIds) {
for (String transactionalId : transactionalIds) {
try (FlinkKafkaInternalProducer<byte[], byte[]> kafkaProducer =
initTransactionalProducer(transactionalId, false)) {
// it suffice to call initTransactions - this will abort any lingering transactions
kafkaProducer.initTransactions();
}
}
} | [
"private",
"void",
"abortTransactions",
"(",
"Set",
"<",
"String",
">",
"transactionalIds",
")",
"{",
"for",
"(",
"String",
"transactionalId",
":",
"transactionalIds",
")",
"{",
"try",
"(",
"FlinkKafkaInternalProducer",
"<",
"byte",
"[",
"]",
",",
"byte",
"[",... | ----------------------------------- Utilities -------------------------- | [
"-----------------------------------",
"Utilities",
"--------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducer.java#L901-L909 | train | Abort all transactions with transactionalIds | [
30522,
2797,
11675,
11113,
11589,
6494,
3619,
18908,
8496,
1006,
2275,
1026,
5164,
1028,
12598,
11475,
5104,
1007,
1063,
2005,
1006,
5164,
12598,
11475,
2094,
1024,
12598,
11475,
5104,
1007,
1063,
3046,
1006,
13109,
19839,
2912,
24316,
22325,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBean.java | AbstractFilterRegistrationBean.setUrlPatterns | public void setUrlPatterns(Collection<String> urlPatterns) {
Assert.notNull(urlPatterns, "UrlPatterns must not be null");
this.urlPatterns = new LinkedHashSet<>(urlPatterns);
} | java | public void setUrlPatterns(Collection<String> urlPatterns) {
Assert.notNull(urlPatterns, "UrlPatterns must not be null");
this.urlPatterns = new LinkedHashSet<>(urlPatterns);
} | [
"public",
"void",
"setUrlPatterns",
"(",
"Collection",
"<",
"String",
">",
"urlPatterns",
")",
"{",
"Assert",
".",
"notNull",
"(",
"urlPatterns",
",",
"\"UrlPatterns must not be null\"",
")",
";",
"this",
".",
"urlPatterns",
"=",
"new",
"LinkedHashSet",
"<>",
"(... | Set the URL patterns that the filter will be registered against. This will replace
any previously specified URL patterns.
@param urlPatterns the URL patterns
@see #setServletRegistrationBeans
@see #setServletNames | [
"Set",
"the",
"URL",
"patterns",
"that",
"the",
"filter",
"will",
"be",
"registered",
"against",
".",
"This",
"will",
"replace",
"any",
"previously",
"specified",
"URL",
"patterns",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBean.java#L142-L145 | train | Sets the URL patterns to be used in the URL. | [
30522,
2270,
11675,
2275,
3126,
14277,
20097,
3619,
1006,
3074,
1026,
5164,
1028,
24471,
14277,
20097,
3619,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
24471,
14277,
20097,
3619,
1010,
1000,
24471,
14277,
20097,
3619,
2442,
2025,
2022,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-cron/src/main/java/cn/hutool/cron/pattern/matcher/ValueMatcherBuilder.java | ValueMatcherBuilder.build | public static ValueMatcher build(String value, ValueParser parser) {
if (isMatchAllStr(value)) {
//兼容Quartz的"?"表达式,不会出现互斥情况,与"*"作用相同
return new AlwaysTrueValueMatcher();
}
List<Integer> values = parseArray(value, parser);
if (values.size() == 0) {
throw new CronException("Invalid field: [{}]", value);
}
if (parser instanceof DayOfMonthValueParser) {
//考虑每月的天数不同,且存在闰年情况,日匹配单独使用
return new DayOfMonthValueMatcher(values);
}else if(parser instanceof YearValueParser){
//考虑年数字太大,不适合boolean数组,单独使用列表遍历匹配
return new YearValueMatcher(values);
}else {
return new BoolArrayValueMatcher(values);
}
} | java | public static ValueMatcher build(String value, ValueParser parser) {
if (isMatchAllStr(value)) {
//兼容Quartz的"?"表达式,不会出现互斥情况,与"*"作用相同
return new AlwaysTrueValueMatcher();
}
List<Integer> values = parseArray(value, parser);
if (values.size() == 0) {
throw new CronException("Invalid field: [{}]", value);
}
if (parser instanceof DayOfMonthValueParser) {
//考虑每月的天数不同,且存在闰年情况,日匹配单独使用
return new DayOfMonthValueMatcher(values);
}else if(parser instanceof YearValueParser){
//考虑年数字太大,不适合boolean数组,单独使用列表遍历匹配
return new YearValueMatcher(values);
}else {
return new BoolArrayValueMatcher(values);
}
} | [
"public",
"static",
"ValueMatcher",
"build",
"(",
"String",
"value",
",",
"ValueParser",
"parser",
")",
"{",
"if",
"(",
"isMatchAllStr",
"(",
"value",
")",
")",
"{",
"//兼容Quartz的\"?\"表达式,不会出现互斥情况,与\"*\"作用相同\r",
"return",
"new",
"AlwaysTrueValueMatcher",
"(",
")",
... | 处理定时任务表达式每个时间字段<br>
多个时间使用逗号分隔
@param value 某个时间字段
@param parser 针对这个时间字段的解析器
@return List | [
"处理定时任务表达式每个时间字段<br",
">",
"多个时间使用逗号分隔"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/pattern/matcher/ValueMatcherBuilder.java#L29-L49 | train | Build a value matcher from a string. | [
30522,
2270,
10763,
3643,
18900,
7474,
3857,
1006,
5164,
3643,
1010,
3643,
19362,
8043,
11968,
8043,
1007,
1063,
2065,
1006,
2003,
18900,
18598,
4877,
16344,
30524,
1026,
16109,
1028,
5300,
1027,
11968,
17310,
11335,
2100,
1006,
3643,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java | TomcatServletWebServerFactory.setEngineValves | public void setEngineValves(Collection<? extends Valve> engineValves) {
Assert.notNull(engineValves, "Valves must not be null");
this.engineValves = new ArrayList<>(engineValves);
} | java | public void setEngineValves(Collection<? extends Valve> engineValves) {
Assert.notNull(engineValves, "Valves must not be null");
this.engineValves = new ArrayList<>(engineValves);
} | [
"public",
"void",
"setEngineValves",
"(",
"Collection",
"<",
"?",
"extends",
"Valve",
">",
"engineValves",
")",
"{",
"Assert",
".",
"notNull",
"(",
"engineValves",
",",
"\"Valves must not be null\"",
")",
";",
"this",
".",
"engineValves",
"=",
"new",
"ArrayList"... | Set {@link Valve}s that should be applied to the Tomcat {@link Engine}. Calling
this method will replace any existing valves.
@param engineValves the valves to set | [
"Set",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java#L496-L499 | train | Sets the list of engine valves to use. | [
30522,
2270,
11675,
2275,
13159,
3170,
10175,
6961,
1006,
3074,
1026,
1029,
8908,
10764,
1028,
3194,
10175,
6961,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
3194,
10175,
6961,
1010,
1000,
17355,
2442,
2025,
2022,
19701,
1000,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java | SqlConnRunner.page | public PageResult<Entity> page(Connection conn, Collection<String> fields, Entity where, Page page) throws SQLException {
checkConn(conn);
//查询全部
if(null == page){
List<Entity> entityList = this.find(conn, fields, where, new EntityListHandler());
final PageResult<Entity> pageResult = new PageResult<Entity>(0, entityList.size(), entityList.size());
pageResult.addAll(entityList);
return pageResult;
}
final int count = count(conn, where);
PageResultHandler pageResultHandler = PageResultHandler.create(new PageResult<Entity>(page.getPageNumber(), page.getPageSize(), count));
return this.page(conn, fields, where, page, pageResultHandler);
} | java | public PageResult<Entity> page(Connection conn, Collection<String> fields, Entity where, Page page) throws SQLException {
checkConn(conn);
//查询全部
if(null == page){
List<Entity> entityList = this.find(conn, fields, where, new EntityListHandler());
final PageResult<Entity> pageResult = new PageResult<Entity>(0, entityList.size(), entityList.size());
pageResult.addAll(entityList);
return pageResult;
}
final int count = count(conn, where);
PageResultHandler pageResultHandler = PageResultHandler.create(new PageResult<Entity>(page.getPageNumber(), page.getPageSize(), count));
return this.page(conn, fields, where, page, pageResultHandler);
} | [
"public",
"PageResult",
"<",
"Entity",
">",
"page",
"(",
"Connection",
"conn",
",",
"Collection",
"<",
"String",
">",
"fields",
",",
"Entity",
"where",
",",
"Page",
"page",
")",
"throws",
"SQLException",
"{",
"checkConn",
"(",
"conn",
")",
";",
"//查询全部\r",... | 分页查询<br>
此方法不会关闭Connection
@param conn 数据库连接对象
@param fields 返回的字段列表,null则返回所有字段
@param where 条件实体类(包含表名)
@param page 分页对象
@return 结果对象
@throws SQLException SQL执行异常 | [
"分页查询<br",
">",
"此方法不会关闭Connection"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java#L528-L542 | train | Gets a page of entities in the database. | [
30522,
2270,
3931,
6072,
11314,
1026,
9178,
1028,
3931,
1006,
4434,
9530,
2078,
1010,
3074,
1026,
5164,
1028,
4249,
1010,
9178,
2073,
1010,
3931,
3931,
1007,
11618,
29296,
10288,
24422,
1063,
4638,
8663,
2078,
1006,
9530,
2078,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.tail | public static void tail(File file, LineHandler handler) {
tail(file, CharsetUtil.CHARSET_UTF_8, handler);
} | java | public static void tail(File file, LineHandler handler) {
tail(file, CharsetUtil.CHARSET_UTF_8, handler);
} | [
"public",
"static",
"void",
"tail",
"(",
"File",
"file",
",",
"LineHandler",
"handler",
")",
"{",
"tail",
"(",
"file",
",",
"CharsetUtil",
".",
"CHARSET_UTF_8",
",",
"handler",
")",
";",
"}"
] | 文件内容跟随器,实现类似Linux下"tail -f"命令功能<br>
此方法会阻塞当前线程
@param file 文件
@param handler 行处理器 | [
"文件内容跟随器,实现类似Linux下",
"tail",
"-",
"f",
"命令功能<br",
">",
"此方法会阻塞当前线程"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3472-L3474 | train | Reads the tail of the file using the given LineHandler. | [
30522,
2270,
10763,
11675,
5725,
1006,
5371,
5371,
1010,
2240,
11774,
3917,
28213,
1007,
1063,
5725,
1006,
5371,
1010,
25869,
13462,
21823,
2140,
1012,
25869,
13462,
1035,
21183,
2546,
1035,
1022,
1010,
28213,
1007,
1025,
1065,
102,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/filesystem/StreamingFileSink.java | StreamingFileSink.initializeState | @Override
public void initializeState(FunctionInitializationContext context) throws Exception {
final int subtaskIndex = getRuntimeContext().getIndexOfThisSubtask();
this.buckets = bucketsBuilder.createBuckets(subtaskIndex);
final OperatorStateStore stateStore = context.getOperatorStateStore();
bucketStates = stateStore.getListState(BUCKET_STATE_DESC);
maxPartCountersState = stateStore.getUnionListState(MAX_PART_COUNTER_STATE_DESC);
if (context.isRestored()) {
buckets.initializeState(bucketStates, maxPartCountersState);
}
} | java | @Override
public void initializeState(FunctionInitializationContext context) throws Exception {
final int subtaskIndex = getRuntimeContext().getIndexOfThisSubtask();
this.buckets = bucketsBuilder.createBuckets(subtaskIndex);
final OperatorStateStore stateStore = context.getOperatorStateStore();
bucketStates = stateStore.getListState(BUCKET_STATE_DESC);
maxPartCountersState = stateStore.getUnionListState(MAX_PART_COUNTER_STATE_DESC);
if (context.isRestored()) {
buckets.initializeState(bucketStates, maxPartCountersState);
}
} | [
"@",
"Override",
"public",
"void",
"initializeState",
"(",
"FunctionInitializationContext",
"context",
")",
"throws",
"Exception",
"{",
"final",
"int",
"subtaskIndex",
"=",
"getRuntimeContext",
"(",
")",
".",
"getIndexOfThisSubtask",
"(",
")",
";",
"this",
".",
"b... | --------------------------- Sink Methods ----------------------------- | [
"---------------------------",
"Sink",
"Methods",
"-----------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/filesystem/StreamingFileSink.java#L324-L336 | train | Initialize the state of the operation. | [
30522,
1030,
2058,
15637,
2270,
11675,
3988,
10057,
12259,
1006,
3853,
5498,
20925,
3989,
8663,
18209,
6123,
1007,
11618,
6453,
1063,
2345,
20014,
4942,
10230,
18824,
10288,
1027,
2131,
15532,
7292,
8663,
18209,
1006,
1007,
1012,
2131,
22254,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/summarize/aggregation/SummaryAggregatorFactory.java | SummaryAggregatorFactory.create | @SuppressWarnings("unchecked")
public static <T, R> Aggregator<T, R> create(Class<T> type) {
if (type == Long.class) {
return (Aggregator<T, R>) new LongSummaryAggregator();
}
else if (type == LongValue.class) {
return (Aggregator<T, R>) new ValueSummaryAggregator.LongValueSummaryAggregator();
}
else if (type == Integer.class) {
return (Aggregator<T, R>) new IntegerSummaryAggregator();
}
else if (type == IntValue.class) {
return (Aggregator<T, R>) new ValueSummaryAggregator.IntegerValueSummaryAggregator();
}
else if (type == Double.class) {
return (Aggregator<T, R>) new DoubleSummaryAggregator();
}
else if (type == DoubleValue.class) {
return (Aggregator<T, R>) new ValueSummaryAggregator.DoubleValueSummaryAggregator();
}
else if (type == Float.class) {
return (Aggregator<T, R>) new FloatSummaryAggregator();
}
else if (type == FloatValue.class) {
return (Aggregator<T, R>) new ValueSummaryAggregator.FloatValueSummaryAggregator();
}
else if (type == Short.class) {
return (Aggregator<T, R>) new ShortSummaryAggregator();
}
else if (type == ShortValue.class) {
return (Aggregator<T, R>) new ValueSummaryAggregator.ShortValueSummaryAggregator();
}
else if (type == Boolean.class) {
return (Aggregator<T, R>) new BooleanSummaryAggregator();
}
else if (type == BooleanValue.class) {
return (Aggregator<T, R>) new ValueSummaryAggregator.BooleanValueSummaryAggregator();
}
else if (type == String.class) {
return (Aggregator<T, R>) new StringSummaryAggregator();
}
else if (type == StringValue.class) {
return (Aggregator<T, R>) new ValueSummaryAggregator.StringValueSummaryAggregator();
}
else {
// rather than error for unsupported types do something very generic
return (Aggregator<T, R>) new ObjectSummaryAggregator();
}
} | java | @SuppressWarnings("unchecked")
public static <T, R> Aggregator<T, R> create(Class<T> type) {
if (type == Long.class) {
return (Aggregator<T, R>) new LongSummaryAggregator();
}
else if (type == LongValue.class) {
return (Aggregator<T, R>) new ValueSummaryAggregator.LongValueSummaryAggregator();
}
else if (type == Integer.class) {
return (Aggregator<T, R>) new IntegerSummaryAggregator();
}
else if (type == IntValue.class) {
return (Aggregator<T, R>) new ValueSummaryAggregator.IntegerValueSummaryAggregator();
}
else if (type == Double.class) {
return (Aggregator<T, R>) new DoubleSummaryAggregator();
}
else if (type == DoubleValue.class) {
return (Aggregator<T, R>) new ValueSummaryAggregator.DoubleValueSummaryAggregator();
}
else if (type == Float.class) {
return (Aggregator<T, R>) new FloatSummaryAggregator();
}
else if (type == FloatValue.class) {
return (Aggregator<T, R>) new ValueSummaryAggregator.FloatValueSummaryAggregator();
}
else if (type == Short.class) {
return (Aggregator<T, R>) new ShortSummaryAggregator();
}
else if (type == ShortValue.class) {
return (Aggregator<T, R>) new ValueSummaryAggregator.ShortValueSummaryAggregator();
}
else if (type == Boolean.class) {
return (Aggregator<T, R>) new BooleanSummaryAggregator();
}
else if (type == BooleanValue.class) {
return (Aggregator<T, R>) new ValueSummaryAggregator.BooleanValueSummaryAggregator();
}
else if (type == String.class) {
return (Aggregator<T, R>) new StringSummaryAggregator();
}
else if (type == StringValue.class) {
return (Aggregator<T, R>) new ValueSummaryAggregator.StringValueSummaryAggregator();
}
else {
// rather than error for unsupported types do something very generic
return (Aggregator<T, R>) new ObjectSummaryAggregator();
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
",",
"R",
">",
"Aggregator",
"<",
"T",
",",
"R",
">",
"create",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"Long",
".",
"class",
")",
"... | Create a SummaryAggregator for the supplied type.
@param <T> the type to aggregate
@param <R> the result type of the aggregation | [
"Create",
"a",
"SummaryAggregator",
"for",
"the",
"supplied",
"type",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/summarize/aggregation/SummaryAggregatorFactory.java#L53-L101 | train | Creates an instance of the specified type. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1056,
1010,
1054,
1028,
24089,
1026,
1056,
1010,
1054,
1028,
3443,
1006,
2465,
1026,
1056,
1028,
2828,
1007,
1063,
2065,
1006,
2828,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/interval/IntervalNode.java | IntervalNode.findOverlappingRanges | protected static List<Intervalable> findOverlappingRanges(IntervalNode node, Intervalable interval)
{
if (node != null)
{
return node.findOverlaps(interval);
}
return Collections.emptyList();
} | java | protected static List<Intervalable> findOverlappingRanges(IntervalNode node, Intervalable interval)
{
if (node != null)
{
return node.findOverlaps(interval);
}
return Collections.emptyList();
} | [
"protected",
"static",
"List",
"<",
"Intervalable",
">",
"findOverlappingRanges",
"(",
"IntervalNode",
"node",
",",
"Intervalable",
"interval",
")",
"{",
"if",
"(",
"node",
"!=",
"null",
")",
"{",
"return",
"node",
".",
"findOverlaps",
"(",
"interval",
")",
... | 是对IntervalNode.findOverlaps(Intervalable)的一个包装,防止NPE
@see com.hankcs.hanlp.algorithm.ahocorasick.interval.IntervalNode#findOverlaps(Intervalable)
@param node
@param interval
@return | [
"是对IntervalNode",
".",
"findOverlaps",
"(",
"Intervalable",
")",
"的一个包装,防止NPE"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/interval/IntervalNode.java#L207-L214 | train | Find overlapping ranges. | [
30522,
5123,
10763,
2862,
1026,
13483,
3085,
1028,
2424,
7840,
2721,
14853,
24388,
2229,
1006,
13483,
3630,
3207,
13045,
1010,
13483,
3085,
13483,
1007,
1063,
2065,
1006,
13045,
999,
1027,
19701,
1007,
1063,
2709,
13045,
1012,
2424,
7840,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/interactions/touch/TouchActions.java | TouchActions.scroll | public TouchActions scroll(int xOffset, int yOffset) {
if (touchScreen != null) {
action.addAction(new ScrollAction(touchScreen, xOffset, yOffset));
}
return this;
} | java | public TouchActions scroll(int xOffset, int yOffset) {
if (touchScreen != null) {
action.addAction(new ScrollAction(touchScreen, xOffset, yOffset));
}
return this;
} | [
"public",
"TouchActions",
"scroll",
"(",
"int",
"xOffset",
",",
"int",
"yOffset",
")",
"{",
"if",
"(",
"touchScreen",
"!=",
"null",
")",
"{",
"action",
".",
"addAction",
"(",
"new",
"ScrollAction",
"(",
"touchScreen",
",",
"xOffset",
",",
"yOffset",
")",
... | Allows the view to be scrolled by an x and y offset.
@param xOffset The horizontal offset relative to the viewport
@param yOffset The vertical offset relative to the viewport
@return self | [
"Allows",
"the",
"view",
"to",
"be",
"scrolled",
"by",
"an",
"x",
"and",
"y",
"offset",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/touch/TouchActions.java#L158-L163 | train | Scroll the screen. | [
30522,
2270,
3543,
18908,
8496,
17186,
1006,
20014,
1060,
27475,
3388,
1010,
20014,
10930,
21807,
3388,
1007,
1063,
2065,
1006,
3543,
18182,
999,
1027,
19701,
1007,
1063,
2895,
1012,
5587,
18908,
3258,
1006,
2047,
17186,
18908,
3258,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java | HiveSessionImplwithUGI.setSessionUGI | public void setSessionUGI(String owner) throws HiveSQLException {
if (owner == null) {
throw new HiveSQLException("No username provided for impersonation");
}
if (UserGroupInformation.isSecurityEnabled()) {
try {
sessionUgi = UserGroupInformation.createProxyUser(
owner, UserGroupInformation.getLoginUser());
} catch (IOException e) {
throw new HiveSQLException("Couldn't setup proxy user", e);
}
} else {
sessionUgi = UserGroupInformation.createRemoteUser(owner);
}
} | java | public void setSessionUGI(String owner) throws HiveSQLException {
if (owner == null) {
throw new HiveSQLException("No username provided for impersonation");
}
if (UserGroupInformation.isSecurityEnabled()) {
try {
sessionUgi = UserGroupInformation.createProxyUser(
owner, UserGroupInformation.getLoginUser());
} catch (IOException e) {
throw new HiveSQLException("Couldn't setup proxy user", e);
}
} else {
sessionUgi = UserGroupInformation.createRemoteUser(owner);
}
} | [
"public",
"void",
"setSessionUGI",
"(",
"String",
"owner",
")",
"throws",
"HiveSQLException",
"{",
"if",
"(",
"owner",
"==",
"null",
")",
"{",
"throw",
"new",
"HiveSQLException",
"(",
"\"No username provided for impersonation\"",
")",
";",
"}",
"if",
"(",
"UserG... | setup appropriate UGI for the session | [
"setup",
"appropriate",
"UGI",
"for",
"the",
"session"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java#L65-L79 | train | Set the session UGI. | [
30522,
2270,
11675,
4520,
7971,
3258,
15916,
2072,
1006,
5164,
3954,
1007,
11618,
26736,
2015,
4160,
2571,
2595,
24422,
1063,
2065,
1006,
3954,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
26736,
2015,
4160,
2571,
2595,
24422,
1006,
1000,
205... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/JobGraph.java | JobGraph.addUserArtifact | public void addUserArtifact(String name, DistributedCache.DistributedCacheEntry file) {
if (file == null) {
throw new IllegalArgumentException();
}
userArtifacts.putIfAbsent(name, file);
} | java | public void addUserArtifact(String name, DistributedCache.DistributedCacheEntry file) {
if (file == null) {
throw new IllegalArgumentException();
}
userArtifacts.putIfAbsent(name, file);
} | [
"public",
"void",
"addUserArtifact",
"(",
"String",
"name",
",",
"DistributedCache",
".",
"DistributedCacheEntry",
"file",
")",
"{",
"if",
"(",
"file",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"userArtifacts",
"."... | Adds the path of a custom file required to run the job on a task manager.
@param name a name under which this artifact will be accessible through {@link DistributedCache}
@param file path of a custom file required to run the job on a task manager | [
"Adds",
"the",
"path",
"of",
"a",
"custom",
"file",
"required",
"to",
"run",
"the",
"job",
"on",
"a",
"task",
"manager",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/JobGraph.java#L517-L523 | train | Add a user artifact to the cache. | [
30522,
2270,
11675,
5587,
20330,
8445,
10128,
18908,
1006,
5164,
2171,
1010,
5500,
3540,
5403,
1012,
5500,
3540,
25923,
3372,
2854,
5371,
1007,
1063,
2065,
1006,
5371,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
259... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/reader/AbstractReader.java | AbstractReader.registerTaskEventListener | @Override
public void registerTaskEventListener(EventListener<TaskEvent> listener, Class<? extends TaskEvent> eventType) {
taskEventHandler.subscribe(listener, eventType);
} | java | @Override
public void registerTaskEventListener(EventListener<TaskEvent> listener, Class<? extends TaskEvent> eventType) {
taskEventHandler.subscribe(listener, eventType);
} | [
"@",
"Override",
"public",
"void",
"registerTaskEventListener",
"(",
"EventListener",
"<",
"TaskEvent",
">",
"listener",
",",
"Class",
"<",
"?",
"extends",
"TaskEvent",
">",
"eventType",
")",
"{",
"taskEventHandler",
".",
"subscribe",
"(",
"listener",
",",
"even... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/reader/AbstractReader.java#L66-L69 | train | Register an event listener for the specified event type. | [
30522,
1030,
2058,
15637,
2270,
11675,
4236,
10230,
3489,
15338,
9863,
24454,
1006,
2724,
9863,
24454,
1026,
4708,
18697,
3372,
1028,
19373,
1010,
2465,
1026,
1029,
8908,
4708,
18697,
3372,
1028,
2724,
13874,
1007,
1063,
4708,
18697,
3372,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java | WatchMonitor.create | public static WatchMonitor create(URI uri, WatchEvent.Kind<?>... events){
return create(uri, 0, events);
} | java | public static WatchMonitor create(URI uri, WatchEvent.Kind<?>... events){
return create(uri, 0, events);
} | [
"public",
"static",
"WatchMonitor",
"create",
"(",
"URI",
"uri",
",",
"WatchEvent",
".",
"Kind",
"<",
"?",
">",
"...",
"events",
")",
"{",
"return",
"create",
"(",
"uri",
",",
"0",
",",
"events",
")",
";",
"}"
] | 创建并初始化监听
@param uri URI
@param events 监听的事件列表
@return 监听对象 | [
"创建并初始化监听"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java#L109-L111 | train | Creates a new watch monitor that will watch the given URI and add the given events to it. | [
30522,
2270,
10763,
3422,
8202,
15660,
3443,
1006,
24471,
2072,
24471,
2072,
1010,
3422,
18697,
3372,
1012,
2785,
1026,
1029,
1028,
1012,
1012,
1012,
2824,
1007,
1063,
2709,
3443,
1006,
24471,
2072,
1010,
1014,
1010,
2824,
1007,
1025,
1065,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/MemoryLogger.java | MemoryLogger.getGarbageCollectorStatsAsString | public static String getGarbageCollectorStatsAsString(List<GarbageCollectorMXBean> gcMXBeans) {
StringBuilder bld = new StringBuilder("Garbage collector stats: ");
for (GarbageCollectorMXBean bean : gcMXBeans) {
bld.append('[').append(bean.getName()).append(", GC TIME (ms): ").append(bean.getCollectionTime());
bld.append(", GC COUNT: ").append(bean.getCollectionCount()).append(']');
bld.append(", ");
}
if (!gcMXBeans.isEmpty()) {
bld.setLength(bld.length() - 2);
}
return bld.toString();
} | java | public static String getGarbageCollectorStatsAsString(List<GarbageCollectorMXBean> gcMXBeans) {
StringBuilder bld = new StringBuilder("Garbage collector stats: ");
for (GarbageCollectorMXBean bean : gcMXBeans) {
bld.append('[').append(bean.getName()).append(", GC TIME (ms): ").append(bean.getCollectionTime());
bld.append(", GC COUNT: ").append(bean.getCollectionCount()).append(']');
bld.append(", ");
}
if (!gcMXBeans.isEmpty()) {
bld.setLength(bld.length() - 2);
}
return bld.toString();
} | [
"public",
"static",
"String",
"getGarbageCollectorStatsAsString",
"(",
"List",
"<",
"GarbageCollectorMXBean",
">",
"gcMXBeans",
")",
"{",
"StringBuilder",
"bld",
"=",
"new",
"StringBuilder",
"(",
"\"Garbage collector stats: \"",
")",
";",
"for",
"(",
"GarbageCollectorMX... | Gets the garbage collection statistics from the JVM.
@param gcMXBeans The collection of garbage collector beans.
@return A string denoting the number of times and total elapsed time in garbage collection. | [
"Gets",
"the",
"garbage",
"collection",
"statistics",
"from",
"the",
"JVM",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/MemoryLogger.java#L231-L246 | train | Get the garbage collector stats as string. | [
30522,
2270,
10763,
5164,
2131,
6843,
16078,
8586,
14511,
22471,
5668,
29336,
20939,
3367,
4892,
1006,
2862,
1026,
13044,
26895,
22471,
2953,
22984,
4783,
2319,
1028,
1043,
27487,
2595,
4783,
6962,
1007,
1063,
5164,
8569,
23891,
2099,
1038,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/RowTypeInfo.java | RowTypeInfo.projectFields | public static RowTypeInfo projectFields(RowTypeInfo rowType, int[] fieldMapping) {
TypeInformation[] fieldTypes = new TypeInformation[fieldMapping.length];
String[] fieldNames = new String[fieldMapping.length];
for (int i = 0; i < fieldMapping.length; i++) {
fieldTypes[i] = rowType.getTypeAt(fieldMapping[i]);
fieldNames[i] = rowType.getFieldNames()[fieldMapping[i]];
}
return new RowTypeInfo(fieldTypes, fieldNames);
} | java | public static RowTypeInfo projectFields(RowTypeInfo rowType, int[] fieldMapping) {
TypeInformation[] fieldTypes = new TypeInformation[fieldMapping.length];
String[] fieldNames = new String[fieldMapping.length];
for (int i = 0; i < fieldMapping.length; i++) {
fieldTypes[i] = rowType.getTypeAt(fieldMapping[i]);
fieldNames[i] = rowType.getFieldNames()[fieldMapping[i]];
}
return new RowTypeInfo(fieldTypes, fieldNames);
} | [
"public",
"static",
"RowTypeInfo",
"projectFields",
"(",
"RowTypeInfo",
"rowType",
",",
"int",
"[",
"]",
"fieldMapping",
")",
"{",
"TypeInformation",
"[",
"]",
"fieldTypes",
"=",
"new",
"TypeInformation",
"[",
"fieldMapping",
".",
"length",
"]",
";",
"String",
... | Creates a {@link RowTypeInfo} with projected fields.
@param rowType The original RowTypeInfo whose fields are projected
@param fieldMapping The field mapping of the projection
@return A RowTypeInfo with projected fields. | [
"Creates",
"a",
"{",
"@link",
"RowTypeInfo",
"}",
"with",
"projected",
"fields",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/RowTypeInfo.java#L388-L396 | train | Project the fields of the given row type and fieldMapping into a RowTypeInfo. | [
30522,
2270,
10763,
5216,
13874,
2378,
14876,
2622,
15155,
1006,
5216,
13874,
2378,
14876,
5216,
13874,
1010,
20014,
1031,
1033,
2492,
2863,
14853,
1007,
1063,
2828,
2378,
14192,
3370,
1031,
1033,
2492,
13874,
2015,
1027,
2047,
2828,
2378,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | core/src/main/java/org/apache/spark/io/NioBufferedFileInputStream.java | NioBufferedFileInputStream.refill | private boolean refill() throws IOException {
if (!byteBuffer.hasRemaining()) {
byteBuffer.clear();
int nRead = 0;
while (nRead == 0) {
nRead = fileChannel.read(byteBuffer);
}
if (nRead < 0) {
return false;
}
byteBuffer.flip();
}
return true;
} | java | private boolean refill() throws IOException {
if (!byteBuffer.hasRemaining()) {
byteBuffer.clear();
int nRead = 0;
while (nRead == 0) {
nRead = fileChannel.read(byteBuffer);
}
if (nRead < 0) {
return false;
}
byteBuffer.flip();
}
return true;
} | [
"private",
"boolean",
"refill",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"byteBuffer",
".",
"hasRemaining",
"(",
")",
")",
"{",
"byteBuffer",
".",
"clear",
"(",
")",
";",
"int",
"nRead",
"=",
"0",
";",
"while",
"(",
"nRead",
"==",
"0",... | Checks weather data is left to be read from the input stream.
@return true if data is left, false otherwise
@throws IOException | [
"Checks",
"weather",
"data",
"is",
"left",
"to",
"be",
"read",
"from",
"the",
"input",
"stream",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/io/NioBufferedFileInputStream.java#L56-L69 | train | refill the underlying file | [
30522,
2797,
22017,
20898,
25416,
8591,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
999,
24880,
8569,
12494,
1012,
2038,
28578,
8113,
2075,
1006,
1007,
1007,
1063,
24880,
8569,
12494,
1012,
3154,
1006,
1007,
1025,
20014,
17212,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/dictionary/DictionaryMaker.java | DictionaryMaker.loadAsItemList | public static List<Item> loadAsItemList(String path)
{
List<Item> itemList = new LinkedList<Item>();
try
{
BufferedReader br = new BufferedReader(new InputStreamReader(IOAdapter == null ? new FileInputStream(path) :
IOAdapter.open(path), "UTF-8"));
String line;
while ((line = br.readLine()) != null)
{
Item item = Item.create(line);
if (item == null)
{
logger.warning("使用【" + line + "】创建Item失败");
return null;
// continue;
}
itemList.add(item);
}
}
catch (Exception e)
{
logger.warning("读取词典" + path + "发生异常" + e);
return null;
}
return itemList;
} | java | public static List<Item> loadAsItemList(String path)
{
List<Item> itemList = new LinkedList<Item>();
try
{
BufferedReader br = new BufferedReader(new InputStreamReader(IOAdapter == null ? new FileInputStream(path) :
IOAdapter.open(path), "UTF-8"));
String line;
while ((line = br.readLine()) != null)
{
Item item = Item.create(line);
if (item == null)
{
logger.warning("使用【" + line + "】创建Item失败");
return null;
// continue;
}
itemList.add(item);
}
}
catch (Exception e)
{
logger.warning("读取词典" + path + "发生异常" + e);
return null;
}
return itemList;
} | [
"public",
"static",
"List",
"<",
"Item",
">",
"loadAsItemList",
"(",
"String",
"path",
")",
"{",
"List",
"<",
"Item",
">",
"itemList",
"=",
"new",
"LinkedList",
"<",
"Item",
">",
"(",
")",
";",
"try",
"{",
"BufferedReader",
"br",
"=",
"new",
"BufferedR... | 读取所有条目
@param path
@return | [
"读取所有条目"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/dictionary/DictionaryMaker.java#L99-L126 | train | Load as item list. | [
30522,
2270,
10763,
2862,
1026,
8875,
1028,
7170,
21369,
18532,
9863,
1006,
5164,
4130,
1007,
1063,
2862,
1026,
8875,
1028,
8875,
9863,
1027,
2047,
5799,
9863,
1026,
8875,
1028,
1006,
1007,
1025,
3046,
1063,
17698,
2098,
16416,
4063,
7987,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.setStrings | public void setStrings(String name, String... values) {
set(name, StringUtils.arrayToString(values));
} | java | public void setStrings(String name, String... values) {
set(name, StringUtils.arrayToString(values));
} | [
"public",
"void",
"setStrings",
"(",
"String",
"name",
",",
"String",
"...",
"values",
")",
"{",
"set",
"(",
"name",
",",
"StringUtils",
".",
"arrayToString",
"(",
"values",
")",
")",
";",
"}"
] | Set the array of string values for the <code>name</code> property as
as comma delimited values.
@param name property name.
@param values The values | [
"Set",
"the",
"array",
"of",
"string",
"values",
"for",
"the",
"<code",
">",
"name<",
"/",
"code",
">",
"property",
"as",
"as",
"comma",
"delimited",
"values",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L2142-L2144 | train | Sets the value of the specified property to the specified Strings. | [
30522,
2270,
11675,
4520,
18886,
3070,
2015,
1006,
5164,
2171,
1010,
5164,
1012,
1012,
1012,
5300,
1007,
1063,
2275,
1006,
2171,
1010,
5164,
21823,
4877,
1012,
9140,
13122,
18886,
3070,
1006,
5300,
1007,
1007,
1025,
1065,
102,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySession.java | SpdySession.hasReceivedReply | boolean hasReceivedReply(int streamId) {
StreamState state = activeStreams.get(streamId);
return state != null && state.hasReceivedReply();
} | java | boolean hasReceivedReply(int streamId) {
StreamState state = activeStreams.get(streamId);
return state != null && state.hasReceivedReply();
} | [
"boolean",
"hasReceivedReply",
"(",
"int",
"streamId",
")",
"{",
"StreamState",
"state",
"=",
"activeStreams",
".",
"get",
"(",
"streamId",
")",
";",
"return",
"state",
"!=",
"null",
"&&",
"state",
".",
"hasReceivedReply",
"(",
")",
";",
"}"
] | /*
hasReceivedReply and receivedReply are only called from channelRead()
no need to synchronize access to the StreamState | [
"/",
"*",
"hasReceivedReply",
"and",
"receivedReply",
"are",
"only",
"called",
"from",
"channelRead",
"()",
"no",
"need",
"to",
"synchronize",
"access",
"to",
"the",
"StreamState"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySession.java#L136-L139 | train | Returns true if the stream has received a reply. | [
30522,
22017,
20898,
2038,
2890,
3401,
3512,
16200,
22086,
1006,
20014,
5460,
3593,
1007,
1063,
9199,
12259,
2110,
1027,
3161,
21422,
2015,
1012,
2131,
1006,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-swift-fs-hadoop/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.getPasswordFromCredentialProviders | protected char[] getPasswordFromCredentialProviders(String name)
throws IOException {
char[] pass = null;
try {
List<CredentialProvider> providers =
CredentialProviderFactory.getProviders(this);
if (providers != null) {
for (CredentialProvider provider : providers) {
try {
CredentialEntry entry = provider.getCredentialEntry(name);
if (entry != null) {
pass = entry.getCredential();
break;
}
}
catch (IOException ioe) {
throw new IOException("Can't get key " + name + " from key provider" +
"of type: " + provider.getClass().getName() + ".", ioe);
}
}
}
}
catch (IOException ioe) {
throw new IOException("Configuration problem with provider path.", ioe);
}
return pass;
} | java | protected char[] getPasswordFromCredentialProviders(String name)
throws IOException {
char[] pass = null;
try {
List<CredentialProvider> providers =
CredentialProviderFactory.getProviders(this);
if (providers != null) {
for (CredentialProvider provider : providers) {
try {
CredentialEntry entry = provider.getCredentialEntry(name);
if (entry != null) {
pass = entry.getCredential();
break;
}
}
catch (IOException ioe) {
throw new IOException("Can't get key " + name + " from key provider" +
"of type: " + provider.getClass().getName() + ".", ioe);
}
}
}
}
catch (IOException ioe) {
throw new IOException("Configuration problem with provider path.", ioe);
}
return pass;
} | [
"protected",
"char",
"[",
"]",
"getPasswordFromCredentialProviders",
"(",
"String",
"name",
")",
"throws",
"IOException",
"{",
"char",
"[",
"]",
"pass",
"=",
"null",
";",
"try",
"{",
"List",
"<",
"CredentialProvider",
">",
"providers",
"=",
"CredentialProviderFa... | Try and resolve the provided element name as a credential provider
alias.
@param name alias of the provisioned credential
@return password or null if not found
@throws IOException | [
"Try",
"and",
"resolve",
"the",
"provided",
"element",
"name",
"as",
"a",
"credential",
"provider",
"alias",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-swift-fs-hadoop/src/main/java/org/apache/hadoop/conf/Configuration.java#L1929-L1957 | train | Get the password from the credential providers. | [
30522,
5123,
25869,
1031,
1033,
2131,
15194,
18351,
19699,
5358,
16748,
16454,
4818,
21572,
17258,
2545,
1006,
5164,
2171,
1007,
11618,
22834,
10288,
24422,
1063,
25869,
1031,
1033,
3413,
1027,
19701,
1025,
3046,
1063,
2862,
1026,
13675,
1472... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamstatus/StatusWatermarkValve.java | StatusWatermarkValve.inputWatermark | public void inputWatermark(Watermark watermark, int channelIndex) {
// ignore the input watermark if its input channel, or all input channels are idle (i.e. overall the valve is idle).
if (lastOutputStreamStatus.isActive() && channelStatuses[channelIndex].streamStatus.isActive()) {
long watermarkMillis = watermark.getTimestamp();
// if the input watermark's value is less than the last received watermark for its input channel, ignore it also.
if (watermarkMillis > channelStatuses[channelIndex].watermark) {
channelStatuses[channelIndex].watermark = watermarkMillis;
// previously unaligned input channels are now aligned if its watermark has caught up
if (!channelStatuses[channelIndex].isWatermarkAligned && watermarkMillis >= lastOutputWatermark) {
channelStatuses[channelIndex].isWatermarkAligned = true;
}
// now, attempt to find a new min watermark across all aligned channels
findAndOutputNewMinWatermarkAcrossAlignedChannels();
}
}
} | java | public void inputWatermark(Watermark watermark, int channelIndex) {
// ignore the input watermark if its input channel, or all input channels are idle (i.e. overall the valve is idle).
if (lastOutputStreamStatus.isActive() && channelStatuses[channelIndex].streamStatus.isActive()) {
long watermarkMillis = watermark.getTimestamp();
// if the input watermark's value is less than the last received watermark for its input channel, ignore it also.
if (watermarkMillis > channelStatuses[channelIndex].watermark) {
channelStatuses[channelIndex].watermark = watermarkMillis;
// previously unaligned input channels are now aligned if its watermark has caught up
if (!channelStatuses[channelIndex].isWatermarkAligned && watermarkMillis >= lastOutputWatermark) {
channelStatuses[channelIndex].isWatermarkAligned = true;
}
// now, attempt to find a new min watermark across all aligned channels
findAndOutputNewMinWatermarkAcrossAlignedChannels();
}
}
} | [
"public",
"void",
"inputWatermark",
"(",
"Watermark",
"watermark",
",",
"int",
"channelIndex",
")",
"{",
"// ignore the input watermark if its input channel, or all input channels are idle (i.e. overall the valve is idle).",
"if",
"(",
"lastOutputStreamStatus",
".",
"isActive",
"("... | Feed a {@link Watermark} into the valve. If the input triggers the valve to output a new Watermark,
{@link ValveOutputHandler#handleWatermark(Watermark)} will be called to process the new Watermark.
@param watermark the watermark to feed to the valve
@param channelIndex the index of the channel that the fed watermark belongs to (index starting from 0) | [
"Feed",
"a",
"{",
"@link",
"Watermark",
"}",
"into",
"the",
"valve",
".",
"If",
"the",
"input",
"triggers",
"the",
"valve",
"to",
"output",
"a",
"new",
"Watermark",
"{",
"@link",
"ValveOutputHandler#handleWatermark",
"(",
"Watermark",
")",
"}",
"will",
"be",... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamstatus/StatusWatermarkValve.java#L96-L114 | train | This method is called by the client when an input watermark is received for a particular channel. It will ignore the input watermark if it is not idle and all input channels are idle. | [
30522,
2270,
11675,
7953,
5880,
10665,
1006,
2300,
10665,
2300,
10665,
1010,
20014,
3149,
22254,
10288,
1007,
1063,
1013,
1013,
8568,
1996,
7953,
2300,
10665,
2065,
2049,
7953,
3149,
1010,
2030,
2035,
7953,
6833,
2024,
18373,
1006,
1045,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java | IterUtil.getFirst | public static <T> T getFirst(Iterable<T> iterable) {
if (null != iterable) {
return getFirst(iterable.iterator());
}
return null;
} | java | public static <T> T getFirst(Iterable<T> iterable) {
if (null != iterable) {
return getFirst(iterable.iterator());
}
return null;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getFirst",
"(",
"Iterable",
"<",
"T",
">",
"iterable",
")",
"{",
"if",
"(",
"null",
"!=",
"iterable",
")",
"{",
"return",
"getFirst",
"(",
"iterable",
".",
"iterator",
"(",
")",
")",
";",
"}",
"return",
"nul... | 获取集合的第一个元素
@param <T> 集合元素类型
@param iterable {@link Iterable}
@return 第一个元素 | [
"获取集合的第一个元素"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java#L497-L502 | train | Gets the first element of the iterable. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
30524,
19701,
999,
1027,
2009,
6906,
3468,
1007,
1063,
2709,
2131,
8873,
12096,
1006,
2009,
6906,
3468,
1012,
2009,
6906,
4263,
1006,
1007,
1007,
1025,
1065,
2709,
19701,
1025,
1065,
102,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/mining/word/TfIdf.java | TfIdf.idf | public static <TERM> Map<TERM, Double> idf(Iterable<Iterable<TERM>> documentVocabularies,
boolean smooth, boolean addOne)
{
Map<TERM, Integer> df = new HashMap<TERM, Integer>();
int d = smooth ? 1 : 0;
int a = addOne ? 1 : 0;
int n = d;
for (Iterable<TERM> documentVocabulary : documentVocabularies)
{
n += 1;
for (TERM term : documentVocabulary)
{
Integer t = df.get(term);
if (t == null) t = d;
df.put(term, t + 1);
}
}
Map<TERM, Double> idf = new HashMap<TERM, Double>();
for (Map.Entry<TERM, Integer> e : df.entrySet())
{
TERM term = e.getKey();
double f = e.getValue();
idf.put(term, Math.log(n / f) + a);
}
return idf;
} | java | public static <TERM> Map<TERM, Double> idf(Iterable<Iterable<TERM>> documentVocabularies,
boolean smooth, boolean addOne)
{
Map<TERM, Integer> df = new HashMap<TERM, Integer>();
int d = smooth ? 1 : 0;
int a = addOne ? 1 : 0;
int n = d;
for (Iterable<TERM> documentVocabulary : documentVocabularies)
{
n += 1;
for (TERM term : documentVocabulary)
{
Integer t = df.get(term);
if (t == null) t = d;
df.put(term, t + 1);
}
}
Map<TERM, Double> idf = new HashMap<TERM, Double>();
for (Map.Entry<TERM, Integer> e : df.entrySet())
{
TERM term = e.getKey();
double f = e.getValue();
idf.put(term, Math.log(n / f) + a);
}
return idf;
} | [
"public",
"static",
"<",
"TERM",
">",
"Map",
"<",
"TERM",
",",
"Double",
">",
"idf",
"(",
"Iterable",
"<",
"Iterable",
"<",
"TERM",
">",
">",
"documentVocabularies",
",",
"boolean",
"smooth",
",",
"boolean",
"addOne",
")",
"{",
"Map",
"<",
"TERM",
",",... | 一系列文档的倒排词频
@param documentVocabularies 词表
@param smooth 平滑参数,视作额外有一个文档,该文档含有smooth个每个词语
@param addOne tf-idf加一平滑
@param <TERM> 词语类型
@return 一个词语->倒排文档的Map | [
"一系列文档的倒排词频"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/word/TfIdf.java#L132-L157 | train | Get a map of term - > value pairs for a Sequence. | [
30522,
2270,
10763,
1026,
2744,
1028,
4949,
1026,
2744,
1010,
3313,
1028,
24011,
1006,
2009,
6906,
3468,
1026,
2009,
6906,
3468,
1026,
2744,
1028,
1028,
6254,
6767,
3540,
28808,
3111,
1010,
22017,
20898,
5744,
1010,
22017,
20898,
5587,
5643... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java | SlotManager.handleFreeSlot | private void handleFreeSlot(TaskManagerSlot freeSlot) {
Preconditions.checkState(freeSlot.getState() == TaskManagerSlot.State.FREE);
PendingSlotRequest pendingSlotRequest = findMatchingRequest(freeSlot.getResourceProfile());
if (null != pendingSlotRequest) {
allocateSlot(freeSlot, pendingSlotRequest);
} else {
freeSlots.put(freeSlot.getSlotId(), freeSlot);
}
} | java | private void handleFreeSlot(TaskManagerSlot freeSlot) {
Preconditions.checkState(freeSlot.getState() == TaskManagerSlot.State.FREE);
PendingSlotRequest pendingSlotRequest = findMatchingRequest(freeSlot.getResourceProfile());
if (null != pendingSlotRequest) {
allocateSlot(freeSlot, pendingSlotRequest);
} else {
freeSlots.put(freeSlot.getSlotId(), freeSlot);
}
} | [
"private",
"void",
"handleFreeSlot",
"(",
"TaskManagerSlot",
"freeSlot",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"freeSlot",
".",
"getState",
"(",
")",
"==",
"TaskManagerSlot",
".",
"State",
".",
"FREE",
")",
";",
"PendingSlotRequest",
"pendingSlotReque... | Handles a free slot. It first tries to find a pending slot request which can be fulfilled.
If there is no such request, then it will add the slot to the set of free slots.
@param freeSlot to find a new slot request for | [
"Handles",
"a",
"free",
"slot",
".",
"It",
"first",
"tries",
"to",
"find",
"a",
"pending",
"slot",
"request",
"which",
"can",
"be",
"fulfilled",
".",
"If",
"there",
"is",
"no",
"such",
"request",
"then",
"it",
"will",
"add",
"the",
"slot",
"to",
"the",... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java#L850-L860 | train | Handles a free slot event. | [
30522,
2797,
11675,
5047,
23301,
14540,
4140,
1006,
4708,
24805,
15776,
10994,
2489,
14540,
4140,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
14148,
12259,
1006,
2489,
14540,
4140,
1012,
4152,
12259,
1006,
1007,
1027,
1027,
4708,
24805,
15776,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/local/BinLogFileQueue.java | BinLogFileQueue.getNextFile | public File getNextFile(File pre) {
try {
lock.lockInterruptibly();
if (exception != null) {
throw exception;
}
if (binlogs.size() == 0) {
return null;
} else {
if (pre == null) {// 第一次
return binlogs.get(0);
} else {
int index = seek(pre);
if (index < binlogs.size() - 1) {
return binlogs.get(index + 1);
} else {
return null;
}
}
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return null;
} finally {
lock.unlock();
}
} | java | public File getNextFile(File pre) {
try {
lock.lockInterruptibly();
if (exception != null) {
throw exception;
}
if (binlogs.size() == 0) {
return null;
} else {
if (pre == null) {// 第一次
return binlogs.get(0);
} else {
int index = seek(pre);
if (index < binlogs.size() - 1) {
return binlogs.get(index + 1);
} else {
return null;
}
}
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return null;
} finally {
lock.unlock();
}
} | [
"public",
"File",
"getNextFile",
"(",
"File",
"pre",
")",
"{",
"try",
"{",
"lock",
".",
"lockInterruptibly",
"(",
")",
";",
"if",
"(",
"exception",
"!=",
"null",
")",
"{",
"throw",
"exception",
";",
"}",
"if",
"(",
"binlogs",
".",
"size",
"(",
")",
... | 根据前一个文件,获取符合条件的下一个binlog文件
@param pre
@return | [
"根据前一个文件,获取符合条件的下一个binlog文件"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/local/BinLogFileQueue.java#L85-L112 | train | Gets the next file in the list. | [
30522,
2270,
5371,
2131,
2638,
18413,
8873,
2571,
1006,
5371,
3653,
1007,
1063,
3046,
1063,
5843,
1012,
5843,
18447,
2121,
21531,
3775,
6321,
1006,
1007,
1025,
2065,
1006,
6453,
999,
1027,
19701,
1007,
1063,
5466,
6453,
1025,
1065,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.getLong64 | public final long getLong64(final int pos) {
final int position = origin + pos;
if (pos + 7 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + 7)));
byte[] buf = buffer;
return ((long) (0xff & buf[position])) | ((long) (0xff & buf[position + 1]) << 8)
| ((long) (0xff & buf[position + 2]) << 16) | ((long) (0xff & buf[position + 3]) << 24)
| ((long) (0xff & buf[position + 4]) << 32) | ((long) (0xff & buf[position + 5]) << 40)
| ((long) (0xff & buf[position + 6]) << 48) | ((long) (buf[position + 7]) << 56);
} | java | public final long getLong64(final int pos) {
final int position = origin + pos;
if (pos + 7 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + 7)));
byte[] buf = buffer;
return ((long) (0xff & buf[position])) | ((long) (0xff & buf[position + 1]) << 8)
| ((long) (0xff & buf[position + 2]) << 16) | ((long) (0xff & buf[position + 3]) << 24)
| ((long) (0xff & buf[position + 4]) << 32) | ((long) (0xff & buf[position + 5]) << 40)
| ((long) (0xff & buf[position + 6]) << 48) | ((long) (buf[position + 7]) << 56);
} | [
"public",
"final",
"long",
"getLong64",
"(",
"final",
"int",
"pos",
")",
"{",
"final",
"int",
"position",
"=",
"origin",
"+",
"pos",
";",
"if",
"(",
"pos",
"+",
"7",
">=",
"limit",
"||",
"pos",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException",... | Return 64-bit signed long from buffer. (little-endian)
@see mysql-5.1.60/include/my_global.h - sint8korr | [
"Return",
"64",
"-",
"bit",
"signed",
"long",
"from",
"buffer",
".",
"(",
"little",
"-",
"endian",
")"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L837-L848 | train | Gets a 64 - bit long from the buffer. | [
30522,
2270,
2345,
2146,
2131,
10052,
21084,
1006,
2345,
20014,
13433,
2015,
1007,
1063,
2345,
20014,
2597,
1027,
4761,
1009,
13433,
2015,
1025,
2065,
1006,
13433,
2015,
1009,
1021,
1028,
1027,
5787,
1064,
1064,
13433,
2015,
1026,
1014,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java | SoapClient.setMethod | public SoapClient setMethod(String methodName, String namespaceURI) {
final List<String> methodNameList = StrUtil.split(methodName, ':');
final QName qName;
if (2 == methodNameList.size()) {
qName = new QName(namespaceURI, methodNameList.get(1), methodNameList.get(0));
} else {
qName = new QName(namespaceURI, methodName);
}
return setMethod(qName);
} | java | public SoapClient setMethod(String methodName, String namespaceURI) {
final List<String> methodNameList = StrUtil.split(methodName, ':');
final QName qName;
if (2 == methodNameList.size()) {
qName = new QName(namespaceURI, methodNameList.get(1), methodNameList.get(0));
} else {
qName = new QName(namespaceURI, methodName);
}
return setMethod(qName);
} | [
"public",
"SoapClient",
"setMethod",
"(",
"String",
"methodName",
",",
"String",
"namespaceURI",
")",
"{",
"final",
"List",
"<",
"String",
">",
"methodNameList",
"=",
"StrUtil",
".",
"split",
"(",
"methodName",
",",
"'",
"'",
")",
";",
"final",
"QName",
"q... | 设置请求方法<br>
方法名自动识别前缀,前缀和方法名使用“:”分隔<br>
当识别到前缀后,自动添加xmlns属性,关联到传入的namespaceURI
@param methodName 方法名(可有前缀也可无)
@param namespaceURI 命名空间URI
@return this | [
"设置请求方法<br",
">",
"方法名自动识别前缀,前缀和方法名使用“",
":",
"”分隔<br",
">",
"当识别到前缀后,自动添加xmlns属性,关联到传入的namespaceURI"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java#L268-L277 | train | Sets the method name and namespace URI. | [
30522,
2270,
7815,
20464,
11638,
2275,
11368,
6806,
2094,
1006,
5164,
4118,
18442,
1010,
5164,
3415,
15327,
9496,
1007,
1063,
2345,
2862,
1026,
5164,
1028,
4118,
18442,
9863,
1027,
2358,
22134,
4014,
1012,
3975,
1006,
4118,
18442,
1010,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | client/src/main/java/com/networknt/client/http/Light4jHttpClientProvider.java | Light4jHttpClientProvider.createHttpClientConnection | private ClientConnection createHttpClientConnection(final StreamConnection connection, final OptionMap options, final ByteBufferPool bufferPool) {
try {
Class<?> cls = Class.forName("io.undertow.client.http.HttpClientConnection");
Constructor<?> o = cls.getDeclaredConstructor(StreamConnection.class, OptionMap.class, ByteBufferPool.class);
o.setAccessible(true);
return (ClientConnection) o.newInstance(connection, options, bufferPool);
}catch(Exception e) {
logger.error(e.getMessage(), e);
}
return null;
} | java | private ClientConnection createHttpClientConnection(final StreamConnection connection, final OptionMap options, final ByteBufferPool bufferPool) {
try {
Class<?> cls = Class.forName("io.undertow.client.http.HttpClientConnection");
Constructor<?> o = cls.getDeclaredConstructor(StreamConnection.class, OptionMap.class, ByteBufferPool.class);
o.setAccessible(true);
return (ClientConnection) o.newInstance(connection, options, bufferPool);
}catch(Exception e) {
logger.error(e.getMessage(), e);
}
return null;
} | [
"private",
"ClientConnection",
"createHttpClientConnection",
"(",
"final",
"StreamConnection",
"connection",
",",
"final",
"OptionMap",
"options",
",",
"final",
"ByteBufferPool",
"bufferPool",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"cls",
"=",
"Class",
".",... | /*
Create instances of "io.undertow.client.http.HttpClientConnection" using reflections | [
"/",
"*",
"Create",
"instances",
"of",
"io",
".",
"undertow",
".",
"client",
".",
"http",
".",
"HttpClientConnection",
"using",
"reflections"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/http/Light4jHttpClientProvider.java#L175-L189 | train | Creates a new HTTP client connection. | [
30522,
2797,
7396,
8663,
2638,
7542,
3443,
11039,
25856,
20464,
11638,
8663,
2638,
7542,
1006,
2345,
5460,
8663,
2638,
7542,
4434,
1010,
2345,
5724,
2863,
2361,
7047,
1010,
2345,
24880,
8569,
12494,
16869,
17698,
16869,
1007,
1063,
3046,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/backpressure/BackPressureStatsTrackerImpl.java | BackPressureStatsTrackerImpl.triggerStackTraceSampleInternal | private boolean triggerStackTraceSampleInternal(final ExecutionJobVertex vertex) {
assert(Thread.holdsLock(lock));
if (shutDown) {
return false;
}
if (!pendingStats.contains(vertex) &&
!vertex.getGraph().getState().isGloballyTerminalState()) {
Executor executor = vertex.getGraph().getFutureExecutor();
// Only trigger if still active job
if (executor != null) {
pendingStats.add(vertex);
if (LOG.isDebugEnabled()) {
LOG.debug("Triggering stack trace sample for tasks: " + Arrays.toString(vertex.getTaskVertices()));
}
CompletableFuture<StackTraceSample> sample = coordinator.triggerStackTraceSample(
vertex.getTaskVertices(),
numSamples,
delayBetweenSamples,
MAX_STACK_TRACE_DEPTH);
sample.handleAsync(new StackTraceSampleCompletionCallback(vertex), executor);
return true;
}
}
return false;
} | java | private boolean triggerStackTraceSampleInternal(final ExecutionJobVertex vertex) {
assert(Thread.holdsLock(lock));
if (shutDown) {
return false;
}
if (!pendingStats.contains(vertex) &&
!vertex.getGraph().getState().isGloballyTerminalState()) {
Executor executor = vertex.getGraph().getFutureExecutor();
// Only trigger if still active job
if (executor != null) {
pendingStats.add(vertex);
if (LOG.isDebugEnabled()) {
LOG.debug("Triggering stack trace sample for tasks: " + Arrays.toString(vertex.getTaskVertices()));
}
CompletableFuture<StackTraceSample> sample = coordinator.triggerStackTraceSample(
vertex.getTaskVertices(),
numSamples,
delayBetweenSamples,
MAX_STACK_TRACE_DEPTH);
sample.handleAsync(new StackTraceSampleCompletionCallback(vertex), executor);
return true;
}
}
return false;
} | [
"private",
"boolean",
"triggerStackTraceSampleInternal",
"(",
"final",
"ExecutionJobVertex",
"vertex",
")",
"{",
"assert",
"(",
"Thread",
".",
"holdsLock",
"(",
"lock",
")",
")",
";",
"if",
"(",
"shutDown",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
... | Triggers a stack trace sample for a operator to gather the back pressure
statistics. If there is a sample in progress for the operator, the call
is ignored.
@param vertex Operator to get the stats for.
@return Flag indicating whether a sample with triggered. | [
"Triggers",
"a",
"stack",
"trace",
"sample",
"for",
"a",
"operator",
"to",
"gather",
"the",
"back",
"pressure",
"statistics",
".",
"If",
"there",
"is",
"a",
"sample",
"in",
"progress",
"for",
"the",
"operator",
"the",
"call",
"is",
"ignored",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/backpressure/BackPressureStatsTrackerImpl.java#L174-L207 | train | Trigger a stack trace sample for a given execution job vertex. | [
30522,
2797,
22017,
20898,
27099,
2696,
3600,
6494,
9623,
16613,
19856,
16451,
2389,
1006,
2345,
7781,
5558,
2497,
16874,
10288,
19449,
1007,
1063,
20865,
1006,
11689,
1012,
4324,
7878,
1006,
5843,
1007,
1007,
1025,
2065,
1006,
3844,
7698,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/io/HeaderlessChannelWriterOutputView.java | HeaderlessChannelWriterOutputView.close | @Override
public int close() throws IOException {
if (!writer.isClosed()) {
int currentPositionInSegment = getCurrentPositionInSegment();
// write last segment
writer.writeBlock(getCurrentSegment());
clear();
writer.getReturnQueue().clear();
this.writer.close();
return currentPositionInSegment;
}
return -1;
} | java | @Override
public int close() throws IOException {
if (!writer.isClosed()) {
int currentPositionInSegment = getCurrentPositionInSegment();
// write last segment
writer.writeBlock(getCurrentSegment());
clear();
writer.getReturnQueue().clear();
this.writer.close();
return currentPositionInSegment;
}
return -1;
} | [
"@",
"Override",
"public",
"int",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"writer",
".",
"isClosed",
"(",
")",
")",
"{",
"int",
"currentPositionInSegment",
"=",
"getCurrentPositionInSegment",
"(",
")",
";",
"// write last segment",
"wr... | Closes this OutputView, closing the underlying writer. And return number bytes in last
memory segment. | [
"Closes",
"this",
"OutputView",
"closing",
"the",
"underlying",
"writer",
".",
"And",
"return",
"number",
"bytes",
"in",
"last",
"memory",
"segment",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/io/HeaderlessChannelWriterOutputView.java#L83-L97 | train | Close the underlying file. | [
30522,
1030,
2058,
15637,
2270,
20014,
2485,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
999,
3213,
1012,
2003,
20464,
24768,
1006,
1007,
1007,
1063,
20014,
2783,
26994,
7076,
13910,
3672,
1027,
2131,
10841,
14343,
30524,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java | WatchMonitor.registerPath | private void registerPath(Path path, int maxDepth) {
try {
final WatchKey key = path.register(watchService, ArrayUtil.isEmpty(this.events) ? EVENTS_ALL : this.events);
watchKeyPathMap.put(key, path);
if(maxDepth > 1) {
//遍历所有子目录并加入监听
Files.walkFileTree(path, EnumSet.noneOf(FileVisitOption.class), maxDepth, new SimpleFileVisitor<Path>(){
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
registerPath(dir, 0);//继续添加目录
return super.postVisitDirectory(dir, exc);
}
});
}
} catch (IOException e) {
if(e instanceof AccessDeniedException) {
//对于禁止访问的目录,跳过监听
return;
}
throw new WatchException(e);
}
} | java | private void registerPath(Path path, int maxDepth) {
try {
final WatchKey key = path.register(watchService, ArrayUtil.isEmpty(this.events) ? EVENTS_ALL : this.events);
watchKeyPathMap.put(key, path);
if(maxDepth > 1) {
//遍历所有子目录并加入监听
Files.walkFileTree(path, EnumSet.noneOf(FileVisitOption.class), maxDepth, new SimpleFileVisitor<Path>(){
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
registerPath(dir, 0);//继续添加目录
return super.postVisitDirectory(dir, exc);
}
});
}
} catch (IOException e) {
if(e instanceof AccessDeniedException) {
//对于禁止访问的目录,跳过监听
return;
}
throw new WatchException(e);
}
} | [
"private",
"void",
"registerPath",
"(",
"Path",
"path",
",",
"int",
"maxDepth",
")",
"{",
"try",
"{",
"final",
"WatchKey",
"key",
"=",
"path",
".",
"register",
"(",
"watchService",
",",
"ArrayUtil",
".",
"isEmpty",
"(",
"this",
".",
"events",
")",
"?",
... | 将指定路径加入到监听中
@param path 路径
@param maxDepth 递归下层目录的最大深度
@return {@link WatchKey} | [
"将指定路径加入到监听中"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java#L447-L468 | train | Register a path with the watch service. | [
30522,
2797,
11675,
4236,
15069,
1006,
4130,
4130,
1010,
20014,
4098,
3207,
13876,
2232,
1007,
1063,
3046,
1063,
2345,
3422,
14839,
3145,
1027,
4130,
1012,
4236,
1006,
3422,
8043,
7903,
2063,
1010,
9140,
21823,
2140,
1012,
2003,
6633,
13876... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/DbUtil.java | DbUtil.close | public static void close(Object... objsToClose) {
for (Object obj : objsToClose) {
if (obj instanceof AutoCloseable) {
IoUtil.close((AutoCloseable) obj);
} else if (obj instanceof Closeable) {
IoUtil.close((Closeable) obj);
} else {
try {
if (obj != null) {
if (obj instanceof ResultSet) {
((ResultSet) obj).close();
} else if (obj instanceof Statement) {
((Statement) obj).close();
} else if (obj instanceof PreparedStatement) {
((PreparedStatement) obj).close();
} else if (obj instanceof Connection) {
((Connection) obj).close();
} else {
log.warn("Object {} not a ResultSet or Statement or PreparedStatement or Connection!", obj.getClass().getName());
}
}
} catch (SQLException e) {
// ignore
}
}
}
} | java | public static void close(Object... objsToClose) {
for (Object obj : objsToClose) {
if (obj instanceof AutoCloseable) {
IoUtil.close((AutoCloseable) obj);
} else if (obj instanceof Closeable) {
IoUtil.close((Closeable) obj);
} else {
try {
if (obj != null) {
if (obj instanceof ResultSet) {
((ResultSet) obj).close();
} else if (obj instanceof Statement) {
((Statement) obj).close();
} else if (obj instanceof PreparedStatement) {
((PreparedStatement) obj).close();
} else if (obj instanceof Connection) {
((Connection) obj).close();
} else {
log.warn("Object {} not a ResultSet or Statement or PreparedStatement or Connection!", obj.getClass().getName());
}
}
} catch (SQLException e) {
// ignore
}
}
}
} | [
"public",
"static",
"void",
"close",
"(",
"Object",
"...",
"objsToClose",
")",
"{",
"for",
"(",
"Object",
"obj",
":",
"objsToClose",
")",
"{",
"if",
"(",
"obj",
"instanceof",
"AutoCloseable",
")",
"{",
"IoUtil",
".",
"close",
"(",
"(",
"AutoCloseable",
"... | 连续关闭一系列的SQL相关对象<br>
这些对象必须按照顺序关闭,否则会出错。
@param objsToClose 需要关闭的对象 | [
"连续关闭一系列的SQL相关对象<br",
">",
"这些对象必须按照顺序关闭,否则会出错。"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/DbUtil.java#L155-L181 | train | Close the specified objects. | [
30522,
2270,
10763,
11675,
2485,
1006,
4874,
1012,
1012,
1012,
27885,
22578,
3406,
20464,
9232,
1007,
1063,
2005,
1006,
4874,
27885,
3501,
1024,
27885,
22578,
3406,
20464,
9232,
1007,
1063,
2065,
1006,
27885,
3501,
6013,
11253,
8285,
20464,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java | MainClassFinder.findMainClass | public static String findMainClass(JarFile jarFile, String classesLocation)
throws IOException {
return doWithMainClasses(jarFile, classesLocation, MainClass::getName);
} | java | public static String findMainClass(JarFile jarFile, String classesLocation)
throws IOException {
return doWithMainClasses(jarFile, classesLocation, MainClass::getName);
} | [
"public",
"static",
"String",
"findMainClass",
"(",
"JarFile",
"jarFile",
",",
"String",
"classesLocation",
")",
"throws",
"IOException",
"{",
"return",
"doWithMainClasses",
"(",
"jarFile",
",",
"classesLocation",
",",
"MainClass",
"::",
"getName",
")",
";",
"}"
] | Find the main class in a given jar file.
@param jarFile the jar file to search
@param classesLocation the location within the jar containing classes
@return the main class or {@code null}
@throws IOException if the jar file cannot be read | [
"Find",
"the",
"main",
"class",
"in",
"a",
"given",
"jar",
"file",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java#L173-L176 | train | Find the main class name from the given JAR file. | [
30522,
2270,
10763,
5164,
2424,
24238,
26266,
1006,
15723,
8873,
2571,
15723,
8873,
2571,
1010,
5164,
4280,
4135,
10719,
1007,
11618,
22834,
10288,
24422,
1063,
2709,
23268,
8939,
24238,
26266,
2229,
1006,
15723,
8873,
2571,
1010,
4280,
4135,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/channel/socket/nio/NioDatagramChannel.java | NioDatagramChannel.block | @Override
public ChannelFuture block(
InetAddress multicastAddress, NetworkInterface networkInterface,
InetAddress sourceToBlock, ChannelPromise promise) {
checkJavaVersion();
if (multicastAddress == null) {
throw new NullPointerException("multicastAddress");
}
if (sourceToBlock == null) {
throw new NullPointerException("sourceToBlock");
}
if (networkInterface == null) {
throw new NullPointerException("networkInterface");
}
synchronized (this) {
if (memberships != null) {
List<MembershipKey> keys = memberships.get(multicastAddress);
for (MembershipKey key: keys) {
if (networkInterface.equals(key.networkInterface())) {
try {
key.block(sourceToBlock);
} catch (IOException e) {
promise.setFailure(e);
}
}
}
}
}
promise.setSuccess();
return promise;
} | java | @Override
public ChannelFuture block(
InetAddress multicastAddress, NetworkInterface networkInterface,
InetAddress sourceToBlock, ChannelPromise promise) {
checkJavaVersion();
if (multicastAddress == null) {
throw new NullPointerException("multicastAddress");
}
if (sourceToBlock == null) {
throw new NullPointerException("sourceToBlock");
}
if (networkInterface == null) {
throw new NullPointerException("networkInterface");
}
synchronized (this) {
if (memberships != null) {
List<MembershipKey> keys = memberships.get(multicastAddress);
for (MembershipKey key: keys) {
if (networkInterface.equals(key.networkInterface())) {
try {
key.block(sourceToBlock);
} catch (IOException e) {
promise.setFailure(e);
}
}
}
}
}
promise.setSuccess();
return promise;
} | [
"@",
"Override",
"public",
"ChannelFuture",
"block",
"(",
"InetAddress",
"multicastAddress",
",",
"NetworkInterface",
"networkInterface",
",",
"InetAddress",
"sourceToBlock",
",",
"ChannelPromise",
"promise",
")",
"{",
"checkJavaVersion",
"(",
")",
";",
"if",
"(",
"... | Block the given sourceToBlock address for the given multicastAddress on the given networkInterface | [
"Block",
"the",
"given",
"sourceToBlock",
"address",
"for",
"the",
"given",
"multicastAddress",
"on",
"the",
"given",
"networkInterface"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/socket/nio/NioDatagramChannel.java#L531-L563 | train | Block the specified multicast address and network interface. | [
30522,
1030,
2058,
15637,
2270,
3149,
11263,
11244,
3796,
1006,
1999,
12928,
14141,
8303,
4800,
10526,
4215,
16200,
4757,
1010,
2897,
18447,
2121,
12172,
2897,
18447,
2121,
12172,
1010,
1999,
12928,
14141,
8303,
3120,
3406,
23467,
1010,
3149,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/RuntimeUtil.java | RuntimeUtil.exec | public static Process exec(String... cmds) {
if (ArrayUtil.isEmpty(cmds)) {
throw new NullPointerException("Command is empty !");
}
// 单条命令的情况
if (1 == cmds.length) {
final String cmd = cmds[0];
if (StrUtil.isBlank(cmd)) {
throw new NullPointerException("Command is empty !");
}
cmds = StrUtil.splitToArray(cmd, StrUtil.C_SPACE);
}
Process process;
try {
process = new ProcessBuilder(cmds).redirectErrorStream(true).start();
} catch (IOException e) {
throw new IORuntimeException(e);
}
return process;
} | java | public static Process exec(String... cmds) {
if (ArrayUtil.isEmpty(cmds)) {
throw new NullPointerException("Command is empty !");
}
// 单条命令的情况
if (1 == cmds.length) {
final String cmd = cmds[0];
if (StrUtil.isBlank(cmd)) {
throw new NullPointerException("Command is empty !");
}
cmds = StrUtil.splitToArray(cmd, StrUtil.C_SPACE);
}
Process process;
try {
process = new ProcessBuilder(cmds).redirectErrorStream(true).start();
} catch (IOException e) {
throw new IORuntimeException(e);
}
return process;
} | [
"public",
"static",
"Process",
"exec",
"(",
"String",
"...",
"cmds",
")",
"{",
"if",
"(",
"ArrayUtil",
".",
"isEmpty",
"(",
"cmds",
")",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Command is empty !\"",
")",
";",
"}",
"// 单条命令的情况\r",
"if",
"... | 执行命令<br>
命令带参数时参数可作为其中一个参数,也可以将命令和参数组合为一个字符串传入
@param cmds 命令
@return {@link Process} | [
"执行命令<br",
">",
"命令带参数时参数可作为其中一个参数,也可以将命令和参数组合为一个字符串传入"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/RuntimeUtil.java#L76-L97 | train | Executes a command on the system. | [
30522,
2270,
10763,
2832,
4654,
8586,
1006,
5164,
1012,
1012,
1012,
4642,
5104,
1007,
1063,
2065,
1006,
9140,
21823,
2140,
1012,
2003,
6633,
13876,
2100,
1006,
4642,
5104,
1007,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.getTrimmed | public String getTrimmed(String name, String defaultValue) {
String ret = getTrimmed(name);
return ret == null ? defaultValue : ret;
} | java | public String getTrimmed(String name, String defaultValue) {
String ret = getTrimmed(name);
return ret == null ? defaultValue : ret;
} | [
"public",
"String",
"getTrimmed",
"(",
"String",
"name",
",",
"String",
"defaultValue",
")",
"{",
"String",
"ret",
"=",
"getTrimmed",
"(",
"name",
")",
";",
"return",
"ret",
"==",
"null",
"?",
"defaultValue",
":",
"ret",
";",
"}"
] | Get the value of the <code>name</code> property as a trimmed <code>String</code>,
<code>defaultValue</code> if no such property exists.
See @{Configuration#getTrimmed} for more details.
@param name the property name.
@param defaultValue the property default value.
@return the value of the <code>name</code> or defaultValue
if it is not set. | [
"Get",
"the",
"value",
"of",
"the",
"<code",
">",
"name<",
"/",
"code",
">",
"property",
"as",
"a",
"trimmed",
"<code",
">",
"String<",
"/",
"code",
">",
"<code",
">",
"defaultValue<",
"/",
"code",
">",
"if",
"no",
"such",
"property",
"exists",
".",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L1148-L1151 | train | Returns the value of the property with the given name trimmed. | [
30522,
2270,
5164,
2131,
18886,
20058,
2094,
1006,
5164,
2171,
1010,
5164,
12398,
10175,
5657,
1007,
1063,
5164,
2128,
2102,
1027,
2131,
18886,
20058,
2094,
1006,
2171,
1007,
1025,
2709,
2128,
2102,
1027,
1027,
19701,
1029,
12398,
10175,
56... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/RowsLogBuffer.java | RowsLogBuffer.nextValue | public final Serializable nextValue(final String columName, final int columnIndex, final int type, final int meta) {
return nextValue(columName, columnIndex, type, meta, false);
} | java | public final Serializable nextValue(final String columName, final int columnIndex, final int type, final int meta) {
return nextValue(columName, columnIndex, type, meta, false);
} | [
"public",
"final",
"Serializable",
"nextValue",
"(",
"final",
"String",
"columName",
",",
"final",
"int",
"columnIndex",
",",
"final",
"int",
"type",
",",
"final",
"int",
"meta",
")",
"{",
"return",
"nextValue",
"(",
"columName",
",",
"columnIndex",
",",
"ty... | Extracting next field value from packed buffer.
@see mysql-5.1.60/sql/log_event.cc -
Rows_log_event::print_verbose_one_row | [
"Extracting",
"next",
"field",
"value",
"from",
"packed",
"buffer",
"."
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/RowsLogBuffer.java#L104-L106 | train | Gets the next value from the database. | [
30522,
2270,
2345,
7642,
21335,
3468,
2279,
10175,
5657,
1006,
2345,
5164,
5930,
14074,
1010,
2345,
20014,
5930,
22254,
10288,
1010,
2345,
20014,
2828,
1010,
2345,
20014,
18804,
1007,
1063,
2709,
2279,
10175,
5657,
1006,
5930,
14074,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/ui/FluentWait.java | FluentWait.until | @Override
public <V> V until(Function<? super T, V> isTrue) {
Instant end = clock.instant().plus(timeout);
Throwable lastException;
while (true) {
try {
V value = isTrue.apply(input);
if (value != null && (Boolean.class != value.getClass() || Boolean.TRUE.equals(value))) {
return value;
}
// Clear the last exception; if another retry or timeout exception would
// be caused by a false or null value, the last exception is not the
// cause of the timeout.
lastException = null;
} catch (Throwable e) {
lastException = propagateIfNotIgnored(e);
}
// Check the timeout after evaluating the function to ensure conditions
// with a zero timeout can succeed.
if (end.isBefore(clock.instant())) {
String message = messageSupplier != null ?
messageSupplier.get() : null;
String timeoutMessage = String.format(
"Expected condition failed: %s (tried for %d second(s) with %d milliseconds interval)",
message == null ? "waiting for " + isTrue : message,
timeout.getSeconds(), interval.toMillis());
throw timeoutException(timeoutMessage, lastException);
}
try {
sleeper.sleep(interval);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new WebDriverException(e);
}
}
} | java | @Override
public <V> V until(Function<? super T, V> isTrue) {
Instant end = clock.instant().plus(timeout);
Throwable lastException;
while (true) {
try {
V value = isTrue.apply(input);
if (value != null && (Boolean.class != value.getClass() || Boolean.TRUE.equals(value))) {
return value;
}
// Clear the last exception; if another retry or timeout exception would
// be caused by a false or null value, the last exception is not the
// cause of the timeout.
lastException = null;
} catch (Throwable e) {
lastException = propagateIfNotIgnored(e);
}
// Check the timeout after evaluating the function to ensure conditions
// with a zero timeout can succeed.
if (end.isBefore(clock.instant())) {
String message = messageSupplier != null ?
messageSupplier.get() : null;
String timeoutMessage = String.format(
"Expected condition failed: %s (tried for %d second(s) with %d milliseconds interval)",
message == null ? "waiting for " + isTrue : message,
timeout.getSeconds(), interval.toMillis());
throw timeoutException(timeoutMessage, lastException);
}
try {
sleeper.sleep(interval);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new WebDriverException(e);
}
}
} | [
"@",
"Override",
"public",
"<",
"V",
">",
"V",
"until",
"(",
"Function",
"<",
"?",
"super",
"T",
",",
"V",
">",
"isTrue",
")",
"{",
"Instant",
"end",
"=",
"clock",
".",
"instant",
"(",
")",
".",
"plus",
"(",
"timeout",
")",
";",
"Throwable",
"las... | Repeatedly applies this instance's input value to the given function until one of the following
occurs:
<ol>
<li>the function returns neither null nor false</li>
<li>the function throws an unignored exception</li>
<li>the timeout expires</li>
<li>the current thread is interrupted</li>
</ol>
@param isTrue the parameter to pass to the {@link ExpectedCondition}
@param <V> The function's expected return type.
@return The function's return value if the function returned something different
from null or false before the timeout expired.
@throws TimeoutException If the timeout expires. | [
"Repeatedly",
"applies",
"this",
"instance",
"s",
"input",
"value",
"to",
"the",
"given",
"function",
"until",
"one",
"of",
"the",
"following",
"occurs",
":",
"<ol",
">",
"<li",
">",
"the",
"function",
"returns",
"neither",
"null",
"nor",
"false<",
"/",
"l... | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/ui/FluentWait.java#L204-L244 | train | Wait until the condition is true. | [
30522,
1030,
2058,
15637,
2270,
1026,
1058,
1028,
1058,
2127,
1006,
3853,
1026,
1029,
3565,
1056,
1010,
1058,
1028,
21541,
6820,
2063,
1007,
1063,
7107,
2203,
1027,
5119,
1012,
7107,
1006,
1007,
1012,
4606,
1006,
2051,
5833,
1007,
1025,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple7.java | Tuple7.copy | @Override
@SuppressWarnings("unchecked")
public Tuple7<T0, T1, T2, T3, T4, T5, T6> copy() {
return new Tuple7<>(this.f0,
this.f1,
this.f2,
this.f3,
this.f4,
this.f5,
this.f6);
} | java | @Override
@SuppressWarnings("unchecked")
public Tuple7<T0, T1, T2, T3, T4, T5, T6> copy() {
return new Tuple7<>(this.f0,
this.f1,
this.f2,
this.f3,
this.f4,
this.f5,
this.f6);
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Tuple7",
"<",
"T0",
",",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
",",
"T6",
">",
"copy",
"(",
")",
"{",
"return",
"new",
"Tuple7",
"<>",
"(",
"this",
".",
"... | Shallow tuple copy.
@return A new Tuple with the same fields as this. | [
"Shallow",
"tuple",
"copy",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple7.java#L248-L258 | train | Returns a copy of this tuple. | [
30522,
1030,
2058,
15637,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10722,
10814,
2581,
1026,
1056,
2692,
1010,
1056,
2487,
1010,
1056,
2475,
1010,
1056,
2509,
1010,
1056,
2549,
1010,
1056,
2629,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/OpenSslX509KeyManagerFactory.java | OpenSslX509KeyManagerFactory.newEngineBased | public static OpenSslX509KeyManagerFactory newEngineBased(X509Certificate[] certificateChain, String password)
throws CertificateException, IOException,
KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException {
KeyStore store = new OpenSslKeyStore(certificateChain.clone(), false);
store.load(null, null);
OpenSslX509KeyManagerFactory factory = new OpenSslX509KeyManagerFactory();
factory.init(store, password == null ? null : password.toCharArray());
return factory;
} | java | public static OpenSslX509KeyManagerFactory newEngineBased(X509Certificate[] certificateChain, String password)
throws CertificateException, IOException,
KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException {
KeyStore store = new OpenSslKeyStore(certificateChain.clone(), false);
store.load(null, null);
OpenSslX509KeyManagerFactory factory = new OpenSslX509KeyManagerFactory();
factory.init(store, password == null ? null : password.toCharArray());
return factory;
} | [
"public",
"static",
"OpenSslX509KeyManagerFactory",
"newEngineBased",
"(",
"X509Certificate",
"[",
"]",
"certificateChain",
",",
"String",
"password",
")",
"throws",
"CertificateException",
",",
"IOException",
",",
"KeyStoreException",
",",
"NoSuchAlgorithmException",
",",
... | Create a new initialized {@link OpenSslX509KeyManagerFactory} which loads its {@link PrivateKey} directly from
an {@code OpenSSL engine} via the
<a href="https://www.openssl.org/docs/man1.1.0/crypto/ENGINE_load_private_key.html">ENGINE_load_private_key</a>
function. | [
"Create",
"a",
"new",
"initialized",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/OpenSslX509KeyManagerFactory.java#L252-L260 | train | Create an OpenSslX509KeyManagerFactory that will create a new SSLEngine based X509KeyManagerFactory. | [
30522,
2270,
10763,
7480,
14540,
2595,
12376,
2683,
14839,
24805,
4590,
21450,
2047,
13159,
3170,
15058,
2094,
1006,
1060,
12376,
2683,
17119,
3775,
8873,
16280,
1031,
1033,
8196,
24925,
2078,
1010,
5164,
20786,
1007,
11618,
8196,
10288,
2442... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/ssh/Sftp.java | Sftp.init | public void init(ChannelSftp channel, Charset charset) {
this.charset = charset;
try {
channel.setFilenameEncoding(charset.toString());
} catch (SftpException e) {
throw new JschRuntimeException(e);
}
this.channel = channel;
} | java | public void init(ChannelSftp channel, Charset charset) {
this.charset = charset;
try {
channel.setFilenameEncoding(charset.toString());
} catch (SftpException e) {
throw new JschRuntimeException(e);
}
this.channel = channel;
} | [
"public",
"void",
"init",
"(",
"ChannelSftp",
"channel",
",",
"Charset",
"charset",
")",
"{",
"this",
".",
"charset",
"=",
"charset",
";",
"try",
"{",
"channel",
".",
"setFilenameEncoding",
"(",
"charset",
".",
"toString",
"(",
")",
")",
";",
"}",
"catch... | 初始化
@param channel {@link ChannelSftp}
@param charset 编码 | [
"初始化"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ssh/Sftp.java#L131-L139 | train | Initializes the handle. | [
30522,
2270,
11675,
1999,
4183,
1006,
6833,
6199,
2361,
3149,
1010,
25869,
13462,
25869,
13462,
1007,
1063,
2023,
1012,
25869,
13462,
1027,
25869,
13462,
1025,
3046,
1063,
3149,
1012,
2275,
8873,
20844,
4168,
2368,
3597,
4667,
1006,
25869,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.newCopyOnWriteArrayList | public static <T> CopyOnWriteArrayList<T> newCopyOnWriteArrayList(Collection<T> collection) {
return (null == collection) ? (new CopyOnWriteArrayList<T>()) : (new CopyOnWriteArrayList<T>(collection));
} | java | public static <T> CopyOnWriteArrayList<T> newCopyOnWriteArrayList(Collection<T> collection) {
return (null == collection) ? (new CopyOnWriteArrayList<T>()) : (new CopyOnWriteArrayList<T>(collection));
} | [
"public",
"static",
"<",
"T",
">",
"CopyOnWriteArrayList",
"<",
"T",
">",
"newCopyOnWriteArrayList",
"(",
"Collection",
"<",
"T",
">",
"collection",
")",
"{",
"return",
"(",
"null",
"==",
"collection",
")",
"?",
"(",
"new",
"CopyOnWriteArrayList",
"<",
"T",
... | 新建一个CopyOnWriteArrayList
@param <T> 集合元素类型
@param collection 集合
@return {@link CopyOnWriteArrayList} | [
"新建一个CopyOnWriteArrayList"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L706-L708 | train | Creates a new instance of CopyOnWriteArrayList<T >. | [
30522,
2270,
10763,
1026,
1056,
1028,
6100,
2239,
26373,
2906,
9447,
9863,
1026,
1056,
1028,
2047,
3597,
7685,
2239,
26373,
2906,
9447,
9863,
1006,
3074,
1026,
1056,
1028,
3074,
1007,
1063,
2709,
1006,
19701,
1027,
1027,
3074,
1007,
1029,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationTemp.java | ApplicationTemp.getDir | public File getDir(String subDir) {
File dir = new File(getDir(), subDir);
dir.mkdirs();
return dir;
} | java | public File getDir(String subDir) {
File dir = new File(getDir(), subDir);
dir.mkdirs();
return dir;
} | [
"public",
"File",
"getDir",
"(",
"String",
"subDir",
")",
"{",
"File",
"dir",
"=",
"new",
"File",
"(",
"getDir",
"(",
")",
",",
"subDir",
")",
";",
"dir",
".",
"mkdirs",
"(",
")",
";",
"return",
"dir",
";",
"}"
] | Return a sub-directory of the application temp.
@param subDir the sub-directory name
@return a sub-directory | [
"Return",
"a",
"sub",
"-",
"directory",
"of",
"the",
"application",
"temp",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationTemp.java#L66-L70 | train | Get a directory with the specified sub - directory. | [
30522,
2270,
5371,
2131,
4305,
2099,
1006,
5164,
4942,
4305,
2099,
1007,
1063,
5371,
16101,
1027,
2047,
5371,
1006,
2131,
4305,
2099,
1006,
1007,
1010,
4942,
4305,
2099,
1007,
1025,
16101,
1012,
12395,
4305,
2869,
1006,
1007,
1025,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobMaster.java | JobMaster.suspend | public CompletableFuture<Acknowledge> suspend(final Exception cause) {
CompletableFuture<Acknowledge> suspendFuture = callAsyncWithoutFencing(
() -> suspendExecution(cause),
RpcUtils.INF_TIMEOUT);
return suspendFuture.whenComplete((acknowledge, throwable) -> stop());
} | java | public CompletableFuture<Acknowledge> suspend(final Exception cause) {
CompletableFuture<Acknowledge> suspendFuture = callAsyncWithoutFencing(
() -> suspendExecution(cause),
RpcUtils.INF_TIMEOUT);
return suspendFuture.whenComplete((acknowledge, throwable) -> stop());
} | [
"public",
"CompletableFuture",
"<",
"Acknowledge",
">",
"suspend",
"(",
"final",
"Exception",
"cause",
")",
"{",
"CompletableFuture",
"<",
"Acknowledge",
">",
"suspendFuture",
"=",
"callAsyncWithoutFencing",
"(",
"(",
")",
"->",
"suspendExecution",
"(",
"cause",
"... | Suspending job, all the running tasks will be cancelled, and communication with other components
will be disposed.
<p>Mostly job is suspended because of the leadership has been revoked, one can be restart this job by
calling the {@link #start(JobMasterId)} method once we take the leadership back again.
<p>This method is executed asynchronously
@param cause The reason of why this job been suspended.
@return Future acknowledge indicating that the job has been suspended. Otherwise the future contains an exception | [
"Suspending",
"job",
"all",
"the",
"running",
"tasks",
"will",
"be",
"cancelled",
"and",
"communication",
"with",
"other",
"components",
"will",
"be",
"disposed",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobMaster.java#L323-L329 | train | Suspend the execution of the cluster. | [
30522,
2270,
4012,
10814,
10880,
11263,
11244,
1026,
13399,
1028,
28324,
1006,
2345,
6453,
3426,
1007,
1063,
4012,
10814,
10880,
11263,
11244,
1026,
13399,
1028,
28324,
11263,
11244,
1027,
2655,
3022,
6038,
2278,
24415,
5833,
18940,
6129,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/ConnectedStreams.java | ConnectedStreams.keyBy | public ConnectedStreams<IN1, IN2> keyBy(String[] fields1, String[] fields2) {
return new ConnectedStreams<>(environment, inputStream1.keyBy(fields1),
inputStream2.keyBy(fields2));
} | java | public ConnectedStreams<IN1, IN2> keyBy(String[] fields1, String[] fields2) {
return new ConnectedStreams<>(environment, inputStream1.keyBy(fields1),
inputStream2.keyBy(fields2));
} | [
"public",
"ConnectedStreams",
"<",
"IN1",
",",
"IN2",
">",
"keyBy",
"(",
"String",
"[",
"]",
"fields1",
",",
"String",
"[",
"]",
"fields2",
")",
"{",
"return",
"new",
"ConnectedStreams",
"<>",
"(",
"environment",
",",
"inputStream1",
".",
"keyBy",
"(",
"... | KeyBy operation for connected data stream using key expressions.
the elements of input1 and input2 according to fields1 and fields2. A
field expression is either the name of a public field or a getter method
with parentheses of the {@link DataStream}S underlying type. A dot can be
used to drill down into objects, as in {@code "field1.getInnerField2()" }
.
@param fields1
The grouping expressions for the first input
@param fields2
The grouping expressions for the second input
@return The grouped {@link ConnectedStreams} | [
"KeyBy",
"operation",
"for",
"connected",
"data",
"stream",
"using",
"key",
"expressions",
".",
"the",
"elements",
"of",
"input1",
"and",
"input2",
"according",
"to",
"fields1",
"and",
"fields2",
".",
"A",
"field",
"expression",
"is",
"either",
"the",
"name",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/ConnectedStreams.java#L174-L177 | train | KeyBy operation for connected data stream. | [
30522,
2270,
4198,
21422,
2015,
1026,
1999,
2487,
1010,
1999,
2475,
1028,
3145,
3762,
1006,
5164,
1031,
1033,
4249,
2487,
1010,
5164,
1031,
1033,
4249,
2475,
1007,
1063,
2709,
2047,
4198,
21422,
2015,
1026,
1028,
1006,
4044,
1010,
20407,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Snappy.java | Snappy.bitsToEncode | private static int bitsToEncode(int value) {
int highestOneBit = Integer.highestOneBit(value);
int bitLength = 0;
while ((highestOneBit >>= 1) != 0) {
bitLength++;
}
return bitLength;
} | java | private static int bitsToEncode(int value) {
int highestOneBit = Integer.highestOneBit(value);
int bitLength = 0;
while ((highestOneBit >>= 1) != 0) {
bitLength++;
}
return bitLength;
} | [
"private",
"static",
"int",
"bitsToEncode",
"(",
"int",
"value",
")",
"{",
"int",
"highestOneBit",
"=",
"Integer",
".",
"highestOneBit",
"(",
"value",
")",
";",
"int",
"bitLength",
"=",
"0",
";",
"while",
"(",
"(",
"highestOneBit",
">>=",
"1",
")",
"!=",... | Calculates the minimum number of bits required to encode a value. This can
then in turn be used to calculate the number of septets or octets (as
appropriate) to use to encode a length parameter.
@param value The value to calculate the minimum number of bits required to encode
@return The minimum number of bits required to encode the supplied value | [
"Calculates",
"the",
"minimum",
"number",
"of",
"bits",
"required",
"to",
"encode",
"a",
"value",
".",
"This",
"can",
"then",
"in",
"turn",
"be",
"used",
"to",
"calculate",
"the",
"number",
"of",
"septets",
"or",
"octets",
"(",
"as",
"appropriate",
")",
... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Snappy.java#L204-L212 | train | Bits to encode. | [
30522,
2797,
10763,
20014,
9017,
3406,
2368,
16044,
1006,
20014,
3643,
1007,
1063,
20014,
3284,
5643,
16313,
1027,
16109,
1012,
3284,
5643,
16313,
1006,
3643,
1007,
1025,
20014,
2978,
7770,
13512,
2232,
1027,
1014,
1025,
2096,
1006,
1006,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/heartbeat/HeartbeatManagerImpl.java | HeartbeatManagerImpl.receiveHeartbeat | @Override
public void receiveHeartbeat(ResourceID heartbeatOrigin, I heartbeatPayload) {
if (!stopped) {
log.debug("Received heartbeat from {}.", heartbeatOrigin);
reportHeartbeat(heartbeatOrigin);
if (heartbeatPayload != null) {
heartbeatListener.reportPayload(heartbeatOrigin, heartbeatPayload);
}
}
} | java | @Override
public void receiveHeartbeat(ResourceID heartbeatOrigin, I heartbeatPayload) {
if (!stopped) {
log.debug("Received heartbeat from {}.", heartbeatOrigin);
reportHeartbeat(heartbeatOrigin);
if (heartbeatPayload != null) {
heartbeatListener.reportPayload(heartbeatOrigin, heartbeatPayload);
}
}
} | [
"@",
"Override",
"public",
"void",
"receiveHeartbeat",
"(",
"ResourceID",
"heartbeatOrigin",
",",
"I",
"heartbeatPayload",
")",
"{",
"if",
"(",
"!",
"stopped",
")",
"{",
"log",
".",
"debug",
"(",
"\"Received heartbeat from {}.\"",
",",
"heartbeatOrigin",
")",
";... | ---------------------------------------------------------------------------------------------- | [
"----------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/heartbeat/HeartbeatManagerImpl.java#L181-L191 | train | Receives a heartbeat from the cluster. | [
30522,
1030,
2058,
15637,
2270,
11675,
4374,
22375,
19442,
1006,
7692,
3593,
12251,
10050,
11528,
1010,
1045,
12251,
4502,
8516,
10441,
2094,
1007,
1063,
2065,
1006,
999,
3030,
1007,
1063,
8833,
1012,
2139,
8569,
2290,
1006,
1000,
2363,
122... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | server/src/main/java/com/alibaba/otter/canal/server/embedded/CanalServerWithEmbedded.java | CanalServerWithEmbedded.getWithoutAck | @Override
public Message getWithoutAck(ClientIdentity clientIdentity, int batchSize) throws CanalServerException {
return getWithoutAck(clientIdentity, batchSize, null, null);
} | java | @Override
public Message getWithoutAck(ClientIdentity clientIdentity, int batchSize) throws CanalServerException {
return getWithoutAck(clientIdentity, batchSize, null, null);
} | [
"@",
"Override",
"public",
"Message",
"getWithoutAck",
"(",
"ClientIdentity",
"clientIdentity",
",",
"int",
"batchSize",
")",
"throws",
"CanalServerException",
"{",
"return",
"getWithoutAck",
"(",
"clientIdentity",
",",
"batchSize",
",",
"null",
",",
"null",
")",
... | 不指定 position 获取事件。canal 会记住此 client 最新的 position。 <br/>
如果是第一次 fetch,则会从 canal 中保存的最老一条数据开始输出。
<pre>
注意: meta获取和数据的获取需要保证顺序性,优先拿到meta的,一定也会是优先拿到数据,所以需要加同步. (不能出现先拿到meta,拿到第二批数据,这样就会导致数据顺序性出现问题)
</pre> | [
"不指定",
"position",
"获取事件。canal",
"会记住此",
"client",
"最新的",
"position。",
"<br",
"/",
">",
"如果是第一次",
"fetch,则会从",
"canal",
"中保存的最老一条数据开始输出。"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/server/src/main/java/com/alibaba/otter/canal/server/embedded/CanalServerWithEmbedded.java#L288-L291 | train | Gets the message without an ack. | [
30522,
1030,
2058,
15637,
2270,
4471,
2131,
24415,
5833,
8684,
1006,
7396,
5178,
16778,
3723,
7396,
5178,
16778,
3723,
1010,
20014,
14108,
5332,
4371,
1007,
11618,
17263,
2121,
28943,
2595,
24422,
1063,
2709,
2131,
24415,
5833,
8684,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java | SecureUtil.sign | public static Sign sign(SignAlgorithm algorithm, String privateKeyBase64, String publicKeyBase64) {
return new Sign(algorithm, privateKeyBase64, publicKeyBase64);
} | java | public static Sign sign(SignAlgorithm algorithm, String privateKeyBase64, String publicKeyBase64) {
return new Sign(algorithm, privateKeyBase64, publicKeyBase64);
} | [
"public",
"static",
"Sign",
"sign",
"(",
"SignAlgorithm",
"algorithm",
",",
"String",
"privateKeyBase64",
",",
"String",
"publicKeyBase64",
")",
"{",
"return",
"new",
"Sign",
"(",
"algorithm",
",",
"privateKeyBase64",
",",
"publicKeyBase64",
")",
";",
"}"
] | 创建签名算法对象<br>
私钥和公钥同时为空时生成一对新的私钥和公钥<br>
私钥和公钥可以单独传入一个,如此则只能使用此钥匙来做签名或验证
@param algorithm 签名算法
@param privateKeyBase64 私钥Base64
@param publicKeyBase64 公钥Base64
@return {@link Sign}
@since 3.3.0 | [
"创建签名算法对象<br",
">",
"私钥和公钥同时为空时生成一对新的私钥和公钥<br",
">",
"私钥和公钥可以单独传入一个,如此则只能使用此钥匙来做签名或验证"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L803-L805 | train | Creates a sign object with the specified algorithm private key and public key base64 encoded string. | [
30522,
2270,
10763,
3696,
3696,
1006,
4742,
20255,
8939,
2213,
9896,
1010,
5164,
2797,
14839,
15058,
21084,
1010,
5164,
2270,
14839,
15058,
21084,
1007,
1063,
2709,
2047,
3696,
1006,
9896,
1010,
2797,
14839,
15058,
21084,
1010,
2270,
14839,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/StringUtils.java | StringUtils.concatenateWithAnd | @Nullable
public static String concatenateWithAnd(@Nullable String s1, @Nullable String s2) {
if (s1 != null) {
return s2 == null ? s1 : s1 + " and " + s2;
}
else {
return s2;
}
} | java | @Nullable
public static String concatenateWithAnd(@Nullable String s1, @Nullable String s2) {
if (s1 != null) {
return s2 == null ? s1 : s1 + " and " + s2;
}
else {
return s2;
}
} | [
"@",
"Nullable",
"public",
"static",
"String",
"concatenateWithAnd",
"(",
"@",
"Nullable",
"String",
"s1",
",",
"@",
"Nullable",
"String",
"s2",
")",
"{",
"if",
"(",
"s1",
"!=",
"null",
")",
"{",
"return",
"s2",
"==",
"null",
"?",
"s1",
":",
"s1",
"+... | If both string arguments are non-null, this method concatenates them with ' and '.
If only one of the arguments is non-null, this method returns the non-null argument.
If both arguments are null, this method returns null.
@param s1 The first string argument
@param s2 The second string argument
@return The concatenated string, or non-null argument, or null | [
"If",
"both",
"string",
"arguments",
"are",
"non",
"-",
"null",
"this",
"method",
"concatenates",
"them",
"with",
"and",
".",
"If",
"only",
"one",
"of",
"the",
"arguments",
"is",
"non",
"-",
"null",
"this",
"method",
"returns",
"the",
"non",
"-",
"null",... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/StringUtils.java#L376-L384 | train | Concatenate two strings. | [
30522,
1030,
19701,
3085,
2270,
10763,
5164,
9530,
16280,
12556,
24415,
5685,
1006,
1030,
19701,
3085,
5164,
1055,
2487,
1010,
1030,
19701,
3085,
5164,
1055,
2475,
1007,
1063,
2065,
1006,
1055,
2487,
999,
1027,
19701,
1007,
1063,
2709,
1055... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java | CompressorHttp2ConnectionEncoder.nextReadableBuf | private static ByteBuf nextReadableBuf(EmbeddedChannel compressor) {
for (;;) {
final ByteBuf buf = compressor.readOutbound();
if (buf == null) {
return null;
}
if (!buf.isReadable()) {
buf.release();
continue;
}
return buf;
}
} | java | private static ByteBuf nextReadableBuf(EmbeddedChannel compressor) {
for (;;) {
final ByteBuf buf = compressor.readOutbound();
if (buf == null) {
return null;
}
if (!buf.isReadable()) {
buf.release();
continue;
}
return buf;
}
} | [
"private",
"static",
"ByteBuf",
"nextReadableBuf",
"(",
"EmbeddedChannel",
"compressor",
")",
"{",
"for",
"(",
";",
";",
")",
"{",
"final",
"ByteBuf",
"buf",
"=",
"compressor",
".",
"readOutbound",
"(",
")",
";",
"if",
"(",
"buf",
"==",
"null",
")",
"{",... | Read the next compressed {@link ByteBuf} from the {@link EmbeddedChannel} or {@code null} if one does not exist.
@param compressor The channel to read from
@return The next decoded {@link ByteBuf} from the {@link EmbeddedChannel} or {@code null} if one does not exist | [
"Read",
"the",
"next",
"compressed",
"{",
"@link",
"ByteBuf",
"}",
"from",
"the",
"{",
"@link",
"EmbeddedChannel",
"}",
"or",
"{",
"@code",
"null",
"}",
"if",
"one",
"does",
"not",
"exist",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java#L306-L318 | train | Read the next readable ByteBuf from the given channel. | [
30522,
2797,
10763,
24880,
8569,
2546,
2279,
16416,
20782,
8569,
2546,
1006,
11157,
26058,
29329,
1007,
1063,
2005,
1006,
1025,
1025,
1007,
1063,
2345,
24880,
8569,
2546,
20934,
2546,
1027,
29329,
1012,
3191,
5833,
15494,
1006,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java | BeanUtil.beanToMap | public static Map<String, Object> beanToMap(Object bean) {
return beanToMap(bean, false, false);
} | java | public static Map<String, Object> beanToMap(Object bean) {
return beanToMap(bean, false, false);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"beanToMap",
"(",
"Object",
"bean",
")",
"{",
"return",
"beanToMap",
"(",
"bean",
",",
"false",
",",
"false",
")",
";",
"}"
] | 对象转Map,不进行驼峰转下划线,不忽略值为空的字段
@param bean bean对象
@return Map | [
"对象转Map,不进行驼峰转下划线,不忽略值为空的字段"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L485-L487 | train | Converts a bean to a map. | [
30522,
2270,
10763,
4949,
1026,
5164,
1010,
4874,
1028,
14068,
20389,
9331,
1006,
4874,
14068,
1007,
1063,
2709,
14068,
20389,
9331,
1006,
14068,
1010,
6270,
1010,
6270,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/swing/DesktopUtil.java | DesktopUtil.mail | public static void mail(String mailAddress) {
final Desktop dsktop = getDsktop();
try {
dsktop.mail(URLUtil.toURI(mailAddress));
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | java | public static void mail(String mailAddress) {
final Desktop dsktop = getDsktop();
try {
dsktop.mail(URLUtil.toURI(mailAddress));
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | [
"public",
"static",
"void",
"mail",
"(",
"String",
"mailAddress",
")",
"{",
"final",
"Desktop",
"dsktop",
"=",
"getDsktop",
"(",
")",
";",
"try",
"{",
"dsktop",
".",
"mail",
"(",
"URLUtil",
".",
"toURI",
"(",
"mailAddress",
")",
")",
";",
"}",
"catch",... | 使用平台默认浏览器打开指定URL地址
@param mailAddress 邮件地址 | [
"使用平台默认浏览器打开指定URL地址"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/swing/DesktopUtil.java#L89-L96 | train | Creates a mail message with the specified address. | [
30522,
2270,
10763,
11675,
5653,
1006,
5164,
5653,
4215,
16200,
4757,
1007,
1063,
2345,
15363,
16233,
25509,
7361,
1027,
2131,
5104,
25509,
7361,
1006,
1007,
1025,
3046,
1063,
16233,
25509,
7361,
1012,
5653,
1006,
24471,
7630,
3775,
2140,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BinaryHashTable.java | BinaryHashTable.tryProbe | public boolean tryProbe(BaseRow record) throws IOException {
if (!this.probeIterator.hasSource()) {
// set the current probe value when probeIterator is null at the begging.
this.probeIterator.setInstance(record);
}
// calculate the hash
BinaryRow probeKey = probeSideProjection.apply(record);
final int hash = hash(probeKey.hashCode(), this.currentRecursionDepth);
BinaryHashPartition p = this.partitionsBeingBuilt.get(hash % partitionsBeingBuilt.size());
// for an in-memory partition, process set the return iterators, else spill the probe records
if (p.isInMemory()) {
this.probeKey = probeKey;
this.probeRow = record;
p.bucketArea.startLookup(hash);
return true;
} else {
if (p.testHashBloomFilter(hash)) {
BinaryRow row = originProbeSideSerializer.baseRowToBinary(record);
p.insertIntoProbeBuffer(row);
}
return false;
}
} | java | public boolean tryProbe(BaseRow record) throws IOException {
if (!this.probeIterator.hasSource()) {
// set the current probe value when probeIterator is null at the begging.
this.probeIterator.setInstance(record);
}
// calculate the hash
BinaryRow probeKey = probeSideProjection.apply(record);
final int hash = hash(probeKey.hashCode(), this.currentRecursionDepth);
BinaryHashPartition p = this.partitionsBeingBuilt.get(hash % partitionsBeingBuilt.size());
// for an in-memory partition, process set the return iterators, else spill the probe records
if (p.isInMemory()) {
this.probeKey = probeKey;
this.probeRow = record;
p.bucketArea.startLookup(hash);
return true;
} else {
if (p.testHashBloomFilter(hash)) {
BinaryRow row = originProbeSideSerializer.baseRowToBinary(record);
p.insertIntoProbeBuffer(row);
}
return false;
}
} | [
"public",
"boolean",
"tryProbe",
"(",
"BaseRow",
"record",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"this",
".",
"probeIterator",
".",
"hasSource",
"(",
")",
")",
"{",
"// set the current probe value when probeIterator is null at the begging.",
"this",
".",
... | Find matched build side rows for a probe row.
@return return false if the target partition has spilled, we will spill this probe row too.
The row will be re-match in rebuild phase. | [
"Find",
"matched",
"build",
"side",
"rows",
"for",
"a",
"probe",
"row",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BinaryHashTable.java#L274-L298 | train | Try to probe the given record. | [
30522,
2270,
22017,
20898,
3046,
21572,
4783,
1006,
2918,
10524,
2501,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
999,
2023,
1012,
15113,
21646,
8844,
1012,
2038,
6499,
3126,
3401,
1006,
1007,
1007,
1063,
1013,
1013,
2275,
1996,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/DataSet.java | DataSet.runOperation | public <X> DataSet<X> runOperation(CustomUnaryOperation<T, X> operation) {
Preconditions.checkNotNull(operation, "The custom operator must not be null.");
operation.setInput(this);
return operation.createResult();
} | java | public <X> DataSet<X> runOperation(CustomUnaryOperation<T, X> operation) {
Preconditions.checkNotNull(operation, "The custom operator must not be null.");
operation.setInput(this);
return operation.createResult();
} | [
"public",
"<",
"X",
">",
"DataSet",
"<",
"X",
">",
"runOperation",
"(",
"CustomUnaryOperation",
"<",
"T",
",",
"X",
">",
"operation",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"operation",
",",
"\"The custom operator must not be null.\"",
")",
";",
... | Runs a {@link CustomUnaryOperation} on the data set. Custom operations are typically complex
operators that are composed of multiple steps.
@param operation The operation to run.
@return The data set produced by the operation. | [
"Runs",
"a",
"{",
"@link",
"CustomUnaryOperation",
"}",
"on",
"the",
"data",
"set",
".",
"Custom",
"operations",
"are",
"typically",
"complex",
"operators",
"that",
"are",
"composed",
"of",
"multiple",
"steps",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L1225-L1229 | train | Runs a custom unary operation on this DataSet. | [
30522,
2270,
1026,
1060,
1028,
2951,
13462,
1026,
1060,
1028,
2448,
25918,
3370,
1006,
7661,
9521,
2854,
25918,
3370,
1026,
1056,
1010,
1060,
1028,
3169,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11231,
3363,
1006,
3169,
1010,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java | MiniCluster.listJobs | public CompletableFuture<Collection<JobStatusMessage>> listJobs() {
return runDispatcherCommand(dispatcherGateway ->
dispatcherGateway
.requestMultipleJobDetails(rpcTimeout)
.thenApply(jobs ->
jobs.getJobs().stream()
.map(details -> new JobStatusMessage(details.getJobId(), details.getJobName(), details.getStatus(), details.getStartTime()))
.collect(Collectors.toList())));
} | java | public CompletableFuture<Collection<JobStatusMessage>> listJobs() {
return runDispatcherCommand(dispatcherGateway ->
dispatcherGateway
.requestMultipleJobDetails(rpcTimeout)
.thenApply(jobs ->
jobs.getJobs().stream()
.map(details -> new JobStatusMessage(details.getJobId(), details.getJobName(), details.getStatus(), details.getStartTime()))
.collect(Collectors.toList())));
} | [
"public",
"CompletableFuture",
"<",
"Collection",
"<",
"JobStatusMessage",
">",
">",
"listJobs",
"(",
")",
"{",
"return",
"runDispatcherCommand",
"(",
"dispatcherGateway",
"->",
"dispatcherGateway",
".",
"requestMultipleJobDetails",
"(",
"rpcTimeout",
")",
".",
"thenA... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java#L536-L544 | train | List all jobs. | [
30522,
2270,
4012,
10814,
10880,
11263,
11244,
1026,
3074,
1026,
5841,
29336,
2271,
7834,
3736,
3351,
1028,
1028,
2862,
5558,
5910,
1006,
1007,
1063,
2709,
2448,
10521,
4502,
10649,
2121,
9006,
2386,
2094,
1006,
18365,
2121,
5867,
4576,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/sources/wmstrategies/WatermarkStrategy.java | WatermarkStrategy.toProperties | @Override
public Map<String, String> toProperties() {
Map<String, String> properties = new HashMap<>();
properties.put(Rowtime.ROWTIME_WATERMARKS_TYPE, Rowtime.ROWTIME_WATERMARKS_TYPE_VALUE_CUSTOM);
properties.put(Rowtime.ROWTIME_WATERMARKS_CLASS, this.getClass().getName());
properties.put(Rowtime.ROWTIME_WATERMARKS_SERIALIZED, EncodingUtils.encodeObjectToString(this));
return properties;
} | java | @Override
public Map<String, String> toProperties() {
Map<String, String> properties = new HashMap<>();
properties.put(Rowtime.ROWTIME_WATERMARKS_TYPE, Rowtime.ROWTIME_WATERMARKS_TYPE_VALUE_CUSTOM);
properties.put(Rowtime.ROWTIME_WATERMARKS_CLASS, this.getClass().getName());
properties.put(Rowtime.ROWTIME_WATERMARKS_SERIALIZED, EncodingUtils.encodeObjectToString(this));
return properties;
} | [
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"String",
">",
"toProperties",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"properties",
".",
"put",
"(",
"Rowtime",
".",
"RO... | This method is a default implementation that uses java serialization and it is discouraged.
All implementation should provide a more specific set of properties. | [
"This",
"method",
"is",
"a",
"default",
"implementation",
"that",
"uses",
"java",
"serialization",
"and",
"it",
"is",
"discouraged",
".",
"All",
"implementation",
"should",
"provide",
"a",
"more",
"specific",
"set",
"of",
"properties",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/sources/wmstrategies/WatermarkStrategy.java#L43-L50 | train | Returns a map of properties that can be used to write the rowtime information to the database. | [
30522,
1030,
2058,
15637,
2270,
4949,
1026,
5164,
1010,
5164,
1028,
2327,
18981,
8743,
3111,
1006,
1007,
1063,
4949,
1026,
5164,
1010,
5164,
1028,
5144,
1027,
2047,
23325,
2863,
2361,
1026,
1028,
1006,
1007,
1025,
5144,
1012,
2404,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/UUID.java | UUID.digits | private static String digits(long val, int digits) {
long hi = 1L << (digits * 4);
return Long.toHexString(hi | (val & (hi - 1))).substring(1);
} | java | private static String digits(long val, int digits) {
long hi = 1L << (digits * 4);
return Long.toHexString(hi | (val & (hi - 1))).substring(1);
} | [
"private",
"static",
"String",
"digits",
"(",
"long",
"val",
",",
"int",
"digits",
")",
"{",
"long",
"hi",
"=",
"1L",
"<<",
"(",
"digits",
"*",
"4",
")",
";",
"return",
"Long",
".",
"toHexString",
"(",
"hi",
"|",
"(",
"val",
"&",
"(",
"hi",
"-",
... | 返回指定数字对应的hex值
@param val 值
@param digits 位
@return 值 | [
"返回指定数字对应的hex值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/UUID.java#L435-L438 | train | Returns a string of digits. | [
30522,
2797,
10763,
5164,
16648,
1006,
2146,
11748,
1010,
20014,
16648,
1007,
1063,
2146,
7632,
1027,
1015,
2140,
1026,
1026,
1006,
16648,
1008,
1018,
1007,
1025,
2709,
2146,
1012,
2000,
5369,
2595,
3367,
4892,
1006,
7632,
1064,
1006,
11748... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java | SingleThreadEventExecutor.delayNanos | protected long delayNanos(long currentTimeNanos) {
ScheduledFutureTask<?> scheduledTask = peekScheduledTask();
if (scheduledTask == null) {
return SCHEDULE_PURGE_INTERVAL;
}
return scheduledTask.delayNanos(currentTimeNanos);
} | java | protected long delayNanos(long currentTimeNanos) {
ScheduledFutureTask<?> scheduledTask = peekScheduledTask();
if (scheduledTask == null) {
return SCHEDULE_PURGE_INTERVAL;
}
return scheduledTask.delayNanos(currentTimeNanos);
} | [
"protected",
"long",
"delayNanos",
"(",
"long",
"currentTimeNanos",
")",
"{",
"ScheduledFutureTask",
"<",
"?",
">",
"scheduledTask",
"=",
"peekScheduledTask",
"(",
")",
";",
"if",
"(",
"scheduledTask",
"==",
"null",
")",
"{",
"return",
"SCHEDULE_PURGE_INTERVAL",
... | Returns the amount of time left until the scheduled task with the closest dead line is executed. | [
"Returns",
"the",
"amount",
"of",
"time",
"left",
"until",
"the",
"scheduled",
"task",
"with",
"the",
"closest",
"dead",
"line",
"is",
"executed",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java#L438-L445 | train | Returns the delay in nanoseconds. | [
30522,
5123,
2146,
8536,
7229,
2891,
1006,
2146,
2783,
7292,
7229,
2891,
1007,
1063,
5115,
11263,
11244,
10230,
2243,
1026,
1029,
1028,
5115,
10230,
2243,
1027,
19043,
22842,
8566,
3709,
10230,
2243,
1006,
1007,
1025,
2065,
1006,
5115,
1023... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/NetUtil.java | NetUtil.getIPv6ByName | private static byte[] getIPv6ByName(CharSequence ip, boolean ipv4Mapped) {
final byte[] bytes = new byte[IPV6_BYTE_COUNT];
final int ipLength = ip.length();
int compressBegin = 0;
int compressLength = 0;
int currentIndex = 0;
int value = 0;
int begin = -1;
int i = 0;
int ipv6Separators = 0;
int ipv4Separators = 0;
int tmp;
boolean needsShift = false;
for (; i < ipLength; ++i) {
final char c = ip.charAt(i);
switch (c) {
case ':':
++ipv6Separators;
if (i - begin > IPV6_MAX_CHAR_BETWEEN_SEPARATOR ||
ipv4Separators > 0 || ipv6Separators > IPV6_MAX_SEPARATORS ||
currentIndex + 1 >= bytes.length) {
return null;
}
value <<= (IPV6_MAX_CHAR_BETWEEN_SEPARATOR - (i - begin)) << 2;
if (compressLength > 0) {
compressLength -= 2;
}
// The value integer holds at most 4 bytes from right (most significant) to left (least significant).
// The following bit shifting is used to extract and re-order the individual bytes to achieve a
// left (most significant) to right (least significant) ordering.
bytes[currentIndex++] = (byte) (((value & 0xf) << 4) | ((value >> 4) & 0xf));
bytes[currentIndex++] = (byte) ((((value >> 8) & 0xf) << 4) | ((value >> 12) & 0xf));
tmp = i + 1;
if (tmp < ipLength && ip.charAt(tmp) == ':') {
++tmp;
if (compressBegin != 0 || (tmp < ipLength && ip.charAt(tmp) == ':')) {
return null;
}
++ipv6Separators;
needsShift = ipv6Separators == 2 && value == 0;
compressBegin = currentIndex;
compressLength = bytes.length - compressBegin - 2;
++i;
}
value = 0;
begin = -1;
break;
case '.':
++ipv4Separators;
tmp = i - begin; // tmp is the length of the current segment.
if (tmp > IPV4_MAX_CHAR_BETWEEN_SEPARATOR
|| begin < 0
|| ipv4Separators > IPV4_SEPARATORS
|| (ipv6Separators > 0 && (currentIndex + compressLength < 12))
|| i + 1 >= ipLength
|| currentIndex >= bytes.length
|| ipv4Separators == 1 &&
// We also parse pure IPv4 addresses as IPv4-Mapped for ease of use.
((!ipv4Mapped || currentIndex != 0 && !isValidIPv4Mapped(bytes, currentIndex,
compressBegin, compressLength)) ||
(tmp == 3 && (!isValidNumericChar(ip.charAt(i - 1)) ||
!isValidNumericChar(ip.charAt(i - 2)) ||
!isValidNumericChar(ip.charAt(i - 3))) ||
tmp == 2 && (!isValidNumericChar(ip.charAt(i - 1)) ||
!isValidNumericChar(ip.charAt(i - 2))) ||
tmp == 1 && !isValidNumericChar(ip.charAt(i - 1))))) {
return null;
}
value <<= (IPV4_MAX_CHAR_BETWEEN_SEPARATOR - tmp) << 2;
// The value integer holds at most 3 bytes from right (most significant) to left (least significant).
// The following bit shifting is to restructure the bytes to be left (most significant) to
// right (least significant) while also accounting for each IPv4 digit is base 10.
begin = (value & 0xf) * 100 + ((value >> 4) & 0xf) * 10 + ((value >> 8) & 0xf);
if (begin < 0 || begin > 255) {
return null;
}
bytes[currentIndex++] = (byte) begin;
value = 0;
begin = -1;
break;
default:
if (!isValidHexChar(c) || (ipv4Separators > 0 && !isValidNumericChar(c))) {
return null;
}
if (begin < 0) {
begin = i;
} else if (i - begin > IPV6_MAX_CHAR_BETWEEN_SEPARATOR) {
return null;
}
// The value is treated as a sort of array of numbers because we are dealing with
// at most 4 consecutive bytes we can use bit shifting to accomplish this.
// The most significant byte will be encountered first, and reside in the right most
// position of the following integer
value += StringUtil.decodeHexNibble(c) << ((i - begin) << 2);
break;
}
}
final boolean isCompressed = compressBegin > 0;
// Finish up last set of data that was accumulated in the loop (or before the loop)
if (ipv4Separators > 0) {
if (begin > 0 && i - begin > IPV4_MAX_CHAR_BETWEEN_SEPARATOR ||
ipv4Separators != IPV4_SEPARATORS ||
currentIndex >= bytes.length) {
return null;
}
if (ipv6Separators == 0) {
compressLength = 12;
} else if (ipv6Separators >= IPV6_MIN_SEPARATORS &&
(!isCompressed && (ipv6Separators == 6 && ip.charAt(0) != ':') ||
isCompressed && (ipv6Separators < IPV6_MAX_SEPARATORS &&
(ip.charAt(0) != ':' || compressBegin <= 2)))) {
compressLength -= 2;
} else {
return null;
}
value <<= (IPV4_MAX_CHAR_BETWEEN_SEPARATOR - (i - begin)) << 2;
// The value integer holds at most 3 bytes from right (most significant) to left (least significant).
// The following bit shifting is to restructure the bytes to be left (most significant) to
// right (least significant) while also accounting for each IPv4 digit is base 10.
begin = (value & 0xf) * 100 + ((value >> 4) & 0xf) * 10 + ((value >> 8) & 0xf);
if (begin < 0 || begin > 255) {
return null;
}
bytes[currentIndex++] = (byte) begin;
} else {
tmp = ipLength - 1;
if (begin > 0 && i - begin > IPV6_MAX_CHAR_BETWEEN_SEPARATOR ||
ipv6Separators < IPV6_MIN_SEPARATORS ||
!isCompressed && (ipv6Separators + 1 != IPV6_MAX_SEPARATORS ||
ip.charAt(0) == ':' || ip.charAt(tmp) == ':') ||
isCompressed && (ipv6Separators > IPV6_MAX_SEPARATORS ||
(ipv6Separators == IPV6_MAX_SEPARATORS &&
(compressBegin <= 2 && ip.charAt(0) != ':' ||
compressBegin >= 14 && ip.charAt(tmp) != ':'))) ||
currentIndex + 1 >= bytes.length ||
begin < 0 && ip.charAt(tmp - 1) != ':' ||
compressBegin > 2 && ip.charAt(0) == ':') {
return null;
}
if (begin >= 0 && i - begin <= IPV6_MAX_CHAR_BETWEEN_SEPARATOR) {
value <<= (IPV6_MAX_CHAR_BETWEEN_SEPARATOR - (i - begin)) << 2;
}
// The value integer holds at most 4 bytes from right (most significant) to left (least significant).
// The following bit shifting is used to extract and re-order the individual bytes to achieve a
// left (most significant) to right (least significant) ordering.
bytes[currentIndex++] = (byte) (((value & 0xf) << 4) | ((value >> 4) & 0xf));
bytes[currentIndex++] = (byte) ((((value >> 8) & 0xf) << 4) | ((value >> 12) & 0xf));
}
i = currentIndex + compressLength;
if (needsShift || i >= bytes.length) {
// Right shift array
if (i >= bytes.length) {
++compressBegin;
}
for (i = currentIndex; i < bytes.length; ++i) {
for (begin = bytes.length - 1; begin >= compressBegin; --begin) {
bytes[begin] = bytes[begin - 1];
}
bytes[begin] = 0;
++compressBegin;
}
} else {
// Selectively move elements
for (i = 0; i < compressLength; ++i) {
begin = i + compressBegin;
currentIndex = begin + compressLength;
if (currentIndex < bytes.length) {
bytes[currentIndex] = bytes[begin];
bytes[begin] = 0;
} else {
break;
}
}
}
if (ipv4Separators > 0) {
// We only support IPv4-Mapped addresses [1] because IPv4-Compatible addresses are deprecated [2].
// [1] https://tools.ietf.org/html/rfc4291#section-2.5.5.2
// [2] https://tools.ietf.org/html/rfc4291#section-2.5.5.1
bytes[10] = bytes[11] = (byte) 0xff;
}
return bytes;
} | java | private static byte[] getIPv6ByName(CharSequence ip, boolean ipv4Mapped) {
final byte[] bytes = new byte[IPV6_BYTE_COUNT];
final int ipLength = ip.length();
int compressBegin = 0;
int compressLength = 0;
int currentIndex = 0;
int value = 0;
int begin = -1;
int i = 0;
int ipv6Separators = 0;
int ipv4Separators = 0;
int tmp;
boolean needsShift = false;
for (; i < ipLength; ++i) {
final char c = ip.charAt(i);
switch (c) {
case ':':
++ipv6Separators;
if (i - begin > IPV6_MAX_CHAR_BETWEEN_SEPARATOR ||
ipv4Separators > 0 || ipv6Separators > IPV6_MAX_SEPARATORS ||
currentIndex + 1 >= bytes.length) {
return null;
}
value <<= (IPV6_MAX_CHAR_BETWEEN_SEPARATOR - (i - begin)) << 2;
if (compressLength > 0) {
compressLength -= 2;
}
// The value integer holds at most 4 bytes from right (most significant) to left (least significant).
// The following bit shifting is used to extract and re-order the individual bytes to achieve a
// left (most significant) to right (least significant) ordering.
bytes[currentIndex++] = (byte) (((value & 0xf) << 4) | ((value >> 4) & 0xf));
bytes[currentIndex++] = (byte) ((((value >> 8) & 0xf) << 4) | ((value >> 12) & 0xf));
tmp = i + 1;
if (tmp < ipLength && ip.charAt(tmp) == ':') {
++tmp;
if (compressBegin != 0 || (tmp < ipLength && ip.charAt(tmp) == ':')) {
return null;
}
++ipv6Separators;
needsShift = ipv6Separators == 2 && value == 0;
compressBegin = currentIndex;
compressLength = bytes.length - compressBegin - 2;
++i;
}
value = 0;
begin = -1;
break;
case '.':
++ipv4Separators;
tmp = i - begin; // tmp is the length of the current segment.
if (tmp > IPV4_MAX_CHAR_BETWEEN_SEPARATOR
|| begin < 0
|| ipv4Separators > IPV4_SEPARATORS
|| (ipv6Separators > 0 && (currentIndex + compressLength < 12))
|| i + 1 >= ipLength
|| currentIndex >= bytes.length
|| ipv4Separators == 1 &&
// We also parse pure IPv4 addresses as IPv4-Mapped for ease of use.
((!ipv4Mapped || currentIndex != 0 && !isValidIPv4Mapped(bytes, currentIndex,
compressBegin, compressLength)) ||
(tmp == 3 && (!isValidNumericChar(ip.charAt(i - 1)) ||
!isValidNumericChar(ip.charAt(i - 2)) ||
!isValidNumericChar(ip.charAt(i - 3))) ||
tmp == 2 && (!isValidNumericChar(ip.charAt(i - 1)) ||
!isValidNumericChar(ip.charAt(i - 2))) ||
tmp == 1 && !isValidNumericChar(ip.charAt(i - 1))))) {
return null;
}
value <<= (IPV4_MAX_CHAR_BETWEEN_SEPARATOR - tmp) << 2;
// The value integer holds at most 3 bytes from right (most significant) to left (least significant).
// The following bit shifting is to restructure the bytes to be left (most significant) to
// right (least significant) while also accounting for each IPv4 digit is base 10.
begin = (value & 0xf) * 100 + ((value >> 4) & 0xf) * 10 + ((value >> 8) & 0xf);
if (begin < 0 || begin > 255) {
return null;
}
bytes[currentIndex++] = (byte) begin;
value = 0;
begin = -1;
break;
default:
if (!isValidHexChar(c) || (ipv4Separators > 0 && !isValidNumericChar(c))) {
return null;
}
if (begin < 0) {
begin = i;
} else if (i - begin > IPV6_MAX_CHAR_BETWEEN_SEPARATOR) {
return null;
}
// The value is treated as a sort of array of numbers because we are dealing with
// at most 4 consecutive bytes we can use bit shifting to accomplish this.
// The most significant byte will be encountered first, and reside in the right most
// position of the following integer
value += StringUtil.decodeHexNibble(c) << ((i - begin) << 2);
break;
}
}
final boolean isCompressed = compressBegin > 0;
// Finish up last set of data that was accumulated in the loop (or before the loop)
if (ipv4Separators > 0) {
if (begin > 0 && i - begin > IPV4_MAX_CHAR_BETWEEN_SEPARATOR ||
ipv4Separators != IPV4_SEPARATORS ||
currentIndex >= bytes.length) {
return null;
}
if (ipv6Separators == 0) {
compressLength = 12;
} else if (ipv6Separators >= IPV6_MIN_SEPARATORS &&
(!isCompressed && (ipv6Separators == 6 && ip.charAt(0) != ':') ||
isCompressed && (ipv6Separators < IPV6_MAX_SEPARATORS &&
(ip.charAt(0) != ':' || compressBegin <= 2)))) {
compressLength -= 2;
} else {
return null;
}
value <<= (IPV4_MAX_CHAR_BETWEEN_SEPARATOR - (i - begin)) << 2;
// The value integer holds at most 3 bytes from right (most significant) to left (least significant).
// The following bit shifting is to restructure the bytes to be left (most significant) to
// right (least significant) while also accounting for each IPv4 digit is base 10.
begin = (value & 0xf) * 100 + ((value >> 4) & 0xf) * 10 + ((value >> 8) & 0xf);
if (begin < 0 || begin > 255) {
return null;
}
bytes[currentIndex++] = (byte) begin;
} else {
tmp = ipLength - 1;
if (begin > 0 && i - begin > IPV6_MAX_CHAR_BETWEEN_SEPARATOR ||
ipv6Separators < IPV6_MIN_SEPARATORS ||
!isCompressed && (ipv6Separators + 1 != IPV6_MAX_SEPARATORS ||
ip.charAt(0) == ':' || ip.charAt(tmp) == ':') ||
isCompressed && (ipv6Separators > IPV6_MAX_SEPARATORS ||
(ipv6Separators == IPV6_MAX_SEPARATORS &&
(compressBegin <= 2 && ip.charAt(0) != ':' ||
compressBegin >= 14 && ip.charAt(tmp) != ':'))) ||
currentIndex + 1 >= bytes.length ||
begin < 0 && ip.charAt(tmp - 1) != ':' ||
compressBegin > 2 && ip.charAt(0) == ':') {
return null;
}
if (begin >= 0 && i - begin <= IPV6_MAX_CHAR_BETWEEN_SEPARATOR) {
value <<= (IPV6_MAX_CHAR_BETWEEN_SEPARATOR - (i - begin)) << 2;
}
// The value integer holds at most 4 bytes from right (most significant) to left (least significant).
// The following bit shifting is used to extract and re-order the individual bytes to achieve a
// left (most significant) to right (least significant) ordering.
bytes[currentIndex++] = (byte) (((value & 0xf) << 4) | ((value >> 4) & 0xf));
bytes[currentIndex++] = (byte) ((((value >> 8) & 0xf) << 4) | ((value >> 12) & 0xf));
}
i = currentIndex + compressLength;
if (needsShift || i >= bytes.length) {
// Right shift array
if (i >= bytes.length) {
++compressBegin;
}
for (i = currentIndex; i < bytes.length; ++i) {
for (begin = bytes.length - 1; begin >= compressBegin; --begin) {
bytes[begin] = bytes[begin - 1];
}
bytes[begin] = 0;
++compressBegin;
}
} else {
// Selectively move elements
for (i = 0; i < compressLength; ++i) {
begin = i + compressBegin;
currentIndex = begin + compressLength;
if (currentIndex < bytes.length) {
bytes[currentIndex] = bytes[begin];
bytes[begin] = 0;
} else {
break;
}
}
}
if (ipv4Separators > 0) {
// We only support IPv4-Mapped addresses [1] because IPv4-Compatible addresses are deprecated [2].
// [1] https://tools.ietf.org/html/rfc4291#section-2.5.5.2
// [2] https://tools.ietf.org/html/rfc4291#section-2.5.5.1
bytes[10] = bytes[11] = (byte) 0xff;
}
return bytes;
} | [
"private",
"static",
"byte",
"[",
"]",
"getIPv6ByName",
"(",
"CharSequence",
"ip",
",",
"boolean",
"ipv4Mapped",
")",
"{",
"final",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"IPV6_BYTE_COUNT",
"]",
";",
"final",
"int",
"ipLength",
"=",
"ip",
".... | Returns the byte array representation of a {@link CharSequence} IP address.
<p>
The {@code ipv4Mapped} parameter specifies how IPv4 addresses should be treated.
"IPv4 mapped" format as
defined in <a href="http://tools.ietf.org/html/rfc4291#section-2.5.5">rfc 4291 section 2</a> is supported.
@param ip {@link CharSequence} IP address to be converted to a {@link Inet6Address}
@param ipv4Mapped
<ul>
<li>{@code true} To allow IPv4 mapped inputs to be translated into {@link Inet6Address}</li>
<li>{@code false} Consider IPv4 mapped addresses as invalid.</li>
</ul>
@return byte array representation of the {@code ip} or {@code null} if not a valid IP address. | [
"Returns",
"the",
"byte",
"array",
"representation",
"of",
"a",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/NetUtil.java#L741-L930 | train | Get IPv6 by name. | [
30522,
2797,
10763,
24880,
1031,
1033,
2131,
11514,
2615,
2575,
3762,
18442,
1006,
25869,
3366,
4226,
5897,
12997,
1010,
22017,
20898,
12997,
2615,
2549,
2863,
11469,
1007,
1063,
2345,
24880,
1031,
1033,
27507,
1027,
2047,
24880,
1031,
12997,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBean.java | AbstractFilterRegistrationBean.setServletNames | public void setServletNames(Collection<String> servletNames) {
Assert.notNull(servletNames, "ServletNames must not be null");
this.servletNames = new LinkedHashSet<>(servletNames);
} | java | public void setServletNames(Collection<String> servletNames) {
Assert.notNull(servletNames, "ServletNames must not be null");
this.servletNames = new LinkedHashSet<>(servletNames);
} | [
"public",
"void",
"setServletNames",
"(",
"Collection",
"<",
"String",
">",
"servletNames",
")",
"{",
"Assert",
".",
"notNull",
"(",
"servletNames",
",",
"\"ServletNames must not be null\"",
")",
";",
"this",
".",
"servletNames",
"=",
"new",
"LinkedHashSet",
"<>",... | Set servlet names that the filter will be registered against. This will replace any
previously specified servlet names.
@param servletNames the servlet names
@see #setServletRegistrationBeans
@see #setUrlPatterns | [
"Set",
"servlet",
"names",
"that",
"the",
"filter",
"will",
"be",
"registered",
"against",
".",
"This",
"will",
"replace",
"any",
"previously",
"specified",
"servlet",
"names",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBean.java#L112-L115 | train | Sets the servlet names. | [
30522,
2270,
11675,
4520,
2121,
2615,
7485,
18442,
2015,
1006,
3074,
1026,
5164,
1028,
14262,
2615,
7485,
18442,
2015,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
14262,
2615,
7485,
18442,
2015,
1010,
1000,
14262,
2615,
7485,
18442,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/nosql/mongo/MongoFactory.java | MongoFactory.getDS | public static MongoDS getDS(Setting setting, String... groups) {
final String key = setting.getSettingPath() + GROUP_SEPRATER + ArrayUtil.join(groups, GROUP_SEPRATER);
MongoDS ds = dsMap.get(key);
if (null == ds) {
// 没有在池中加入之
ds = new MongoDS(setting, groups);
dsMap.put(key, ds);
}
return ds;
} | java | public static MongoDS getDS(Setting setting, String... groups) {
final String key = setting.getSettingPath() + GROUP_SEPRATER + ArrayUtil.join(groups, GROUP_SEPRATER);
MongoDS ds = dsMap.get(key);
if (null == ds) {
// 没有在池中加入之
ds = new MongoDS(setting, groups);
dsMap.put(key, ds);
}
return ds;
} | [
"public",
"static",
"MongoDS",
"getDS",
"(",
"Setting",
"setting",
",",
"String",
"...",
"groups",
")",
"{",
"final",
"String",
"key",
"=",
"setting",
".",
"getSettingPath",
"(",
")",
"+",
"GROUP_SEPRATER",
"+",
"ArrayUtil",
".",
"join",
"(",
"groups",
","... | 获取MongoDB数据源<br>
@param setting 设定文件
@param groups 分组列表
@return MongoDB连接 | [
"获取MongoDB数据源<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/nosql/mongo/MongoFactory.java#L90-L100 | train | Gets the DS object. | [
30522,
2270,
10763,
12256,
3995,
5104,
2131,
5104,
1006,
4292,
4292,
1010,
5164,
1012,
1012,
1012,
2967,
1007,
1063,
2345,
5164,
3145,
1027,
4292,
1012,
4152,
18319,
3070,
15069,
1006,
1007,
1009,
2177,
1035,
19802,
11657,
2099,
1009,
9140,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java | ThriftCLIServiceClient.getFunctions | @Override
public OperationHandle getFunctions(SessionHandle sessionHandle,
String catalogName, String schemaName, String functionName) throws HiveSQLException {
try {
TGetFunctionsReq req = new TGetFunctionsReq(sessionHandle.toTSessionHandle(), functionName);
req.setCatalogName(catalogName);
req.setSchemaName(schemaName);
TGetFunctionsResp resp = cliService.GetFunctions(req);
checkStatus(resp.getStatus());
TProtocolVersion protocol = sessionHandle.getProtocolVersion();
return new OperationHandle(resp.getOperationHandle(), protocol);
} catch (HiveSQLException e) {
throw e;
} catch (Exception e) {
throw new HiveSQLException(e);
}
} | java | @Override
public OperationHandle getFunctions(SessionHandle sessionHandle,
String catalogName, String schemaName, String functionName) throws HiveSQLException {
try {
TGetFunctionsReq req = new TGetFunctionsReq(sessionHandle.toTSessionHandle(), functionName);
req.setCatalogName(catalogName);
req.setSchemaName(schemaName);
TGetFunctionsResp resp = cliService.GetFunctions(req);
checkStatus(resp.getStatus());
TProtocolVersion protocol = sessionHandle.getProtocolVersion();
return new OperationHandle(resp.getOperationHandle(), protocol);
} catch (HiveSQLException e) {
throw e;
} catch (Exception e) {
throw new HiveSQLException(e);
}
} | [
"@",
"Override",
"public",
"OperationHandle",
"getFunctions",
"(",
"SessionHandle",
"sessionHandle",
",",
"String",
"catalogName",
",",
"String",
"schemaName",
",",
"String",
"functionName",
")",
"throws",
"HiveSQLException",
"{",
"try",
"{",
"TGetFunctionsReq",
"req"... | /* (non-Javadoc)
@see org.apache.hive.service.cli.ICLIService#getFunctions(org.apache.hive.service.cli.SessionHandle) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java#L277-L293 | train | Get a function from the given catalog and schema name. | [
30522,
1030,
2058,
15637,
2270,
3169,
11774,
2571,
2131,
11263,
27989,
2015,
1006,
5219,
11774,
2571,
5219,
11774,
2571,
1010,
5164,
12105,
18442,
1010,
5164,
8040,
28433,
18442,
1010,
5164,
3853,
18442,
1007,
11618,
26736,
2015,
4160,
2571,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionJobVertex.java | ExecutionJobVertex.connectToPredecessors | public void connectToPredecessors(Map<IntermediateDataSetID, IntermediateResult> intermediateDataSets) throws JobException {
List<JobEdge> inputs = jobVertex.getInputs();
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("Connecting ExecutionJobVertex %s (%s) to %d predecessors.", jobVertex.getID(), jobVertex.getName(), inputs.size()));
}
for (int num = 0; num < inputs.size(); num++) {
JobEdge edge = inputs.get(num);
if (LOG.isDebugEnabled()) {
if (edge.getSource() == null) {
LOG.debug(String.format("Connecting input %d of vertex %s (%s) to intermediate result referenced via ID %s.",
num, jobVertex.getID(), jobVertex.getName(), edge.getSourceId()));
} else {
LOG.debug(String.format("Connecting input %d of vertex %s (%s) to intermediate result referenced via predecessor %s (%s).",
num, jobVertex.getID(), jobVertex.getName(), edge.getSource().getProducer().getID(), edge.getSource().getProducer().getName()));
}
}
// fetch the intermediate result via ID. if it does not exist, then it either has not been created, or the order
// in which this method is called for the job vertices is not a topological order
IntermediateResult ires = intermediateDataSets.get(edge.getSourceId());
if (ires == null) {
throw new JobException("Cannot connect this job graph to the previous graph. No previous intermediate result found for ID "
+ edge.getSourceId());
}
this.inputs.add(ires);
int consumerIndex = ires.registerConsumer();
for (int i = 0; i < parallelism; i++) {
ExecutionVertex ev = taskVertices[i];
ev.connectSource(num, ires, edge, consumerIndex);
}
}
} | java | public void connectToPredecessors(Map<IntermediateDataSetID, IntermediateResult> intermediateDataSets) throws JobException {
List<JobEdge> inputs = jobVertex.getInputs();
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("Connecting ExecutionJobVertex %s (%s) to %d predecessors.", jobVertex.getID(), jobVertex.getName(), inputs.size()));
}
for (int num = 0; num < inputs.size(); num++) {
JobEdge edge = inputs.get(num);
if (LOG.isDebugEnabled()) {
if (edge.getSource() == null) {
LOG.debug(String.format("Connecting input %d of vertex %s (%s) to intermediate result referenced via ID %s.",
num, jobVertex.getID(), jobVertex.getName(), edge.getSourceId()));
} else {
LOG.debug(String.format("Connecting input %d of vertex %s (%s) to intermediate result referenced via predecessor %s (%s).",
num, jobVertex.getID(), jobVertex.getName(), edge.getSource().getProducer().getID(), edge.getSource().getProducer().getName()));
}
}
// fetch the intermediate result via ID. if it does not exist, then it either has not been created, or the order
// in which this method is called for the job vertices is not a topological order
IntermediateResult ires = intermediateDataSets.get(edge.getSourceId());
if (ires == null) {
throw new JobException("Cannot connect this job graph to the previous graph. No previous intermediate result found for ID "
+ edge.getSourceId());
}
this.inputs.add(ires);
int consumerIndex = ires.registerConsumer();
for (int i = 0; i < parallelism; i++) {
ExecutionVertex ev = taskVertices[i];
ev.connectSource(num, ires, edge, consumerIndex);
}
}
} | [
"public",
"void",
"connectToPredecessors",
"(",
"Map",
"<",
"IntermediateDataSetID",
",",
"IntermediateResult",
">",
"intermediateDataSets",
")",
"throws",
"JobException",
"{",
"List",
"<",
"JobEdge",
">",
"inputs",
"=",
"jobVertex",
".",
"getInputs",
"(",
")",
";... | --------------------------------------------------------------------------------------------- | [
"---------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionJobVertex.java#L425-L463 | train | Connect the job graph to the predecessors of the job vertices. | [
30522,
2270,
11675,
7532,
14399,
5596,
26005,
24137,
2869,
1006,
4949,
1026,
7783,
2850,
18260,
3775,
2094,
1010,
7783,
6072,
11314,
1028,
7783,
2850,
18260,
3215,
1007,
11618,
3105,
10288,
24422,
1063,
2862,
1026,
3105,
24225,
1028,
20407,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-setting/src/main/java/cn/hutool/setting/AbsSetting.java | AbsSetting.getStrings | public String[] getStrings(String key, String group, String delimiter) {
final String value = getByGroup(key, group);
if (StrUtil.isBlank(value)) {
return null;
}
return StrUtil.split(value, delimiter);
} | java | public String[] getStrings(String key, String group, String delimiter) {
final String value = getByGroup(key, group);
if (StrUtil.isBlank(value)) {
return null;
}
return StrUtil.split(value, delimiter);
} | [
"public",
"String",
"[",
"]",
"getStrings",
"(",
"String",
"key",
",",
"String",
"group",
",",
"String",
"delimiter",
")",
"{",
"final",
"String",
"value",
"=",
"getByGroup",
"(",
"key",
",",
"group",
")",
";",
"if",
"(",
"StrUtil",
".",
"isBlank",
"("... | 获得数组型
@param key 属性名
@param group 分组名
@param delimiter 分隔符
@return 属性值 | [
"获得数组型"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/AbsSetting.java#L136-L142 | train | Returns an array of strings from the specified group. | [
30522,
2270,
5164,
1031,
1033,
4152,
18886,
3070,
2015,
1006,
5164,
3145,
1010,
5164,
2177,
1010,
5164,
3972,
27605,
3334,
1007,
1063,
2345,
5164,
3643,
1027,
2131,
3762,
17058,
1006,
3145,
1010,
2177,
1007,
1025,
2065,
1006,
2358,
22134,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.