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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.toStream | public static ByteArrayInputStream toStream(String content, Charset charset) {
if (content == null) {
return null;
}
return toStream(StrUtil.bytes(content, charset));
} | java | public static ByteArrayInputStream toStream(String content, Charset charset) {
if (content == null) {
return null;
}
return toStream(StrUtil.bytes(content, charset));
} | [
"public",
"static",
"ByteArrayInputStream",
"toStream",
"(",
"String",
"content",
",",
"Charset",
"charset",
")",
"{",
"if",
"(",
"content",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"toStream",
"(",
"StrUtil",
".",
"bytes",
"(",
"conte... | String 转为流
@param content 内容
@param charset 编码
@return 字节流 | [
"String",
"转为流"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L750-L755 | train | Converts a String to an InputStream. | [
30522,
2270,
10763,
24880,
2906,
9447,
2378,
18780,
21422,
2000,
21422,
1006,
5164,
4180,
1010,
25869,
13462,
25869,
13462,
1007,
1063,
2065,
1006,
4180,
1027,
1027,
19701,
1007,
1063,
2709,
19701,
1025,
1065,
2709,
2000,
21422,
1006,
2358,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundrySecurityService.java | ReactiveCloudFoundrySecurityService.getAccessLevel | public Mono<AccessLevel> getAccessLevel(String token, String applicationId)
throws CloudFoundryAuthorizationException {
String uri = getPermissionsUri(applicationId);
return this.webClient.get().uri(uri).header("Authorization", "bearer " + token)
.retrieve().bodyToMono(Map.class).map(this::getAccessLevel)
.onErrorMap(this::mapError);
} | java | public Mono<AccessLevel> getAccessLevel(String token, String applicationId)
throws CloudFoundryAuthorizationException {
String uri = getPermissionsUri(applicationId);
return this.webClient.get().uri(uri).header("Authorization", "bearer " + token)
.retrieve().bodyToMono(Map.class).map(this::getAccessLevel)
.onErrorMap(this::mapError);
} | [
"public",
"Mono",
"<",
"AccessLevel",
">",
"getAccessLevel",
"(",
"String",
"token",
",",
"String",
"applicationId",
")",
"throws",
"CloudFoundryAuthorizationException",
"{",
"String",
"uri",
"=",
"getPermissionsUri",
"(",
"applicationId",
")",
";",
"return",
"this"... | Return a Mono of the access level that should be granted to the given token.
@param token the token
@param applicationId the cloud foundry application ID
@return a Mono of the access level that should be granted
@throws CloudFoundryAuthorizationException if the token is not authorized | [
"Return",
"a",
"Mono",
"of",
"the",
"access",
"level",
"that",
"should",
"be",
"granted",
"to",
"the",
"given",
"token",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundrySecurityService.java#L86-L92 | train | Get the access level for the given token. | [
30522,
2270,
18847,
1026,
3229,
20414,
2884,
1028,
2131,
6305,
9623,
25016,
15985,
1006,
5164,
19204,
1010,
5164,
4646,
3593,
1007,
11618,
6112,
14876,
8630,
20444,
14317,
10050,
9276,
10288,
24422,
1063,
5164,
24471,
2072,
1027,
2131,
4842,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/api/window/TimeWindow.java | TimeWindow.modInverse | private int modInverse(int x) {
// Cube gives inverse mod 2^4, as x^4 == 1 (mod 2^4) for all odd x.
int inverse = x * x * x;
// Newton iteration doubles correct bits at each step.
inverse *= 2 - x * inverse;
inverse *= 2 - x * inverse;
inverse *= 2 - x * inverse;
return inverse;
} | java | private int modInverse(int x) {
// Cube gives inverse mod 2^4, as x^4 == 1 (mod 2^4) for all odd x.
int inverse = x * x * x;
// Newton iteration doubles correct bits at each step.
inverse *= 2 - x * inverse;
inverse *= 2 - x * inverse;
inverse *= 2 - x * inverse;
return inverse;
} | [
"private",
"int",
"modInverse",
"(",
"int",
"x",
")",
"{",
"// Cube gives inverse mod 2^4, as x^4 == 1 (mod 2^4) for all odd x.",
"int",
"inverse",
"=",
"x",
"*",
"x",
"*",
"x",
";",
"// Newton iteration doubles correct bits at each step.",
"inverse",
"*=",
"2",
"-",
"x... | Compute the inverse of (odd) x mod 2^32. | [
"Compute",
"the",
"inverse",
"of",
"(",
"odd",
")",
"x",
"mod",
"2^32",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/api/window/TimeWindow.java#L102-L110 | train | Returns the inverse of x mod 2^4. | [
30522,
2797,
20014,
16913,
2378,
16070,
1006,
20014,
1060,
1007,
1063,
1013,
1013,
14291,
3957,
19262,
16913,
1016,
1034,
1018,
1010,
2004,
1060,
1034,
1018,
1027,
1027,
1015,
1006,
16913,
1016,
1034,
1018,
1007,
2005,
2035,
5976,
1060,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/trie/Trie.java | Trie.remainLongest | private static void remainLongest(Collection<Emit> collectedEmits)
{
if (collectedEmits.size() < 2) return;
Map<Integer, Emit> emitMapStart = new TreeMap<Integer, Emit>();
for (Emit emit : collectedEmits)
{
Emit pre = emitMapStart.get(emit.getStart());
if (pre == null || pre.size() < emit.size())
{
emitMapStart.put(emit.getStart(), emit);
}
}
if (emitMapStart.size() < 2)
{
collectedEmits.clear();
collectedEmits.addAll(emitMapStart.values());
return;
}
Map<Integer, Emit> emitMapEnd = new TreeMap<Integer, Emit>();
for (Emit emit : emitMapStart.values())
{
Emit pre = emitMapEnd.get(emit.getEnd());
if (pre == null || pre.size() < emit.size())
{
emitMapEnd.put(emit.getEnd(), emit);
}
}
collectedEmits.clear();
collectedEmits.addAll(emitMapEnd.values());
} | java | private static void remainLongest(Collection<Emit> collectedEmits)
{
if (collectedEmits.size() < 2) return;
Map<Integer, Emit> emitMapStart = new TreeMap<Integer, Emit>();
for (Emit emit : collectedEmits)
{
Emit pre = emitMapStart.get(emit.getStart());
if (pre == null || pre.size() < emit.size())
{
emitMapStart.put(emit.getStart(), emit);
}
}
if (emitMapStart.size() < 2)
{
collectedEmits.clear();
collectedEmits.addAll(emitMapStart.values());
return;
}
Map<Integer, Emit> emitMapEnd = new TreeMap<Integer, Emit>();
for (Emit emit : emitMapStart.values())
{
Emit pre = emitMapEnd.get(emit.getEnd());
if (pre == null || pre.size() < emit.size())
{
emitMapEnd.put(emit.getEnd(), emit);
}
}
collectedEmits.clear();
collectedEmits.addAll(emitMapEnd.values());
} | [
"private",
"static",
"void",
"remainLongest",
"(",
"Collection",
"<",
"Emit",
">",
"collectedEmits",
")",
"{",
"if",
"(",
"collectedEmits",
".",
"size",
"(",
")",
"<",
"2",
")",
"return",
";",
"Map",
"<",
"Integer",
",",
"Emit",
">",
"emitMapStart",
"=",... | 只保留最长词
@param collectedEmits | [
"只保留最长词"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/trie/Trie.java#L168-L198 | train | remainLongest method. | [
30522,
2797,
10763,
11675,
3961,
10052,
4355,
1006,
3074,
1026,
12495,
2102,
1028,
5067,
23238,
3215,
1007,
1063,
2065,
1006,
5067,
23238,
3215,
1012,
2946,
1006,
1007,
1026,
1016,
1007,
2709,
1025,
4949,
1026,
16109,
1010,
12495,
2102,
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/flink | flink-core/src/main/java/org/apache/flink/core/memory/DataOutputSerializer.java | DataOutputSerializer.write | @Override
public void write(int b) throws IOException {
if (this.position >= this.buffer.length) {
resize(1);
}
this.buffer[this.position++] = (byte) (b & 0xff);
} | java | @Override
public void write(int b) throws IOException {
if (this.position >= this.buffer.length) {
resize(1);
}
this.buffer[this.position++] = (byte) (b & 0xff);
} | [
"@",
"Override",
"public",
"void",
"write",
"(",
"int",
"b",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"position",
">=",
"this",
".",
"buffer",
".",
"length",
")",
"{",
"resize",
"(",
"1",
")",
";",
"}",
"this",
".",
"buffer",
"[",... | ---------------------------------------------------------------------------------------- | [
"----------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/DataOutputSerializer.java#L133-L139 | train | Writes a single byte to the output stream. | [
30522,
1030,
2058,
15637,
2270,
11675,
4339,
1006,
20014,
1038,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
2023,
1012,
2597,
1028,
1027,
2023,
1012,
17698,
1012,
3091,
1007,
1063,
24501,
4697,
1006,
1015,
1007,
1025,
1065,
2023,
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/operators/AllGroupReduceDriver.java | AllGroupReduceDriver.prepare | @Override
public void prepare() throws Exception {
final TaskConfig config = this.taskContext.getTaskConfig();
this.strategy = config.getDriverStrategy();
switch (this.strategy) {
case ALL_GROUP_REDUCE_COMBINE:
if (!(this.taskContext.getStub() instanceof GroupCombineFunction)) {
throw new Exception("Using combiner on a UDF that does not implement the combiner interface " + GroupCombineFunction.class.getName());
}
case ALL_GROUP_REDUCE:
case ALL_GROUP_COMBINE:
break;
default:
throw new Exception("Unrecognized driver strategy for AllGroupReduce driver: " + this.strategy.name());
}
this.serializer = this.taskContext.<IT>getInputSerializer(0).getSerializer();
this.input = this.taskContext.getInput(0);
ExecutionConfig executionConfig = taskContext.getExecutionConfig();
this.objectReuseEnabled = executionConfig.isObjectReuseEnabled();
if (LOG.isDebugEnabled()) {
LOG.debug("AllGroupReduceDriver object reuse: " + (this.objectReuseEnabled ? "ENABLED" : "DISABLED") + ".");
}
} | java | @Override
public void prepare() throws Exception {
final TaskConfig config = this.taskContext.getTaskConfig();
this.strategy = config.getDriverStrategy();
switch (this.strategy) {
case ALL_GROUP_REDUCE_COMBINE:
if (!(this.taskContext.getStub() instanceof GroupCombineFunction)) {
throw new Exception("Using combiner on a UDF that does not implement the combiner interface " + GroupCombineFunction.class.getName());
}
case ALL_GROUP_REDUCE:
case ALL_GROUP_COMBINE:
break;
default:
throw new Exception("Unrecognized driver strategy for AllGroupReduce driver: " + this.strategy.name());
}
this.serializer = this.taskContext.<IT>getInputSerializer(0).getSerializer();
this.input = this.taskContext.getInput(0);
ExecutionConfig executionConfig = taskContext.getExecutionConfig();
this.objectReuseEnabled = executionConfig.isObjectReuseEnabled();
if (LOG.isDebugEnabled()) {
LOG.debug("AllGroupReduceDriver object reuse: " + (this.objectReuseEnabled ? "ENABLED" : "DISABLED") + ".");
}
} | [
"@",
"Override",
"public",
"void",
"prepare",
"(",
")",
"throws",
"Exception",
"{",
"final",
"TaskConfig",
"config",
"=",
"this",
".",
"taskContext",
".",
"getTaskConfig",
"(",
")",
";",
"this",
".",
"strategy",
"=",
"config",
".",
"getDriverStrategy",
"(",
... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/AllGroupReduceDriver.java#L88-L114 | train | Prepare the Driver. | [
30522,
1030,
2058,
15637,
2270,
11675,
7374,
1006,
1007,
11618,
6453,
1063,
2345,
4708,
8663,
8873,
2290,
9530,
8873,
2290,
1027,
2023,
1012,
4708,
8663,
18209,
1012,
2131,
10230,
2243,
8663,
8873,
2290,
1006,
1007,
1025,
2023,
1012,
5656,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.set | public HttpHeaders set(HttpHeaders headers) {
checkNotNull(headers, "headers");
clear();
if (headers.isEmpty()) {
return this;
}
for (Entry<String, String> entry : headers) {
add(entry.getKey(), entry.getValue());
}
return this;
} | java | public HttpHeaders set(HttpHeaders headers) {
checkNotNull(headers, "headers");
clear();
if (headers.isEmpty()) {
return this;
}
for (Entry<String, String> entry : headers) {
add(entry.getKey(), entry.getValue());
}
return this;
} | [
"public",
"HttpHeaders",
"set",
"(",
"HttpHeaders",
"headers",
")",
"{",
"checkNotNull",
"(",
"headers",
",",
"\"headers\"",
")",
";",
"clear",
"(",
")",
";",
"if",
"(",
"headers",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"this",
";",
"}",
"for",
... | Cleans the current header entries and copies all header entries of the specified {@code headers}.
@return {@code this} | [
"Cleans",
"the",
"current",
"header",
"entries",
"and",
"copies",
"all",
"header",
"entries",
"of",
"the",
"specified",
"{",
"@code",
"headers",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L1495-L1508 | train | Sets the HTTP headers. | [
30522,
2270,
8299,
4974,
2545,
2275,
1006,
8299,
4974,
2545,
20346,
2015,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
20346,
2015,
1010,
1000,
20346,
2015,
1000,
1007,
1025,
3154,
1006,
1007,
1025,
2065,
1006,
20346,
2015,
1012,
2003,
6633,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/common/MutablePropertySources.java | MutablePropertySources.assertPresentAndGetIndex | private int assertPresentAndGetIndex(String name) {
int index = this.propertySourceList.indexOf(PropertySource.named(name));
if (index == -1) {
throw new IllegalArgumentException("PropertySource named '" + name + "' does not exist");
}
return index;
} | java | private int assertPresentAndGetIndex(String name) {
int index = this.propertySourceList.indexOf(PropertySource.named(name));
if (index == -1) {
throw new IllegalArgumentException("PropertySource named '" + name + "' does not exist");
}
return index;
} | [
"private",
"int",
"assertPresentAndGetIndex",
"(",
"String",
"name",
")",
"{",
"int",
"index",
"=",
"this",
".",
"propertySourceList",
".",
"indexOf",
"(",
"PropertySource",
".",
"named",
"(",
"name",
")",
")",
";",
"if",
"(",
"index",
"==",
"-",
"1",
")... | Assert that the named property source is present and return its index.
@param name {@linkplain PropertySource#getName() name of the property source}
to find
@throws IllegalArgumentException if the named property source is not present | [
"Assert",
"that",
"the",
"named",
"property",
"source",
"is",
"present",
"and",
"return",
"its",
"index",
"."
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/common/MutablePropertySources.java#L214-L220 | train | Assert that a property source is present and has an index. | [
30522,
2797,
20014,
20865,
28994,
4765,
5685,
18150,
22254,
10288,
1006,
5164,
2171,
1007,
1063,
20014,
5950,
1027,
2023,
1012,
3200,
6499,
3126,
29109,
2923,
1012,
5950,
11253,
1006,
3200,
6499,
3126,
3401,
1012,
2315,
1006,
2171,
1007,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/AhoCorasick/AhoCorasickDoubleArrayTrie.java | AhoCorasickDoubleArrayTrie.load | public boolean load(ByteArray byteArray, V[] value)
{
if (byteArray == null) return false;
size = byteArray.nextInt();
base = new int[size + 65535]; // 多留一些,防止越界
check = new int[size + 65535];
fail = new int[size + 65535];
output = new int[size + 65535][];
int length;
for (int i = 0; i < size; ++i)
{
base[i] = byteArray.nextInt();
check[i] = byteArray.nextInt();
fail[i] = byteArray.nextInt();
length = byteArray.nextInt();
if (length == 0) continue;
output[i] = new int[length];
for (int j = 0; j < output[i].length; ++j)
{
output[i][j] = byteArray.nextInt();
}
}
length = byteArray.nextInt();
l = new int[length];
for (int i = 0; i < l.length; ++i)
{
l[i] = byteArray.nextInt();
}
v = value;
return true;
} | java | public boolean load(ByteArray byteArray, V[] value)
{
if (byteArray == null) return false;
size = byteArray.nextInt();
base = new int[size + 65535]; // 多留一些,防止越界
check = new int[size + 65535];
fail = new int[size + 65535];
output = new int[size + 65535][];
int length;
for (int i = 0; i < size; ++i)
{
base[i] = byteArray.nextInt();
check[i] = byteArray.nextInt();
fail[i] = byteArray.nextInt();
length = byteArray.nextInt();
if (length == 0) continue;
output[i] = new int[length];
for (int j = 0; j < output[i].length; ++j)
{
output[i][j] = byteArray.nextInt();
}
}
length = byteArray.nextInt();
l = new int[length];
for (int i = 0; i < l.length; ++i)
{
l[i] = byteArray.nextInt();
}
v = value;
return true;
} | [
"public",
"boolean",
"load",
"(",
"ByteArray",
"byteArray",
",",
"V",
"[",
"]",
"value",
")",
"{",
"if",
"(",
"byteArray",
"==",
"null",
")",
"return",
"false",
";",
"size",
"=",
"byteArray",
".",
"nextInt",
"(",
")",
";",
"base",
"=",
"new",
"int",
... | 载入
@param byteArray 一个字节数组
@param value 值数组
@return 成功与否 | [
"载入"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/AhoCorasick/AhoCorasickDoubleArrayTrie.java#L247-L277 | train | Load a single class from a ByteArray. | [
30522,
2270,
22017,
20898,
7170,
1006,
24880,
2906,
9447,
24880,
2906,
9447,
1010,
1058,
1031,
1033,
3643,
1007,
1063,
2065,
1006,
24880,
2906,
9447,
1027,
1027,
19701,
1007,
2709,
6270,
1025,
2946,
1027,
24880,
2906,
9447,
1012,
2279,
1844... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/sort/FixedLengthRecordSorter.java | FixedLengthRecordSorter.write | @Override
public boolean write(T record) throws IOException {
// check whether we need a new memory segment for the sort index
if (this.currentSortBufferOffset > this.lastEntryOffset) {
if (memoryAvailable()) {
this.currentSortBufferSegment = nextMemorySegment();
this.sortBuffer.add(this.currentSortBufferSegment);
this.outView.set(this.currentSortBufferSegment);
this.currentSortBufferOffset = 0;
this.sortBufferBytes += this.segmentSize;
}
else {
return false;
}
}
// serialize the record into the data buffers
try {
this.comparator.writeWithKeyNormalization(record, this.outView);
this.numRecords++;
this.currentSortBufferOffset += this.recordSize;
return true;
} catch (EOFException eofex) {
throw new IOException("Error: Serialization consumes more bytes than announced by the serializer.");
}
} | java | @Override
public boolean write(T record) throws IOException {
// check whether we need a new memory segment for the sort index
if (this.currentSortBufferOffset > this.lastEntryOffset) {
if (memoryAvailable()) {
this.currentSortBufferSegment = nextMemorySegment();
this.sortBuffer.add(this.currentSortBufferSegment);
this.outView.set(this.currentSortBufferSegment);
this.currentSortBufferOffset = 0;
this.sortBufferBytes += this.segmentSize;
}
else {
return false;
}
}
// serialize the record into the data buffers
try {
this.comparator.writeWithKeyNormalization(record, this.outView);
this.numRecords++;
this.currentSortBufferOffset += this.recordSize;
return true;
} catch (EOFException eofex) {
throw new IOException("Error: Serialization consumes more bytes than announced by the serializer.");
}
} | [
"@",
"Override",
"public",
"boolean",
"write",
"(",
"T",
"record",
")",
"throws",
"IOException",
"{",
"// check whether we need a new memory segment for the sort index",
"if",
"(",
"this",
".",
"currentSortBufferOffset",
">",
"this",
".",
"lastEntryOffset",
")",
"{",
... | Writes a given record to this sort buffer. The written record will be appended and take
the last logical position.
@param record The record to be written.
@return True, if the record was successfully written, false, if the sort buffer was full.
@throws IOException Thrown, if an error occurred while serializing the record into the buffers. | [
"Writes",
"a",
"given",
"record",
"to",
"this",
"sort",
"buffer",
".",
"The",
"written",
"record",
"will",
"be",
"appended",
"and",
"take",
"the",
"last",
"logical",
"position",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/FixedLengthRecordSorter.java#L223-L248 | train | Write the record into the output stream. | [
30522,
1030,
2058,
15637,
2270,
22017,
20898,
4339,
1006,
1056,
2501,
1007,
11618,
22834,
10288,
24422,
1063,
1013,
1013,
4638,
3251,
2057,
2342,
1037,
2047,
3638,
6903,
2005,
1996,
4066,
5950,
2065,
1006,
2023,
1012,
14731,
11589,
8569,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/ImgUtil.java | ImgUtil.writeJpg | public static void writeJpg(Image image, ImageOutputStream destImageStream) throws IORuntimeException {
write(image, IMAGE_TYPE_JPG, destImageStream);
} | java | public static void writeJpg(Image image, ImageOutputStream destImageStream) throws IORuntimeException {
write(image, IMAGE_TYPE_JPG, destImageStream);
} | [
"public",
"static",
"void",
"writeJpg",
"(",
"Image",
"image",
",",
"ImageOutputStream",
"destImageStream",
")",
"throws",
"IORuntimeException",
"{",
"write",
"(",
"image",
",",
"IMAGE_TYPE_JPG",
",",
"destImageStream",
")",
";",
"}"
] | 写出图像为JPG格式
@param image {@link Image}
@param destImageStream 写出到的目标流
@throws IORuntimeException IO异常 | [
"写出图像为JPG格式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1354-L1356 | train | Write the JPG image to an image output stream. | [
30522,
2270,
10763,
11675,
4339,
3501,
26952,
1006,
3746,
3746,
1010,
3746,
5833,
18780,
21422,
4078,
3775,
26860,
21422,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
4339,
1006,
3746,
1010,
3746,
1035,
2828,
1035,
16545,
2290,
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 | common/src/main/java/io/netty/util/internal/logging/Log4JLogger.java | Log4JLogger.warn | @Override
public void warn(String msg) {
logger.log(FQCN, Level.WARN, msg, null);
} | java | @Override
public void warn(String msg) {
logger.log(FQCN, Level.WARN, msg, null);
} | [
"@",
"Override",
"public",
"void",
"warn",
"(",
"String",
"msg",
")",
"{",
"logger",
".",
"log",
"(",
"FQCN",
",",
"Level",
".",
"WARN",
",",
"msg",
",",
"null",
")",
";",
"}"
] | Log a message object at the WARN level.
@param msg
- the message object to be logged | [
"Log",
"a",
"message",
"object",
"at",
"the",
"WARN",
"level",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/logging/Log4JLogger.java#L408-L411 | train | Log a warning message. | [
30522,
1030,
2058,
15637,
2270,
11675,
11582,
1006,
5164,
5796,
2290,
1007,
1063,
8833,
4590,
1012,
8833,
1006,
1042,
4160,
2278,
2078,
1010,
2504,
1012,
11582,
1010,
5796,
2290,
1010,
19701,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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/Tuple5.java | Tuple5.copy | @Override
@SuppressWarnings("unchecked")
public Tuple5<T0, T1, T2, T3, T4> copy() {
return new Tuple5<>(this.f0,
this.f1,
this.f2,
this.f3,
this.f4);
} | java | @Override
@SuppressWarnings("unchecked")
public Tuple5<T0, T1, T2, T3, T4> copy() {
return new Tuple5<>(this.f0,
this.f1,
this.f2,
this.f3,
this.f4);
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Tuple5",
"<",
"T0",
",",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
">",
"copy",
"(",
")",
"{",
"return",
"new",
"Tuple5",
"<>",
"(",
"this",
".",
"f0",
",",
"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/Tuple5.java#L216-L224 | 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,
2629,
1026,
1056,
2692,
1010,
1056,
2487,
1010,
1056,
2475,
1010,
1056,
2509,
1010,
1056,
2549,
1028,
6100,
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-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/datastream/PythonDataStream.java | PythonDataStream.key_by | public PythonKeyedStream key_by(KeySelector<PyObject, PyKey> selector) throws IOException {
return new PythonKeyedStream(stream.keyBy(new PythonKeySelector(selector)));
} | java | public PythonKeyedStream key_by(KeySelector<PyObject, PyKey> selector) throws IOException {
return new PythonKeyedStream(stream.keyBy(new PythonKeySelector(selector)));
} | [
"public",
"PythonKeyedStream",
"key_by",
"(",
"KeySelector",
"<",
"PyObject",
",",
"PyKey",
">",
"selector",
")",
"throws",
"IOException",
"{",
"return",
"new",
"PythonKeyedStream",
"(",
"stream",
".",
"keyBy",
"(",
"new",
"PythonKeySelector",
"(",
"selector",
"... | A thin wrapper layer over {@link DataStream#keyBy(KeySelector)}.
@param selector The KeySelector to be used for extracting the key for partitioning
@return The {@link PythonDataStream} with partitioned state (i.e. {@link PythonKeyedStream}) | [
"A",
"thin",
"wrapper",
"layer",
"over",
"{",
"@link",
"DataStream#keyBy",
"(",
"KeySelector",
")",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/datastream/PythonDataStream.java#L135-L137 | train | Key by. | [
30522,
2270,
18750,
14839,
2098,
21422,
3145,
1035,
2011,
1006,
6309,
12260,
16761,
1026,
1052,
7677,
2497,
20614,
1010,
1052,
15922,
3240,
1028,
27000,
1007,
11618,
22834,
10288,
24422,
1063,
2709,
2047,
18750,
14839,
2098,
21422,
1006,
5460... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/operators/TwoInputUdfOperator.java | TwoInputUdfOperator.returns | public O returns(TypeHint<OUT> typeHint) {
requireNonNull(typeHint, "TypeHint must not be null");
try {
return returns(TypeInformation.of(typeHint));
}
catch (InvalidTypesException e) {
throw new InvalidTypesException("Cannot infer the type information from the type hint. " +
"Make sure that the TypeHint does not use any generic type variables.");
}
} | java | public O returns(TypeHint<OUT> typeHint) {
requireNonNull(typeHint, "TypeHint must not be null");
try {
return returns(TypeInformation.of(typeHint));
}
catch (InvalidTypesException e) {
throw new InvalidTypesException("Cannot infer the type information from the type hint. " +
"Make sure that the TypeHint does not use any generic type variables.");
}
} | [
"public",
"O",
"returns",
"(",
"TypeHint",
"<",
"OUT",
">",
"typeHint",
")",
"{",
"requireNonNull",
"(",
"typeHint",
",",
"\"TypeHint must not be null\"",
")",
";",
"try",
"{",
"return",
"returns",
"(",
"TypeInformation",
".",
"of",
"(",
"typeHint",
")",
")"... | Adds a type information hint about the return type of this operator. This method
can be used in cases where Flink cannot determine automatically what the produced
type of a function is. That can be the case if the function uses generic type variables
in the return type that cannot be inferred from the input type.
<p>Use this method the following way:
<pre>{@code
DataSet<Tuple2<String, Double>> result =
data1.join(data2).where("id").equalTo("fieldX")
.with(new JoinFunctionWithNonInferrableReturnType())
.returns(new TypeHint<Tuple2<String, Double>>(){});
}</pre>
@param typeHint The type hint for the returned data type.
@return This operator with the type information corresponding to the given type hint. | [
"Adds",
"a",
"type",
"information",
"hint",
"about",
"the",
"return",
"type",
"of",
"this",
"operator",
".",
"This",
"method",
"can",
"be",
"used",
"in",
"cases",
"where",
"Flink",
"cannot",
"determine",
"automatically",
"what",
"the",
"produced",
"type",
"o... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/TwoInputUdfOperator.java#L297-L307 | train | Returns the value of the method that is the type of the given type hint. | [
30522,
2270,
1051,
5651,
1006,
2828,
10606,
2102,
1026,
2041,
1028,
2828,
10606,
2102,
1007,
1063,
5478,
8540,
11231,
3363,
1006,
2828,
10606,
2102,
1010,
1000,
2828,
10606,
2102,
2442,
2025,
2022,
19701,
1000,
1007,
1025,
3046,
1063,
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... |
SeleniumHQ/selenium | java/server/src/org/openqa/grid/web/servlet/handler/RequestHandler.java | RequestHandler.waitForSessionBound | public void waitForSessionBound() throws InterruptedException, TimeoutException {
// Maintain compatibility with Grid 1.x, which had the ability to
// specify how long to wait before canceling a request.
GridHubConfiguration configuration = getRegistry().getHub().getConfiguration();
Integer newSessionWaitTimeout = configuration.newSessionWaitTimeout != null ?
configuration.newSessionWaitTimeout : 0;
if (newSessionWaitTimeout > 0) {
if (!sessionAssigned.await(newSessionWaitTimeout.longValue(), TimeUnit.MILLISECONDS)) {
throw new TimeoutException("Request timed out waiting for a node to become available.");
}
} else {
// Wait until a proxy becomes available to handle the request.
sessionAssigned.await();
}
} | java | public void waitForSessionBound() throws InterruptedException, TimeoutException {
// Maintain compatibility with Grid 1.x, which had the ability to
// specify how long to wait before canceling a request.
GridHubConfiguration configuration = getRegistry().getHub().getConfiguration();
Integer newSessionWaitTimeout = configuration.newSessionWaitTimeout != null ?
configuration.newSessionWaitTimeout : 0;
if (newSessionWaitTimeout > 0) {
if (!sessionAssigned.await(newSessionWaitTimeout.longValue(), TimeUnit.MILLISECONDS)) {
throw new TimeoutException("Request timed out waiting for a node to become available.");
}
} else {
// Wait until a proxy becomes available to handle the request.
sessionAssigned.await();
}
} | [
"public",
"void",
"waitForSessionBound",
"(",
")",
"throws",
"InterruptedException",
",",
"TimeoutException",
"{",
"// Maintain compatibility with Grid 1.x, which had the ability to",
"// specify how long to wait before canceling a request.",
"GridHubConfiguration",
"configuration",
"=",... | wait for the registry to match the request with a TestSlot.
@throws InterruptedException Interrupted exception
@throws TimeoutException if the request reaches the new session wait timeout before being
assigned. | [
"wait",
"for",
"the",
"registry",
"to",
"match",
"the",
"request",
"with",
"a",
"TestSlot",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/web/servlet/handler/RequestHandler.java#L189-L203 | train | Wait until a session is bound. | [
30522,
2270,
11675,
3524,
29278,
8583,
10992,
15494,
1006,
1007,
11618,
7153,
10288,
24422,
1010,
2051,
5833,
10288,
24422,
1063,
1013,
1013,
5441,
21778,
2007,
8370,
1015,
1012,
1060,
1010,
2029,
2018,
1996,
3754,
2000,
1013,
1013,
20648,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/SinkContextUtil.java | SinkContextUtil.forTimestamp | public static <T> SinkFunction.Context<T> forTimestamp(long timestamp) {
return new SinkFunction.Context<T>() {
@Override
public long currentProcessingTime() {
throw new RuntimeException("Not implemented");
}
@Override
public long currentWatermark() {
throw new RuntimeException("Not implemented");
}
@Override
public Long timestamp() {
return timestamp;
}
};
} | java | public static <T> SinkFunction.Context<T> forTimestamp(long timestamp) {
return new SinkFunction.Context<T>() {
@Override
public long currentProcessingTime() {
throw new RuntimeException("Not implemented");
}
@Override
public long currentWatermark() {
throw new RuntimeException("Not implemented");
}
@Override
public Long timestamp() {
return timestamp;
}
};
} | [
"public",
"static",
"<",
"T",
">",
"SinkFunction",
".",
"Context",
"<",
"T",
">",
"forTimestamp",
"(",
"long",
"timestamp",
")",
"{",
"return",
"new",
"SinkFunction",
".",
"Context",
"<",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"long",
"cur... | Creates a {@link SinkFunction.Context} that
throws an exception when trying to access the current watermark or processing time. | [
"Creates",
"a",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/SinkContextUtil.java#L33-L50 | train | Returns a SinkFunction. Context that is a copy of the given timestamp. | [
30522,
2270,
10763,
1026,
1056,
1028,
7752,
11263,
27989,
1012,
6123,
1026,
1056,
1028,
3481,
14428,
9153,
8737,
1006,
2146,
2335,
15464,
2361,
1007,
1063,
2709,
2047,
7752,
11263,
27989,
1012,
6123,
1026,
1056,
1028,
1006,
1007,
1063,
1030... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/CliFrontend.java | CliFrontend.stop | protected void stop(String[] args) throws Exception {
LOG.info("Running 'stop-with-savepoint' command.");
final Options commandOptions = CliFrontendParser.getStopCommandOptions();
final Options commandLineOptions = CliFrontendParser.mergeOptions(commandOptions, customCommandLineOptions);
final CommandLine commandLine = CliFrontendParser.parse(commandLineOptions, args, false);
final StopOptions stopOptions = new StopOptions(commandLine);
if (stopOptions.isPrintHelp()) {
CliFrontendParser.printHelpForStop(customCommandLines);
return;
}
final String[] cleanedArgs = stopOptions.getArgs();
final String targetDirectory = stopOptions.hasSavepointFlag() && cleanedArgs.length > 0
? stopOptions.getTargetDirectory()
: null; // the default savepoint location is going to be used in this case.
final JobID jobId = cleanedArgs.length != 0
? parseJobId(cleanedArgs[0])
: parseJobId(stopOptions.getTargetDirectory());
final boolean advanceToEndOfEventTime = stopOptions.shouldAdvanceToEndOfEventTime();
logAndSysout((advanceToEndOfEventTime ? "Draining job " : "Suspending job ") + "\"" + jobId + "\" with a savepoint.");
final CustomCommandLine<?> activeCommandLine = getActiveCustomCommandLine(commandLine);
runClusterAction(
activeCommandLine,
commandLine,
clusterClient -> {
try {
clusterClient.stopWithSavepoint(jobId, advanceToEndOfEventTime, targetDirectory);
} catch (Exception e) {
throw new FlinkException("Could not stop with a savepoint job \"" + jobId + "\".", e);
}
});
logAndSysout((advanceToEndOfEventTime ? "Drained job " : "Suspended job ") + "\"" + jobId + "\" with a savepoint.");
} | java | protected void stop(String[] args) throws Exception {
LOG.info("Running 'stop-with-savepoint' command.");
final Options commandOptions = CliFrontendParser.getStopCommandOptions();
final Options commandLineOptions = CliFrontendParser.mergeOptions(commandOptions, customCommandLineOptions);
final CommandLine commandLine = CliFrontendParser.parse(commandLineOptions, args, false);
final StopOptions stopOptions = new StopOptions(commandLine);
if (stopOptions.isPrintHelp()) {
CliFrontendParser.printHelpForStop(customCommandLines);
return;
}
final String[] cleanedArgs = stopOptions.getArgs();
final String targetDirectory = stopOptions.hasSavepointFlag() && cleanedArgs.length > 0
? stopOptions.getTargetDirectory()
: null; // the default savepoint location is going to be used in this case.
final JobID jobId = cleanedArgs.length != 0
? parseJobId(cleanedArgs[0])
: parseJobId(stopOptions.getTargetDirectory());
final boolean advanceToEndOfEventTime = stopOptions.shouldAdvanceToEndOfEventTime();
logAndSysout((advanceToEndOfEventTime ? "Draining job " : "Suspending job ") + "\"" + jobId + "\" with a savepoint.");
final CustomCommandLine<?> activeCommandLine = getActiveCustomCommandLine(commandLine);
runClusterAction(
activeCommandLine,
commandLine,
clusterClient -> {
try {
clusterClient.stopWithSavepoint(jobId, advanceToEndOfEventTime, targetDirectory);
} catch (Exception e) {
throw new FlinkException("Could not stop with a savepoint job \"" + jobId + "\".", e);
}
});
logAndSysout((advanceToEndOfEventTime ? "Drained job " : "Suspended job ") + "\"" + jobId + "\" with a savepoint.");
} | [
"protected",
"void",
"stop",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"LOG",
".",
"info",
"(",
"\"Running 'stop-with-savepoint' command.\"",
")",
";",
"final",
"Options",
"commandOptions",
"=",
"CliFrontendParser",
".",
"getStopCommandOption... | Executes the STOP action.
@param args Command line arguments for the stop action. | [
"Executes",
"the",
"STOP",
"action",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java#L501-L541 | train | Stop the cluster with savepoint. | [
30522,
5123,
11675,
2644,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
11618,
6453,
1063,
8833,
1012,
18558,
1006,
1000,
2770,
1005,
2644,
1011,
2007,
1011,
3828,
8400,
1005,
3094,
1012,
1000,
1007,
1025,
2345,
7047,
15054,
16790,
2015,
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... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java | AbstractAsymmetricCrypto.decrypt | public byte[] decrypt(InputStream data, KeyType keyType) throws IORuntimeException {
return decrypt(IoUtil.readBytes(data), keyType);
} | java | public byte[] decrypt(InputStream data, KeyType keyType) throws IORuntimeException {
return decrypt(IoUtil.readBytes(data), keyType);
} | [
"public",
"byte",
"[",
"]",
"decrypt",
"(",
"InputStream",
"data",
",",
"KeyType",
"keyType",
")",
"throws",
"IORuntimeException",
"{",
"return",
"decrypt",
"(",
"IoUtil",
".",
"readBytes",
"(",
"data",
")",
",",
"keyType",
")",
";",
"}"
] | 解密
@param data 被解密的bytes
@param keyType 私钥或公钥 {@link KeyType}
@return 解密后的bytes
@throws IORuntimeException IO异常 | [
"解密"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java#L234-L236 | train | Decrypt the input stream. | [
30522,
2270,
24880,
1031,
1033,
11703,
2854,
13876,
1006,
20407,
25379,
2951,
1010,
3145,
13874,
3145,
13874,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
11703,
2854,
13876,
1006,
22834,
21823,
2140,
1012,
3191,
3762,
4570,
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-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BinaryHashTable.java | BinaryHashTable.clearPartitions | @Override
public void clearPartitions() {
// clear the iterators, so the next call to next() will notice
this.bucketIterator = null;
this.probeIterator = null;
for (int i = this.partitionsBeingBuilt.size() - 1; i >= 0; --i) {
final BinaryHashPartition p = this.partitionsBeingBuilt.get(i);
try {
p.clearAllMemory(this.availableMemory);
} catch (Exception e) {
LOG.error("Error during partition cleanup.", e);
}
}
this.partitionsBeingBuilt.clear();
// clear the partitions that are still to be done (that have files on disk)
for (final BinaryHashPartition p : this.partitionsPending) {
p.clearAllMemory(this.availableMemory);
}
} | java | @Override
public void clearPartitions() {
// clear the iterators, so the next call to next() will notice
this.bucketIterator = null;
this.probeIterator = null;
for (int i = this.partitionsBeingBuilt.size() - 1; i >= 0; --i) {
final BinaryHashPartition p = this.partitionsBeingBuilt.get(i);
try {
p.clearAllMemory(this.availableMemory);
} catch (Exception e) {
LOG.error("Error during partition cleanup.", e);
}
}
this.partitionsBeingBuilt.clear();
// clear the partitions that are still to be done (that have files on disk)
for (final BinaryHashPartition p : this.partitionsPending) {
p.clearAllMemory(this.availableMemory);
}
} | [
"@",
"Override",
"public",
"void",
"clearPartitions",
"(",
")",
"{",
"// clear the iterators, so the next call to next() will notice",
"this",
".",
"bucketIterator",
"=",
"null",
";",
"this",
".",
"probeIterator",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"th... | This method clears all partitions currently residing (partially) in memory. It releases all
memory
and deletes all spilled partitions.
<p>This method is intended for a hard cleanup in the case that the join is aborted. | [
"This",
"method",
"clears",
"all",
"partitions",
"currently",
"residing",
"(",
"partially",
")",
"in",
"memory",
".",
"It",
"releases",
"all",
"memory",
"and",
"deletes",
"all",
"spilled",
"partitions",
"."
] | 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#L588-L608 | train | Clear the partitions. | [
30522,
1030,
2058,
15637,
2270,
11675,
3154,
19362,
3775,
9285,
1006,
1007,
1063,
1013,
1013,
3154,
1996,
2009,
6906,
6591,
1010,
2061,
1996,
2279,
2655,
2000,
2279,
1006,
1007,
2097,
5060,
2023,
1012,
13610,
21646,
8844,
1027,
19701,
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... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/BootstrapTools.java | BootstrapTools.parseDynamicProperties | public static Configuration parseDynamicProperties(CommandLine cmd) {
final Configuration config = new Configuration();
String[] values = cmd.getOptionValues(DYNAMIC_PROPERTIES_OPT);
if (values != null) {
for (String value : values) {
String[] pair = value.split("=", 2);
if (pair.length == 1) {
config.setString(pair[0], Boolean.TRUE.toString());
}
else if (pair.length == 2) {
config.setString(pair[0], pair[1]);
}
}
}
return config;
} | java | public static Configuration parseDynamicProperties(CommandLine cmd) {
final Configuration config = new Configuration();
String[] values = cmd.getOptionValues(DYNAMIC_PROPERTIES_OPT);
if (values != null) {
for (String value : values) {
String[] pair = value.split("=", 2);
if (pair.length == 1) {
config.setString(pair[0], Boolean.TRUE.toString());
}
else if (pair.length == 2) {
config.setString(pair[0], pair[1]);
}
}
}
return config;
} | [
"public",
"static",
"Configuration",
"parseDynamicProperties",
"(",
"CommandLine",
"cmd",
")",
"{",
"final",
"Configuration",
"config",
"=",
"new",
"Configuration",
"(",
")",
";",
"String",
"[",
"]",
"values",
"=",
"cmd",
".",
"getOptionValues",
"(",
"DYNAMIC_PR... | Parse the dynamic properties (passed on the command line). | [
"Parse",
"the",
"dynamic",
"properties",
"(",
"passed",
"on",
"the",
"command",
"line",
")",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/BootstrapTools.java#L383-L400 | train | Parses the dynamic properties from the command line. | [
30522,
2270,
10763,
9563,
11968,
6924,
18279,
7712,
21572,
4842,
7368,
1006,
3094,
4179,
4642,
2094,
1007,
1063,
2345,
9563,
9530,
8873,
2290,
1027,
2047,
9563,
1006,
1007,
1025,
5164,
1031,
1033,
5300,
1027,
4642,
2094,
1012,
2131,
7361,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/sinks/TableSinkBase.java | TableSinkBase.configure | public final TableSink<T> configure(String[] fieldNames, TypeInformation<?>[] fieldTypes) {
final TableSinkBase<T> configuredSink = this.copy();
configuredSink.fieldNames = Optional.of(fieldNames);
configuredSink.fieldTypes = Optional.of(fieldTypes);
return configuredSink;
} | java | public final TableSink<T> configure(String[] fieldNames, TypeInformation<?>[] fieldTypes) {
final TableSinkBase<T> configuredSink = this.copy();
configuredSink.fieldNames = Optional.of(fieldNames);
configuredSink.fieldTypes = Optional.of(fieldTypes);
return configuredSink;
} | [
"public",
"final",
"TableSink",
"<",
"T",
">",
"configure",
"(",
"String",
"[",
"]",
"fieldNames",
",",
"TypeInformation",
"<",
"?",
">",
"[",
"]",
"fieldTypes",
")",
"{",
"final",
"TableSinkBase",
"<",
"T",
">",
"configuredSink",
"=",
"this",
".",
"copy... | Returns a copy of this {@link TableSink} configured with the field names and types of the
table to emit.
@param fieldNames The field names of the table to emit.
@param fieldTypes The field types of the table to emit.
@return A copy of this {@link TableSink} configured with the field names and types of the
table to emit. | [
"Returns",
"a",
"copy",
"of",
"this",
"{",
"@link",
"TableSink",
"}",
"configured",
"with",
"the",
"field",
"names",
"and",
"types",
"of",
"the",
"table",
"to",
"emit",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/sinks/TableSinkBase.java#L75-L82 | train | Configure the sink to use the given field names and field types. | [
30522,
2270,
2345,
7251,
19839,
1026,
1056,
1028,
9530,
8873,
27390,
2063,
1006,
5164,
1031,
1033,
2492,
18442,
2015,
1010,
2828,
2378,
14192,
3370,
1026,
1029,
1028,
1031,
1033,
2492,
13874,
2015,
1007,
1063,
2345,
7251,
19839,
15058,
1026... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/net/SSLUtils.java | SSLUtils.createInternalServerSSLEngineFactory | public static SSLHandlerFactory createInternalServerSSLEngineFactory(final Configuration config) throws Exception {
SSLContext sslContext = createInternalSSLContext(config);
if (sslContext == null) {
throw new IllegalConfigurationException("SSL is not enabled for internal communication.");
}
return new SSLHandlerFactory(
sslContext,
getEnabledProtocols(config),
getEnabledCipherSuites(config),
false,
true,
config.getInteger(SecurityOptions.SSL_INTERNAL_HANDSHAKE_TIMEOUT),
config.getInteger(SecurityOptions.SSL_INTERNAL_CLOSE_NOTIFY_FLUSH_TIMEOUT));
} | java | public static SSLHandlerFactory createInternalServerSSLEngineFactory(final Configuration config) throws Exception {
SSLContext sslContext = createInternalSSLContext(config);
if (sslContext == null) {
throw new IllegalConfigurationException("SSL is not enabled for internal communication.");
}
return new SSLHandlerFactory(
sslContext,
getEnabledProtocols(config),
getEnabledCipherSuites(config),
false,
true,
config.getInteger(SecurityOptions.SSL_INTERNAL_HANDSHAKE_TIMEOUT),
config.getInteger(SecurityOptions.SSL_INTERNAL_CLOSE_NOTIFY_FLUSH_TIMEOUT));
} | [
"public",
"static",
"SSLHandlerFactory",
"createInternalServerSSLEngineFactory",
"(",
"final",
"Configuration",
"config",
")",
"throws",
"Exception",
"{",
"SSLContext",
"sslContext",
"=",
"createInternalSSLContext",
"(",
"config",
")",
";",
"if",
"(",
"sslContext",
"=="... | Creates a SSLEngineFactory to be used by internal communication server endpoints. | [
"Creates",
"a",
"SSLEngineFactory",
"to",
"be",
"used",
"by",
"internal",
"communication",
"server",
"endpoints",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/net/SSLUtils.java#L113-L127 | train | Creates an SSLHandlerFactory for internal communication with the server. | [
30522,
2270,
10763,
7020,
2140,
11774,
3917,
21450,
3443,
18447,
11795,
9777,
2121,
14028,
25016,
3070,
3170,
21450,
1006,
2345,
9563,
9530,
8873,
2290,
1007,
11618,
6453,
1063,
7020,
22499,
10111,
18413,
7020,
22499,
10111,
18413,
1027,
3443... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/ImgUtil.java | ImgUtil.rotate | public static void rotate(Image image, int degree, ImageOutputStream out) throws IORuntimeException {
writeJpg(rotate(image, degree), out);
} | java | public static void rotate(Image image, int degree, ImageOutputStream out) throws IORuntimeException {
writeJpg(rotate(image, degree), out);
} | [
"public",
"static",
"void",
"rotate",
"(",
"Image",
"image",
",",
"int",
"degree",
",",
"ImageOutputStream",
"out",
")",
"throws",
"IORuntimeException",
"{",
"writeJpg",
"(",
"rotate",
"(",
"image",
",",
"degree",
")",
",",
"out",
")",
";",
"}"
] | 旋转图片为指定角度<br>
此方法不会关闭输出流,输出格式为JPG
@param image 目标图像
@param degree 旋转角度
@param out 输出图像流
@since 3.2.2
@throws IORuntimeException IO异常 | [
"旋转图片为指定角度<br",
">",
"此方法不会关闭输出流,输出格式为JPG"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1044-L1046 | train | Write a rotate image to an output stream. | [
30522,
2270,
10763,
11675,
24357,
1006,
3746,
3746,
1010,
20014,
3014,
1010,
3746,
5833,
18780,
21422,
2041,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
4339,
3501,
26952,
1006,
24357,
1006,
3746,
1010,
3014,
1007,
1010,
2041,
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/spark | common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/RetryingBlockFetcher.java | RetryingBlockFetcher.fetchAllOutstanding | private void fetchAllOutstanding() {
// Start by retrieving our shared state within a synchronized block.
String[] blockIdsToFetch;
int numRetries;
RetryingBlockFetchListener myListener;
synchronized (this) {
blockIdsToFetch = outstandingBlocksIds.toArray(new String[outstandingBlocksIds.size()]);
numRetries = retryCount;
myListener = currentListener;
}
// Now initiate the fetch on all outstanding blocks, possibly initiating a retry if that fails.
try {
fetchStarter.createAndStart(blockIdsToFetch, myListener);
} catch (Exception e) {
logger.error(String.format("Exception while beginning fetch of %s outstanding blocks %s",
blockIdsToFetch.length, numRetries > 0 ? "(after " + numRetries + " retries)" : ""), e);
if (shouldRetry(e)) {
initiateRetry();
} else {
for (String bid : blockIdsToFetch) {
listener.onBlockFetchFailure(bid, e);
}
}
}
} | java | private void fetchAllOutstanding() {
// Start by retrieving our shared state within a synchronized block.
String[] blockIdsToFetch;
int numRetries;
RetryingBlockFetchListener myListener;
synchronized (this) {
blockIdsToFetch = outstandingBlocksIds.toArray(new String[outstandingBlocksIds.size()]);
numRetries = retryCount;
myListener = currentListener;
}
// Now initiate the fetch on all outstanding blocks, possibly initiating a retry if that fails.
try {
fetchStarter.createAndStart(blockIdsToFetch, myListener);
} catch (Exception e) {
logger.error(String.format("Exception while beginning fetch of %s outstanding blocks %s",
blockIdsToFetch.length, numRetries > 0 ? "(after " + numRetries + " retries)" : ""), e);
if (shouldRetry(e)) {
initiateRetry();
} else {
for (String bid : blockIdsToFetch) {
listener.onBlockFetchFailure(bid, e);
}
}
}
} | [
"private",
"void",
"fetchAllOutstanding",
"(",
")",
"{",
"// Start by retrieving our shared state within a synchronized block.",
"String",
"[",
"]",
"blockIdsToFetch",
";",
"int",
"numRetries",
";",
"RetryingBlockFetchListener",
"myListener",
";",
"synchronized",
"(",
"this",... | Fires off a request to fetch all blocks that have not been fetched successfully or permanently
failed (i.e., by a non-IOException). | [
"Fires",
"off",
"a",
"request",
"to",
"fetch",
"all",
"blocks",
"that",
"have",
"not",
"been",
"fetched",
"successfully",
"or",
"permanently",
"failed",
"(",
"i",
".",
"e",
".",
"by",
"a",
"non",
"-",
"IOException",
")",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/RetryingBlockFetcher.java#L128-L154 | train | Fetch all outstanding blocks. | [
30522,
2797,
11675,
18584,
8095,
12166,
5794,
4667,
1006,
1007,
1063,
1013,
1013,
2707,
2011,
2128,
18886,
23559,
2256,
4207,
2110,
2306,
1037,
25549,
3796,
1012,
5164,
1031,
1033,
3796,
9821,
3406,
7959,
10649,
1025,
20014,
16371,
2213,
13... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.getCatalogs | @Override
public OperationHandle getCatalogs(SessionHandle sessionHandle) throws HiveSQLException {
try {
TGetCatalogsReq req = new TGetCatalogsReq(sessionHandle.toTSessionHandle());
TGetCatalogsResp resp = cliService.GetCatalogs(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 getCatalogs(SessionHandle sessionHandle) throws HiveSQLException {
try {
TGetCatalogsReq req = new TGetCatalogsReq(sessionHandle.toTSessionHandle());
TGetCatalogsResp resp = cliService.GetCatalogs(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",
"getCatalogs",
"(",
"SessionHandle",
"sessionHandle",
")",
"throws",
"HiveSQLException",
"{",
"try",
"{",
"TGetCatalogsReq",
"req",
"=",
"new",
"TGetCatalogsReq",
"(",
"sessionHandle",
".",
"toTSessionHandle",
"(",
")",
... | /* (non-Javadoc)
@see org.apache.hive.service.cli.ICLIService#getCatalogs(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#L171-L184 | train | Get the catalog list for the given session handle. | [
30522,
1030,
2058,
15637,
2270,
3169,
11774,
2571,
2131,
11266,
23067,
5620,
1006,
5219,
11774,
2571,
5219,
11774,
2571,
1007,
11618,
26736,
2015,
4160,
2571,
2595,
24422,
1063,
3046,
1063,
1056,
18150,
11266,
23067,
5620,
2890,
4160,
2128,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | examples/src/main/java/org/apache/spark/examples/sql/JavaSparkSQLExample.java | JavaSparkSQLExample.main | public static void main(String[] args) throws AnalysisException {
// $example on:init_session$
SparkSession spark = SparkSession
.builder()
.appName("Java Spark SQL basic example")
.config("spark.some.config.option", "some-value")
.getOrCreate();
// $example off:init_session$
runBasicDataFrameExample(spark);
runDatasetCreationExample(spark);
runInferSchemaExample(spark);
runProgrammaticSchemaExample(spark);
spark.stop();
} | java | public static void main(String[] args) throws AnalysisException {
// $example on:init_session$
SparkSession spark = SparkSession
.builder()
.appName("Java Spark SQL basic example")
.config("spark.some.config.option", "some-value")
.getOrCreate();
// $example off:init_session$
runBasicDataFrameExample(spark);
runDatasetCreationExample(spark);
runInferSchemaExample(spark);
runProgrammaticSchemaExample(spark);
spark.stop();
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"AnalysisException",
"{",
"// $example on:init_session$",
"SparkSession",
"spark",
"=",
"SparkSession",
".",
"builder",
"(",
")",
".",
"appName",
"(",
"\"Java Spark SQL basic example... | $example off:create_ds$ | [
"$example",
"off",
":",
"create_ds$"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/examples/src/main/java/org/apache/spark/examples/sql/JavaSparkSQLExample.java#L88-L103 | train | Demonstrates how to run the example on a Spark Session. | [
30522,
2270,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
11618,
4106,
10288,
24422,
1063,
1013,
1013,
1002,
2742,
2006,
1024,
1999,
4183,
1035,
5219,
1002,
12300,
7971,
3258,
12125,
1027,
12300,
7971,
3258,
1012,
12508,
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-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java | SqlValidatorImpl.checkConstraint | private void checkConstraint(
SqlValidatorTable validatorTable,
SqlUpdate update,
RelDataType targetRowType) {
final ModifiableViewTable modifiableViewTable =
validatorTable.unwrap(ModifiableViewTable.class);
if (modifiableViewTable != null) {
final Table table = modifiableViewTable.unwrap(Table.class);
final RelDataType tableRowType = table.getRowType(typeFactory);
final Map<Integer, RexNode> projectMap =
RelOptUtil.getColumnConstraints(modifiableViewTable, targetRowType,
typeFactory);
final Map<String, Integer> nameToIndex =
SqlValidatorUtil.mapNameToIndex(tableRowType.getFieldList());
// Validate update values against the view constraint.
final List<SqlNode> targets = update.getTargetColumnList().getList();
final List<SqlNode> sources = update.getSourceExpressionList().getList();
for (final Pair<SqlNode, SqlNode> column : Pair.zip(targets, sources)) {
final String columnName = ((SqlIdentifier) column.left).getSimple();
final Integer columnIndex = nameToIndex.get(columnName);
if (projectMap.containsKey(columnIndex)) {
final RexNode columnConstraint = projectMap.get(columnIndex);
final ValidationError validationError =
new ValidationError(column.right,
RESOURCE.viewConstraintNotSatisfied(columnName,
Util.last(validatorTable.getQualifiedName())));
RelOptUtil.validateValueAgainstConstraint(column.right,
columnConstraint, validationError);
}
}
}
} | java | private void checkConstraint(
SqlValidatorTable validatorTable,
SqlUpdate update,
RelDataType targetRowType) {
final ModifiableViewTable modifiableViewTable =
validatorTable.unwrap(ModifiableViewTable.class);
if (modifiableViewTable != null) {
final Table table = modifiableViewTable.unwrap(Table.class);
final RelDataType tableRowType = table.getRowType(typeFactory);
final Map<Integer, RexNode> projectMap =
RelOptUtil.getColumnConstraints(modifiableViewTable, targetRowType,
typeFactory);
final Map<String, Integer> nameToIndex =
SqlValidatorUtil.mapNameToIndex(tableRowType.getFieldList());
// Validate update values against the view constraint.
final List<SqlNode> targets = update.getTargetColumnList().getList();
final List<SqlNode> sources = update.getSourceExpressionList().getList();
for (final Pair<SqlNode, SqlNode> column : Pair.zip(targets, sources)) {
final String columnName = ((SqlIdentifier) column.left).getSimple();
final Integer columnIndex = nameToIndex.get(columnName);
if (projectMap.containsKey(columnIndex)) {
final RexNode columnConstraint = projectMap.get(columnIndex);
final ValidationError validationError =
new ValidationError(column.right,
RESOURCE.viewConstraintNotSatisfied(columnName,
Util.last(validatorTable.getQualifiedName())));
RelOptUtil.validateValueAgainstConstraint(column.right,
columnConstraint, validationError);
}
}
}
} | [
"private",
"void",
"checkConstraint",
"(",
"SqlValidatorTable",
"validatorTable",
",",
"SqlUpdate",
"update",
",",
"RelDataType",
"targetRowType",
")",
"{",
"final",
"ModifiableViewTable",
"modifiableViewTable",
"=",
"validatorTable",
".",
"unwrap",
"(",
"ModifiableViewTa... | Validates updates against the constraint of a modifiable view.
@param validatorTable A {@link SqlValidatorTable} that may wrap a
ModifiableViewTable
@param update The UPDATE parse tree node
@param targetRowType The target type | [
"Validates",
"updates",
"against",
"the",
"constraint",
"of",
"a",
"modifiable",
"view",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L4323-L4356 | train | Check the constraint. | [
30522,
2797,
11675,
4638,
8663,
20528,
18447,
1006,
29296,
10175,
8524,
25485,
3085,
9398,
8844,
10880,
1010,
29296,
6279,
13701,
10651,
1010,
2128,
15150,
29336,
18863,
4539,
10524,
13874,
1007,
1063,
2345,
16913,
10128,
19210,
8584,
10880,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java | ConditionEvaluationReport.getUnconditionalClasses | public Set<String> getUnconditionalClasses() {
Set<String> filtered = new HashSet<>(this.unconditionalClasses);
filtered.removeAll(this.exclusions);
return Collections.unmodifiableSet(filtered);
} | java | public Set<String> getUnconditionalClasses() {
Set<String> filtered = new HashSet<>(this.unconditionalClasses);
filtered.removeAll(this.exclusions);
return Collections.unmodifiableSet(filtered);
} | [
"public",
"Set",
"<",
"String",
">",
"getUnconditionalClasses",
"(",
")",
"{",
"Set",
"<",
"String",
">",
"filtered",
"=",
"new",
"HashSet",
"<>",
"(",
"this",
".",
"unconditionalClasses",
")",
";",
"filtered",
".",
"removeAll",
"(",
"this",
".",
"exclusio... | Returns the names of the classes that were evaluated but were not conditional.
@return the names of the unconditional classes | [
"Returns",
"the",
"names",
"of",
"the",
"classes",
"that",
"were",
"evaluated",
"but",
"were",
"not",
"conditional",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java#L149-L153 | train | Returns a set of unconditional classes. | [
30522,
2270,
2275,
1026,
5164,
1028,
2131,
4609,
8663,
27064,
26266,
2229,
1006,
1007,
1063,
2275,
1026,
5164,
1028,
21839,
1027,
2047,
23325,
13462,
1026,
1028,
1006,
2023,
1012,
4895,
8663,
27064,
26266,
2229,
1007,
1025,
21839,
1012,
636... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-optimizer/src/main/java/org/apache/flink/optimizer/plantranslate/JobGraphGenerator.java | JobGraphGenerator.postVisit | @Override
public void postVisit(PlanNode node) {
try {
// --------- check special cases for which we handle post visit differently ----------
// skip data source node (they have no inputs)
// also, do nothing for union nodes, we connect them later when gathering the inputs for a task
// solution sets have no input. the initial solution set input is connected when the iteration node is in its postVisit
if (node instanceof SourcePlanNode || node instanceof NAryUnionPlanNode || node instanceof SolutionSetPlanNode) {
return;
}
// check if we have an iteration. in that case, translate the step function now
if (node instanceof IterationPlanNode) {
// prevent nested iterations
if (node.isOnDynamicPath()) {
throw new CompilerException("Nested Iterations are not possible at the moment!");
}
// if we recursively go into an iteration (because the constant path of one iteration contains
// another one), we push the current one onto the stack
if (this.currentIteration != null) {
this.iterationStack.add(this.currentIteration);
}
this.currentIteration = (IterationPlanNode) node;
this.currentIteration.acceptForStepFunction(this);
// pop the current iteration from the stack
if (this.iterationStack.isEmpty()) {
this.currentIteration = null;
} else {
this.currentIteration = this.iterationStack.remove(this.iterationStack.size() - 1);
}
// inputs for initial bulk partial solution or initial workset are already connected to the iteration head in the head's post visit.
// connect the initial solution set now.
if (node instanceof WorksetIterationPlanNode) {
// connect the initial solution set
WorksetIterationPlanNode wsNode = (WorksetIterationPlanNode) node;
JobVertex headVertex = this.iterations.get(wsNode).getHeadTask();
TaskConfig headConfig = new TaskConfig(headVertex.getConfiguration());
int inputIndex = headConfig.getDriverStrategy().getNumInputs();
headConfig.setIterationHeadSolutionSetInputIndex(inputIndex);
translateChannel(wsNode.getInitialSolutionSetInput(), inputIndex, headVertex, headConfig, false);
}
return;
}
final JobVertex targetVertex = this.vertices.get(node);
// --------- Main Path: Translation of channels ----------
//
// There are two paths of translation: One for chained tasks (or merged tasks in general),
// which do not have their own task vertex. The other for tasks that have their own vertex,
// or are the primary task in a vertex (to which the others are chained).
// check whether this node has its own task, or is merged with another one
if (targetVertex == null) {
// node's task is merged with another task. it is either chained, of a merged head vertex
// from an iteration
final TaskInChain chainedTask;
if ((chainedTask = this.chainedTasks.get(node)) != null) {
// Chained Task. Sanity check first...
final Iterator<Channel> inConns = node.getInputs().iterator();
if (!inConns.hasNext()) {
throw new CompilerException("Bug: Found chained task with no input.");
}
final Channel inConn = inConns.next();
if (inConns.hasNext()) {
throw new CompilerException("Bug: Found a chained task with more than one input!");
}
if (inConn.getLocalStrategy() != null && inConn.getLocalStrategy() != LocalStrategy.NONE) {
throw new CompilerException("Bug: Found a chained task with an input local strategy.");
}
if (inConn.getShipStrategy() != null && inConn.getShipStrategy() != ShipStrategyType.FORWARD) {
throw new CompilerException("Bug: Found a chained task with an input ship strategy other than FORWARD.");
}
JobVertex container = chainedTask.getContainingVertex();
if (container == null) {
final PlanNode sourceNode = inConn.getSource();
container = this.vertices.get(sourceNode);
if (container == null) {
// predecessor is itself chained
container = this.chainedTasks.get(sourceNode).getContainingVertex();
if (container == null) {
throw new IllegalStateException("Bug: Chained task predecessor has not been assigned its containing vertex.");
}
} else {
// predecessor is a proper task job vertex and this is the first chained task. add a forward connection entry.
new TaskConfig(container.getConfiguration()).addOutputShipStrategy(ShipStrategyType.FORWARD);
}
chainedTask.setContainingVertex(container);
}
// add info about the input serializer type
chainedTask.getTaskConfig().setInputSerializer(inConn.getSerializer(), 0);
// update name of container task
String containerTaskName = container.getName();
if (containerTaskName.startsWith("CHAIN ")) {
container.setName(containerTaskName + " -> " + chainedTask.getTaskName());
} else {
container.setName("CHAIN " + containerTaskName + " -> " + chainedTask.getTaskName());
}
//update resource of container task
container.setResources(container.getMinResources().merge(node.getMinResources()),
container.getPreferredResources().merge(node.getPreferredResources()));
this.chainedTasksInSequence.add(chainedTask);
return;
}
else if (node instanceof BulkPartialSolutionPlanNode ||
node instanceof WorksetPlanNode)
{
// merged iteration head task. the task that the head is merged with will take care of it
return;
} else {
throw new CompilerException("Bug: Unrecognized merged task vertex.");
}
}
// -------- Here, we translate non-chained tasks -------------
if (this.currentIteration != null) {
JobVertex head = this.iterations.get(this.currentIteration).getHeadTask();
// Exclude static code paths from the co-location constraint, because otherwise
// their execution determines the deployment slots of the co-location group
if (node.isOnDynamicPath()) {
targetVertex.setStrictlyCoLocatedWith(head);
}
}
// create the config that will contain all the description of the inputs
final TaskConfig targetVertexConfig = new TaskConfig(targetVertex.getConfiguration());
// get the inputs. if this node is the head of an iteration, we obtain the inputs from the
// enclosing iteration node, because the inputs are the initial inputs to the iteration.
final Iterator<Channel> inConns;
if (node instanceof BulkPartialSolutionPlanNode) {
inConns = ((BulkPartialSolutionPlanNode) node).getContainingIterationNode().getInputs().iterator();
// because the partial solution has its own vertex, is has only one (logical) input.
// note this in the task configuration
targetVertexConfig.setIterationHeadPartialSolutionOrWorksetInputIndex(0);
} else if (node instanceof WorksetPlanNode) {
WorksetPlanNode wspn = (WorksetPlanNode) node;
// input that is the initial workset
inConns = Collections.singleton(wspn.getContainingIterationNode().getInput2()).iterator();
// because we have a stand-alone (non-merged) workset iteration head, the initial workset will
// be input 0 and the solution set will be input 1
targetVertexConfig.setIterationHeadPartialSolutionOrWorksetInputIndex(0);
targetVertexConfig.setIterationHeadSolutionSetInputIndex(1);
} else {
inConns = node.getInputs().iterator();
}
if (!inConns.hasNext()) {
throw new CompilerException("Bug: Found a non-source task with no input.");
}
int inputIndex = 0;
while (inConns.hasNext()) {
Channel input = inConns.next();
inputIndex += translateChannel(input, inputIndex, targetVertex, targetVertexConfig, false);
}
// broadcast variables
int broadcastInputIndex = 0;
for (NamedChannel broadcastInput: node.getBroadcastInputs()) {
int broadcastInputIndexDelta = translateChannel(broadcastInput, broadcastInputIndex, targetVertex, targetVertexConfig, true);
targetVertexConfig.setBroadcastInputName(broadcastInput.getName(), broadcastInputIndex);
targetVertexConfig.setBroadcastInputSerializer(broadcastInput.getSerializer(), broadcastInputIndex);
broadcastInputIndex += broadcastInputIndexDelta;
}
} catch (Exception e) {
throw new CompilerException(
"An error occurred while translating the optimized plan to a JobGraph: " + e.getMessage(), e);
}
} | java | @Override
public void postVisit(PlanNode node) {
try {
// --------- check special cases for which we handle post visit differently ----------
// skip data source node (they have no inputs)
// also, do nothing for union nodes, we connect them later when gathering the inputs for a task
// solution sets have no input. the initial solution set input is connected when the iteration node is in its postVisit
if (node instanceof SourcePlanNode || node instanceof NAryUnionPlanNode || node instanceof SolutionSetPlanNode) {
return;
}
// check if we have an iteration. in that case, translate the step function now
if (node instanceof IterationPlanNode) {
// prevent nested iterations
if (node.isOnDynamicPath()) {
throw new CompilerException("Nested Iterations are not possible at the moment!");
}
// if we recursively go into an iteration (because the constant path of one iteration contains
// another one), we push the current one onto the stack
if (this.currentIteration != null) {
this.iterationStack.add(this.currentIteration);
}
this.currentIteration = (IterationPlanNode) node;
this.currentIteration.acceptForStepFunction(this);
// pop the current iteration from the stack
if (this.iterationStack.isEmpty()) {
this.currentIteration = null;
} else {
this.currentIteration = this.iterationStack.remove(this.iterationStack.size() - 1);
}
// inputs for initial bulk partial solution or initial workset are already connected to the iteration head in the head's post visit.
// connect the initial solution set now.
if (node instanceof WorksetIterationPlanNode) {
// connect the initial solution set
WorksetIterationPlanNode wsNode = (WorksetIterationPlanNode) node;
JobVertex headVertex = this.iterations.get(wsNode).getHeadTask();
TaskConfig headConfig = new TaskConfig(headVertex.getConfiguration());
int inputIndex = headConfig.getDriverStrategy().getNumInputs();
headConfig.setIterationHeadSolutionSetInputIndex(inputIndex);
translateChannel(wsNode.getInitialSolutionSetInput(), inputIndex, headVertex, headConfig, false);
}
return;
}
final JobVertex targetVertex = this.vertices.get(node);
// --------- Main Path: Translation of channels ----------
//
// There are two paths of translation: One for chained tasks (or merged tasks in general),
// which do not have their own task vertex. The other for tasks that have their own vertex,
// or are the primary task in a vertex (to which the others are chained).
// check whether this node has its own task, or is merged with another one
if (targetVertex == null) {
// node's task is merged with another task. it is either chained, of a merged head vertex
// from an iteration
final TaskInChain chainedTask;
if ((chainedTask = this.chainedTasks.get(node)) != null) {
// Chained Task. Sanity check first...
final Iterator<Channel> inConns = node.getInputs().iterator();
if (!inConns.hasNext()) {
throw new CompilerException("Bug: Found chained task with no input.");
}
final Channel inConn = inConns.next();
if (inConns.hasNext()) {
throw new CompilerException("Bug: Found a chained task with more than one input!");
}
if (inConn.getLocalStrategy() != null && inConn.getLocalStrategy() != LocalStrategy.NONE) {
throw new CompilerException("Bug: Found a chained task with an input local strategy.");
}
if (inConn.getShipStrategy() != null && inConn.getShipStrategy() != ShipStrategyType.FORWARD) {
throw new CompilerException("Bug: Found a chained task with an input ship strategy other than FORWARD.");
}
JobVertex container = chainedTask.getContainingVertex();
if (container == null) {
final PlanNode sourceNode = inConn.getSource();
container = this.vertices.get(sourceNode);
if (container == null) {
// predecessor is itself chained
container = this.chainedTasks.get(sourceNode).getContainingVertex();
if (container == null) {
throw new IllegalStateException("Bug: Chained task predecessor has not been assigned its containing vertex.");
}
} else {
// predecessor is a proper task job vertex and this is the first chained task. add a forward connection entry.
new TaskConfig(container.getConfiguration()).addOutputShipStrategy(ShipStrategyType.FORWARD);
}
chainedTask.setContainingVertex(container);
}
// add info about the input serializer type
chainedTask.getTaskConfig().setInputSerializer(inConn.getSerializer(), 0);
// update name of container task
String containerTaskName = container.getName();
if (containerTaskName.startsWith("CHAIN ")) {
container.setName(containerTaskName + " -> " + chainedTask.getTaskName());
} else {
container.setName("CHAIN " + containerTaskName + " -> " + chainedTask.getTaskName());
}
//update resource of container task
container.setResources(container.getMinResources().merge(node.getMinResources()),
container.getPreferredResources().merge(node.getPreferredResources()));
this.chainedTasksInSequence.add(chainedTask);
return;
}
else if (node instanceof BulkPartialSolutionPlanNode ||
node instanceof WorksetPlanNode)
{
// merged iteration head task. the task that the head is merged with will take care of it
return;
} else {
throw new CompilerException("Bug: Unrecognized merged task vertex.");
}
}
// -------- Here, we translate non-chained tasks -------------
if (this.currentIteration != null) {
JobVertex head = this.iterations.get(this.currentIteration).getHeadTask();
// Exclude static code paths from the co-location constraint, because otherwise
// their execution determines the deployment slots of the co-location group
if (node.isOnDynamicPath()) {
targetVertex.setStrictlyCoLocatedWith(head);
}
}
// create the config that will contain all the description of the inputs
final TaskConfig targetVertexConfig = new TaskConfig(targetVertex.getConfiguration());
// get the inputs. if this node is the head of an iteration, we obtain the inputs from the
// enclosing iteration node, because the inputs are the initial inputs to the iteration.
final Iterator<Channel> inConns;
if (node instanceof BulkPartialSolutionPlanNode) {
inConns = ((BulkPartialSolutionPlanNode) node).getContainingIterationNode().getInputs().iterator();
// because the partial solution has its own vertex, is has only one (logical) input.
// note this in the task configuration
targetVertexConfig.setIterationHeadPartialSolutionOrWorksetInputIndex(0);
} else if (node instanceof WorksetPlanNode) {
WorksetPlanNode wspn = (WorksetPlanNode) node;
// input that is the initial workset
inConns = Collections.singleton(wspn.getContainingIterationNode().getInput2()).iterator();
// because we have a stand-alone (non-merged) workset iteration head, the initial workset will
// be input 0 and the solution set will be input 1
targetVertexConfig.setIterationHeadPartialSolutionOrWorksetInputIndex(0);
targetVertexConfig.setIterationHeadSolutionSetInputIndex(1);
} else {
inConns = node.getInputs().iterator();
}
if (!inConns.hasNext()) {
throw new CompilerException("Bug: Found a non-source task with no input.");
}
int inputIndex = 0;
while (inConns.hasNext()) {
Channel input = inConns.next();
inputIndex += translateChannel(input, inputIndex, targetVertex, targetVertexConfig, false);
}
// broadcast variables
int broadcastInputIndex = 0;
for (NamedChannel broadcastInput: node.getBroadcastInputs()) {
int broadcastInputIndexDelta = translateChannel(broadcastInput, broadcastInputIndex, targetVertex, targetVertexConfig, true);
targetVertexConfig.setBroadcastInputName(broadcastInput.getName(), broadcastInputIndex);
targetVertexConfig.setBroadcastInputSerializer(broadcastInput.getSerializer(), broadcastInputIndex);
broadcastInputIndex += broadcastInputIndexDelta;
}
} catch (Exception e) {
throw new CompilerException(
"An error occurred while translating the optimized plan to a JobGraph: " + e.getMessage(), e);
}
} | [
"@",
"Override",
"public",
"void",
"postVisit",
"(",
"PlanNode",
"node",
")",
"{",
"try",
"{",
"// --------- check special cases for which we handle post visit differently ----------",
"// skip data source node (they have no inputs)",
"// also, do nothing for union nodes, we connect them... | This method implements the post-visit during the depth-first traversal. When the post visit happens,
all of the descendants have been processed, so this method connects all of the current node's
predecessors to the current node.
@param node
The node currently processed during the post-visit.
@see org.apache.flink.util.Visitor#postVisit(org.apache.flink.util.Visitable) t | [
"This",
"method",
"implements",
"the",
"post",
"-",
"visit",
"during",
"the",
"depth",
"-",
"first",
"traversal",
".",
"When",
"the",
"post",
"visit",
"happens",
"all",
"of",
"the",
"descendants",
"have",
"been",
"processed",
"so",
"this",
"method",
"connect... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/plantranslate/JobGraphGenerator.java#L472-L657 | train | This method is called after the node is visited. | [
30522,
1030,
2058,
15637,
2270,
11675,
2695,
11365,
4183,
1006,
2933,
3630,
3207,
13045,
1007,
1063,
3046,
1063,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
4638,
2569,
3572,
2005,
2029,
2057,
5047,
2695,
3942,
11543,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/runtime/PojoSerializerSnapshot.java | PojoSerializerSnapshot.newPojoSerializerIsCompatibleAfterMigration | private static <T> boolean newPojoSerializerIsCompatibleAfterMigration(
PojoSerializer<T> newPojoSerializer,
IntermediateCompatibilityResult<T> fieldSerializerCompatibility,
IntermediateCompatibilityResult<T> preExistingRegistrationsCompatibility,
LinkedOptionalMap<Field, TypeSerializerSnapshot<?>> fieldSerializerSnapshots) {
return newPojoHasNewOrRemovedFields(fieldSerializerSnapshots, newPojoSerializer)
|| fieldSerializerCompatibility.isCompatibleAfterMigration()
|| preExistingRegistrationsCompatibility.isCompatibleAfterMigration();
} | java | private static <T> boolean newPojoSerializerIsCompatibleAfterMigration(
PojoSerializer<T> newPojoSerializer,
IntermediateCompatibilityResult<T> fieldSerializerCompatibility,
IntermediateCompatibilityResult<T> preExistingRegistrationsCompatibility,
LinkedOptionalMap<Field, TypeSerializerSnapshot<?>> fieldSerializerSnapshots) {
return newPojoHasNewOrRemovedFields(fieldSerializerSnapshots, newPojoSerializer)
|| fieldSerializerCompatibility.isCompatibleAfterMigration()
|| preExistingRegistrationsCompatibility.isCompatibleAfterMigration();
} | [
"private",
"static",
"<",
"T",
">",
"boolean",
"newPojoSerializerIsCompatibleAfterMigration",
"(",
"PojoSerializer",
"<",
"T",
">",
"newPojoSerializer",
",",
"IntermediateCompatibilityResult",
"<",
"T",
">",
"fieldSerializerCompatibility",
",",
"IntermediateCompatibilityResul... | Checks if the new {@link PojoSerializer} is compatible after migration. | [
"Checks",
"if",
"the",
"new",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializerSnapshot.java#L345-L353 | train | Checks if the new pojo serializer is compatible after migration. | [
30522,
2797,
10763,
1026,
1056,
1028,
22017,
20898,
2047,
6873,
19929,
11610,
28863,
2483,
9006,
24952,
3468,
10354,
3334,
4328,
29397,
1006,
13433,
19929,
11610,
28863,
1026,
1056,
1028,
2047,
6873,
19929,
11610,
28863,
1010,
7783,
9006,
249... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/websocketx/WebSocketClientHandshaker00.java | WebSocketClientHandshaker00.newHandshakeRequest | @Override
protected FullHttpRequest newHandshakeRequest() {
// Make keys
int spaces1 = WebSocketUtil.randomNumber(1, 12);
int spaces2 = WebSocketUtil.randomNumber(1, 12);
int max1 = Integer.MAX_VALUE / spaces1;
int max2 = Integer.MAX_VALUE / spaces2;
int number1 = WebSocketUtil.randomNumber(0, max1);
int number2 = WebSocketUtil.randomNumber(0, max2);
int product1 = number1 * spaces1;
int product2 = number2 * spaces2;
String key1 = Integer.toString(product1);
String key2 = Integer.toString(product2);
key1 = insertRandomCharacters(key1);
key2 = insertRandomCharacters(key2);
key1 = insertSpaces(key1, spaces1);
key2 = insertSpaces(key2, spaces2);
byte[] key3 = WebSocketUtil.randomBytes(8);
ByteBuffer buffer = ByteBuffer.allocate(4);
buffer.putInt(number1);
byte[] number1Array = buffer.array();
buffer = ByteBuffer.allocate(4);
buffer.putInt(number2);
byte[] number2Array = buffer.array();
byte[] challenge = new byte[16];
System.arraycopy(number1Array, 0, challenge, 0, 4);
System.arraycopy(number2Array, 0, challenge, 4, 4);
System.arraycopy(key3, 0, challenge, 8, 8);
expectedChallengeResponseBytes = Unpooled.wrappedBuffer(WebSocketUtil.md5(challenge));
// Get path
URI wsURL = uri();
String path = rawPath(wsURL);
// Format request
FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path);
HttpHeaders headers = request.headers();
if (customHeaders != null) {
headers.add(customHeaders);
}
headers.set(HttpHeaderNames.UPGRADE, WEBSOCKET)
.set(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE)
.set(HttpHeaderNames.HOST, websocketHostValue(wsURL))
.set(HttpHeaderNames.ORIGIN, websocketOriginValue(wsURL))
.set(HttpHeaderNames.SEC_WEBSOCKET_KEY1, key1)
.set(HttpHeaderNames.SEC_WEBSOCKET_KEY2, key2);
String expectedSubprotocol = expectedSubprotocol();
if (expectedSubprotocol != null && !expectedSubprotocol.isEmpty()) {
headers.set(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL, expectedSubprotocol);
}
// Set Content-Length to workaround some known defect.
// See also: http://www.ietf.org/mail-archive/web/hybi/current/msg02149.html
headers.set(HttpHeaderNames.CONTENT_LENGTH, key3.length);
request.content().writeBytes(key3);
return request;
} | java | @Override
protected FullHttpRequest newHandshakeRequest() {
// Make keys
int spaces1 = WebSocketUtil.randomNumber(1, 12);
int spaces2 = WebSocketUtil.randomNumber(1, 12);
int max1 = Integer.MAX_VALUE / spaces1;
int max2 = Integer.MAX_VALUE / spaces2;
int number1 = WebSocketUtil.randomNumber(0, max1);
int number2 = WebSocketUtil.randomNumber(0, max2);
int product1 = number1 * spaces1;
int product2 = number2 * spaces2;
String key1 = Integer.toString(product1);
String key2 = Integer.toString(product2);
key1 = insertRandomCharacters(key1);
key2 = insertRandomCharacters(key2);
key1 = insertSpaces(key1, spaces1);
key2 = insertSpaces(key2, spaces2);
byte[] key3 = WebSocketUtil.randomBytes(8);
ByteBuffer buffer = ByteBuffer.allocate(4);
buffer.putInt(number1);
byte[] number1Array = buffer.array();
buffer = ByteBuffer.allocate(4);
buffer.putInt(number2);
byte[] number2Array = buffer.array();
byte[] challenge = new byte[16];
System.arraycopy(number1Array, 0, challenge, 0, 4);
System.arraycopy(number2Array, 0, challenge, 4, 4);
System.arraycopy(key3, 0, challenge, 8, 8);
expectedChallengeResponseBytes = Unpooled.wrappedBuffer(WebSocketUtil.md5(challenge));
// Get path
URI wsURL = uri();
String path = rawPath(wsURL);
// Format request
FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path);
HttpHeaders headers = request.headers();
if (customHeaders != null) {
headers.add(customHeaders);
}
headers.set(HttpHeaderNames.UPGRADE, WEBSOCKET)
.set(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE)
.set(HttpHeaderNames.HOST, websocketHostValue(wsURL))
.set(HttpHeaderNames.ORIGIN, websocketOriginValue(wsURL))
.set(HttpHeaderNames.SEC_WEBSOCKET_KEY1, key1)
.set(HttpHeaderNames.SEC_WEBSOCKET_KEY2, key2);
String expectedSubprotocol = expectedSubprotocol();
if (expectedSubprotocol != null && !expectedSubprotocol.isEmpty()) {
headers.set(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL, expectedSubprotocol);
}
// Set Content-Length to workaround some known defect.
// See also: http://www.ietf.org/mail-archive/web/hybi/current/msg02149.html
headers.set(HttpHeaderNames.CONTENT_LENGTH, key3.length);
request.content().writeBytes(key3);
return request;
} | [
"@",
"Override",
"protected",
"FullHttpRequest",
"newHandshakeRequest",
"(",
")",
"{",
"// Make keys",
"int",
"spaces1",
"=",
"WebSocketUtil",
".",
"randomNumber",
"(",
"1",
",",
"12",
")",
";",
"int",
"spaces2",
"=",
"WebSocketUtil",
".",
"randomNumber",
"(",
... | <p>
Sends the opening request to the server:
</p>
<pre>
GET /demo HTTP/1.1
Upgrade: WebSocket
Connection: Upgrade
Host: example.com
Origin: http://example.com
Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5
Sec-WebSocket-Key2: 12998 5 Y3 1 .P00
^n:ds[4U
</pre> | [
"<p",
">",
"Sends",
"the",
"opening",
"request",
"to",
"the",
"server",
":",
"<",
"/",
"p",
">"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker00.java#L112-L180 | train | Creates a new HTTP handshake request. | [
30522,
1030,
2058,
15637,
5123,
2440,
11039,
25856,
2890,
15500,
2047,
11774,
7377,
5484,
2063,
15500,
1006,
1007,
1063,
1013,
1013,
2191,
6309,
20014,
7258,
2487,
1027,
4773,
6499,
19869,
8525,
3775,
2140,
1012,
6721,
19172,
5677,
1006,
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-core/src/main/java/org/apache/flink/util/StringUtils.java | StringUtils.arrayAwareToString | public static String arrayAwareToString(Object o) {
if (o == null) {
return "null";
}
if (o.getClass().isArray()) {
return arrayToString(o);
}
return o.toString();
} | java | public static String arrayAwareToString(Object o) {
if (o == null) {
return "null";
}
if (o.getClass().isArray()) {
return arrayToString(o);
}
return o.toString();
} | [
"public",
"static",
"String",
"arrayAwareToString",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"return",
"\"null\"",
";",
"}",
"if",
"(",
"o",
".",
"getClass",
"(",
")",
".",
"isArray",
"(",
")",
")",
"{",
"return",
"arra... | This method calls {@link Object#toString()} on the given object, unless the
object is an array. In that case, it will use the {@link #arrayToString(Object)}
method to create a string representation of the array that includes all contained
elements.
@param o The object for which to create the string representation.
@return The string representation of the object. | [
"This",
"method",
"calls",
"{",
"@link",
"Object#toString",
"()",
"}",
"on",
"the",
"given",
"object",
"unless",
"the",
"object",
"is",
"an",
"array",
".",
"In",
"that",
"case",
"it",
"will",
"use",
"the",
"{",
"@link",
"#arrayToString",
"(",
"Object",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/StringUtils.java#L112-L121 | train | Returns a string representation of an object. | [
30522,
2270,
10763,
5164,
9140,
10830,
13465,
14122,
4892,
1006,
4874,
1051,
1007,
1063,
2065,
1006,
1051,
1027,
1027,
19701,
1007,
1063,
2709,
1000,
19701,
1000,
1025,
1065,
2065,
1006,
1051,
1012,
2131,
26266,
1006,
1007,
1012,
18061,
113... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/Bzip2BlockDecompressor.java | Bzip2BlockDecompressor.decodeHuffmanData | boolean decodeHuffmanData(final Bzip2HuffmanStageDecoder huffmanDecoder) {
final Bzip2BitReader reader = this.reader;
final byte[] bwtBlock = this.bwtBlock;
final byte[] huffmanSymbolMap = this.huffmanSymbolMap;
final int streamBlockSize = this.bwtBlock.length;
final int huffmanEndOfBlockSymbol = this.huffmanEndOfBlockSymbol;
final int[] bwtByteCounts = this.bwtByteCounts;
final Bzip2MoveToFrontTable symbolMTF = this.symbolMTF;
int bwtBlockLength = this.bwtBlockLength;
int repeatCount = this.repeatCount;
int repeatIncrement = this.repeatIncrement;
int mtfValue = this.mtfValue;
for (;;) {
if (!reader.hasReadableBits(HUFFMAN_DECODE_MAX_CODE_LENGTH)) {
this.bwtBlockLength = bwtBlockLength;
this.repeatCount = repeatCount;
this.repeatIncrement = repeatIncrement;
this.mtfValue = mtfValue;
return false;
}
final int nextSymbol = huffmanDecoder.nextSymbol();
if (nextSymbol == HUFFMAN_SYMBOL_RUNA) {
repeatCount += repeatIncrement;
repeatIncrement <<= 1;
} else if (nextSymbol == HUFFMAN_SYMBOL_RUNB) {
repeatCount += repeatIncrement << 1;
repeatIncrement <<= 1;
} else {
if (repeatCount > 0) {
if (bwtBlockLength + repeatCount > streamBlockSize) {
throw new DecompressionException("block exceeds declared block size");
}
final byte nextByte = huffmanSymbolMap[mtfValue];
bwtByteCounts[nextByte & 0xff] += repeatCount;
while (--repeatCount >= 0) {
bwtBlock[bwtBlockLength++] = nextByte;
}
repeatCount = 0;
repeatIncrement = 1;
}
if (nextSymbol == huffmanEndOfBlockSymbol) {
break;
}
if (bwtBlockLength >= streamBlockSize) {
throw new DecompressionException("block exceeds declared block size");
}
mtfValue = symbolMTF.indexToFront(nextSymbol - 1) & 0xff;
final byte nextByte = huffmanSymbolMap[mtfValue];
bwtByteCounts[nextByte & 0xff]++;
bwtBlock[bwtBlockLength++] = nextByte;
}
}
this.bwtBlockLength = bwtBlockLength;
initialiseInverseBWT();
return true;
} | java | boolean decodeHuffmanData(final Bzip2HuffmanStageDecoder huffmanDecoder) {
final Bzip2BitReader reader = this.reader;
final byte[] bwtBlock = this.bwtBlock;
final byte[] huffmanSymbolMap = this.huffmanSymbolMap;
final int streamBlockSize = this.bwtBlock.length;
final int huffmanEndOfBlockSymbol = this.huffmanEndOfBlockSymbol;
final int[] bwtByteCounts = this.bwtByteCounts;
final Bzip2MoveToFrontTable symbolMTF = this.symbolMTF;
int bwtBlockLength = this.bwtBlockLength;
int repeatCount = this.repeatCount;
int repeatIncrement = this.repeatIncrement;
int mtfValue = this.mtfValue;
for (;;) {
if (!reader.hasReadableBits(HUFFMAN_DECODE_MAX_CODE_LENGTH)) {
this.bwtBlockLength = bwtBlockLength;
this.repeatCount = repeatCount;
this.repeatIncrement = repeatIncrement;
this.mtfValue = mtfValue;
return false;
}
final int nextSymbol = huffmanDecoder.nextSymbol();
if (nextSymbol == HUFFMAN_SYMBOL_RUNA) {
repeatCount += repeatIncrement;
repeatIncrement <<= 1;
} else if (nextSymbol == HUFFMAN_SYMBOL_RUNB) {
repeatCount += repeatIncrement << 1;
repeatIncrement <<= 1;
} else {
if (repeatCount > 0) {
if (bwtBlockLength + repeatCount > streamBlockSize) {
throw new DecompressionException("block exceeds declared block size");
}
final byte nextByte = huffmanSymbolMap[mtfValue];
bwtByteCounts[nextByte & 0xff] += repeatCount;
while (--repeatCount >= 0) {
bwtBlock[bwtBlockLength++] = nextByte;
}
repeatCount = 0;
repeatIncrement = 1;
}
if (nextSymbol == huffmanEndOfBlockSymbol) {
break;
}
if (bwtBlockLength >= streamBlockSize) {
throw new DecompressionException("block exceeds declared block size");
}
mtfValue = symbolMTF.indexToFront(nextSymbol - 1) & 0xff;
final byte nextByte = huffmanSymbolMap[mtfValue];
bwtByteCounts[nextByte & 0xff]++;
bwtBlock[bwtBlockLength++] = nextByte;
}
}
this.bwtBlockLength = bwtBlockLength;
initialiseInverseBWT();
return true;
} | [
"boolean",
"decodeHuffmanData",
"(",
"final",
"Bzip2HuffmanStageDecoder",
"huffmanDecoder",
")",
"{",
"final",
"Bzip2BitReader",
"reader",
"=",
"this",
".",
"reader",
";",
"final",
"byte",
"[",
"]",
"bwtBlock",
"=",
"this",
".",
"bwtBlock",
";",
"final",
"byte",... | Reads the Huffman encoded data from the input stream, performs Run-Length Decoding and
applies the Move To Front transform to reconstruct the Burrows-Wheeler Transform array. | [
"Reads",
"the",
"Huffman",
"encoded",
"data",
"from",
"the",
"input",
"stream",
"performs",
"Run",
"-",
"Length",
"Decoding",
"and",
"applies",
"the",
"Move",
"To",
"Front",
"transform",
"to",
"reconstruct",
"the",
"Burrows",
"-",
"Wheeler",
"Transform",
"arra... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2BlockDecompressor.java#L171-L234 | train | Decode the Huffman data. | [
30522,
22017,
20898,
21933,
25383,
16093,
16715,
13832,
2696,
1006,
2345,
1038,
5831,
2361,
2475,
6979,
4246,
15154,
26702,
3207,
16044,
2099,
21301,
2386,
3207,
16044,
2099,
1007,
1063,
2345,
1038,
5831,
2361,
2475,
16313,
16416,
4063,
8068,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/types/Record.java | Record.updateBinaryRepresenation | public void updateBinaryRepresenation() {
// check whether the binary state is in sync
final int firstModified = this.firstModifiedPos;
if (firstModified == Integer.MAX_VALUE) {
return;
}
final InternalDeSerializer serializer = this.serializer;
final int[] offsets = this.offsets;
final int numFields = this.numFields;
serializer.memory = this.switchBuffer != null ? this.switchBuffer :
(this.binaryLen > 0 ? new byte[this.binaryLen] : new byte[numFields * DEFAULT_FIELD_LEN_ESTIMATE + 1]);
serializer.position = 0;
if (numFields > 0) {
int offset = 0;
// search backwards to find the latest preceding non-null field
if (firstModified > 0) {
for (int i = firstModified - 1; i >= 0; i--) {
if (this.offsets[i] != NULL_INDICATOR_OFFSET) {
offset = this.offsets[i] + this.lengths[i];
break;
}
}
}
// we assume that changed and unchanged fields are interleaved and serialize into another array
try {
if (offset > 0) {
// copy the first unchanged portion as one
serializer.write(this.binaryData, 0, offset);
}
// copy field by field
for (int i = firstModified; i < numFields; i++) {
final int co = offsets[i];
/// skip null fields
if (co == NULL_INDICATOR_OFFSET) {
continue;
}
offsets[i] = offset;
if (co == MODIFIED_INDICATOR_OFFSET) {
final Value writeField = this.writeFields[i];
if (writeField == RESERVE_SPACE) {
// RESERVE_SPACE is a placeholder indicating lengths[i] bytes should be reserved
final int length = this.lengths[i];
if (serializer.position >= serializer.memory.length - length - 1) {
serializer.resize(length);
}
serializer.position += length;
} else {
// serialize modified fields
this.writeFields[i].write(serializer);
}
} else {
// bin-copy unmodified fields
serializer.write(this.binaryData, co, this.lengths[i]);
}
this.lengths[i] = serializer.position - offset;
offset = serializer.position;
}
}
catch (Exception e) {
throw new RuntimeException("Error in data type serialization: " + e.getMessage(), e);
}
}
serializeHeader(serializer, offsets, numFields);
// set the fields
this.switchBuffer = this.binaryData;
this.binaryData = serializer.memory;
this.binaryLen = serializer.position;
this.firstModifiedPos = Integer.MAX_VALUE;
} | java | public void updateBinaryRepresenation() {
// check whether the binary state is in sync
final int firstModified = this.firstModifiedPos;
if (firstModified == Integer.MAX_VALUE) {
return;
}
final InternalDeSerializer serializer = this.serializer;
final int[] offsets = this.offsets;
final int numFields = this.numFields;
serializer.memory = this.switchBuffer != null ? this.switchBuffer :
(this.binaryLen > 0 ? new byte[this.binaryLen] : new byte[numFields * DEFAULT_FIELD_LEN_ESTIMATE + 1]);
serializer.position = 0;
if (numFields > 0) {
int offset = 0;
// search backwards to find the latest preceding non-null field
if (firstModified > 0) {
for (int i = firstModified - 1; i >= 0; i--) {
if (this.offsets[i] != NULL_INDICATOR_OFFSET) {
offset = this.offsets[i] + this.lengths[i];
break;
}
}
}
// we assume that changed and unchanged fields are interleaved and serialize into another array
try {
if (offset > 0) {
// copy the first unchanged portion as one
serializer.write(this.binaryData, 0, offset);
}
// copy field by field
for (int i = firstModified; i < numFields; i++) {
final int co = offsets[i];
/// skip null fields
if (co == NULL_INDICATOR_OFFSET) {
continue;
}
offsets[i] = offset;
if (co == MODIFIED_INDICATOR_OFFSET) {
final Value writeField = this.writeFields[i];
if (writeField == RESERVE_SPACE) {
// RESERVE_SPACE is a placeholder indicating lengths[i] bytes should be reserved
final int length = this.lengths[i];
if (serializer.position >= serializer.memory.length - length - 1) {
serializer.resize(length);
}
serializer.position += length;
} else {
// serialize modified fields
this.writeFields[i].write(serializer);
}
} else {
// bin-copy unmodified fields
serializer.write(this.binaryData, co, this.lengths[i]);
}
this.lengths[i] = serializer.position - offset;
offset = serializer.position;
}
}
catch (Exception e) {
throw new RuntimeException("Error in data type serialization: " + e.getMessage(), e);
}
}
serializeHeader(serializer, offsets, numFields);
// set the fields
this.switchBuffer = this.binaryData;
this.binaryData = serializer.memory;
this.binaryLen = serializer.position;
this.firstModifiedPos = Integer.MAX_VALUE;
} | [
"public",
"void",
"updateBinaryRepresenation",
"(",
")",
"{",
"// check whether the binary state is in sync",
"final",
"int",
"firstModified",
"=",
"this",
".",
"firstModifiedPos",
";",
"if",
"(",
"firstModified",
"==",
"Integer",
".",
"MAX_VALUE",
")",
"{",
"return",... | Updates the binary representation of the data, such that it reflects the state of the currently
stored fields. If the binary representation is already up to date, nothing happens. Otherwise,
this function triggers the modified fields to serialize themselves into the records buffer and
afterwards updates the offset table. | [
"Updates",
"the",
"binary",
"representation",
"of",
"the",
"data",
"such",
"that",
"it",
"reflects",
"the",
"state",
"of",
"the",
"currently",
"stored",
"fields",
".",
"If",
"the",
"binary",
"representation",
"is",
"already",
"up",
"to",
"date",
"nothing",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/Record.java#L928-L1009 | train | Update the binary represenation. | [
30522,
2270,
11675,
10651,
21114,
2854,
2890,
28994,
8189,
3508,
1006,
1007,
1063,
1013,
1013,
4638,
3251,
1996,
12441,
2110,
2003,
1999,
26351,
2345,
20014,
2034,
5302,
4305,
10451,
1027,
2023,
1012,
2034,
5302,
4305,
10451,
6873,
2015,
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/incubator-shardingsphere | sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/internal/registry/state/node/StateNode.java | StateNode.getDataSourcesNodeFullPath | public String getDataSourcesNodeFullPath(final String schemaDataSourceName) {
return Joiner.on("/").join("", name, ROOT, DATA_SOURCES_NODE_PATH, schemaDataSourceName);
} | java | public String getDataSourcesNodeFullPath(final String schemaDataSourceName) {
return Joiner.on("/").join("", name, ROOT, DATA_SOURCES_NODE_PATH, schemaDataSourceName);
} | [
"public",
"String",
"getDataSourcesNodeFullPath",
"(",
"final",
"String",
"schemaDataSourceName",
")",
"{",
"return",
"Joiner",
".",
"on",
"(",
"\"/\"",
")",
".",
"join",
"(",
"\"\"",
",",
"name",
",",
"ROOT",
",",
"DATA_SOURCES_NODE_PATH",
",",
"schemaDataSourc... | Get data source node full path.
@param schemaDataSourceName schema name and data source name
@return data source node full path | [
"Get",
"data",
"source",
"node",
"full",
"path",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/internal/registry/state/node/StateNode.java#L65-L67 | train | Get the full path of the data source node. | [
30522,
2270,
5164,
2131,
2850,
10230,
8162,
9623,
3630,
3207,
3993,
14277,
8988,
1006,
2345,
5164,
8040,
28433,
2850,
10230,
8162,
27524,
14074,
1007,
1063,
2709,
3693,
2121,
1012,
2006,
1006,
1000,
1013,
1000,
1007,
1012,
3693,
1006,
1000,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/support/ESTemplate.java | ESTemplate.commit | public void commit() {
if (getBulk().numberOfActions() > 0) {
BulkResponse response = getBulk().execute().actionGet();
if (response.hasFailures()) {
for (BulkItemResponse itemResponse : response.getItems()) {
if (!itemResponse.isFailed()) {
continue;
}
if (itemResponse.getFailure().getStatus() == RestStatus.NOT_FOUND) {
logger.error(itemResponse.getFailureMessage());
} else {
throw new RuntimeException("ES sync commit error" + itemResponse.getFailureMessage());
}
}
}
}
} | java | public void commit() {
if (getBulk().numberOfActions() > 0) {
BulkResponse response = getBulk().execute().actionGet();
if (response.hasFailures()) {
for (BulkItemResponse itemResponse : response.getItems()) {
if (!itemResponse.isFailed()) {
continue;
}
if (itemResponse.getFailure().getStatus() == RestStatus.NOT_FOUND) {
logger.error(itemResponse.getFailureMessage());
} else {
throw new RuntimeException("ES sync commit error" + itemResponse.getFailureMessage());
}
}
}
}
} | [
"public",
"void",
"commit",
"(",
")",
"{",
"if",
"(",
"getBulk",
"(",
")",
".",
"numberOfActions",
"(",
")",
">",
"0",
")",
"{",
"BulkResponse",
"response",
"=",
"getBulk",
"(",
")",
".",
"execute",
"(",
")",
".",
"actionGet",
"(",
")",
";",
"if",
... | 提交批次 | [
"提交批次"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/support/ESTemplate.java#L197-L214 | train | Commit the bulk operation. | [
30522,
2270,
11675,
10797,
1006,
1007,
1063,
2065,
1006,
2131,
8569,
13687,
1006,
1007,
1012,
2193,
11253,
18908,
8496,
1006,
1007,
1028,
1014,
1007,
1063,
9625,
6072,
26029,
3366,
3433,
1027,
2131,
8569,
13687,
1006,
1007,
1012,
15389,
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-runtime/src/main/java/org/apache/flink/runtime/operators/shipping/OutputCollector.java | OutputCollector.getWriters | @SuppressWarnings("unchecked")
public List<RecordWriter<SerializationDelegate<T>>> getWriters() {
return Collections.unmodifiableList(Arrays.asList(this.writers));
} | java | @SuppressWarnings("unchecked")
public List<RecordWriter<SerializationDelegate<T>>> getWriters() {
return Collections.unmodifiableList(Arrays.asList(this.writers));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"List",
"<",
"RecordWriter",
"<",
"SerializationDelegate",
"<",
"T",
">",
">",
">",
"getWriters",
"(",
")",
"{",
"return",
"Collections",
".",
"unmodifiableList",
"(",
"Arrays",
".",
"asList",
"(",
... | List of writers that are associated with this output collector
@return list of writers | [
"List",
"of",
"writers",
"that",
"are",
"associated",
"with",
"this",
"output",
"collector"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/shipping/OutputCollector.java#L93-L96 | train | Returns a list of record writers. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
2862,
1026,
2501,
15994,
1026,
7642,
3989,
9247,
29107,
2618,
1026,
1056,
1028,
1028,
1028,
2131,
15994,
2015,
1006,
1007,
1063,
2709,
6407,
1012,
4895,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.setMaxParallelism | public StreamExecutionEnvironment setMaxParallelism(int maxParallelism) {
Preconditions.checkArgument(maxParallelism > 0 &&
maxParallelism <= KeyGroupRangeAssignment.UPPER_BOUND_MAX_PARALLELISM,
"maxParallelism is out of bounds 0 < maxParallelism <= " +
KeyGroupRangeAssignment.UPPER_BOUND_MAX_PARALLELISM + ". Found: " + maxParallelism);
config.setMaxParallelism(maxParallelism);
return this;
} | java | public StreamExecutionEnvironment setMaxParallelism(int maxParallelism) {
Preconditions.checkArgument(maxParallelism > 0 &&
maxParallelism <= KeyGroupRangeAssignment.UPPER_BOUND_MAX_PARALLELISM,
"maxParallelism is out of bounds 0 < maxParallelism <= " +
KeyGroupRangeAssignment.UPPER_BOUND_MAX_PARALLELISM + ". Found: " + maxParallelism);
config.setMaxParallelism(maxParallelism);
return this;
} | [
"public",
"StreamExecutionEnvironment",
"setMaxParallelism",
"(",
"int",
"maxParallelism",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"maxParallelism",
">",
"0",
"&&",
"maxParallelism",
"<=",
"KeyGroupRangeAssignment",
".",
"UPPER_BOUND_MAX_PARALLELISM",
",",
"... | Sets the maximum degree of parallelism defined for the program. The upper limit (inclusive)
is Short.MAX_VALUE.
<p>The maximum degree of parallelism specifies the upper limit for dynamic scaling. It also
defines the number of key groups used for partitioned state.
@param maxParallelism Maximum degree of parallelism to be used for the program.,
with 0 < maxParallelism <= 2^15 - 1 | [
"Sets",
"the",
"maximum",
"degree",
"of",
"parallelism",
"defined",
"for",
"the",
"program",
".",
"The",
"upper",
"limit",
"(",
"inclusive",
")",
"is",
"Short",
".",
"MAX_VALUE",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L191-L199 | train | Sets the maximum parallelism for this environment. | [
30522,
2270,
5460,
10288,
8586,
13700,
2368,
21663,
2239,
3672,
2275,
17848,
28689,
6216,
28235,
1006,
20014,
4098,
28689,
6216,
28235,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
2906,
22850,
4765,
1006,
4098,
28689,
6216,
28235,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/configuration/Configuration.java | Configuration.getDouble | @PublicEvolving
public double getDouble(ConfigOption<Double> configOption, double overrideDefault) {
Object o = getRawValueFromOption(configOption);
if (o == null) {
return overrideDefault;
}
return convertToDouble(o, configOption.defaultValue());
} | java | @PublicEvolving
public double getDouble(ConfigOption<Double> configOption, double overrideDefault) {
Object o = getRawValueFromOption(configOption);
if (o == null) {
return overrideDefault;
}
return convertToDouble(o, configOption.defaultValue());
} | [
"@",
"PublicEvolving",
"public",
"double",
"getDouble",
"(",
"ConfigOption",
"<",
"Double",
">",
"configOption",
",",
"double",
"overrideDefault",
")",
"{",
"Object",
"o",
"=",
"getRawValueFromOption",
"(",
"configOption",
")",
";",
"if",
"(",
"o",
"==",
"null... | Returns the value associated with the given config option as a {@code double}.
If no value is mapped under any key of the option, it returns the specified
default instead of the option's default value.
@param configOption The configuration option
@param overrideDefault The value to return if no value was mapper for any key of the option
@return the configured value associated with the given config option, or the overrideDefault | [
"Returns",
"the",
"value",
"associated",
"with",
"the",
"given",
"config",
"option",
"as",
"a",
"{",
"@code",
"double",
"}",
".",
"If",
"no",
"value",
"is",
"mapped",
"under",
"any",
"key",
"of",
"the",
"option",
"it",
"returns",
"the",
"specified",
"def... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L530-L537 | train | Returns the value associated with the given config option as a double. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
3313,
2131,
26797,
3468,
1006,
9530,
8873,
3995,
16790,
1026,
3313,
1028,
9530,
8873,
3995,
16790,
1010,
3313,
2058,
15637,
3207,
7011,
11314,
1007,
1063,
4874,
1051,
1027,
2131,
2527,
2860,
10175,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/program/rest/RestClusterClient.java | RestClusterClient.getWebInterfaceURL | @Override
public String getWebInterfaceURL() {
try {
return getWebMonitorBaseUrl().get().toString();
} catch (InterruptedException | ExecutionException e) {
ExceptionUtils.checkInterrupted(e);
log.warn("Could not retrieve the web interface URL for the cluster.", e);
return "Unknown address.";
}
} | java | @Override
public String getWebInterfaceURL() {
try {
return getWebMonitorBaseUrl().get().toString();
} catch (InterruptedException | ExecutionException e) {
ExceptionUtils.checkInterrupted(e);
log.warn("Could not retrieve the web interface URL for the cluster.", e);
return "Unknown address.";
}
} | [
"@",
"Override",
"public",
"String",
"getWebInterfaceURL",
"(",
")",
"{",
"try",
"{",
"return",
"getWebMonitorBaseUrl",
"(",
")",
".",
"get",
"(",
")",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"|",
"ExecutionException",
"e",... | ====================================== | [
"======================================"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java#L615-L625 | train | Returns the URL of the web interface that is used to connect to the cluster. | [
30522,
1030,
2058,
15637,
2270,
5164,
2131,
8545,
8428,
3334,
12172,
3126,
2140,
1006,
1007,
1063,
3046,
1063,
2709,
2131,
8545,
25526,
10698,
4263,
15058,
3126,
2140,
1006,
1007,
1012,
2131,
1006,
1007,
1012,
2000,
3367,
4892,
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-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/Router.java | Router.route | public RouteResult<T> route(HttpMethod method, String path) {
return route(method, path, Collections.emptyMap());
} | java | public RouteResult<T> route(HttpMethod method, String path) {
return route(method, path, Collections.emptyMap());
} | [
"public",
"RouteResult",
"<",
"T",
">",
"route",
"(",
"HttpMethod",
"method",
",",
"String",
"path",
")",
"{",
"return",
"route",
"(",
"method",
",",
"path",
",",
"Collections",
".",
"emptyMap",
"(",
")",
")",
";",
"}"
] | If there's no match, returns the result with {@link #notFound(Object) notFound}
as the target if it is set, otherwise returns {@code null}. | [
"If",
"there",
"s",
"no",
"match",
"returns",
"the",
"result",
"with",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/Router.java#L218-L220 | train | Route the request to the given path. | [
30522,
2270,
2799,
6072,
11314,
1026,
1056,
1028,
2799,
1006,
8299,
11368,
6806,
2094,
4118,
1010,
5164,
4130,
1007,
1063,
2709,
2799,
1006,
4118,
1010,
4130,
1010,
6407,
1012,
4064,
2863,
2361,
1006,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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/serialization/ClassResolvers.java | ClassResolvers.softCachingResolver | public static ClassResolver softCachingResolver(ClassLoader classLoader) {
return new CachingClassResolver(
new ClassLoaderClassResolver(defaultClassLoader(classLoader)),
new SoftReferenceMap<String, Class<?>>(new HashMap<String, Reference<Class<?>>>()));
} | java | public static ClassResolver softCachingResolver(ClassLoader classLoader) {
return new CachingClassResolver(
new ClassLoaderClassResolver(defaultClassLoader(classLoader)),
new SoftReferenceMap<String, Class<?>>(new HashMap<String, Reference<Class<?>>>()));
} | [
"public",
"static",
"ClassResolver",
"softCachingResolver",
"(",
"ClassLoader",
"classLoader",
")",
"{",
"return",
"new",
"CachingClassResolver",
"(",
"new",
"ClassLoaderClassResolver",
"(",
"defaultClassLoader",
"(",
"classLoader",
")",
")",
",",
"new",
"SoftReferenceM... | aggressive non-concurrent cache
good for non-shared cache, when we're not worried about class unloading
@param classLoader - specific classLoader to use, or null if you want to revert to default
@return new instance of class resolver | [
"aggressive",
"non",
"-",
"concurrent",
"cache",
"good",
"for",
"non",
"-",
"shared",
"cache",
"when",
"we",
"re",
"not",
"worried",
"about",
"class",
"unloading"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/serialization/ClassResolvers.java#L54-L58 | train | Creates a class resolver that uses the default classloader. | [
30522,
2270,
10763,
2465,
6072,
4747,
6299,
3730,
3540,
8450,
6072,
4747,
6299,
1006,
2465,
11066,
2121,
2465,
11066,
2121,
1007,
1063,
2709,
2047,
6187,
8450,
26266,
6072,
4747,
6299,
1006,
2047,
2465,
11066,
2121,
26266,
6072,
4747,
6299,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/traffic/AbstractTrafficShapingHandler.java | AbstractTrafficShapingHandler.setReadLimit | public void setReadLimit(long readLimit) {
this.readLimit = readLimit;
if (trafficCounter != null) {
trafficCounter.resetAccounting(TrafficCounter.milliSecondFromNano());
}
} | java | public void setReadLimit(long readLimit) {
this.readLimit = readLimit;
if (trafficCounter != null) {
trafficCounter.resetAccounting(TrafficCounter.milliSecondFromNano());
}
} | [
"public",
"void",
"setReadLimit",
"(",
"long",
"readLimit",
")",
"{",
"this",
".",
"readLimit",
"=",
"readLimit",
";",
"if",
"(",
"trafficCounter",
"!=",
"null",
")",
"{",
"trafficCounter",
".",
"resetAccounting",
"(",
"TrafficCounter",
".",
"milliSecondFromNano... | <p>Note the change will be taken as best effort, meaning
that all already scheduled traffics will not be
changed, but only applied to new traffics.</p>
<p>So the expected usage of this method is to be used not too often,
accordingly to the traffic shaping configuration.</p>
@param readLimit the readLimit to set | [
"<p",
">",
"Note",
"the",
"change",
"will",
"be",
"taken",
"as",
"best",
"effort",
"meaning",
"that",
"all",
"already",
"scheduled",
"traffics",
"will",
"not",
"be",
"changed",
"but",
"only",
"applied",
"to",
"new",
"traffics",
".",
"<",
"/",
"p",
">",
... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/traffic/AbstractTrafficShapingHandler.java#L312-L317 | train | Sets the readLimit value. | [
30522,
2270,
11675,
2275,
16416,
19422,
27605,
2102,
1006,
2146,
3191,
17960,
4183,
1007,
1063,
2023,
1012,
3191,
17960,
4183,
1027,
3191,
17960,
4183,
1025,
2065,
1006,
4026,
3597,
16671,
2121,
999,
1027,
19701,
1007,
1063,
4026,
3597,
166... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/URLUtil.java | URLUtil.encodeQuery | public static String encodeQuery(String url, String charset) throws UtilException {
return encodeQuery(url, StrUtil.isBlank(charset) ? CharsetUtil.defaultCharset() : CharsetUtil.charset(charset));
} | java | public static String encodeQuery(String url, String charset) throws UtilException {
return encodeQuery(url, StrUtil.isBlank(charset) ? CharsetUtil.defaultCharset() : CharsetUtil.charset(charset));
} | [
"public",
"static",
"String",
"encodeQuery",
"(",
"String",
"url",
",",
"String",
"charset",
")",
"throws",
"UtilException",
"{",
"return",
"encodeQuery",
"(",
"url",
",",
"StrUtil",
".",
"isBlank",
"(",
"charset",
")",
"?",
"CharsetUtil",
".",
"defaultCharset... | 编码URL<br>
将需要转换的内容(ASCII码形式之外的内容),用十六进制表示法转换出来,并在之前加上%开头。<br>
此方法用于POST请求中的请求体自动编码,转义大部分特殊字符
@param url URL
@param charset 编码
@return 编码后的URL
@exception UtilException UnsupportedEncodingException | [
"编码URL<br",
">",
"将需要转换的内容(ASCII码形式之外的内容),用十六进制表示法转换出来,并在之前加上%开头。<br",
">",
"此方法用于POST请求中的请求体自动编码,转义大部分特殊字符"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L332-L334 | train | Encodes the given URL with the given charset. | [
30522,
2270,
10763,
5164,
4372,
16044,
4226,
2854,
1006,
5164,
24471,
2140,
1010,
5164,
25869,
13462,
1007,
11618,
21183,
9463,
2595,
24422,
1063,
2709,
4372,
16044,
4226,
2854,
1006,
24471,
2140,
1010,
2358,
22134,
4014,
1012,
2003,
28522,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/ObjectUtil.java | ObjectUtil.isEmpty | @SuppressWarnings("rawtypes")
public static boolean isEmpty(Object obj) {
if(null == obj) {
return true;
}
if(obj instanceof CharSequence) {
return StrUtil.isEmpty((CharSequence)obj);
}else if(obj instanceof Map) {
return MapUtil.isEmpty((Map)obj);
}else if(obj instanceof Iterable) {
return IterUtil.isEmpty((Iterable)obj);
}else if(obj instanceof Iterator) {
return IterUtil.isEmpty((Iterator)obj);
}else if(ArrayUtil.isArray(obj)) {
return ArrayUtil.isEmpty(obj);
}
return false;
} | java | @SuppressWarnings("rawtypes")
public static boolean isEmpty(Object obj) {
if(null == obj) {
return true;
}
if(obj instanceof CharSequence) {
return StrUtil.isEmpty((CharSequence)obj);
}else if(obj instanceof Map) {
return MapUtil.isEmpty((Map)obj);
}else if(obj instanceof Iterable) {
return IterUtil.isEmpty((Iterable)obj);
}else if(obj instanceof Iterator) {
return IterUtil.isEmpty((Iterator)obj);
}else if(ArrayUtil.isArray(obj)) {
return ArrayUtil.isEmpty(obj);
}
return false;
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"static",
"boolean",
"isEmpty",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"null",
"==",
"obj",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"obj",
"instanceof",
"CharSequence",
")",
"{",
... | 判断指定对象是否为空,支持:
<pre>
1. CharSequence
2. Map
3. Iterable
4. Iterator
5. Array
</pre>
@param obj 被判断的对象
@return 是否为空,如果类型不支持,返回false
@since 4.5.7 | [
"判断指定对象是否为空,支持:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ObjectUtil.java#L217-L236 | train | Returns true if the specified object is empty. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
6315,
13874,
2015,
1000,
1007,
2270,
10763,
22017,
20898,
2003,
6633,
13876,
2100,
1006,
4874,
27885,
3501,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
27885,
3501,
1007,
1063,
2709,
2995,
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... |
redisson/redisson | redisson/src/main/java/org/redisson/api/LocalCachedMapOptions.java | LocalCachedMapOptions.evictionPolicy | public LocalCachedMapOptions<K, V> evictionPolicy(EvictionPolicy evictionPolicy) {
if (evictionPolicy == null) {
throw new NullPointerException("evictionPolicy can't be null");
}
this.evictionPolicy = evictionPolicy;
return this;
} | java | public LocalCachedMapOptions<K, V> evictionPolicy(EvictionPolicy evictionPolicy) {
if (evictionPolicy == null) {
throw new NullPointerException("evictionPolicy can't be null");
}
this.evictionPolicy = evictionPolicy;
return this;
} | [
"public",
"LocalCachedMapOptions",
"<",
"K",
",",
"V",
">",
"evictionPolicy",
"(",
"EvictionPolicy",
"evictionPolicy",
")",
"{",
"if",
"(",
"evictionPolicy",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"evictionPolicy can't be null\"",
")"... | Sets eviction policy.
@param evictionPolicy
<p><code>LRU</code> - uses local cache with LRU (least recently used) eviction policy.
<p><code>LFU</code> - uses local cache with LFU (least frequently used) eviction policy.
<p><code>SOFT</code> - uses local cache with soft references. The garbage collector will evict items from the local cache when the JVM is running out of memory.
<p><code>NONE</code> - doesn't use eviction policy, but timeToLive and maxIdleTime params are still working.
@return LocalCachedMapOptions instance | [
"Sets",
"eviction",
"policy",
"."
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/api/LocalCachedMapOptions.java#L216-L222 | train | Sets the eviction policy. | [
30522,
2270,
2334,
3540,
7690,
2863,
16340,
9285,
1026,
1047,
1010,
1058,
1028,
23408,
28097,
18155,
2594,
2100,
1006,
23408,
28097,
18155,
2594,
2100,
23408,
28097,
18155,
2594,
2100,
1007,
1063,
2065,
1006,
23408,
28097,
18155,
2594,
2100,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/MysqlEventParser.java | MysqlEventParser.doSwitch | public void doSwitch() {
AuthenticationInfo newRunningInfo = (runningInfo.equals(masterInfo) ? standbyInfo : masterInfo);
this.doSwitch(newRunningInfo);
} | java | public void doSwitch() {
AuthenticationInfo newRunningInfo = (runningInfo.equals(masterInfo) ? standbyInfo : masterInfo);
this.doSwitch(newRunningInfo);
} | [
"public",
"void",
"doSwitch",
"(",
")",
"{",
"AuthenticationInfo",
"newRunningInfo",
"=",
"(",
"runningInfo",
".",
"equals",
"(",
"masterInfo",
")",
"?",
"standbyInfo",
":",
"masterInfo",
")",
";",
"this",
".",
"doSwitch",
"(",
"newRunningInfo",
")",
";",
"}... | 处理主备切换的逻辑 | [
"处理主备切换的逻辑"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlEventParser.java#L276-L279 | train | Switch to another session. | [
30522,
2270,
11675,
9998,
9148,
10649,
1006,
1007,
1063,
27280,
2378,
14876,
2047,
15532,
5582,
2378,
14876,
1027,
1006,
2770,
2378,
14876,
1012,
19635,
1006,
3040,
2378,
14876,
1007,
1029,
3233,
3762,
2378,
14876,
1024,
3040,
2378,
14876,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | metrics/src/main/java/io/dropwizard/metrics/InstrumentedScheduledExecutorService.java | InstrumentedScheduledExecutorService.schedule | @Nonnull
@Override
public ScheduledFuture<?> schedule(@Nonnull Runnable command, long delay, @Nonnull TimeUnit unit) {
scheduledOnce.mark();
return delegate.schedule(new InstrumentedRunnable(command), delay, unit);
} | java | @Nonnull
@Override
public ScheduledFuture<?> schedule(@Nonnull Runnable command, long delay, @Nonnull TimeUnit unit) {
scheduledOnce.mark();
return delegate.schedule(new InstrumentedRunnable(command), delay, unit);
} | [
"@",
"Nonnull",
"@",
"Override",
"public",
"ScheduledFuture",
"<",
"?",
">",
"schedule",
"(",
"@",
"Nonnull",
"Runnable",
"command",
",",
"long",
"delay",
",",
"@",
"Nonnull",
"TimeUnit",
"unit",
")",
"{",
"scheduledOnce",
".",
"mark",
"(",
")",
";",
"re... | {@inheritDoc} | [
"{"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/InstrumentedScheduledExecutorService.java#L83-L88 | train | Schedules a Runnable to be executed on the system. | [
30522,
1030,
2512,
11231,
3363,
1030,
2058,
15637,
2270,
5115,
11263,
11244,
1026,
1029,
1028,
6134,
1006,
1030,
2512,
11231,
3363,
2448,
22966,
3094,
1010,
2146,
8536,
1010,
1030,
2512,
11231,
3363,
2051,
19496,
2102,
3131,
1007,
1063,
511... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/restore/RocksDBIncrementalRestoreOperation.java | RocksDBIncrementalRestoreOperation.restoreInstanceDirectoryFromPath | private void restoreInstanceDirectoryFromPath(Path source, String instanceRocksDBPath) throws IOException {
FileSystem fileSystem = source.getFileSystem();
final FileStatus[] fileStatuses = fileSystem.listStatus(source);
if (fileStatuses == null) {
throw new IOException("Cannot list file statues. Directory " + source + " does not exist.");
}
for (FileStatus fileStatus : fileStatuses) {
final Path filePath = fileStatus.getPath();
final String fileName = filePath.getName();
File restoreFile = new File(source.getPath(), fileName);
File targetFile = new File(instanceRocksDBPath, fileName);
if (fileName.endsWith(SST_FILE_SUFFIX)) {
// hardlink'ing the immutable sst-files.
Files.createLink(targetFile.toPath(), restoreFile.toPath());
} else {
// true copy for all other files.
Files.copy(restoreFile.toPath(), targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
}
} | java | private void restoreInstanceDirectoryFromPath(Path source, String instanceRocksDBPath) throws IOException {
FileSystem fileSystem = source.getFileSystem();
final FileStatus[] fileStatuses = fileSystem.listStatus(source);
if (fileStatuses == null) {
throw new IOException("Cannot list file statues. Directory " + source + " does not exist.");
}
for (FileStatus fileStatus : fileStatuses) {
final Path filePath = fileStatus.getPath();
final String fileName = filePath.getName();
File restoreFile = new File(source.getPath(), fileName);
File targetFile = new File(instanceRocksDBPath, fileName);
if (fileName.endsWith(SST_FILE_SUFFIX)) {
// hardlink'ing the immutable sst-files.
Files.createLink(targetFile.toPath(), restoreFile.toPath());
} else {
// true copy for all other files.
Files.copy(restoreFile.toPath(), targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
}
} | [
"private",
"void",
"restoreInstanceDirectoryFromPath",
"(",
"Path",
"source",
",",
"String",
"instanceRocksDBPath",
")",
"throws",
"IOException",
"{",
"FileSystem",
"fileSystem",
"=",
"source",
".",
"getFileSystem",
"(",
")",
";",
"final",
"FileStatus",
"[",
"]",
... | This recreates the new working directory of the recovered RocksDB instance and links/copies the contents from
a local state. | [
"This",
"recreates",
"the",
"new",
"working",
"directory",
"of",
"the",
"recovered",
"RocksDB",
"instance",
"and",
"links",
"/",
"copies",
"the",
"contents",
"from",
"a",
"local",
"state",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/restore/RocksDBIncrementalRestoreOperation.java#L456-L479 | train | Restore the instance directory from the source directory. | [
30522,
2797,
11675,
9239,
7076,
26897,
4305,
2890,
16761,
2100,
19699,
25377,
8988,
1006,
4130,
3120,
1010,
5164,
6013,
16901,
16150,
2497,
15069,
1007,
11618,
22834,
10288,
24422,
1063,
6764,
27268,
6633,
6764,
27268,
6633,
1027,
3120,
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... |
networknt/light-4j | utility/src/main/java/com/networknt/utility/Util.java | Util.getInetAddress | public static InetAddress getInetAddress() {
InetAddress inetAddress = null;
try {
inetAddress = InetAddress.getLocalHost();
} catch (IOException ioe) {
logger.error("Error in getting InetAddress", ioe);
}
return inetAddress;
} | java | public static InetAddress getInetAddress() {
InetAddress inetAddress = null;
try {
inetAddress = InetAddress.getLocalHost();
} catch (IOException ioe) {
logger.error("Error in getting InetAddress", ioe);
}
return inetAddress;
} | [
"public",
"static",
"InetAddress",
"getInetAddress",
"(",
")",
"{",
"InetAddress",
"inetAddress",
"=",
"null",
";",
"try",
"{",
"inetAddress",
"=",
"InetAddress",
".",
"getLocalHost",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"logger"... | Get InetAddress
@return The InetAddress object | [
"Get",
"InetAddress"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/Util.java#L84-L92 | train | Get the InetAddress of the current thread. | [
30522,
2270,
10763,
1999,
12928,
14141,
8303,
2131,
3170,
17713,
16200,
4757,
1006,
1007,
1063,
1999,
12928,
14141,
8303,
1999,
12928,
14141,
8303,
1027,
19701,
1025,
3046,
1063,
1999,
12928,
14141,
8303,
1027,
1999,
12928,
14141,
8303,
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/util/ClassUtil.java | ClassUtil.invoke | public static <T> T invoke(String className, String methodName, boolean isSingleton, Object... args) {
Class<Object> clazz = loadClass(className);
try {
final Method method = getDeclaredMethod(clazz, methodName, getClasses(args));
if (null == method) {
throw new NoSuchMethodException(StrUtil.format("No such method: [{}]", methodName));
}
if (isStatic(method)) {
return ReflectUtil.invoke(null, method, args);
} else {
return ReflectUtil.invoke(isSingleton ? Singleton.get(clazz) : clazz.newInstance(), method, args);
}
} catch (Exception e) {
throw new UtilException(e);
}
} | java | public static <T> T invoke(String className, String methodName, boolean isSingleton, Object... args) {
Class<Object> clazz = loadClass(className);
try {
final Method method = getDeclaredMethod(clazz, methodName, getClasses(args));
if (null == method) {
throw new NoSuchMethodException(StrUtil.format("No such method: [{}]", methodName));
}
if (isStatic(method)) {
return ReflectUtil.invoke(null, method, args);
} else {
return ReflectUtil.invoke(isSingleton ? Singleton.get(clazz) : clazz.newInstance(), method, args);
}
} catch (Exception e) {
throw new UtilException(e);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"invoke",
"(",
"String",
"className",
",",
"String",
"methodName",
",",
"boolean",
"isSingleton",
",",
"Object",
"...",
"args",
")",
"{",
"Class",
"<",
"Object",
">",
"clazz",
"=",
"loadClass",
"(",
"className",
")... | 执行方法<br>
可执行Private方法,也可执行static方法<br>
执行非static方法时,必须满足对象有默认构造方法<br>
@param <T> 对象类型
@param className 类名,完整类路径
@param methodName 方法名
@param isSingleton 是否为单例对象,如果此参数为false,每次执行方法时创建一个新对象
@param args 参数,必须严格对应指定方法的参数类型和数量
@return 返回结果 | [
"执行方法<br",
">",
"可执行Private方法,也可执行static方法<br",
">",
"执行非static方法时,必须满足对象有默认构造方法<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L681-L696 | train | Invoke a method on a class. | [
30522,
2270,
10763,
1026,
30524,
1063,
2345,
4118,
4118,
1027,
2131,
3207,
20464,
12069,
22117,
11031,
7716,
1006,
18856,
10936,
2480,
1010,
4118,
18442,
1010,
2131,
26266,
2229,
1006,
12098,
5620,
1007,
1007,
1025,
2065,
1006,
19701,
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... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/iterative/task/IterationSynchronizationSinkTask.java | IterationSynchronizationSinkTask.invoke | @Override
public void invoke() throws Exception {
this.headEventReader = new MutableRecordReader<>(
getEnvironment().getInputGate(0),
getEnvironment().getTaskManagerInfo().getTmpDirectories());
TaskConfig taskConfig = new TaskConfig(getTaskConfiguration());
// store all aggregators
this.aggregators = new HashMap<>();
for (AggregatorWithName<?> aggWithName : taskConfig.getIterationAggregators(getUserCodeClassLoader())) {
aggregators.put(aggWithName.getName(), aggWithName.getAggregator());
}
// store the aggregator convergence criterion
if (taskConfig.usesConvergenceCriterion()) {
convergenceCriterion = taskConfig.getConvergenceCriterion(getUserCodeClassLoader());
convergenceAggregatorName = taskConfig.getConvergenceCriterionAggregatorName();
Preconditions.checkNotNull(convergenceAggregatorName);
}
// store the default aggregator convergence criterion
if (taskConfig.usesImplicitConvergenceCriterion()) {
implicitConvergenceCriterion = taskConfig.getImplicitConvergenceCriterion(getUserCodeClassLoader());
implicitConvergenceAggregatorName = taskConfig.getImplicitConvergenceCriterionAggregatorName();
Preconditions.checkNotNull(implicitConvergenceAggregatorName);
}
maxNumberOfIterations = taskConfig.getNumberOfIterations();
// set up the event handler
int numEventsTillEndOfSuperstep = taskConfig.getNumberOfEventsUntilInterruptInIterativeGate(0);
eventHandler = new SyncEventHandler(numEventsTillEndOfSuperstep, aggregators,
getEnvironment().getUserClassLoader());
headEventReader.registerTaskEventListener(eventHandler, WorkerDoneEvent.class);
IntValue dummy = new IntValue();
while (!terminationRequested()) {
if (log.isInfoEnabled()) {
log.info(formatLogString("starting iteration [" + currentIteration + "]"));
}
// this call listens for events until the end-of-superstep is reached
readHeadEventChannel(dummy);
if (log.isInfoEnabled()) {
log.info(formatLogString("finishing iteration [" + currentIteration + "]"));
}
if (checkForConvergence()) {
if (log.isInfoEnabled()) {
log.info(formatLogString("signaling that all workers are to terminate in iteration ["
+ currentIteration + "]"));
}
requestTermination();
sendToAllWorkers(new TerminationEvent());
} else {
if (log.isInfoEnabled()) {
log.info(formatLogString("signaling that all workers are done in iteration [" + currentIteration
+ "]"));
}
AllWorkersDoneEvent allWorkersDoneEvent = new AllWorkersDoneEvent(aggregators);
sendToAllWorkers(allWorkersDoneEvent);
// reset all aggregators
for (Aggregator<?> agg : aggregators.values()) {
agg.reset();
}
currentIteration++;
}
}
} | java | @Override
public void invoke() throws Exception {
this.headEventReader = new MutableRecordReader<>(
getEnvironment().getInputGate(0),
getEnvironment().getTaskManagerInfo().getTmpDirectories());
TaskConfig taskConfig = new TaskConfig(getTaskConfiguration());
// store all aggregators
this.aggregators = new HashMap<>();
for (AggregatorWithName<?> aggWithName : taskConfig.getIterationAggregators(getUserCodeClassLoader())) {
aggregators.put(aggWithName.getName(), aggWithName.getAggregator());
}
// store the aggregator convergence criterion
if (taskConfig.usesConvergenceCriterion()) {
convergenceCriterion = taskConfig.getConvergenceCriterion(getUserCodeClassLoader());
convergenceAggregatorName = taskConfig.getConvergenceCriterionAggregatorName();
Preconditions.checkNotNull(convergenceAggregatorName);
}
// store the default aggregator convergence criterion
if (taskConfig.usesImplicitConvergenceCriterion()) {
implicitConvergenceCriterion = taskConfig.getImplicitConvergenceCriterion(getUserCodeClassLoader());
implicitConvergenceAggregatorName = taskConfig.getImplicitConvergenceCriterionAggregatorName();
Preconditions.checkNotNull(implicitConvergenceAggregatorName);
}
maxNumberOfIterations = taskConfig.getNumberOfIterations();
// set up the event handler
int numEventsTillEndOfSuperstep = taskConfig.getNumberOfEventsUntilInterruptInIterativeGate(0);
eventHandler = new SyncEventHandler(numEventsTillEndOfSuperstep, aggregators,
getEnvironment().getUserClassLoader());
headEventReader.registerTaskEventListener(eventHandler, WorkerDoneEvent.class);
IntValue dummy = new IntValue();
while (!terminationRequested()) {
if (log.isInfoEnabled()) {
log.info(formatLogString("starting iteration [" + currentIteration + "]"));
}
// this call listens for events until the end-of-superstep is reached
readHeadEventChannel(dummy);
if (log.isInfoEnabled()) {
log.info(formatLogString("finishing iteration [" + currentIteration + "]"));
}
if (checkForConvergence()) {
if (log.isInfoEnabled()) {
log.info(formatLogString("signaling that all workers are to terminate in iteration ["
+ currentIteration + "]"));
}
requestTermination();
sendToAllWorkers(new TerminationEvent());
} else {
if (log.isInfoEnabled()) {
log.info(formatLogString("signaling that all workers are done in iteration [" + currentIteration
+ "]"));
}
AllWorkersDoneEvent allWorkersDoneEvent = new AllWorkersDoneEvent(aggregators);
sendToAllWorkers(allWorkersDoneEvent);
// reset all aggregators
for (Aggregator<?> agg : aggregators.values()) {
agg.reset();
}
currentIteration++;
}
}
} | [
"@",
"Override",
"public",
"void",
"invoke",
"(",
")",
"throws",
"Exception",
"{",
"this",
".",
"headEventReader",
"=",
"new",
"MutableRecordReader",
"<>",
"(",
"getEnvironment",
"(",
")",
".",
"getInputGate",
"(",
"0",
")",
",",
"getEnvironment",
"(",
")",
... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/iterative/task/IterationSynchronizationSinkTask.java#L88-L163 | train | This method is invoked by the TaskManagerImpl to initialize the object. | [
30522,
1030,
2058,
15637,
2270,
11675,
1999,
6767,
3489,
1006,
1007,
11618,
6453,
1063,
2023,
1012,
2132,
18697,
3372,
16416,
4063,
1027,
2047,
14163,
10880,
2890,
27108,
16200,
9648,
2099,
1026,
1028,
1006,
2131,
2368,
21663,
2239,
3672,
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... |
redisson/redisson | redisson/src/main/java/org/redisson/api/LocalCachedMapOptions.java | LocalCachedMapOptions.defaults | public static <K, V> LocalCachedMapOptions<K, V> defaults() {
return new LocalCachedMapOptions<K, V>()
.cacheSize(0).timeToLive(0).maxIdle(0)
.evictionPolicy(EvictionPolicy.NONE)
.reconnectionStrategy(ReconnectionStrategy.NONE)
.syncStrategy(SyncStrategy.INVALIDATE);
} | java | public static <K, V> LocalCachedMapOptions<K, V> defaults() {
return new LocalCachedMapOptions<K, V>()
.cacheSize(0).timeToLive(0).maxIdle(0)
.evictionPolicy(EvictionPolicy.NONE)
.reconnectionStrategy(ReconnectionStrategy.NONE)
.syncStrategy(SyncStrategy.INVALIDATE);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"LocalCachedMapOptions",
"<",
"K",
",",
"V",
">",
"defaults",
"(",
")",
"{",
"return",
"new",
"LocalCachedMapOptions",
"<",
"K",
",",
"V",
">",
"(",
")",
".",
"cacheSize",
"(",
"0",
")",
".",
"timeToLive",... | Creates a new instance of LocalCachedMapOptions with default options.
<p>
This is equivalent to:
<pre>
new LocalCachedMapOptions()
.cacheSize(0).timeToLive(0).maxIdle(0)
.evictionPolicy(EvictionPolicy.NONE)
.invalidateEntryOnChange(true);
</pre>
@param <K> key type
@param <V> value type
@return LocalCachedMapOptions instance | [
"Creates",
"a",
"new",
"instance",
"of",
"LocalCachedMapOptions",
"with",
"default",
"options",
".",
"<p",
">",
"This",
"is",
"equivalent",
"to",
":",
"<pre",
">",
"new",
"LocalCachedMapOptions",
"()",
".",
"cacheSize",
"(",
"0",
")",
".",
"timeToLive",
"(",... | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/api/LocalCachedMapOptions.java#L145-L151 | train | Returns a new instance of the cache options. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
2334,
3540,
7690,
2863,
16340,
9285,
1026,
1047,
1010,
1058,
1028,
12398,
2015,
1006,
1007,
1063,
2709,
2047,
2334,
3540,
7690,
2863,
16340,
9285,
1026,
1047,
1010,
1058,
1028,
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-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/ResourceManager.java | ResourceManager.deregisterApplication | @Override
public CompletableFuture<Acknowledge> deregisterApplication(
final ApplicationStatus finalStatus,
@Nullable final String diagnostics) {
log.info("Shut down cluster because application is in {}, diagnostics {}.", finalStatus, diagnostics);
try {
internalDeregisterApplication(finalStatus, diagnostics);
} catch (ResourceManagerException e) {
log.warn("Could not properly shutdown the application.", e);
}
return CompletableFuture.completedFuture(Acknowledge.get());
} | java | @Override
public CompletableFuture<Acknowledge> deregisterApplication(
final ApplicationStatus finalStatus,
@Nullable final String diagnostics) {
log.info("Shut down cluster because application is in {}, diagnostics {}.", finalStatus, diagnostics);
try {
internalDeregisterApplication(finalStatus, diagnostics);
} catch (ResourceManagerException e) {
log.warn("Could not properly shutdown the application.", e);
}
return CompletableFuture.completedFuture(Acknowledge.get());
} | [
"@",
"Override",
"public",
"CompletableFuture",
"<",
"Acknowledge",
">",
"deregisterApplication",
"(",
"final",
"ApplicationStatus",
"finalStatus",
",",
"@",
"Nullable",
"final",
"String",
"diagnostics",
")",
"{",
"log",
".",
"info",
"(",
"\"Shut down cluster because ... | Cleanup application and shut down cluster.
@param finalStatus of the Flink application
@param diagnostics diagnostics message for the Flink application or {@code null} | [
"Cleanup",
"application",
"and",
"shut",
"down",
"cluster",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/ResourceManager.java#L492-L505 | train | Deregister an application from the cluster. | [
30522,
1030,
2058,
15637,
2270,
4012,
10814,
10880,
11263,
11244,
1026,
13399,
1028,
4315,
13910,
12911,
29098,
19341,
3508,
1006,
2345,
5097,
29336,
2271,
4399,
29336,
2271,
1010,
1030,
19701,
3085,
2345,
5164,
16474,
2015,
1007,
1063,
8833,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-cep/src/main/java/org/apache/flink/cep/nfa/NFA.java | NFA.open | public void open(RuntimeContext cepRuntimeContext, Configuration conf) throws Exception {
for (State<T> state : getStates()) {
for (StateTransition<T> transition : state.getStateTransitions()) {
IterativeCondition condition = transition.getCondition();
FunctionUtils.setFunctionRuntimeContext(condition, cepRuntimeContext);
FunctionUtils.openFunction(condition, conf);
}
}
} | java | public void open(RuntimeContext cepRuntimeContext, Configuration conf) throws Exception {
for (State<T> state : getStates()) {
for (StateTransition<T> transition : state.getStateTransitions()) {
IterativeCondition condition = transition.getCondition();
FunctionUtils.setFunctionRuntimeContext(condition, cepRuntimeContext);
FunctionUtils.openFunction(condition, conf);
}
}
} | [
"public",
"void",
"open",
"(",
"RuntimeContext",
"cepRuntimeContext",
",",
"Configuration",
"conf",
")",
"throws",
"Exception",
"{",
"for",
"(",
"State",
"<",
"T",
">",
"state",
":",
"getStates",
"(",
")",
")",
"{",
"for",
"(",
"StateTransition",
"<",
"T",... | Initialization method for the NFA. It is called before any element is passed and thus suitable for one time setup
work.
@param cepRuntimeContext runtime context of the enclosing operator
@param conf The configuration containing the parameters attached to the contract. | [
"Initialization",
"method",
"for",
"the",
"NFA",
".",
"It",
"is",
"called",
"before",
"any",
"element",
"is",
"passed",
"and",
"thus",
"suitable",
"for",
"one",
"time",
"setup",
"work",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/NFA.java#L179-L187 | train | Open the CEP function. | [
30522,
2270,
11675,
2330,
1006,
2448,
7292,
8663,
18209,
8292,
18098,
16671,
14428,
8663,
18209,
1010,
9563,
9530,
2546,
1007,
11618,
6453,
1063,
2005,
1006,
2110,
1026,
1056,
1028,
2110,
1024,
4152,
12259,
2015,
1006,
1007,
1007,
1063,
200... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/ImgUtil.java | ImgUtil.convert | @Deprecated
public static void convert(Image srcImage, String formatName, ImageOutputStream destImageStream) {
convert(srcImage, formatName, destImageStream, false);
} | java | @Deprecated
public static void convert(Image srcImage, String formatName, ImageOutputStream destImageStream) {
convert(srcImage, formatName, destImageStream, false);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"convert",
"(",
"Image",
"srcImage",
",",
"String",
"formatName",
",",
"ImageOutputStream",
"destImageStream",
")",
"{",
"convert",
"(",
"srcImage",
",",
"formatName",
",",
"destImageStream",
",",
"false",
")",
";",... | 图像类型转换:GIF=》JPG、GIF=》PNG、PNG=》JPG、PNG=》GIF(X)、BMP=》PNG<br>
此方法并不关闭流
@param srcImage 源图像流
@param formatName 包含格式非正式名称的 String:如JPG、JPEG、GIF等
@param destImageStream 目标图像输出流
@since 3.0.9
@deprecated 请使用{@link #write(Image, String, ImageOutputStream)} | [
"图像类型转换:GIF",
"=",
"》JPG、GIF",
"=",
"》PNG、PNG",
"=",
"》JPG、PNG",
"=",
"》GIF",
"(",
"X",
")",
"、BMP",
"=",
"》PNG<br",
">",
"此方法并不关闭流"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L550-L553 | train | Convert an image to an image output stream. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
11675,
10463,
1006,
3746,
5034,
6895,
26860,
1010,
5164,
4289,
18442,
1010,
3746,
5833,
18780,
21422,
4078,
3775,
26860,
21422,
1007,
1063,
10463,
1006,
5034,
6895,
26860,
1010,
4289,
18442,
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/client/RestTemplateBuilder.java | RestTemplateBuilder.additionalInterceptors | public RestTemplateBuilder additionalInterceptors(
ClientHttpRequestInterceptor... interceptors) {
Assert.notNull(interceptors, "interceptors must not be null");
return additionalInterceptors(Arrays.asList(interceptors));
} | java | public RestTemplateBuilder additionalInterceptors(
ClientHttpRequestInterceptor... interceptors) {
Assert.notNull(interceptors, "interceptors must not be null");
return additionalInterceptors(Arrays.asList(interceptors));
} | [
"public",
"RestTemplateBuilder",
"additionalInterceptors",
"(",
"ClientHttpRequestInterceptor",
"...",
"interceptors",
")",
"{",
"Assert",
".",
"notNull",
"(",
"interceptors",
",",
"\"interceptors must not be null\"",
")",
";",
"return",
"additionalInterceptors",
"(",
"Arra... | Add additional {@link ClientHttpRequestInterceptor ClientHttpRequestInterceptors}
that should be used with the {@link RestTemplate}.
@param interceptors the interceptors to add
@return a new builder instance
@since 1.4.1
@see #interceptors(ClientHttpRequestInterceptor...) | [
"Add",
"additional",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java#L279-L283 | train | Add additional interceptors to the rest template. | [
30522,
2270,
2717,
18532,
15725,
8569,
23891,
2099,
3176,
18447,
2121,
3401,
13876,
5668,
1006,
7396,
11039,
25856,
2890,
15500,
18447,
2121,
3401,
13876,
2953,
1012,
1012,
1012,
24727,
2015,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
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-core/src/main/java/org/apache/flink/api/common/operators/base/PartitionOperatorBase.java | PartitionOperatorBase.executeOnCollections | @Override
protected List<IN> executeOnCollections(List<IN> inputData, RuntimeContext runtimeContext, ExecutionConfig executionConfig) {
return inputData;
} | java | @Override
protected List<IN> executeOnCollections(List<IN> inputData, RuntimeContext runtimeContext, ExecutionConfig executionConfig) {
return inputData;
} | [
"@",
"Override",
"protected",
"List",
"<",
"IN",
">",
"executeOnCollections",
"(",
"List",
"<",
"IN",
">",
"inputData",
",",
"RuntimeContext",
"runtimeContext",
",",
"ExecutionConfig",
"executionConfig",
")",
"{",
"return",
"inputData",
";",
"}"
] | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/base/PartitionOperatorBase.java#L115-L118 | train | Override this method to execute on collections. | [
30522,
1030,
2058,
15637,
5123,
2862,
1026,
1999,
1028,
15389,
2239,
26895,
18491,
2015,
1006,
2862,
1026,
1999,
1028,
7953,
2850,
2696,
1010,
2448,
7292,
8663,
18209,
2448,
7292,
8663,
18209,
1010,
7781,
8663,
8873,
2290,
7781,
8663,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/classification/utilities/CollectionUtility.java | CollectionUtility.spiltArray | public static String[][] spiltArray(String[] src, double rate)
{
assert 0 <= rate && rate <= 1;
String[][] output = new String[2][];
output[0] = new String[(int) (src.length * rate)];
output[1] = new String[src.length - output[0].length];
System.arraycopy(src, 0, output[0], 0, output[0].length);
System.arraycopy(src, output[0].length, output[1], 0, output[1].length);
return output;
} | java | public static String[][] spiltArray(String[] src, double rate)
{
assert 0 <= rate && rate <= 1;
String[][] output = new String[2][];
output[0] = new String[(int) (src.length * rate)];
output[1] = new String[src.length - output[0].length];
System.arraycopy(src, 0, output[0], 0, output[0].length);
System.arraycopy(src, output[0].length, output[1], 0, output[1].length);
return output;
} | [
"public",
"static",
"String",
"[",
"]",
"[",
"]",
"spiltArray",
"(",
"String",
"[",
"]",
"src",
",",
"double",
"rate",
")",
"{",
"assert",
"0",
"<=",
"rate",
"&&",
"rate",
"<=",
"1",
";",
"String",
"[",
"]",
"[",
"]",
"output",
"=",
"new",
"Strin... | 分割数组为两个数组
@param src 原数组
@param rate 第一个数组所占的比例
@return 两个数组 | [
"分割数组为两个数组"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/classification/utilities/CollectionUtility.java#L69-L78 | train | Spilt array. | [
30522,
2270,
10763,
5164,
1031,
1033,
1031,
1033,
11867,
4014,
7559,
9447,
1006,
5164,
1031,
1033,
5034,
2278,
1010,
3313,
3446,
1007,
1063,
20865,
1014,
1026,
1027,
3446,
1004,
1004,
3446,
1026,
1027,
1015,
1025,
5164,
1031,
1033,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/word2vec/TextFileCorpus.java | TextFileCorpus.reduceVocab | void reduceVocab()
{
table = new int[vocabSize];
int j = 0;
for (int i = 0; i < vocabSize; i++)
{
if (vocab[i].cn > minReduce)
{
vocab[j].cn = vocab[i].cn;
vocab[j].word = vocab[i].word;
table[vocabIndexMap.get(vocab[j].word)] = j;
j++;
}
else
{
table[vocabIndexMap.get(vocab[j].word)] = -4;
}
}
// adjust the index in the cache
try
{
cache.close();
File fixingFile = new File(cacheFile.getAbsolutePath() + ".fixing");
cache = new DataOutputStream(new FileOutputStream(fixingFile));
DataInputStream oldCache = new DataInputStream(new FileInputStream(cacheFile));
while (oldCache.available() >= 4)
{
int oldId = oldCache.readInt();
if (oldId < 0)
{
cache.writeInt(oldId);
continue;
}
int id = table[oldId];
if (id == -4) continue;
cache.writeInt(id);
}
oldCache.close();
cache.close();
if (!fixingFile.renameTo(cacheFile))
{
throw new RuntimeException(String.format("moving %s to %s failed", fixingFile.getAbsolutePath(), cacheFile.getName()));
}
cache = new DataOutputStream(new FileOutputStream(cacheFile));
}
catch (IOException e)
{
throw new RuntimeException(String.format("failed to adjust cache file", e));
}
table = null;
vocabSize = j;
vocabIndexMap.clear();
for (int i = 0; i < vocabSize; i++)
{
vocabIndexMap.put(vocab[i].word, i);
}
minReduce++;
} | java | void reduceVocab()
{
table = new int[vocabSize];
int j = 0;
for (int i = 0; i < vocabSize; i++)
{
if (vocab[i].cn > minReduce)
{
vocab[j].cn = vocab[i].cn;
vocab[j].word = vocab[i].word;
table[vocabIndexMap.get(vocab[j].word)] = j;
j++;
}
else
{
table[vocabIndexMap.get(vocab[j].word)] = -4;
}
}
// adjust the index in the cache
try
{
cache.close();
File fixingFile = new File(cacheFile.getAbsolutePath() + ".fixing");
cache = new DataOutputStream(new FileOutputStream(fixingFile));
DataInputStream oldCache = new DataInputStream(new FileInputStream(cacheFile));
while (oldCache.available() >= 4)
{
int oldId = oldCache.readInt();
if (oldId < 0)
{
cache.writeInt(oldId);
continue;
}
int id = table[oldId];
if (id == -4) continue;
cache.writeInt(id);
}
oldCache.close();
cache.close();
if (!fixingFile.renameTo(cacheFile))
{
throw new RuntimeException(String.format("moving %s to %s failed", fixingFile.getAbsolutePath(), cacheFile.getName()));
}
cache = new DataOutputStream(new FileOutputStream(cacheFile));
}
catch (IOException e)
{
throw new RuntimeException(String.format("failed to adjust cache file", e));
}
table = null;
vocabSize = j;
vocabIndexMap.clear();
for (int i = 0; i < vocabSize; i++)
{
vocabIndexMap.put(vocab[i].word, i);
}
minReduce++;
} | [
"void",
"reduceVocab",
"(",
")",
"{",
"table",
"=",
"new",
"int",
"[",
"vocabSize",
"]",
";",
"int",
"j",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"vocabSize",
";",
"i",
"++",
")",
"{",
"if",
"(",
"vocab",
"[",
"i",
"... | Reduces the vocabulary by removing infrequent tokens | [
"Reduces",
"the",
"vocabulary",
"by",
"removing",
"infrequent",
"tokens"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/word2vec/TextFileCorpus.java#L42-L99 | train | Reduce the vocabulary by removing the most likely negative number of words from the cache file. | [
30522,
11675,
5547,
6767,
3540,
2497,
1006,
1007,
1063,
2795,
1027,
2047,
20014,
1031,
29536,
3540,
5910,
4697,
1033,
1025,
20014,
1046,
1027,
1014,
1025,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
29536,
3540,
5910,
4697,
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... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/DescriptorProperties.java | DescriptorProperties.putProperties | public void putProperties(DescriptorProperties otherProperties) {
for (Map.Entry<String, String> otherProperty : otherProperties.properties.entrySet()) {
put(otherProperty.getKey(), otherProperty.getValue());
}
} | java | public void putProperties(DescriptorProperties otherProperties) {
for (Map.Entry<String, String> otherProperty : otherProperties.properties.entrySet()) {
put(otherProperty.getKey(), otherProperty.getValue());
}
} | [
"public",
"void",
"putProperties",
"(",
"DescriptorProperties",
"otherProperties",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"otherProperty",
":",
"otherProperties",
".",
"properties",
".",
"entrySet",
"(",
")",
")",
"{",
... | Adds a set of descriptor properties. | [
"Adds",
"a",
"set",
"of",
"descriptor",
"properties",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/DescriptorProperties.java#L100-L104 | train | Put properties from another descriptor properties. | [
30522,
2270,
11675,
2404,
21572,
4842,
7368,
1006,
4078,
23235,
2953,
21572,
4842,
7368,
2060,
21572,
4842,
7368,
1007,
1063,
2005,
1006,
4949,
1012,
4443,
1026,
5164,
1010,
5164,
1028,
2060,
21572,
4842,
3723,
1024,
2060,
21572,
4842,
7368... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/core/fs/FileSystem.java | FileSystem.create | @Deprecated
public FSDataOutputStream create(Path f, boolean overwrite) throws IOException {
return create(f, overwrite ? WriteMode.OVERWRITE : WriteMode.NO_OVERWRITE);
} | java | @Deprecated
public FSDataOutputStream create(Path f, boolean overwrite) throws IOException {
return create(f, overwrite ? WriteMode.OVERWRITE : WriteMode.NO_OVERWRITE);
} | [
"@",
"Deprecated",
"public",
"FSDataOutputStream",
"create",
"(",
"Path",
"f",
",",
"boolean",
"overwrite",
")",
"throws",
"IOException",
"{",
"return",
"create",
"(",
"f",
",",
"overwrite",
"?",
"WriteMode",
".",
"OVERWRITE",
":",
"WriteMode",
".",
"NO_OVERWR... | Opens an FSDataOutputStream at the indicated Path.
@param f
the file name to open
@param overwrite
if a file with this name already exists, then if true,
the file will be overwritten, and if false an error will be thrown.
@throws IOException Thrown, if the stream could not be opened because of an I/O, or because
a file already exists at that path and the write mode indicates to not
overwrite the file.
@deprecated Use {@link #create(Path, WriteMode)} instead. | [
"Opens",
"an",
"FSDataOutputStream",
"at",
"the",
"indicated",
"Path",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/fs/FileSystem.java#L669-L672 | train | Create a file with the specified path. | [
30522,
1030,
2139,
28139,
12921,
2270,
1042,
16150,
6790,
5833,
18780,
21422,
30524,
1007,
11618,
22834,
10288,
24422,
1063,
2709,
3443,
1006,
1042,
1010,
2058,
26373,
1029,
4339,
5302,
3207,
1012,
2058,
26373,
1024,
4339,
5302,
3207,
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... |
netty/netty | common/src/main/java/io/netty/util/AsciiString.java | AsciiString.endsWith | public boolean endsWith(CharSequence suffix) {
int suffixLen = suffix.length();
return regionMatches(length() - suffixLen, suffix, 0, suffixLen);
} | java | public boolean endsWith(CharSequence suffix) {
int suffixLen = suffix.length();
return regionMatches(length() - suffixLen, suffix, 0, suffixLen);
} | [
"public",
"boolean",
"endsWith",
"(",
"CharSequence",
"suffix",
")",
"{",
"int",
"suffixLen",
"=",
"suffix",
".",
"length",
"(",
")",
";",
"return",
"regionMatches",
"(",
"length",
"(",
")",
"-",
"suffixLen",
",",
"suffix",
",",
"0",
",",
"suffixLen",
")... | Compares the specified string to this string to determine if the specified string is a suffix.
@param suffix the suffix to look for.
@return {@code true} if the specified string is a suffix of this string, {@code false} otherwise.
@throws NullPointerException if {@code suffix} is {@code null}. | [
"Compares",
"the",
"specified",
"string",
"to",
"this",
"string",
"to",
"determine",
"if",
"the",
"specified",
"string",
"is",
"a",
"suffix",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L512-L515 | train | Returns true if this sequence ends with the specified sequence. | [
30522,
2270,
22017,
20898,
4515,
24415,
1006,
25869,
3366,
4226,
5897,
16809,
1007,
1063,
20014,
16809,
7770,
1027,
16809,
1012,
3091,
1006,
1007,
1025,
2709,
2555,
18900,
8376,
1006,
3091,
1006,
1007,
1011,
16809,
7770,
1010,
16809,
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-core/src/main/java/org/apache/flink/core/memory/DataInputDeserializer.java | DataInputDeserializer.setBuffer | public void setBuffer(@Nonnull ByteBuffer buffer) {
if (buffer.hasArray()) {
this.buffer = buffer.array();
this.position = buffer.arrayOffset() + buffer.position();
this.end = this.position + buffer.remaining();
} else if (buffer.isDirect() || buffer.isReadOnly()) {
// TODO: FLINK-8585 handle readonly and other non array based buffers more efficiently without data copy
this.buffer = new byte[buffer.remaining()];
this.position = 0;
this.end = this.buffer.length;
buffer.get(this.buffer);
} else {
throw new IllegalArgumentException("The given buffer is neither an array-backed heap ByteBuffer, nor a direct ByteBuffer.");
}
} | java | public void setBuffer(@Nonnull ByteBuffer buffer) {
if (buffer.hasArray()) {
this.buffer = buffer.array();
this.position = buffer.arrayOffset() + buffer.position();
this.end = this.position + buffer.remaining();
} else if (buffer.isDirect() || buffer.isReadOnly()) {
// TODO: FLINK-8585 handle readonly and other non array based buffers more efficiently without data copy
this.buffer = new byte[buffer.remaining()];
this.position = 0;
this.end = this.buffer.length;
buffer.get(this.buffer);
} else {
throw new IllegalArgumentException("The given buffer is neither an array-backed heap ByteBuffer, nor a direct ByteBuffer.");
}
} | [
"public",
"void",
"setBuffer",
"(",
"@",
"Nonnull",
"ByteBuffer",
"buffer",
")",
"{",
"if",
"(",
"buffer",
".",
"hasArray",
"(",
")",
")",
"{",
"this",
".",
"buffer",
"=",
"buffer",
".",
"array",
"(",
")",
";",
"this",
".",
"position",
"=",
"buffer",... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/DataInputDeserializer.java#L68-L83 | train | Sets the buffer. | [
30522,
2270,
11675,
2275,
8569,
12494,
1006,
1030,
2512,
11231,
3363,
24880,
8569,
12494,
17698,
1007,
1063,
2065,
1006,
17698,
1012,
2038,
2906,
9447,
1006,
1007,
1007,
1063,
2023,
1012,
17698,
1027,
17698,
1012,
9140,
1006,
1007,
1025,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/listener/TaskListenerManager.java | TaskListenerManager.notifyTaskFailed | public void notifyTaskFailed(TaskExecutor executor, Throwable exception) {
synchronized (listeners) {
int size = listeners.size();
if(size > 0){
for (int i = 0; i < size; i++) {
TaskListener listenerl = listeners.get(i);
listenerl.onFailed(executor, exception);
}
}else{
StaticLog.error(exception, exception.getMessage());
}
}
} | java | public void notifyTaskFailed(TaskExecutor executor, Throwable exception) {
synchronized (listeners) {
int size = listeners.size();
if(size > 0){
for (int i = 0; i < size; i++) {
TaskListener listenerl = listeners.get(i);
listenerl.onFailed(executor, exception);
}
}else{
StaticLog.error(exception, exception.getMessage());
}
}
} | [
"public",
"void",
"notifyTaskFailed",
"(",
"TaskExecutor",
"executor",
",",
"Throwable",
"exception",
")",
"{",
"synchronized",
"(",
"listeners",
")",
"{",
"int",
"size",
"=",
"listeners",
".",
"size",
"(",
")",
";",
"if",
"(",
"size",
">",
"0",
")",
"{"... | 通知所有监听任务启动器结束并失败<br>
无监听将打印堆栈到命令行
@param executor {@link TaskExecutor}
@param exception 失败原因 | [
"通知所有监听任务启动器结束并失败<br",
">",
"无监听将打印堆栈到命令行"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/listener/TaskListenerManager.java#L75-L87 | train | Notifies all listeners that a task has failed. | [
30522,
2270,
11675,
2025,
8757,
10230,
2243,
7011,
18450,
1006,
4708,
10288,
8586,
16161,
2099,
4654,
8586,
16161,
2099,
1010,
5466,
3085,
6453,
1007,
1063,
25549,
1006,
13810,
1007,
1063,
20014,
2946,
1027,
13810,
1012,
2946,
1006,
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... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.createRemoteEnvironment | public static StreamExecutionEnvironment createRemoteEnvironment(
String host, int port, Configuration clientConfig, String... jarFiles) {
return new RemoteStreamEnvironment(host, port, clientConfig, jarFiles);
} | java | public static StreamExecutionEnvironment createRemoteEnvironment(
String host, int port, Configuration clientConfig, String... jarFiles) {
return new RemoteStreamEnvironment(host, port, clientConfig, jarFiles);
} | [
"public",
"static",
"StreamExecutionEnvironment",
"createRemoteEnvironment",
"(",
"String",
"host",
",",
"int",
"port",
",",
"Configuration",
"clientConfig",
",",
"String",
"...",
"jarFiles",
")",
"{",
"return",
"new",
"RemoteStreamEnvironment",
"(",
"host",
",",
"p... | Creates a {@link RemoteStreamEnvironment}. The remote environment sends
(parts of) the program to a cluster for execution. Note that all file
paths used in the program must be accessible from the cluster. The
execution will use the specified parallelism.
@param host
The host name or address of the master (JobManager), where the
program should be executed.
@param port
The port of the master (JobManager), where the program should
be executed.
@param clientConfig
The configuration used by the client that connects to the remote cluster.
@param jarFiles
The JAR files with code that needs to be shipped to the
cluster. If the program uses user-defined functions,
user-defined input formats, or any libraries, those must be
provided in the JAR files.
@return A remote environment that executes the program on a cluster. | [
"Creates",
"a",
"{",
"@link",
"RemoteStreamEnvironment",
"}",
".",
"The",
"remote",
"environment",
"sends",
"(",
"parts",
"of",
")",
"the",
"program",
"to",
"a",
"cluster",
"for",
"execution",
".",
"Note",
"that",
"all",
"file",
"paths",
"used",
"in",
"the... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L1736-L1739 | train | Create a remote environment. | [
30522,
2270,
10763,
5460,
10288,
8586,
13700,
2368,
21663,
2239,
3672,
3443,
28578,
12184,
2368,
21663,
2239,
3672,
1006,
5164,
30524,
8663,
8873,
2290,
1010,
5164,
1012,
1012,
1012,
15723,
8873,
4244,
1007,
1063,
2709,
2047,
6556,
21422,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronLexicalAnalyzer.java | PerceptronLexicalAnalyzer.partOfSpeechTag | public String[] partOfSpeechTag(List<String> wordList)
{
if (posTagger == null)
{
throw new IllegalStateException("未提供词性标注模型");
}
return tag(wordList);
} | java | public String[] partOfSpeechTag(List<String> wordList)
{
if (posTagger == null)
{
throw new IllegalStateException("未提供词性标注模型");
}
return tag(wordList);
} | [
"public",
"String",
"[",
"]",
"partOfSpeechTag",
"(",
"List",
"<",
"String",
">",
"wordList",
")",
"{",
"if",
"(",
"posTagger",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"未提供词性标注模型\");",
"",
"",
"}",
"return",
"tag",
"(",
"w... | 词性标注
@param wordList
@return | [
"词性标注"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronLexicalAnalyzer.java#L116-L123 | train | Part of speech tag. | [
30522,
2270,
5164,
1031,
1033,
2112,
11253,
13102,
4402,
10143,
8490,
1006,
2862,
1026,
5164,
1028,
2773,
9863,
1007,
1063,
2065,
1006,
2695,
27609,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
6206,
9153,
17389,
2595,
24422,
1006,
1000,
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-runtime/src/main/java/org/apache/flink/runtime/heartbeat/HeartbeatServices.java | HeartbeatServices.fromConfiguration | public static HeartbeatServices fromConfiguration(Configuration configuration) {
long heartbeatInterval = configuration.getLong(HeartbeatManagerOptions.HEARTBEAT_INTERVAL);
long heartbeatTimeout = configuration.getLong(HeartbeatManagerOptions.HEARTBEAT_TIMEOUT);
return new HeartbeatServices(heartbeatInterval, heartbeatTimeout);
} | java | public static HeartbeatServices fromConfiguration(Configuration configuration) {
long heartbeatInterval = configuration.getLong(HeartbeatManagerOptions.HEARTBEAT_INTERVAL);
long heartbeatTimeout = configuration.getLong(HeartbeatManagerOptions.HEARTBEAT_TIMEOUT);
return new HeartbeatServices(heartbeatInterval, heartbeatTimeout);
} | [
"public",
"static",
"HeartbeatServices",
"fromConfiguration",
"(",
"Configuration",
"configuration",
")",
"{",
"long",
"heartbeatInterval",
"=",
"configuration",
".",
"getLong",
"(",
"HeartbeatManagerOptions",
".",
"HEARTBEAT_INTERVAL",
")",
";",
"long",
"heartbeatTimeout... | Creates an HeartbeatServices instance from a {@link Configuration}.
@param configuration Configuration to be used for the HeartbeatServices creation
@return An HeartbeatServices instance created from the given configuration | [
"Creates",
"an",
"HeartbeatServices",
"instance",
"from",
"a",
"{",
"@link",
"Configuration",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/heartbeat/HeartbeatServices.java#L110-L116 | train | Creates a heartbeat services instance from the given configuration. | [
30522,
2270,
10763,
12251,
8043,
7903,
2229,
2013,
8663,
8873,
27390,
3370,
1006,
9563,
9563,
1007,
1063,
2146,
12251,
18447,
2121,
10175,
1027,
9563,
1012,
2131,
10052,
1006,
12251,
24805,
4590,
7361,
9285,
1012,
12251,
1035,
13483,
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/FileUtil.java | FileUtil.writeUtf8Map | public static File writeUtf8Map(Map<?, ?> map, File file, String kvSeparator, boolean isAppend) throws IORuntimeException {
return FileWriter.create(file, CharsetUtil.CHARSET_UTF_8).writeMap(map, kvSeparator, isAppend);
} | java | public static File writeUtf8Map(Map<?, ?> map, File file, String kvSeparator, boolean isAppend) throws IORuntimeException {
return FileWriter.create(file, CharsetUtil.CHARSET_UTF_8).writeMap(map, kvSeparator, isAppend);
} | [
"public",
"static",
"File",
"writeUtf8Map",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
",",
"File",
"file",
",",
"String",
"kvSeparator",
",",
"boolean",
"isAppend",
")",
"throws",
"IORuntimeException",
"{",
"return",
"FileWriter",
".",
"create",
"(",
"fi... | 将Map写入文件,每个键值对为一行,一行中键与值之间使用kvSeparator分隔
@param map Map
@param file 文件
@param kvSeparator 键和值之间的分隔符,如果传入null使用默认分隔符" = "
@param isAppend 是否追加
@return 目标文件
@throws IORuntimeException IO异常
@since 4.0.5 | [
"将Map写入文件,每个键值对为一行,一行中键与值之间使用kvSeparator分隔"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3086-L3088 | train | Write UTF - 8 map to file. | [
30522,
2270,
10763,
5371,
4339,
4904,
2546,
2620,
2863,
2361,
1006,
4949,
1026,
1029,
1010,
1029,
1028,
4949,
1010,
5371,
5371,
1010,
5164,
24888,
3366,
28689,
4263,
1010,
22017,
20898,
18061,
21512,
4859,
1007,
11618,
22834,
15532,
7292,
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-http/src/main/java/cn/hutool/http/HttpUtil.java | HttpUtil.get | public static String get(String urlString, Map<String, Object> paramMap) {
return HttpRequest.get(urlString).form(paramMap).execute().body();
} | java | public static String get(String urlString, Map<String, Object> paramMap) {
return HttpRequest.get(urlString).form(paramMap).execute().body();
} | [
"public",
"static",
"String",
"get",
"(",
"String",
"urlString",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"paramMap",
")",
"{",
"return",
"HttpRequest",
".",
"get",
"(",
"urlString",
")",
".",
"form",
"(",
"paramMap",
")",
".",
"execute",
"(",
")... | 发送get请求
@param urlString 网址
@param paramMap post表单数据
@return 返回数据 | [
"发送get请求"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java#L129-L131 | train | Perform a GET request with the given parameters | [
30522,
2270,
10763,
5164,
2131,
1006,
5164,
24471,
4877,
18886,
3070,
1010,
4949,
1026,
5164,
1010,
4874,
1028,
11498,
14760,
2361,
1007,
1063,
2709,
8299,
2890,
15500,
1012,
2131,
1006,
24471,
4877,
18886,
3070,
1007,
1012,
2433,
1006,
114... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.isFile | public static boolean isFile(Path path, boolean isFollowLinks) {
if (null == path) {
return false;
}
final LinkOption[] options = isFollowLinks ? new LinkOption[0] : new LinkOption[] { LinkOption.NOFOLLOW_LINKS };
return Files.isRegularFile(path, options);
} | java | public static boolean isFile(Path path, boolean isFollowLinks) {
if (null == path) {
return false;
}
final LinkOption[] options = isFollowLinks ? new LinkOption[0] : new LinkOption[] { LinkOption.NOFOLLOW_LINKS };
return Files.isRegularFile(path, options);
} | [
"public",
"static",
"boolean",
"isFile",
"(",
"Path",
"path",
",",
"boolean",
"isFollowLinks",
")",
"{",
"if",
"(",
"null",
"==",
"path",
")",
"{",
"return",
"false",
";",
"}",
"final",
"LinkOption",
"[",
"]",
"options",
"=",
"isFollowLinks",
"?",
"new",... | 判断是否为文件,如果file为null,则返回false
@param path 文件
@param isFollowLinks 是否跟踪软链(快捷方式)
@return 如果为文件true | [
"判断是否为文件,如果file为null,则返回false"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L1292-L1298 | train | Checks if the given path points to a file or directory. | [
30522,
2270,
10763,
22017,
20898,
2003,
8873,
2571,
1006,
4130,
4130,
1010,
22017,
20898,
2003,
14876,
7174,
13668,
19839,
2015,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
4130,
1007,
1063,
2709,
6270,
1025,
1065,
2345,
4957,
7361,
3508,
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/taskmanager/Task.java | Task.run | @Override
public void run() {
// ----------------------------
// Initial State transition
// ----------------------------
while (true) {
ExecutionState current = this.executionState;
if (current == ExecutionState.CREATED) {
if (transitionState(ExecutionState.CREATED, ExecutionState.DEPLOYING)) {
// success, we can start our work
break;
}
}
else if (current == ExecutionState.FAILED) {
// we were immediately failed. tell the TaskManager that we reached our final state
notifyFinalState();
if (metrics != null) {
metrics.close();
}
return;
}
else if (current == ExecutionState.CANCELING) {
if (transitionState(ExecutionState.CANCELING, ExecutionState.CANCELED)) {
// we were immediately canceled. tell the TaskManager that we reached our final state
notifyFinalState();
if (metrics != null) {
metrics.close();
}
return;
}
}
else {
if (metrics != null) {
metrics.close();
}
throw new IllegalStateException("Invalid state for beginning of operation of task " + this + '.');
}
}
// all resource acquisitions and registrations from here on
// need to be undone in the end
Map<String, Future<Path>> distributedCacheEntries = new HashMap<>();
AbstractInvokable invokable = null;
try {
// ----------------------------
// Task Bootstrap - We periodically
// check for canceling as a shortcut
// ----------------------------
// activate safety net for task thread
LOG.info("Creating FileSystem stream leak safety net for task {}", this);
FileSystemSafetyNet.initializeSafetyNetForThread();
blobService.getPermanentBlobService().registerJob(jobId);
// first of all, get a user-code classloader
// this may involve downloading the job's JAR files and/or classes
LOG.info("Loading JAR files for task {}.", this);
userCodeClassLoader = createUserCodeClassloader();
final ExecutionConfig executionConfig = serializedExecutionConfig.deserializeValue(userCodeClassLoader);
if (executionConfig.getTaskCancellationInterval() >= 0) {
// override task cancellation interval from Flink config if set in ExecutionConfig
taskCancellationInterval = executionConfig.getTaskCancellationInterval();
}
if (executionConfig.getTaskCancellationTimeout() >= 0) {
// override task cancellation timeout from Flink config if set in ExecutionConfig
taskCancellationTimeout = executionConfig.getTaskCancellationTimeout();
}
if (isCanceledOrFailed()) {
throw new CancelTaskException();
}
// ----------------------------------------------------------------
// register the task with the network stack
// this operation may fail if the system does not have enough
// memory to run the necessary data exchanges
// the registration must also strictly be undone
// ----------------------------------------------------------------
LOG.info("Registering task at network: {}.", this);
network.registerTask(this);
for (ResultPartition partition : producedPartitions) {
taskEventDispatcher.registerPartition(partition.getPartitionId());
}
// add metrics for buffers
this.metrics.getIOMetricGroup().initializeBufferMetrics(this);
// register detailed network metrics, if configured
if (taskManagerConfig.getConfiguration().getBoolean(TaskManagerOptions.NETWORK_DETAILED_METRICS)) {
// similar to MetricUtils.instantiateNetworkMetrics() but inside this IOMetricGroup
MetricGroup networkGroup = this.metrics.getIOMetricGroup().addGroup("Network");
MetricGroup outputGroup = networkGroup.addGroup("Output");
MetricGroup inputGroup = networkGroup.addGroup("Input");
// output metrics
for (int i = 0; i < producedPartitions.length; i++) {
ResultPartitionMetrics.registerQueueLengthMetrics(
outputGroup.addGroup(i), producedPartitions[i]);
}
for (int i = 0; i < inputGates.length; i++) {
InputGateMetrics.registerQueueLengthMetrics(
inputGroup.addGroup(i), inputGates[i]);
}
}
// next, kick off the background copying of files for the distributed cache
try {
for (Map.Entry<String, DistributedCache.DistributedCacheEntry> entry :
DistributedCache.readFileInfoFromConfig(jobConfiguration)) {
LOG.info("Obtaining local cache file for '{}'.", entry.getKey());
Future<Path> cp = fileCache.createTmpFile(entry.getKey(), entry.getValue(), jobId, executionId);
distributedCacheEntries.put(entry.getKey(), cp);
}
}
catch (Exception e) {
throw new Exception(
String.format("Exception while adding files to distributed cache of task %s (%s).", taskNameWithSubtask, executionId), e);
}
if (isCanceledOrFailed()) {
throw new CancelTaskException();
}
// ----------------------------------------------------------------
// call the user code initialization methods
// ----------------------------------------------------------------
TaskKvStateRegistry kvStateRegistry = kvStateService.createKvStateTaskRegistry(jobId, getJobVertexId());
Environment env = new RuntimeEnvironment(
jobId,
vertexId,
executionId,
executionConfig,
taskInfo,
jobConfiguration,
taskConfiguration,
userCodeClassLoader,
memoryManager,
ioManager,
broadcastVariableManager,
taskStateManager,
aggregateManager,
accumulatorRegistry,
kvStateRegistry,
inputSplitProvider,
distributedCacheEntries,
producedPartitions,
inputGates,
taskEventDispatcher,
checkpointResponder,
taskManagerConfig,
metrics,
this);
// now load and instantiate the task's invokable code
invokable = loadAndInstantiateInvokable(userCodeClassLoader, nameOfInvokableClass, env);
// ----------------------------------------------------------------
// actual task core work
// ----------------------------------------------------------------
// we must make strictly sure that the invokable is accessible to the cancel() call
// by the time we switched to running.
this.invokable = invokable;
// switch to the RUNNING state, if that fails, we have been canceled/failed in the meantime
if (!transitionState(ExecutionState.DEPLOYING, ExecutionState.RUNNING)) {
throw new CancelTaskException();
}
// notify everyone that we switched to running
taskManagerActions.updateTaskExecutionState(new TaskExecutionState(jobId, executionId, ExecutionState.RUNNING));
// make sure the user code classloader is accessible thread-locally
executingThread.setContextClassLoader(userCodeClassLoader);
// run the invokable
invokable.invoke();
// make sure, we enter the catch block if the task leaves the invoke() method due
// to the fact that it has been canceled
if (isCanceledOrFailed()) {
throw new CancelTaskException();
}
// ----------------------------------------------------------------
// finalization of a successful execution
// ----------------------------------------------------------------
// finish the produced partitions. if this fails, we consider the execution failed.
for (ResultPartition partition : producedPartitions) {
if (partition != null) {
partition.finish();
}
}
// try to mark the task as finished
// if that fails, the task was canceled/failed in the meantime
if (!transitionState(ExecutionState.RUNNING, ExecutionState.FINISHED)) {
throw new CancelTaskException();
}
}
catch (Throwable t) {
// unwrap wrapped exceptions to make stack traces more compact
if (t instanceof WrappingRuntimeException) {
t = ((WrappingRuntimeException) t).unwrap();
}
// ----------------------------------------------------------------
// the execution failed. either the invokable code properly failed, or
// an exception was thrown as a side effect of cancelling
// ----------------------------------------------------------------
try {
// check if the exception is unrecoverable
if (ExceptionUtils.isJvmFatalError(t) ||
(t instanceof OutOfMemoryError && taskManagerConfig.shouldExitJvmOnOutOfMemoryError())) {
// terminate the JVM immediately
// don't attempt a clean shutdown, because we cannot expect the clean shutdown to complete
try {
LOG.error("Encountered fatal error {} - terminating the JVM", t.getClass().getName(), t);
} finally {
Runtime.getRuntime().halt(-1);
}
}
// transition into our final state. we should be either in DEPLOYING, RUNNING, CANCELING, or FAILED
// loop for multiple retries during concurrent state changes via calls to cancel() or
// to failExternally()
while (true) {
ExecutionState current = this.executionState;
if (current == ExecutionState.RUNNING || current == ExecutionState.DEPLOYING) {
if (t instanceof CancelTaskException) {
if (transitionState(current, ExecutionState.CANCELED)) {
cancelInvokable(invokable);
break;
}
}
else {
if (transitionState(current, ExecutionState.FAILED, t)) {
// proper failure of the task. record the exception as the root cause
failureCause = t;
cancelInvokable(invokable);
break;
}
}
}
else if (current == ExecutionState.CANCELING) {
if (transitionState(current, ExecutionState.CANCELED)) {
break;
}
}
else if (current == ExecutionState.FAILED) {
// in state failed already, no transition necessary any more
break;
}
// unexpected state, go to failed
else if (transitionState(current, ExecutionState.FAILED, t)) {
LOG.error("Unexpected state in task {} ({}) during an exception: {}.", taskNameWithSubtask, executionId, current);
break;
}
// else fall through the loop and
}
}
catch (Throwable tt) {
String message = String.format("FATAL - exception in exception handler of task %s (%s).", taskNameWithSubtask, executionId);
LOG.error(message, tt);
notifyFatalError(message, tt);
}
}
finally {
try {
LOG.info("Freeing task resources for {} ({}).", taskNameWithSubtask, executionId);
// clear the reference to the invokable. this helps guard against holding references
// to the invokable and its structures in cases where this Task object is still referenced
this.invokable = null;
// stop the async dispatcher.
// copy dispatcher reference to stack, against concurrent release
final BlockingCallMonitoringThreadPool dispatcher = this.asyncCallDispatcher;
if (dispatcher != null && !dispatcher.isShutdown()) {
dispatcher.shutdownNow();
}
// free the network resources
releaseNetworkResources();
// free memory resources
if (invokable != null) {
memoryManager.releaseAll(invokable);
}
// remove all of the tasks library resources
libraryCache.unregisterTask(jobId, executionId);
fileCache.releaseJob(jobId, executionId);
blobService.getPermanentBlobService().releaseJob(jobId);
// close and de-activate safety net for task thread
LOG.info("Ensuring all FileSystem streams are closed for task {}", this);
FileSystemSafetyNet.closeSafetyNetAndGuardedResourcesForThread();
notifyFinalState();
}
catch (Throwable t) {
// an error in the resource cleanup is fatal
String message = String.format("FATAL - exception in resource cleanup of task %s (%s).", taskNameWithSubtask, executionId);
LOG.error(message, t);
notifyFatalError(message, t);
}
// un-register the metrics at the end so that the task may already be
// counted as finished when this happens
// errors here will only be logged
try {
metrics.close();
}
catch (Throwable t) {
LOG.error("Error during metrics de-registration of task {} ({}).", taskNameWithSubtask, executionId, t);
}
}
} | java | @Override
public void run() {
// ----------------------------
// Initial State transition
// ----------------------------
while (true) {
ExecutionState current = this.executionState;
if (current == ExecutionState.CREATED) {
if (transitionState(ExecutionState.CREATED, ExecutionState.DEPLOYING)) {
// success, we can start our work
break;
}
}
else if (current == ExecutionState.FAILED) {
// we were immediately failed. tell the TaskManager that we reached our final state
notifyFinalState();
if (metrics != null) {
metrics.close();
}
return;
}
else if (current == ExecutionState.CANCELING) {
if (transitionState(ExecutionState.CANCELING, ExecutionState.CANCELED)) {
// we were immediately canceled. tell the TaskManager that we reached our final state
notifyFinalState();
if (metrics != null) {
metrics.close();
}
return;
}
}
else {
if (metrics != null) {
metrics.close();
}
throw new IllegalStateException("Invalid state for beginning of operation of task " + this + '.');
}
}
// all resource acquisitions and registrations from here on
// need to be undone in the end
Map<String, Future<Path>> distributedCacheEntries = new HashMap<>();
AbstractInvokable invokable = null;
try {
// ----------------------------
// Task Bootstrap - We periodically
// check for canceling as a shortcut
// ----------------------------
// activate safety net for task thread
LOG.info("Creating FileSystem stream leak safety net for task {}", this);
FileSystemSafetyNet.initializeSafetyNetForThread();
blobService.getPermanentBlobService().registerJob(jobId);
// first of all, get a user-code classloader
// this may involve downloading the job's JAR files and/or classes
LOG.info("Loading JAR files for task {}.", this);
userCodeClassLoader = createUserCodeClassloader();
final ExecutionConfig executionConfig = serializedExecutionConfig.deserializeValue(userCodeClassLoader);
if (executionConfig.getTaskCancellationInterval() >= 0) {
// override task cancellation interval from Flink config if set in ExecutionConfig
taskCancellationInterval = executionConfig.getTaskCancellationInterval();
}
if (executionConfig.getTaskCancellationTimeout() >= 0) {
// override task cancellation timeout from Flink config if set in ExecutionConfig
taskCancellationTimeout = executionConfig.getTaskCancellationTimeout();
}
if (isCanceledOrFailed()) {
throw new CancelTaskException();
}
// ----------------------------------------------------------------
// register the task with the network stack
// this operation may fail if the system does not have enough
// memory to run the necessary data exchanges
// the registration must also strictly be undone
// ----------------------------------------------------------------
LOG.info("Registering task at network: {}.", this);
network.registerTask(this);
for (ResultPartition partition : producedPartitions) {
taskEventDispatcher.registerPartition(partition.getPartitionId());
}
// add metrics for buffers
this.metrics.getIOMetricGroup().initializeBufferMetrics(this);
// register detailed network metrics, if configured
if (taskManagerConfig.getConfiguration().getBoolean(TaskManagerOptions.NETWORK_DETAILED_METRICS)) {
// similar to MetricUtils.instantiateNetworkMetrics() but inside this IOMetricGroup
MetricGroup networkGroup = this.metrics.getIOMetricGroup().addGroup("Network");
MetricGroup outputGroup = networkGroup.addGroup("Output");
MetricGroup inputGroup = networkGroup.addGroup("Input");
// output metrics
for (int i = 0; i < producedPartitions.length; i++) {
ResultPartitionMetrics.registerQueueLengthMetrics(
outputGroup.addGroup(i), producedPartitions[i]);
}
for (int i = 0; i < inputGates.length; i++) {
InputGateMetrics.registerQueueLengthMetrics(
inputGroup.addGroup(i), inputGates[i]);
}
}
// next, kick off the background copying of files for the distributed cache
try {
for (Map.Entry<String, DistributedCache.DistributedCacheEntry> entry :
DistributedCache.readFileInfoFromConfig(jobConfiguration)) {
LOG.info("Obtaining local cache file for '{}'.", entry.getKey());
Future<Path> cp = fileCache.createTmpFile(entry.getKey(), entry.getValue(), jobId, executionId);
distributedCacheEntries.put(entry.getKey(), cp);
}
}
catch (Exception e) {
throw new Exception(
String.format("Exception while adding files to distributed cache of task %s (%s).", taskNameWithSubtask, executionId), e);
}
if (isCanceledOrFailed()) {
throw new CancelTaskException();
}
// ----------------------------------------------------------------
// call the user code initialization methods
// ----------------------------------------------------------------
TaskKvStateRegistry kvStateRegistry = kvStateService.createKvStateTaskRegistry(jobId, getJobVertexId());
Environment env = new RuntimeEnvironment(
jobId,
vertexId,
executionId,
executionConfig,
taskInfo,
jobConfiguration,
taskConfiguration,
userCodeClassLoader,
memoryManager,
ioManager,
broadcastVariableManager,
taskStateManager,
aggregateManager,
accumulatorRegistry,
kvStateRegistry,
inputSplitProvider,
distributedCacheEntries,
producedPartitions,
inputGates,
taskEventDispatcher,
checkpointResponder,
taskManagerConfig,
metrics,
this);
// now load and instantiate the task's invokable code
invokable = loadAndInstantiateInvokable(userCodeClassLoader, nameOfInvokableClass, env);
// ----------------------------------------------------------------
// actual task core work
// ----------------------------------------------------------------
// we must make strictly sure that the invokable is accessible to the cancel() call
// by the time we switched to running.
this.invokable = invokable;
// switch to the RUNNING state, if that fails, we have been canceled/failed in the meantime
if (!transitionState(ExecutionState.DEPLOYING, ExecutionState.RUNNING)) {
throw new CancelTaskException();
}
// notify everyone that we switched to running
taskManagerActions.updateTaskExecutionState(new TaskExecutionState(jobId, executionId, ExecutionState.RUNNING));
// make sure the user code classloader is accessible thread-locally
executingThread.setContextClassLoader(userCodeClassLoader);
// run the invokable
invokable.invoke();
// make sure, we enter the catch block if the task leaves the invoke() method due
// to the fact that it has been canceled
if (isCanceledOrFailed()) {
throw new CancelTaskException();
}
// ----------------------------------------------------------------
// finalization of a successful execution
// ----------------------------------------------------------------
// finish the produced partitions. if this fails, we consider the execution failed.
for (ResultPartition partition : producedPartitions) {
if (partition != null) {
partition.finish();
}
}
// try to mark the task as finished
// if that fails, the task was canceled/failed in the meantime
if (!transitionState(ExecutionState.RUNNING, ExecutionState.FINISHED)) {
throw new CancelTaskException();
}
}
catch (Throwable t) {
// unwrap wrapped exceptions to make stack traces more compact
if (t instanceof WrappingRuntimeException) {
t = ((WrappingRuntimeException) t).unwrap();
}
// ----------------------------------------------------------------
// the execution failed. either the invokable code properly failed, or
// an exception was thrown as a side effect of cancelling
// ----------------------------------------------------------------
try {
// check if the exception is unrecoverable
if (ExceptionUtils.isJvmFatalError(t) ||
(t instanceof OutOfMemoryError && taskManagerConfig.shouldExitJvmOnOutOfMemoryError())) {
// terminate the JVM immediately
// don't attempt a clean shutdown, because we cannot expect the clean shutdown to complete
try {
LOG.error("Encountered fatal error {} - terminating the JVM", t.getClass().getName(), t);
} finally {
Runtime.getRuntime().halt(-1);
}
}
// transition into our final state. we should be either in DEPLOYING, RUNNING, CANCELING, or FAILED
// loop for multiple retries during concurrent state changes via calls to cancel() or
// to failExternally()
while (true) {
ExecutionState current = this.executionState;
if (current == ExecutionState.RUNNING || current == ExecutionState.DEPLOYING) {
if (t instanceof CancelTaskException) {
if (transitionState(current, ExecutionState.CANCELED)) {
cancelInvokable(invokable);
break;
}
}
else {
if (transitionState(current, ExecutionState.FAILED, t)) {
// proper failure of the task. record the exception as the root cause
failureCause = t;
cancelInvokable(invokable);
break;
}
}
}
else if (current == ExecutionState.CANCELING) {
if (transitionState(current, ExecutionState.CANCELED)) {
break;
}
}
else if (current == ExecutionState.FAILED) {
// in state failed already, no transition necessary any more
break;
}
// unexpected state, go to failed
else if (transitionState(current, ExecutionState.FAILED, t)) {
LOG.error("Unexpected state in task {} ({}) during an exception: {}.", taskNameWithSubtask, executionId, current);
break;
}
// else fall through the loop and
}
}
catch (Throwable tt) {
String message = String.format("FATAL - exception in exception handler of task %s (%s).", taskNameWithSubtask, executionId);
LOG.error(message, tt);
notifyFatalError(message, tt);
}
}
finally {
try {
LOG.info("Freeing task resources for {} ({}).", taskNameWithSubtask, executionId);
// clear the reference to the invokable. this helps guard against holding references
// to the invokable and its structures in cases where this Task object is still referenced
this.invokable = null;
// stop the async dispatcher.
// copy dispatcher reference to stack, against concurrent release
final BlockingCallMonitoringThreadPool dispatcher = this.asyncCallDispatcher;
if (dispatcher != null && !dispatcher.isShutdown()) {
dispatcher.shutdownNow();
}
// free the network resources
releaseNetworkResources();
// free memory resources
if (invokable != null) {
memoryManager.releaseAll(invokable);
}
// remove all of the tasks library resources
libraryCache.unregisterTask(jobId, executionId);
fileCache.releaseJob(jobId, executionId);
blobService.getPermanentBlobService().releaseJob(jobId);
// close and de-activate safety net for task thread
LOG.info("Ensuring all FileSystem streams are closed for task {}", this);
FileSystemSafetyNet.closeSafetyNetAndGuardedResourcesForThread();
notifyFinalState();
}
catch (Throwable t) {
// an error in the resource cleanup is fatal
String message = String.format("FATAL - exception in resource cleanup of task %s (%s).", taskNameWithSubtask, executionId);
LOG.error(message, t);
notifyFatalError(message, t);
}
// un-register the metrics at the end so that the task may already be
// counted as finished when this happens
// errors here will only be logged
try {
metrics.close();
}
catch (Throwable t) {
LOG.error("Error during metrics de-registration of task {} ({}).", taskNameWithSubtask, executionId, t);
}
}
} | [
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"// ----------------------------",
"// Initial State transition",
"// ----------------------------",
"while",
"(",
"true",
")",
"{",
"ExecutionState",
"current",
"=",
"this",
".",
"executionState",
";",
"if",
"... | The core work method that bootstraps the task and executes its code. | [
"The",
"core",
"work",
"method",
"that",
"bootstraps",
"the",
"task",
"and",
"executes",
"its",
"code",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java#L539-L875 | train | This method is called by the TaskManager to run the task. | [
30522,
1030,
2058,
15637,
2270,
11675,
2448,
1006,
1007,
1063,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
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... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker.java | WebSocketClientHandshaker.rawPath | static String rawPath(URI wsURL) {
String path = wsURL.getRawPath();
String query = wsURL.getRawQuery();
if (query != null && !query.isEmpty()) {
path = path + '?' + query;
}
return path == null || path.isEmpty() ? "/" : path;
} | java | static String rawPath(URI wsURL) {
String path = wsURL.getRawPath();
String query = wsURL.getRawQuery();
if (query != null && !query.isEmpty()) {
path = path + '?' + query;
}
return path == null || path.isEmpty() ? "/" : path;
} | [
"static",
"String",
"rawPath",
"(",
"URI",
"wsURL",
")",
"{",
"String",
"path",
"=",
"wsURL",
".",
"getRawPath",
"(",
")",
";",
"String",
"query",
"=",
"wsURL",
".",
"getRawQuery",
"(",
")",
";",
"if",
"(",
"query",
"!=",
"null",
"&&",
"!",
"query",
... | Return the constructed raw path for the give {@link URI}. | [
"Return",
"the",
"constructed",
"raw",
"path",
"for",
"the",
"give",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker.java#L539-L547 | train | Get the raw path of the URL. | [
30522,
10763,
5164,
6315,
15069,
1006,
24471,
2072,
1059,
26210,
2140,
1007,
1063,
5164,
4130,
1027,
1059,
26210,
2140,
1012,
2131,
2527,
2860,
15069,
1006,
1007,
1025,
5164,
23032,
1027,
1059,
26210,
2140,
1012,
2131,
2527,
2860,
4226,
285... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/operation/MetadataOperation.java | MetadataOperation.convertPattern | private String convertPattern(final String pattern, boolean datanucleusFormat) {
String wStr;
if (datanucleusFormat) {
wStr = "*";
} else {
wStr = ".*";
}
return pattern
.replaceAll("([^\\\\])%", "$1" + wStr).replaceAll("\\\\%", "%").replaceAll("^%", wStr)
.replaceAll("([^\\\\])_", "$1.").replaceAll("\\\\_", "_").replaceAll("^_", ".");
} | java | private String convertPattern(final String pattern, boolean datanucleusFormat) {
String wStr;
if (datanucleusFormat) {
wStr = "*";
} else {
wStr = ".*";
}
return pattern
.replaceAll("([^\\\\])%", "$1" + wStr).replaceAll("\\\\%", "%").replaceAll("^%", wStr)
.replaceAll("([^\\\\])_", "$1.").replaceAll("\\\\_", "_").replaceAll("^_", ".");
} | [
"private",
"String",
"convertPattern",
"(",
"final",
"String",
"pattern",
",",
"boolean",
"datanucleusFormat",
")",
"{",
"String",
"wStr",
";",
"if",
"(",
"datanucleusFormat",
")",
"{",
"wStr",
"=",
"\"*\"",
";",
"}",
"else",
"{",
"wStr",
"=",
"\".*\"",
";... | Convert a pattern containing JDBC catalog search wildcards into
Java regex patterns.
@param pattern input which may contain '%' or '_' wildcard characters, or
these characters escaped using {@link #getSearchStringEscape()}.
@return replace %/_ with regex search characters, also handle escaped
characters.
The datanucleus module expects the wildchar as '*'. The columns search on the
other hand is done locally inside the hive code and that requires the regex wildchar
format '.*' This is driven by the datanucleusFormat flag. | [
"Convert",
"a",
"pattern",
"containing",
"JDBC",
"catalog",
"search",
"wildcards",
"into",
"Java",
"regex",
"patterns",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/MetadataOperation.java#L97-L107 | train | Convert a pattern to a CIS pattern. | [
30522,
2797,
5164,
10463,
4502,
12079,
2078,
1006,
2345,
5164,
5418,
1010,
22017,
20898,
2951,
11231,
14321,
2271,
14192,
4017,
1007,
1063,
5164,
1059,
3367,
2099,
1025,
2065,
1006,
2951,
11231,
14321,
2271,
14192,
4017,
1007,
1063,
1059,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/IdcardUtil.java | IdcardUtil.getAgeByIdCard | public static int getAgeByIdCard(String idCard, Date dateToCompare) {
String birth = getBirthByIdCard(idCard);
return DateUtil.age(DateUtil.parse(birth, "yyyyMMdd"), dateToCompare);
} | java | public static int getAgeByIdCard(String idCard, Date dateToCompare) {
String birth = getBirthByIdCard(idCard);
return DateUtil.age(DateUtil.parse(birth, "yyyyMMdd"), dateToCompare);
} | [
"public",
"static",
"int",
"getAgeByIdCard",
"(",
"String",
"idCard",
",",
"Date",
"dateToCompare",
")",
"{",
"String",
"birth",
"=",
"getBirthByIdCard",
"(",
"idCard",
")",
";",
"return",
"DateUtil",
".",
"age",
"(",
"DateUtil",
".",
"parse",
"(",
"birth",
... | 根据身份编号获取指定日期当时的年龄年龄,只支持15或18位身份证号码
@param idCard 身份编号
@param dateToCompare 以此日期为界,计算年龄。
@return 年龄 | [
"根据身份编号获取指定日期当时的年龄年龄,只支持15或18位身份证号码"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/IdcardUtil.java#L421-L424 | train | Get the age of a user by ID card | [
30522,
2270,
10763,
20014,
2131,
4270,
3762,
3593,
11522,
1006,
5164,
8909,
11522,
1010,
3058,
3058,
3406,
9006,
19362,
2063,
1007,
1063,
5164,
4182,
1027,
2131,
17706,
2705,
3762,
3593,
11522,
1006,
8909,
11522,
1007,
1025,
2709,
3058,
218... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/HttpResponse.java | HttpResponse.getCookieValue | public String getCookieValue(String name) {
HttpCookie cookie = getCookie(name);
return (null == cookie) ? null : cookie.getValue();
} | java | public String getCookieValue(String name) {
HttpCookie cookie = getCookie(name);
return (null == cookie) ? null : cookie.getValue();
} | [
"public",
"String",
"getCookieValue",
"(",
"String",
"name",
")",
"{",
"HttpCookie",
"cookie",
"=",
"getCookie",
"(",
"name",
")",
";",
"return",
"(",
"null",
"==",
"cookie",
")",
"?",
"null",
":",
"cookie",
".",
"getValue",
"(",
")",
";",
"}"
] | 获取Cookie值
@param name Cookie名
@return Cookie值
@since 4.1.4 | [
"获取Cookie值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpResponse.java#L177-L180 | train | Returns the value of the cookie with the given name. | [
30522,
2270,
5164,
2131,
3597,
23212,
13331,
7630,
2063,
1006,
5164,
2171,
1007,
1063,
8299,
3597,
23212,
2063,
17387,
1027,
2131,
3597,
23212,
2063,
1006,
2171,
1007,
1025,
2709,
1006,
19701,
1027,
1027,
17387,
1007,
1029,
19701,
1024,
173... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/server/src/org/openqa/grid/internal/NewSessionRequestQueue.java | NewSessionRequestQueue.processQueue | public void processQueue(
Predicate<RequestHandler> handlerConsumer,
Prioritizer prioritizer) {
Comparator<RequestHandler> comparator =
prioritizer == null ?
Ordering.allEqual()::compare :
(a, b) -> prioritizer.compareTo(
a.getRequest().getDesiredCapabilities(), b.getRequest().getDesiredCapabilities());
lock.writeLock().lock();
try {
newSessionRequests.stream()
.sorted(comparator)
.filter(handlerConsumer)
.forEach(requestHandler -> {
if (!removeNewSessionRequest(requestHandler)) {
log.severe("Bug removing request " + requestHandler);
}
});
} finally {
lock.writeLock().unlock();
}
} | java | public void processQueue(
Predicate<RequestHandler> handlerConsumer,
Prioritizer prioritizer) {
Comparator<RequestHandler> comparator =
prioritizer == null ?
Ordering.allEqual()::compare :
(a, b) -> prioritizer.compareTo(
a.getRequest().getDesiredCapabilities(), b.getRequest().getDesiredCapabilities());
lock.writeLock().lock();
try {
newSessionRequests.stream()
.sorted(comparator)
.filter(handlerConsumer)
.forEach(requestHandler -> {
if (!removeNewSessionRequest(requestHandler)) {
log.severe("Bug removing request " + requestHandler);
}
});
} finally {
lock.writeLock().unlock();
}
} | [
"public",
"void",
"processQueue",
"(",
"Predicate",
"<",
"RequestHandler",
">",
"handlerConsumer",
",",
"Prioritizer",
"prioritizer",
")",
"{",
"Comparator",
"<",
"RequestHandler",
">",
"comparator",
"=",
"prioritizer",
"==",
"null",
"?",
"Ordering",
".",
"allEqua... | Processes all the entries in this queue.
@param handlerConsumer The consumer that returns true if it has taken the item from the queue
@param prioritizer The prioritizer to use | [
"Processes",
"all",
"the",
"entries",
"in",
"this",
"queue",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/internal/NewSessionRequestQueue.java#L71-L95 | train | Process the queue of new session requests. | [
30522,
2270,
11675,
2832,
4226,
5657,
1006,
3653,
30524,
1007,
1024,
1024,
12826,
1024,
1006,
1037,
1010,
1038,
1007,
1011,
1028,
3188,
25090,
6290,
1012,
12826,
3406,
1006,
1037,
1012,
2131,
2890,
15500,
1006,
1007,
1012,
2131,
6155,
27559... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/dictionary/nt/OrganizationDictionary.java | OrganizationDictionary.parsePattern | public static void parsePattern(List<NT> ntList, List<Vertex> vertexList, final WordNet wordNetOptimum, final WordNet wordNetAll)
{
// ListIterator<Vertex> listIterator = vertexList.listIterator();
StringBuilder sbPattern = new StringBuilder(ntList.size());
for (NT nt : ntList)
{
sbPattern.append(nt.toString());
}
String pattern = sbPattern.toString();
final Vertex[] wordArray = vertexList.toArray(new Vertex[0]);
trie.parseText(pattern, new AhoCorasickDoubleArrayTrie.IHit<String>()
{
@Override
public void hit(int begin, int end, String keyword)
{
StringBuilder sbName = new StringBuilder();
for (int i = begin; i < end; ++i)
{
sbName.append(wordArray[i].realWord);
}
String name = sbName.toString();
// 对一些bad case做出调整
if (isBadCase(name)) return;
// 正式算它是一个名字
if (HanLP.Config.DEBUG)
{
System.out.printf("识别出机构名:%s %s\n", name, keyword);
}
int offset = 0;
for (int i = 0; i < begin; ++i)
{
offset += wordArray[i].realWord.length();
}
wordNetOptimum.insert(offset, new Vertex(Predefine.TAG_GROUP, name, ATTRIBUTE, WORD_ID), wordNetAll);
}
});
} | java | public static void parsePattern(List<NT> ntList, List<Vertex> vertexList, final WordNet wordNetOptimum, final WordNet wordNetAll)
{
// ListIterator<Vertex> listIterator = vertexList.listIterator();
StringBuilder sbPattern = new StringBuilder(ntList.size());
for (NT nt : ntList)
{
sbPattern.append(nt.toString());
}
String pattern = sbPattern.toString();
final Vertex[] wordArray = vertexList.toArray(new Vertex[0]);
trie.parseText(pattern, new AhoCorasickDoubleArrayTrie.IHit<String>()
{
@Override
public void hit(int begin, int end, String keyword)
{
StringBuilder sbName = new StringBuilder();
for (int i = begin; i < end; ++i)
{
sbName.append(wordArray[i].realWord);
}
String name = sbName.toString();
// 对一些bad case做出调整
if (isBadCase(name)) return;
// 正式算它是一个名字
if (HanLP.Config.DEBUG)
{
System.out.printf("识别出机构名:%s %s\n", name, keyword);
}
int offset = 0;
for (int i = 0; i < begin; ++i)
{
offset += wordArray[i].realWord.length();
}
wordNetOptimum.insert(offset, new Vertex(Predefine.TAG_GROUP, name, ATTRIBUTE, WORD_ID), wordNetAll);
}
});
} | [
"public",
"static",
"void",
"parsePattern",
"(",
"List",
"<",
"NT",
">",
"ntList",
",",
"List",
"<",
"Vertex",
">",
"vertexList",
",",
"final",
"WordNet",
"wordNetOptimum",
",",
"final",
"WordNet",
"wordNetAll",
")",
"{",
"// ListIterator<Vertex> listIterat... | 模式匹配
@param ntList 确定的标注序列
@param vertexList 原始的未加角色标注的序列
@param wordNetOptimum 待优化的图
@param wordNetAll | [
"模式匹配"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/nt/OrganizationDictionary.java#L3745-L3782 | train | Parse pattern. | [
30522,
2270,
10763,
11675,
30524,
27147,
1010,
2345,
2773,
7159,
2773,
7159,
8095,
1007,
1063,
1013,
1013,
2862,
21646,
8844,
1026,
19449,
1028,
2862,
21646,
8844,
1027,
19449,
9863,
1012,
2862,
21646,
8844,
1006,
1007,
1025,
5164,
8569,
23... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/thread/ThreadUtil.java | ThreadUtil.newThread | public static Thread newThread(Runnable runnable, String name) {
final Thread t = newThread(runnable, name, false);
if (t.getPriority() != Thread.NORM_PRIORITY) {
t.setPriority(Thread.NORM_PRIORITY);
}
return t;
} | java | public static Thread newThread(Runnable runnable, String name) {
final Thread t = newThread(runnable, name, false);
if (t.getPriority() != Thread.NORM_PRIORITY) {
t.setPriority(Thread.NORM_PRIORITY);
}
return t;
} | [
"public",
"static",
"Thread",
"newThread",
"(",
"Runnable",
"runnable",
",",
"String",
"name",
")",
"{",
"final",
"Thread",
"t",
"=",
"newThread",
"(",
"runnable",
",",
"name",
",",
"false",
")",
";",
"if",
"(",
"t",
".",
"getPriority",
"(",
")",
"!=",... | 创建新线程,非守护线程,正常优先级,线程组与当前线程的线程组一致
@param runnable {@link Runnable}
@param name 线程名
@return {@link Thread}
@since 3.1.2 | [
"创建新线程,非守护线程,正常优先级,线程组与当前线程的线程组一致"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/thread/ThreadUtil.java#L179-L185 | train | Creates a new thread with the specified name and priority. | [
30522,
2270,
10763,
11689,
25597,
28362,
4215,
1006,
2448,
22966,
2448,
22966,
1010,
5164,
2171,
1007,
1063,
2345,
11689,
1056,
1027,
25597,
28362,
4215,
1006,
2448,
22966,
1010,
2171,
1010,
6270,
1007,
1025,
2065,
1006,
1056,
1012,
2131,
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-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.pathEndsWith | public static boolean pathEndsWith(File file, String suffix) {
return file.getPath().toLowerCase().endsWith(suffix);
} | java | public static boolean pathEndsWith(File file, String suffix) {
return file.getPath().toLowerCase().endsWith(suffix);
} | [
"public",
"static",
"boolean",
"pathEndsWith",
"(",
"File",
"file",
",",
"String",
"suffix",
")",
"{",
"return",
"file",
".",
"getPath",
"(",
")",
".",
"toLowerCase",
"(",
")",
".",
"endsWith",
"(",
"suffix",
")",
";",
"}"
] | 判断文件路径是否有指定后缀,忽略大小写<br>
常用语判断扩展名
@param file 文件或目录
@param suffix 后缀
@return 是否有指定后缀 | [
"判断文件路径是否有指定后缀,忽略大小写<br",
">",
"常用语判断扩展名"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L1845-L1847 | train | Checks if the path ends with the given suffix. | [
30522,
2270,
10763,
22017,
20898,
4130,
10497,
26760,
8939,
1006,
5371,
5371,
1010,
5164,
16809,
1007,
1063,
2709,
5371,
1012,
2131,
15069,
1006,
1007,
1012,
2000,
27663,
18992,
3366,
1006,
1007,
1012,
4515,
24415,
1006,
16809,
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... |
apache/flink | flink-clients/src/main/java/org/apache/flink/client/program/OptimizerPlanEnvironment.java | OptimizerPlanEnvironment.execute | @Override
public JobExecutionResult execute(String jobName) throws Exception {
Plan plan = createProgramPlan(jobName);
this.optimizerPlan = compiler.compile(plan);
// do not go on with anything now!
throw new ProgramAbortException();
} | java | @Override
public JobExecutionResult execute(String jobName) throws Exception {
Plan plan = createProgramPlan(jobName);
this.optimizerPlan = compiler.compile(plan);
// do not go on with anything now!
throw new ProgramAbortException();
} | [
"@",
"Override",
"public",
"JobExecutionResult",
"execute",
"(",
"String",
"jobName",
")",
"throws",
"Exception",
"{",
"Plan",
"plan",
"=",
"createProgramPlan",
"(",
"jobName",
")",
";",
"this",
".",
"optimizerPlan",
"=",
"compiler",
".",
"compile",
"(",
"plan... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/program/OptimizerPlanEnvironment.java#L48-L55 | train | Execute the job. | [
30522,
1030,
2058,
15637,
2270,
3105,
10288,
8586,
13700,
6072,
11314,
15389,
1006,
5164,
3105,
18442,
1007,
11618,
6453,
1063,
2933,
2933,
1027,
3443,
21572,
13113,
24759,
2319,
1006,
3105,
18442,
1007,
1025,
2023,
1012,
23569,
27605,
6290,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.leftOuterJoin | public <R> JoinOperatorSetsBase<T, R> leftOuterJoin(DataSet<R> other) {
return new JoinOperatorSetsBase<>(this, other, JoinHint.OPTIMIZER_CHOOSES, JoinType.LEFT_OUTER);
} | java | public <R> JoinOperatorSetsBase<T, R> leftOuterJoin(DataSet<R> other) {
return new JoinOperatorSetsBase<>(this, other, JoinHint.OPTIMIZER_CHOOSES, JoinType.LEFT_OUTER);
} | [
"public",
"<",
"R",
">",
"JoinOperatorSetsBase",
"<",
"T",
",",
"R",
">",
"leftOuterJoin",
"(",
"DataSet",
"<",
"R",
">",
"other",
")",
"{",
"return",
"new",
"JoinOperatorSetsBase",
"<>",
"(",
"this",
",",
"other",
",",
"JoinHint",
".",
"OPTIMIZER_CHOOSES"... | Initiates a Left Outer Join transformation.
<p>An Outer Join transformation joins two elements of two
{@link DataSet DataSets} on key equality and provides multiple ways to combine
joining elements into one DataSet.
<p>Elements of the <b>left</b> DataSet (i.e. {@code this}) that do not have a matching
element on the other side are joined with {@code null} and emitted to the
resulting DataSet.
@param other The other DataSet with which this DataSet is joined.
@return A JoinOperatorSet to continue the definition of the Join transformation.
@see org.apache.flink.api.java.operators.join.JoinOperatorSetsBase
@see DataSet | [
"Initiates",
"a",
"Left",
"Outer",
"Join",
"transformation",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L841-L843 | train | Create a left outer join of this DataSet with the other DataSet. | [
30522,
2270,
1026,
1054,
1028,
3693,
25918,
18926,
8454,
15058,
1026,
1056,
1010,
1054,
1028,
2187,
5833,
2121,
5558,
2378,
1006,
2951,
13462,
1026,
1054,
1028,
2060,
1007,
1063,
2709,
2047,
3693,
25918,
18926,
8454,
15058,
1026,
1028,
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 | common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleClient.java | ExternalShuffleClient.registerWithShuffleServer | public void registerWithShuffleServer(
String host,
int port,
String execId,
ExecutorShuffleInfo executorInfo) throws IOException, InterruptedException {
checkInit();
try (TransportClient client = clientFactory.createUnmanagedClient(host, port)) {
ByteBuffer registerMessage = new RegisterExecutor(appId, execId, executorInfo).toByteBuffer();
client.sendRpcSync(registerMessage, registrationTimeoutMs);
}
} | java | public void registerWithShuffleServer(
String host,
int port,
String execId,
ExecutorShuffleInfo executorInfo) throws IOException, InterruptedException {
checkInit();
try (TransportClient client = clientFactory.createUnmanagedClient(host, port)) {
ByteBuffer registerMessage = new RegisterExecutor(appId, execId, executorInfo).toByteBuffer();
client.sendRpcSync(registerMessage, registrationTimeoutMs);
}
} | [
"public",
"void",
"registerWithShuffleServer",
"(",
"String",
"host",
",",
"int",
"port",
",",
"String",
"execId",
",",
"ExecutorShuffleInfo",
"executorInfo",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"checkInit",
"(",
")",
";",
"try",
"(",
... | Registers this executor with an external shuffle server. This registration is required to
inform the shuffle server about where and how we store our shuffle files.
@param host Host of shuffle server.
@param port Port of shuffle server.
@param execId This Executor's id.
@param executorInfo Contains all info necessary for the service to find our shuffle files. | [
"Registers",
"this",
"executor",
"with",
"an",
"external",
"shuffle",
"server",
".",
"This",
"registration",
"is",
"required",
"to",
"inform",
"the",
"shuffle",
"server",
"about",
"where",
"and",
"how",
"we",
"store",
"our",
"shuffle",
"files",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleClient.java#L136-L146 | train | Register with shuffle server. | [
30522,
2270,
11675,
4236,
24415,
14235,
18142,
8043,
6299,
1006,
5164,
3677,
1010,
20014,
3417,
1010,
5164,
4654,
8586,
3593,
1010,
4654,
8586,
16161,
2869,
6979,
18142,
2378,
14876,
4654,
8586,
16161,
6657,
14876,
1007,
11618,
22834,
10288,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/Validator.java | Validator.validateBetween | public static void validateBetween(Number value, Number min, Number max, String errorMsg) throws ValidateException {
if (false == isBetween(value, min, max)) {
throw new ValidateException(errorMsg);
}
} | java | public static void validateBetween(Number value, Number min, Number max, String errorMsg) throws ValidateException {
if (false == isBetween(value, min, max)) {
throw new ValidateException(errorMsg);
}
} | [
"public",
"static",
"void",
"validateBetween",
"(",
"Number",
"value",
",",
"Number",
"min",
",",
"Number",
"max",
",",
"String",
"errorMsg",
")",
"throws",
"ValidateException",
"{",
"if",
"(",
"false",
"==",
"isBetween",
"(",
"value",
",",
"min",
",",
"ma... | 检查给定的数字是否在指定范围内
@param value 值
@param min 最小值(包含)
@param max 最大值(包含)
@param errorMsg 验证错误的信息
@throws ValidateException 验证异常
@since 4.1.10 | [
"检查给定的数字是否在指定范围内"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L1064-L1068 | train | Validate between method. | [
30522,
2270,
10763,
11675,
9398,
3686,
20915,
28394,
2078,
1006,
2193,
3643,
1010,
2193,
8117,
1010,
2193,
4098,
1010,
5164,
7561,
5244,
2290,
30524,
4098,
1007,
1007,
1063,
5466,
2047,
9398,
3686,
10288,
24422,
1006,
7561,
5244,
2290,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/trie/bintrie/util/ArrayTool.java | ArrayTool.binarySearch | public static int binarySearch(BaseNode[] branches, BaseNode node)
{
int high = branches.length - 1;
if (branches.length < 1)
{
return high;
}
int low = 0;
while (low <= high)
{
int mid = (low + high) >>> 1;
int cmp = branches[mid].compareTo(node);
if (cmp < 0)
low = mid + 1;
else if (cmp > 0)
high = mid - 1;
else
return mid;
}
return -(low + 1);
} | java | public static int binarySearch(BaseNode[] branches, BaseNode node)
{
int high = branches.length - 1;
if (branches.length < 1)
{
return high;
}
int low = 0;
while (low <= high)
{
int mid = (low + high) >>> 1;
int cmp = branches[mid].compareTo(node);
if (cmp < 0)
low = mid + 1;
else if (cmp > 0)
high = mid - 1;
else
return mid;
}
return -(low + 1);
} | [
"public",
"static",
"int",
"binarySearch",
"(",
"BaseNode",
"[",
"]",
"branches",
",",
"BaseNode",
"node",
")",
"{",
"int",
"high",
"=",
"branches",
".",
"length",
"-",
"1",
";",
"if",
"(",
"branches",
".",
"length",
"<",
"1",
")",
"{",
"return",
"hi... | 二分查找
@param branches 数组
@param node 要查找的node
@return 数组下标,小于0表示没找到 | [
"二分查找"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/bintrie/util/ArrayTool.java#L28-L49 | train | Gets the index of the BaseNode in the BaseNode array that is greater than or equal to the given BaseNode. | [
30522,
2270,
10763,
20014,
12441,
17310,
11140,
1006,
2918,
3630,
3207,
1031,
1033,
5628,
1010,
2918,
3630,
3207,
13045,
1007,
1063,
20014,
2152,
1027,
5628,
1012,
3091,
1011,
1015,
1025,
2065,
1006,
5628,
1012,
3091,
1026,
1015,
1007,
1063... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/seg/Other/CommonAhoCorasickSegmentUtil.java | CommonAhoCorasickSegmentUtil.segmentReverseOrder | public static <V> LinkedList<ResultTerm<V>> segmentReverseOrder(final char[] charArray, AhoCorasickDoubleArrayTrie<V> trie)
{
LinkedList<ResultTerm<V>> termList = new LinkedList<ResultTerm<V>>();
final ResultTerm<V>[] wordNet = new ResultTerm[charArray.length + 1];
trie.parseText(charArray, new AhoCorasickDoubleArrayTrie.IHit<V>()
{
@Override
public void hit(int begin, int end, V value)
{
if (wordNet[end] == null || wordNet[end].word.length() < end - begin)
{
wordNet[end] = new ResultTerm<V>(new String(charArray, begin, end - begin), value, begin);
}
}
});
for (int i = charArray.length; i > 0;)
{
if (wordNet[i] == null)
{
StringBuilder sbTerm = new StringBuilder();
int offset = i - 1;
byte preCharType = CharType.get(charArray[offset]);
while (i > 0 && wordNet[i] == null && CharType.get(charArray[i - 1]) == preCharType)
{
sbTerm.append(charArray[i - 1]);
preCharType = CharType.get(charArray[i - 1]);
--i;
}
termList.addFirst(new ResultTerm<V>(sbTerm.reverse().toString(), null, offset));
}
else
{
termList.addFirst(wordNet[i]);
i -= wordNet[i].word.length();
}
}
return termList;
} | java | public static <V> LinkedList<ResultTerm<V>> segmentReverseOrder(final char[] charArray, AhoCorasickDoubleArrayTrie<V> trie)
{
LinkedList<ResultTerm<V>> termList = new LinkedList<ResultTerm<V>>();
final ResultTerm<V>[] wordNet = new ResultTerm[charArray.length + 1];
trie.parseText(charArray, new AhoCorasickDoubleArrayTrie.IHit<V>()
{
@Override
public void hit(int begin, int end, V value)
{
if (wordNet[end] == null || wordNet[end].word.length() < end - begin)
{
wordNet[end] = new ResultTerm<V>(new String(charArray, begin, end - begin), value, begin);
}
}
});
for (int i = charArray.length; i > 0;)
{
if (wordNet[i] == null)
{
StringBuilder sbTerm = new StringBuilder();
int offset = i - 1;
byte preCharType = CharType.get(charArray[offset]);
while (i > 0 && wordNet[i] == null && CharType.get(charArray[i - 1]) == preCharType)
{
sbTerm.append(charArray[i - 1]);
preCharType = CharType.get(charArray[i - 1]);
--i;
}
termList.addFirst(new ResultTerm<V>(sbTerm.reverse().toString(), null, offset));
}
else
{
termList.addFirst(wordNet[i]);
i -= wordNet[i].word.length();
}
}
return termList;
} | [
"public",
"static",
"<",
"V",
">",
"LinkedList",
"<",
"ResultTerm",
"<",
"V",
">",
">",
"segmentReverseOrder",
"(",
"final",
"char",
"[",
"]",
"charArray",
",",
"AhoCorasickDoubleArrayTrie",
"<",
"V",
">",
"trie",
")",
"{",
"LinkedList",
"<",
"ResultTerm",
... | 逆向最长分词,合并未知语素
@param charArray 文本
@param trie 自动机
@param <V> 类型
@return 结果链表 | [
"逆向最长分词,合并未知语素"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/Other/CommonAhoCorasickSegmentUtil.java#L102-L139 | train | segmentReverseOrder This method is used to segment the text in the char array in reverse order. | [
30522,
2270,
10763,
1026,
1058,
1028,
5799,
9863,
1026,
2765,
3334,
2213,
1026,
1058,
1028,
1028,
6903,
2890,
16070,
8551,
2121,
1006,
2345,
25869,
1031,
1033,
25869,
2906,
9447,
1010,
6289,
24163,
8180,
6799,
26797,
3468,
2906,
9447,
18886... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java | MetricConfig.getInteger | public int getInteger(String key, int defaultValue) {
String argument = getProperty(key, null);
return argument == null
? defaultValue
: Integer.parseInt(argument);
} | java | public int getInteger(String key, int defaultValue) {
String argument = getProperty(key, null);
return argument == null
? defaultValue
: Integer.parseInt(argument);
} | [
"public",
"int",
"getInteger",
"(",
"String",
"key",
",",
"int",
"defaultValue",
")",
"{",
"String",
"argument",
"=",
"getProperty",
"(",
"key",
",",
"null",
")",
";",
"return",
"argument",
"==",
"null",
"?",
"defaultValue",
":",
"Integer",
".",
"parseInt"... | Searches for the property with the specified key in this property list.
If the key is not found in this property list, the default property list,
and its defaults, recursively, are then checked. The method returns the
default value argument if the property is not found.
@param key the hashtable key.
@param defaultValue a default value.
@return the value in this property list with the specified key value parsed as an int. | [
"Searches",
"for",
"the",
"property",
"with",
"the",
"specified",
"key",
"in",
"this",
"property",
"list",
".",
"If",
"the",
"key",
"is",
"not",
"found",
"in",
"this",
"property",
"list",
"the",
"default",
"property",
"list",
"and",
"its",
"defaults",
"rec... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java#L42-L47 | train | Get the integer value for the given key. | [
30522,
2270,
20014,
2131,
18447,
26320,
1006,
5164,
3145,
1010,
20014,
12398,
10175,
5657,
1007,
1063,
5164,
6685,
1027,
2131,
21572,
4842,
3723,
1006,
3145,
1010,
19701,
1007,
1025,
2709,
6685,
1027,
1027,
19701,
1029,
12398,
10175,
5657,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolver.java | DnsNameResolver.resolveAll | public final Future<List<DnsRecord>> resolveAll(DnsQuestion question, Iterable<DnsRecord> additionals,
Promise<List<DnsRecord>> promise) {
final DnsRecord[] additionalsArray = toArray(additionals, true);
return resolveAll(question, additionalsArray, promise);
} | java | public final Future<List<DnsRecord>> resolveAll(DnsQuestion question, Iterable<DnsRecord> additionals,
Promise<List<DnsRecord>> promise) {
final DnsRecord[] additionalsArray = toArray(additionals, true);
return resolveAll(question, additionalsArray, promise);
} | [
"public",
"final",
"Future",
"<",
"List",
"<",
"DnsRecord",
">",
">",
"resolveAll",
"(",
"DnsQuestion",
"question",
",",
"Iterable",
"<",
"DnsRecord",
">",
"additionals",
",",
"Promise",
"<",
"List",
"<",
"DnsRecord",
">",
">",
"promise",
")",
"{",
"final"... | Resolves the {@link DnsRecord}s that are matched by the specified {@link DnsQuestion}. Unlike
{@link #query(DnsQuestion)}, this method handles redirection, CNAMEs and multiple name servers.
If the specified {@link DnsQuestion} is {@code A} or {@code AAAA}, this method looks up the configured
{@link HostsFileEntries} before sending a query to the name servers. If a match is found in the
{@link HostsFileEntries}, a synthetic {@code A} or {@code AAAA} record will be returned.
@param question the question
@param additionals additional records ({@code OPT})
@param promise the {@link Promise} which will be fulfilled when the resolution is finished
@return the list of the {@link DnsRecord}s as the result of the resolution | [
"Resolves",
"the",
"{",
"@link",
"DnsRecord",
"}",
"s",
"that",
"are",
"matched",
"by",
"the",
"specified",
"{",
"@link",
"DnsQuestion",
"}",
".",
"Unlike",
"{",
"@link",
"#query",
"(",
"DnsQuestion",
")",
"}",
"this",
"method",
"handles",
"redirection",
"... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolver.java#L744-L748 | train | Resolve all the records in the question with the specified additionals. | [
30522,
2270,
2345,
2925,
1026,
2862,
1026,
1040,
3619,
2890,
27108,
2094,
1028,
1028,
10663,
8095,
1006,
1040,
3619,
15500,
3258,
3160,
1010,
2009,
6906,
3468,
1026,
1040,
3619,
2890,
27108,
2094,
1028,
3176,
2015,
1010,
4872,
1026,
2862,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/io/FileInputFormat.java | FileInputFormat.getFilePaths | public Path[] getFilePaths() {
if (supportsMultiPaths()) {
if (this.filePaths == null) {
return new Path[0];
}
return this.filePaths;
} else {
if (this.filePath == null) {
return new Path[0];
}
return new Path[] {filePath};
}
} | java | public Path[] getFilePaths() {
if (supportsMultiPaths()) {
if (this.filePaths == null) {
return new Path[0];
}
return this.filePaths;
} else {
if (this.filePath == null) {
return new Path[0];
}
return new Path[] {filePath};
}
} | [
"public",
"Path",
"[",
"]",
"getFilePaths",
"(",
")",
"{",
"if",
"(",
"supportsMultiPaths",
"(",
")",
")",
"{",
"if",
"(",
"this",
".",
"filePaths",
"==",
"null",
")",
"{",
"return",
"new",
"Path",
"[",
"0",
"]",
";",
"}",
"return",
"this",
".",
... | Returns the paths of all files to be read by the FileInputFormat.
@return The list of all paths to read. | [
"Returns",
"the",
"paths",
"of",
"all",
"files",
"to",
"be",
"read",
"by",
"the",
"FileInputFormat",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java#L285-L298 | train | Gets the file paths. | [
30522,
2270,
4130,
1031,
1033,
2131,
8873,
2571,
15069,
2015,
1006,
1007,
1063,
2065,
1006,
6753,
12274,
7096,
11514,
8988,
2015,
1006,
1007,
1007,
1063,
2065,
1006,
2023,
1012,
5371,
15069,
2015,
1027,
1027,
19701,
1007,
1063,
2709,
2047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/asymmetric/AbstractAsymmetricCrypto.java | AbstractAsymmetricCrypto.encryptBase64 | public String encryptBase64(String data, KeyType keyType) {
return Base64.encode(encrypt(data, keyType));
} | java | public String encryptBase64(String data, KeyType keyType) {
return Base64.encode(encrypt(data, keyType));
} | [
"public",
"String",
"encryptBase64",
"(",
"String",
"data",
",",
"KeyType",
"keyType",
")",
"{",
"return",
"Base64",
".",
"encode",
"(",
"encrypt",
"(",
"data",
",",
"keyType",
")",
")",
";",
"}"
] | 编码为Base64字符串,使用UTF-8编码
@param data 被加密的字符串
@param keyType 私钥或公钥 {@link KeyType}
@return Base64字符串
@since 4.0.1 | [
"编码为Base64字符串,使用UTF",
"-",
"8编码"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java#L137-L139 | train | Encrypts the given data using the specified key type. | [
30522,
2270,
5164,
4372,
26775,
22571,
2102,
15058,
21084,
1006,
5164,
2951,
1010,
3145,
13874,
3145,
13874,
1007,
1063,
2709,
2918,
21084,
1012,
4372,
16044,
1006,
4372,
26775,
22571,
2102,
1006,
2951,
1010,
3145,
13874,
1007,
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... |
alibaba/canal | client-adapter/launcher/src/main/java/com/alibaba/otter/canal/adapter/launcher/loader/AbstractCanalAdapterWorker.java | AbstractCanalAdapterWorker.batchSync | private void batchSync(List<Dml> dmls, OuterAdapter adapter) {
// 分批同步
if (dmls.size() <= canalClientConfig.getSyncBatchSize()) {
adapter.sync(dmls);
} else {
int len = 0;
List<Dml> dmlsBatch = new ArrayList<>();
for (Dml dml : dmls) {
dmlsBatch.add(dml);
if (dml.getData() == null || dml.getData().isEmpty()) {
len += 1;
} else {
len += dml.getData().size();
}
if (len >= canalClientConfig.getSyncBatchSize()) {
adapter.sync(dmlsBatch);
dmlsBatch.clear();
len = 0;
}
}
if (!dmlsBatch.isEmpty()) {
adapter.sync(dmlsBatch);
}
}
} | java | private void batchSync(List<Dml> dmls, OuterAdapter adapter) {
// 分批同步
if (dmls.size() <= canalClientConfig.getSyncBatchSize()) {
adapter.sync(dmls);
} else {
int len = 0;
List<Dml> dmlsBatch = new ArrayList<>();
for (Dml dml : dmls) {
dmlsBatch.add(dml);
if (dml.getData() == null || dml.getData().isEmpty()) {
len += 1;
} else {
len += dml.getData().size();
}
if (len >= canalClientConfig.getSyncBatchSize()) {
adapter.sync(dmlsBatch);
dmlsBatch.clear();
len = 0;
}
}
if (!dmlsBatch.isEmpty()) {
adapter.sync(dmlsBatch);
}
}
} | [
"private",
"void",
"batchSync",
"(",
"List",
"<",
"Dml",
">",
"dmls",
",",
"OuterAdapter",
"adapter",
")",
"{",
"// 分批同步",
"if",
"(",
"dmls",
".",
"size",
"(",
")",
"<=",
"canalClientConfig",
".",
"getSyncBatchSize",
"(",
")",
")",
"{",
"adapter",
".",
... | 分批同步
@param dmls
@param adapter | [
"分批同步"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/launcher/src/main/java/com/alibaba/otter/canal/adapter/launcher/loader/AbstractCanalAdapterWorker.java#L195-L219 | train | Batch sync. | [
30522,
2797,
11675,
14108,
6508,
12273,
1006,
2862,
1026,
1040,
19968,
1028,
1040,
19968,
2015,
1010,
6058,
8447,
13876,
2121,
15581,
2121,
1007,
1063,
1013,
1013,
1775,
100,
1794,
100,
2065,
1006,
1040,
19968,
2015,
1012,
2946,
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-examples/flink-examples-table/src/main/java/org/apache/flink/table/examples/java/WordCountSQL.java | WordCountSQL.main | public static void main(String[] args) throws Exception {
// set up execution environment
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
BatchTableEnvironment tEnv = BatchTableEnvironment.create(env);
DataSet<WC> input = env.fromElements(
new WC("Hello", 1),
new WC("Ciao", 1),
new WC("Hello", 1));
// register the DataSet as table "WordCount"
tEnv.registerDataSet("WordCount", input, "word, frequency");
// run a SQL query on the Table and retrieve the result as a new Table
Table table = tEnv.sqlQuery(
"SELECT word, SUM(frequency) as frequency FROM WordCount GROUP BY word");
DataSet<WC> result = tEnv.toDataSet(table, WC.class);
result.print();
} | java | public static void main(String[] args) throws Exception {
// set up execution environment
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
BatchTableEnvironment tEnv = BatchTableEnvironment.create(env);
DataSet<WC> input = env.fromElements(
new WC("Hello", 1),
new WC("Ciao", 1),
new WC("Hello", 1));
// register the DataSet as table "WordCount"
tEnv.registerDataSet("WordCount", input, "word, frequency");
// run a SQL query on the Table and retrieve the result as a new Table
Table table = tEnv.sqlQuery(
"SELECT word, SUM(frequency) as frequency FROM WordCount GROUP BY word");
DataSet<WC> result = tEnv.toDataSet(table, WC.class);
result.print();
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"// set up execution environment",
"ExecutionEnvironment",
"env",
"=",
"ExecutionEnvironment",
".",
"getExecutionEnvironment",
"(",
")",
";",
"BatchTableEnvironment",
... | ************************************************************************* | [
"*************************************************************************"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-examples/flink-examples-table/src/main/java/org/apache/flink/table/examples/java/WordCountSQL.java#L40-L61 | train | Main method to run the CRUD test. | [
30522,
2270,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
11618,
6453,
1063,
1013,
1013,
2275,
2039,
7781,
4044,
7781,
2368,
21663,
2239,
3672,
4372,
2615,
1027,
7781,
2368,
21663,
2239,
3672,
1012,
2131,
10288,
8586,
1370... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/context/condition/Condition.java | Condition.getConditionValues | public List<Comparable<?>> getConditionValues(final List<?> parameters) {
List<Comparable<?>> result = new LinkedList<>(positionValueMap.values());
for (Entry<Integer, Integer> entry : positionIndexMap.entrySet()) {
Object parameter = parameters.get(entry.getValue());
if (!(parameter instanceof Comparable<?>)) {
throw new ShardingException("Parameter `%s` should extends Comparable for sharding value.", parameter);
}
if (entry.getKey() < result.size()) {
result.add(entry.getKey(), (Comparable<?>) parameter);
} else {
result.add((Comparable<?>) parameter);
}
}
return result;
} | java | public List<Comparable<?>> getConditionValues(final List<?> parameters) {
List<Comparable<?>> result = new LinkedList<>(positionValueMap.values());
for (Entry<Integer, Integer> entry : positionIndexMap.entrySet()) {
Object parameter = parameters.get(entry.getValue());
if (!(parameter instanceof Comparable<?>)) {
throw new ShardingException("Parameter `%s` should extends Comparable for sharding value.", parameter);
}
if (entry.getKey() < result.size()) {
result.add(entry.getKey(), (Comparable<?>) parameter);
} else {
result.add((Comparable<?>) parameter);
}
}
return result;
} | [
"public",
"List",
"<",
"Comparable",
"<",
"?",
">",
">",
"getConditionValues",
"(",
"final",
"List",
"<",
"?",
">",
"parameters",
")",
"{",
"List",
"<",
"Comparable",
"<",
"?",
">",
">",
"result",
"=",
"new",
"LinkedList",
"<>",
"(",
"positionValueMap",
... | Get condition values.
@param parameters parameters
@return condition values | [
"Get",
"condition",
"values",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/context/condition/Condition.java#L115-L129 | train | Gets condition values. | [
30522,
2270,
2862,
1026,
12435,
1026,
1029,
1028,
1028,
2131,
8663,
20562,
10175,
15808,
1006,
2345,
2862,
1026,
1029,
1028,
11709,
1007,
1063,
2862,
1026,
12435,
1026,
1029,
1028,
1028,
2765,
1027,
2047,
5799,
9863,
1026,
1028,
1006,
2597,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/operators/AbstractUdfStreamOperator.java | AbstractUdfStreamOperator.setOutputType | @Override
public void setOutputType(TypeInformation<OUT> outTypeInfo, ExecutionConfig executionConfig) {
StreamingFunctionUtils.setOutputType(userFunction, outTypeInfo, executionConfig);
} | java | @Override
public void setOutputType(TypeInformation<OUT> outTypeInfo, ExecutionConfig executionConfig) {
StreamingFunctionUtils.setOutputType(userFunction, outTypeInfo, executionConfig);
} | [
"@",
"Override",
"public",
"void",
"setOutputType",
"(",
"TypeInformation",
"<",
"OUT",
">",
"outTypeInfo",
",",
"ExecutionConfig",
"executionConfig",
")",
"{",
"StreamingFunctionUtils",
".",
"setOutputType",
"(",
"userFunction",
",",
"outTypeInfo",
",",
"executionCon... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/AbstractUdfStreamOperator.java#L138-L141 | train | Sets the output type of the user function. | [
30522,
1030,
2058,
15637,
2270,
11675,
2275,
5833,
18780,
13874,
1006,
2828,
2378,
14192,
3370,
1026,
2041,
1028,
2041,
13874,
2378,
14876,
1010,
7781,
8663,
8873,
2290,
7781,
8663,
8873,
2290,
1007,
1063,
11058,
11263,
27989,
21823,
4877,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/window/assigners/SlidingWindowAssigner.java | SlidingWindowAssigner.of | public static SlidingWindowAssigner of(Duration size, Duration slide) {
return new SlidingWindowAssigner(size.toMillis(), slide.toMillis(), 0, true);
} | java | public static SlidingWindowAssigner of(Duration size, Duration slide) {
return new SlidingWindowAssigner(size.toMillis(), slide.toMillis(), 0, true);
} | [
"public",
"static",
"SlidingWindowAssigner",
"of",
"(",
"Duration",
"size",
",",
"Duration",
"slide",
")",
"{",
"return",
"new",
"SlidingWindowAssigner",
"(",
"size",
".",
"toMillis",
"(",
")",
",",
"slide",
".",
"toMillis",
"(",
")",
",",
"0",
",",
"true"... | Creates a new {@code SlidingEventTimeWindows} {@link org.apache.flink.streaming.api.windowing.assigners.WindowAssigner} that assigns
elements to sliding time windows based on the element timestamp.
@param size The size of the generated windows.
@param slide The slide interval of the generated windows.
@return The time policy. | [
"Creates",
"a",
"new",
"{",
"@code",
"SlidingEventTimeWindows",
"}",
"{",
"@link",
"org",
".",
"apache",
".",
"flink",
".",
"streaming",
".",
"api",
".",
"windowing",
".",
"assigners",
".",
"WindowAssigner",
"}",
"that",
"assigns",
"elements",
"to",
"sliding... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/window/assigners/SlidingWindowAssigner.java#L155-L157 | train | Creates a sliding window assigner. | [
30522,
2270,
10763,
8058,
11101,
21293,
18719,
10177,
2099,
1997,
1006,
9367,
2946,
1010,
9367,
7358,
1007,
1063,
2709,
2047,
8058,
11101,
21293,
18719,
10177,
2099,
1006,
2946,
1012,
3419,
8591,
2483,
1006,
1007,
1010,
7358,
1012,
3419,
85... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.parseArray | private static List<Integer> parseArray(String value, ValueParser parser){
final List<Integer> values = new ArrayList<>();
final List<String> parts = StrUtil.split(value, StrUtil.C_COMMA);
for (String part : parts) {
CollectionUtil.addAllIfNotContains(values, parseStep(part, parser));
}
return values;
} | java | private static List<Integer> parseArray(String value, ValueParser parser){
final List<Integer> values = new ArrayList<>();
final List<String> parts = StrUtil.split(value, StrUtil.C_COMMA);
for (String part : parts) {
CollectionUtil.addAllIfNotContains(values, parseStep(part, parser));
}
return values;
} | [
"private",
"static",
"List",
"<",
"Integer",
">",
"parseArray",
"(",
"String",
"value",
",",
"ValueParser",
"parser",
")",
"{",
"final",
"List",
"<",
"Integer",
">",
"values",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"final",
"List",
"<",
"String",
... | 处理数组形式表达式<br>
处理的形式包括:
<ul>
<li><strong>a</strong> 或 <strong>*</strong></li>
<li><strong>a,b,c,d</strong></li>
</ul>
@param value 子表达式值
@param parser 针对这个字段的解析器
@return 值列表 | [
"处理数组形式表达式<br",
">",
"处理的形式包括:",
"<ul",
">",
"<li",
">",
"<strong",
">",
"a<",
"/",
"strong",
">",
"或",
"<strong",
">",
"*",
"<",
"/",
"strong",
">",
"<",
"/",
"li",
">",
"<li",
">",
"<strong",
">",
"a",
"b",
"c",
"d<",
"/",
"strong",
">",
"<",... | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/pattern/matcher/ValueMatcherBuilder.java#L62-L70 | train | Parses an array of integers. | [
30522,
2797,
10763,
2862,
1026,
16109,
1028,
11968,
17310,
11335,
2100,
1006,
5164,
3643,
1010,
3643,
19362,
8043,
11968,
8043,
1007,
1063,
2345,
2862,
1026,
16109,
1028,
5300,
1027,
2047,
9140,
9863,
1026,
1028,
1006,
1007,
1025,
2345,
286... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | handler/src/main/java/com/networknt/handler/Handler.java | Handler.start | public static boolean start(HttpServerExchange httpServerExchange) {
// Get the matcher corresponding to the current request type.
PathTemplateMatcher<String> pathTemplateMatcher = methodToMatcherMap.get(httpServerExchange.getRequestMethod());
if (pathTemplateMatcher != null) {
// Match the current request path to the configured paths.
PathTemplateMatcher.PathMatchResult<String> result = pathTemplateMatcher
.match(httpServerExchange.getRequestPath());
if (result != null) {
// Found a match, configure and return true;
// Add path variables to query params.
httpServerExchange.putAttachment(ATTACHMENT_KEY,
new io.undertow.util.PathTemplateMatch(result.getMatchedTemplate(), result.getParameters()));
for (Map.Entry<String, String> entry : result.getParameters().entrySet()) {
// the values shouldn't be added to query param. but this is left as it was to keep backward compatability
httpServerExchange.addQueryParam(entry.getKey(), entry.getValue());
// put values in path param map
httpServerExchange.addPathParam(entry.getKey(), entry.getValue());
}
String id = result.getValue();
httpServerExchange.putAttachment(CHAIN_ID, id);
httpServerExchange.putAttachment(CHAIN_SEQ, 0);
return true;
}
}
return false;
} | java | public static boolean start(HttpServerExchange httpServerExchange) {
// Get the matcher corresponding to the current request type.
PathTemplateMatcher<String> pathTemplateMatcher = methodToMatcherMap.get(httpServerExchange.getRequestMethod());
if (pathTemplateMatcher != null) {
// Match the current request path to the configured paths.
PathTemplateMatcher.PathMatchResult<String> result = pathTemplateMatcher
.match(httpServerExchange.getRequestPath());
if (result != null) {
// Found a match, configure and return true;
// Add path variables to query params.
httpServerExchange.putAttachment(ATTACHMENT_KEY,
new io.undertow.util.PathTemplateMatch(result.getMatchedTemplate(), result.getParameters()));
for (Map.Entry<String, String> entry : result.getParameters().entrySet()) {
// the values shouldn't be added to query param. but this is left as it was to keep backward compatability
httpServerExchange.addQueryParam(entry.getKey(), entry.getValue());
// put values in path param map
httpServerExchange.addPathParam(entry.getKey(), entry.getValue());
}
String id = result.getValue();
httpServerExchange.putAttachment(CHAIN_ID, id);
httpServerExchange.putAttachment(CHAIN_SEQ, 0);
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"start",
"(",
"HttpServerExchange",
"httpServerExchange",
")",
"{",
"// Get the matcher corresponding to the current request type.",
"PathTemplateMatcher",
"<",
"String",
">",
"pathTemplateMatcher",
"=",
"methodToMatcherMap",
".",
"get",
"(",
"h... | On the first step of the request, match the request against the configured
paths. If the match is successful, store the chain id within the exchange.
Otherwise return false.
@param httpServerExchange
The current requests server exchange.
@return true if a handler has been defined for the given path. | [
"On",
"the",
"first",
"step",
"of",
"the",
"request",
"match",
"the",
"request",
"against",
"the",
"configured",
"paths",
".",
"If",
"the",
"match",
"is",
"successful",
"store",
"the",
"chain",
"id",
"within",
"the",
"exchange",
".",
"Otherwise",
"return",
... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/handler/src/main/java/com/networknt/handler/Handler.java#L311-L337 | train | Start the servlet. | [
30522,
2270,
10763,
22017,
20898,
2707,
1006,
16770,
2121,
28943,
2595,
22305,
2063,
16770,
2121,
28943,
2595,
22305,
2063,
1007,
1063,
1013,
1013,
2131,
1996,
2674,
2121,
7978,
2000,
1996,
2783,
5227,
2828,
1012,
4130,
18532,
15725,
18900,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/collection/trie/bintrie/BinTrie.java | BinTrie.parseLongestText | public void parseLongestText(String text, AhoCorasickDoubleArrayTrie.IHit<V> processor)
{
int length = text.length();
for (int i = 0; i < length; ++i)
{
BaseNode<V> state = transition(text.charAt(i));
if (state != null)
{
int to = i + 1;
int end = to;
V value = state.getValue();
for (; to < length; ++to)
{
state = state.transition(text.charAt(to));
if (state == null) break;
if (state.getValue() != null)
{
value = state.getValue();
end = to + 1;
}
}
if (value != null)
{
processor.hit(i, end, value);
i = end - 1;
}
}
}
} | java | public void parseLongestText(String text, AhoCorasickDoubleArrayTrie.IHit<V> processor)
{
int length = text.length();
for (int i = 0; i < length; ++i)
{
BaseNode<V> state = transition(text.charAt(i));
if (state != null)
{
int to = i + 1;
int end = to;
V value = state.getValue();
for (; to < length; ++to)
{
state = state.transition(text.charAt(to));
if (state == null) break;
if (state.getValue() != null)
{
value = state.getValue();
end = to + 1;
}
}
if (value != null)
{
processor.hit(i, end, value);
i = end - 1;
}
}
}
} | [
"public",
"void",
"parseLongestText",
"(",
"String",
"text",
",",
"AhoCorasickDoubleArrayTrie",
".",
"IHit",
"<",
"V",
">",
"processor",
")",
"{",
"int",
"length",
"=",
"text",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
... | 最长匹配
@param text 文本
@param processor 处理器 | [
"最长匹配"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/bintrie/BinTrie.java#L523-L551 | train | Parses the text of the Aho Corasick Double Array trie. | [
30522,
2270,
11675,
11968,
11246,
5063,
4355,
18209,
1006,
5164,
3793,
1010,
6289,
24163,
8180,
6799,
26797,
3468,
2906,
9447,
18886,
2063,
1012,
1045,
16584,
1026,
1058,
1028,
13151,
1007,
1063,
20014,
3091,
1027,
3793,
1012,
3091,
1006,
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-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java | CliFrontend.savepoint | protected void savepoint(String[] args) throws Exception {
LOG.info("Running 'savepoint' command.");
final Options commandOptions = CliFrontendParser.getSavepointCommandOptions();
final Options commandLineOptions = CliFrontendParser.mergeOptions(commandOptions, customCommandLineOptions);
final CommandLine commandLine = CliFrontendParser.parse(commandLineOptions, args, false);
final SavepointOptions savepointOptions = new SavepointOptions(commandLine);
// evaluate help flag
if (savepointOptions.isPrintHelp()) {
CliFrontendParser.printHelpForSavepoint(customCommandLines);
return;
}
final CustomCommandLine<?> activeCommandLine = getActiveCustomCommandLine(commandLine);
if (savepointOptions.isDispose()) {
runClusterAction(
activeCommandLine,
commandLine,
clusterClient -> disposeSavepoint(clusterClient, savepointOptions.getSavepointPath()));
} else {
String[] cleanedArgs = savepointOptions.getArgs();
final JobID jobId;
if (cleanedArgs.length >= 1) {
String jobIdString = cleanedArgs[0];
jobId = parseJobId(jobIdString);
} else {
throw new CliArgsException("Missing JobID. " +
"Specify a Job ID to trigger a savepoint.");
}
final String savepointDirectory;
if (cleanedArgs.length >= 2) {
savepointDirectory = cleanedArgs[1];
} else {
savepointDirectory = null;
}
// Print superfluous arguments
if (cleanedArgs.length >= 3) {
logAndSysout("Provided more arguments than required. Ignoring not needed arguments.");
}
runClusterAction(
activeCommandLine,
commandLine,
clusterClient -> triggerSavepoint(clusterClient, jobId, savepointDirectory));
}
} | java | protected void savepoint(String[] args) throws Exception {
LOG.info("Running 'savepoint' command.");
final Options commandOptions = CliFrontendParser.getSavepointCommandOptions();
final Options commandLineOptions = CliFrontendParser.mergeOptions(commandOptions, customCommandLineOptions);
final CommandLine commandLine = CliFrontendParser.parse(commandLineOptions, args, false);
final SavepointOptions savepointOptions = new SavepointOptions(commandLine);
// evaluate help flag
if (savepointOptions.isPrintHelp()) {
CliFrontendParser.printHelpForSavepoint(customCommandLines);
return;
}
final CustomCommandLine<?> activeCommandLine = getActiveCustomCommandLine(commandLine);
if (savepointOptions.isDispose()) {
runClusterAction(
activeCommandLine,
commandLine,
clusterClient -> disposeSavepoint(clusterClient, savepointOptions.getSavepointPath()));
} else {
String[] cleanedArgs = savepointOptions.getArgs();
final JobID jobId;
if (cleanedArgs.length >= 1) {
String jobIdString = cleanedArgs[0];
jobId = parseJobId(jobIdString);
} else {
throw new CliArgsException("Missing JobID. " +
"Specify a Job ID to trigger a savepoint.");
}
final String savepointDirectory;
if (cleanedArgs.length >= 2) {
savepointDirectory = cleanedArgs[1];
} else {
savepointDirectory = null;
}
// Print superfluous arguments
if (cleanedArgs.length >= 3) {
logAndSysout("Provided more arguments than required. Ignoring not needed arguments.");
}
runClusterAction(
activeCommandLine,
commandLine,
clusterClient -> triggerSavepoint(clusterClient, jobId, savepointDirectory));
}
} | [
"protected",
"void",
"savepoint",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"LOG",
".",
"info",
"(",
"\"Running 'savepoint' command.\"",
")",
";",
"final",
"Options",
"commandOptions",
"=",
"CliFrontendParser",
".",
"getSavepointCommandOption... | Executes the SAVEPOINT action.
@param args Command line arguments for the savepoint action. | [
"Executes",
"the",
"SAVEPOINT",
"action",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java#L630-L686 | train | Execute a savepoint command. | [
30522,
5123,
11675,
3828,
8400,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
11618,
6453,
1063,
8833,
1012,
18558,
1006,
1000,
2770,
1005,
3828,
8400,
1005,
3094,
1012,
1000,
1007,
1025,
2345,
7047,
15054,
16790,
2015,
1027,
18856,
10128,
494... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.