repo stringclasses 11 values | path stringlengths 41 234 | func_name stringlengths 5 78 | original_string stringlengths 71 14.1k | language stringclasses 1 value | code stringlengths 71 14.1k | code_tokens sequencelengths 22 2.65k | docstring stringlengths 2 5.35k | docstring_tokens sequencelengths 1 369 | sha stringclasses 11 values | url stringlengths 129 339 | partition stringclasses 1 value | summary stringlengths 7 175 | input_ids sequencelengths 502 502 | token_type_ids sequencelengths 502 502 | attention_mask sequencelengths 502 502 | labels sequencelengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
alibaba/canal | parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlConnection.java | MysqlConnection.loadBinlogChecksum | private void loadBinlogChecksum() {
ResultSetPacket rs = null;
try {
rs = query("select @@global.binlog_checksum");
List<String> columnValues = rs.getFieldValues();
if (columnValues != null && columnValues.size() >= 1 && columnValues.get(0).toUpperCase().equals("CRC32")) {
binlogChecksum = LogEvent.BINLOG_CHECKSUM_ALG_CRC32;
} else {
binlogChecksum = LogEvent.BINLOG_CHECKSUM_ALG_OFF;
}
} catch (Throwable e) {
logger.error("", e);
binlogChecksum = LogEvent.BINLOG_CHECKSUM_ALG_OFF;
}
} | java | private void loadBinlogChecksum() {
ResultSetPacket rs = null;
try {
rs = query("select @@global.binlog_checksum");
List<String> columnValues = rs.getFieldValues();
if (columnValues != null && columnValues.size() >= 1 && columnValues.get(0).toUpperCase().equals("CRC32")) {
binlogChecksum = LogEvent.BINLOG_CHECKSUM_ALG_CRC32;
} else {
binlogChecksum = LogEvent.BINLOG_CHECKSUM_ALG_OFF;
}
} catch (Throwable e) {
logger.error("", e);
binlogChecksum = LogEvent.BINLOG_CHECKSUM_ALG_OFF;
}
} | [
"private",
"void",
"loadBinlogChecksum",
"(",
")",
"{",
"ResultSetPacket",
"rs",
"=",
"null",
";",
"try",
"{",
"rs",
"=",
"query",
"(",
"\"select @@global.binlog_checksum\"",
")",
";",
"List",
"<",
"String",
">",
"columnValues",
"=",
"rs",
".",
"getFieldValues... | 获取主库checksum信息
<pre>
mariadb区别于mysql会在binlog的第一个事件Rotate_Event里也会采用checksum逻辑,而mysql是在第二个binlog事件之后才感知是否需要处理checksum
导致maraidb只要是开启checksum就会出现binlog文件名解析乱码
fixed issue : https://github.com/alibaba/canal/issues/1081
</pre> | [
"获取主库checksum信息"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlConnection.java#L519-L533 | train | Load the binlog checksum | [
30522,
2797,
11675,
7170,
8428,
21197,
5403,
10603,
2819,
1006,
1007,
1063,
3463,
3388,
23947,
3388,
12667,
1027,
19701,
1025,
3046,
1063,
12667,
1027,
23032,
1006,
1000,
7276,
1030,
1030,
3795,
1012,
8026,
21197,
1035,
14148,
2819,
1000,
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/flink/table/plan/rules/logical/ExtendedAggregateExtractProjectRule.java | ExtendedAggregateExtractProjectRule.getInputFieldUsed | private ImmutableBitSet.Builder getInputFieldUsed(Aggregate aggregate, RelNode input) {
// 1. group fields are always used
final ImmutableBitSet.Builder inputFieldsUsed =
aggregate.getGroupSet().rebuild();
// 2. agg functions
for (AggregateCall aggCall : aggregate.getAggCallList()) {
for (int i : aggCall.getArgList()) {
inputFieldsUsed.set(i);
}
if (aggCall.filterArg >= 0) {
inputFieldsUsed.set(aggCall.filterArg);
}
}
// 3. window time field if the aggregate is a group window aggregate.
if (aggregate instanceof LogicalWindowAggregate) {
inputFieldsUsed.set(getWindowTimeFieldIndex((LogicalWindowAggregate) aggregate, input));
}
return inputFieldsUsed;
} | java | private ImmutableBitSet.Builder getInputFieldUsed(Aggregate aggregate, RelNode input) {
// 1. group fields are always used
final ImmutableBitSet.Builder inputFieldsUsed =
aggregate.getGroupSet().rebuild();
// 2. agg functions
for (AggregateCall aggCall : aggregate.getAggCallList()) {
for (int i : aggCall.getArgList()) {
inputFieldsUsed.set(i);
}
if (aggCall.filterArg >= 0) {
inputFieldsUsed.set(aggCall.filterArg);
}
}
// 3. window time field if the aggregate is a group window aggregate.
if (aggregate instanceof LogicalWindowAggregate) {
inputFieldsUsed.set(getWindowTimeFieldIndex((LogicalWindowAggregate) aggregate, input));
}
return inputFieldsUsed;
} | [
"private",
"ImmutableBitSet",
".",
"Builder",
"getInputFieldUsed",
"(",
"Aggregate",
"aggregate",
",",
"RelNode",
"input",
")",
"{",
"// 1. group fields are always used",
"final",
"ImmutableBitSet",
".",
"Builder",
"inputFieldsUsed",
"=",
"aggregate",
".",
"getGroupSet",
... | Compute which input fields are used by the aggregate. | [
"Compute",
"which",
"input",
"fields",
"are",
"used",
"by",
"the",
"aggregate",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/plan/rules/logical/ExtendedAggregateExtractProjectRule.java#L124-L142 | train | Gets the input field used by the given aggregate. | [
30522,
2797,
10047,
28120,
3085,
16313,
13462,
1012,
12508,
2131,
2378,
18780,
3790,
13901,
1006,
9572,
9572,
1010,
2128,
19666,
10244,
7953,
1007,
1063,
1013,
1013,
1015,
1012,
2177,
4249,
2024,
2467,
2109,
2345,
10047,
28120,
3085,
16313,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/util/InterpreterUtils.java | InterpreterUtils.deserializeFunction | @SuppressWarnings("unchecked")
public static <X> X deserializeFunction(RuntimeContext context, byte[] serFun) throws FlinkException {
if (!jythonInitialized) {
// This branch is only tested by end-to-end tests
String path = context.getDistributedCache().getFile(PythonConstants.FLINK_PYTHON_DC_ID).getAbsolutePath();
String scriptName = PythonStreamExecutionEnvironment.PythonJobParameters.getScriptName(context.getExecutionConfig().getGlobalJobParameters());
try {
initPythonInterpreter(
new String[]{Paths.get(path, scriptName).toString()},
path,
scriptName);
} catch (Exception e) {
try {
LOG.error("Initialization of jython failed.", e);
throw new FlinkRuntimeException("Initialization of jython failed.", e);
} catch (Exception ie) {
// this may occur if the initial exception relies on jython being initialized properly
LOG.error("Initialization of jython failed. Could not print original stacktrace.", ie);
throw new FlinkRuntimeException("Initialization of jython failed. Could not print original stacktrace.");
}
}
}
try {
return (X) SerializationUtils.deserializeObject(serFun);
} catch (IOException | ClassNotFoundException ex) {
throw new FlinkException("Deserialization of user-function failed.", ex);
}
} | java | @SuppressWarnings("unchecked")
public static <X> X deserializeFunction(RuntimeContext context, byte[] serFun) throws FlinkException {
if (!jythonInitialized) {
// This branch is only tested by end-to-end tests
String path = context.getDistributedCache().getFile(PythonConstants.FLINK_PYTHON_DC_ID).getAbsolutePath();
String scriptName = PythonStreamExecutionEnvironment.PythonJobParameters.getScriptName(context.getExecutionConfig().getGlobalJobParameters());
try {
initPythonInterpreter(
new String[]{Paths.get(path, scriptName).toString()},
path,
scriptName);
} catch (Exception e) {
try {
LOG.error("Initialization of jython failed.", e);
throw new FlinkRuntimeException("Initialization of jython failed.", e);
} catch (Exception ie) {
// this may occur if the initial exception relies on jython being initialized properly
LOG.error("Initialization of jython failed. Could not print original stacktrace.", ie);
throw new FlinkRuntimeException("Initialization of jython failed. Could not print original stacktrace.");
}
}
}
try {
return (X) SerializationUtils.deserializeObject(serFun);
} catch (IOException | ClassNotFoundException ex) {
throw new FlinkException("Deserialization of user-function failed.", ex);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"X",
">",
"X",
"deserializeFunction",
"(",
"RuntimeContext",
"context",
",",
"byte",
"[",
"]",
"serFun",
")",
"throws",
"FlinkException",
"{",
"if",
"(",
"!",
"jythonInitialized",
")"... | Deserialize the given python function. If the functions class definition cannot be found we assume that this is
the first invocation of this method for a given job and load the python script containing the class definition
via jython.
@param context the RuntimeContext of the java function
@param serFun serialized python UDF
@return deserialized python UDF
@throws FlinkException if the deserialization failed | [
"Deserialize",
"the",
"given",
"python",
"function",
".",
"If",
"the",
"functions",
"class",
"definition",
"cannot",
"be",
"found",
"we",
"assume",
"that",
"this",
"is",
"the",
"first",
"invocation",
"of",
"this",
"method",
"for",
"a",
"given",
"job",
"and",... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/util/InterpreterUtils.java#L64-L95 | train | Deserializes a user - defined function. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1060,
1028,
1060,
4078,
11610,
3669,
4371,
11263,
27989,
1006,
2448,
7292,
8663,
18209,
6123,
1010,
24880,
1031,
1033,
14262,
11263,
2078,
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/util/ClassLoaderUtil.java | ClassLoaderUtil.loadClass | public static Class<?> loadClass(String name, boolean isInitialized) throws UtilException {
return loadClass(name, null, isInitialized);
} | java | public static Class<?> loadClass(String name, boolean isInitialized) throws UtilException {
return loadClass(name, null, isInitialized);
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"loadClass",
"(",
"String",
"name",
",",
"boolean",
"isInitialized",
")",
"throws",
"UtilException",
"{",
"return",
"loadClass",
"(",
"name",
",",
"null",
",",
"isInitialized",
")",
";",
"}"
] | 加载类,通过传入类的字符串,返回其对应的类名,使用默认ClassLoader<br>
扩展{@link Class#forName(String, boolean, ClassLoader)}方法,支持以下几类类名的加载:
<pre>
1、原始类型,例如:int
2、数组类型,例如:int[]、Long[]、String[]
3、内部类,例如:java.lang.Thread.State会被转为java.lang.Thread$State加载
</pre>
@param name 类名
@param isInitialized 是否初始化类(调用static模块内容和初始化static属性)
@return 类名对应的类
@throws UtilException 包装{@link ClassNotFoundException},没有类名对应的类时抛出此异常 | [
"加载类,通过传入类的字符串,返回其对应的类名,使用默认ClassLoader<br",
">",
"扩展",
"{",
"@link",
"Class#forName",
"(",
"String",
"boolean",
"ClassLoader",
")",
"}",
"方法,支持以下几类类名的加载:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassLoaderUtil.java#L125-L127 | train | Load a class from a name. | [
30522,
2270,
10763,
2465,
1026,
1029,
1028,
7170,
26266,
1006,
5164,
2171,
1010,
22017,
20898,
2003,
5498,
20925,
3550,
1007,
11618,
21183,
9463,
2595,
24422,
1063,
2709,
7170,
26266,
1006,
2171,
1010,
19701,
1010,
2003,
5498,
20925,
3550,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-devtools/src/main/java/org/springframework/boot/devtools/DevtoolsEnablementDeducer.java | DevtoolsEnablementDeducer.shouldEnable | public static boolean shouldEnable(Thread thread) {
for (StackTraceElement element : thread.getStackTrace()) {
if (isSkippedStackElement(element)) {
return false;
}
}
return true;
} | java | public static boolean shouldEnable(Thread thread) {
for (StackTraceElement element : thread.getStackTrace()) {
if (isSkippedStackElement(element)) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"shouldEnable",
"(",
"Thread",
"thread",
")",
"{",
"for",
"(",
"StackTraceElement",
"element",
":",
"thread",
".",
"getStackTrace",
"(",
")",
")",
"{",
"if",
"(",
"isSkippedStackElement",
"(",
"element",
")",
")",
"{",
"return"... | Checks if a specific {@link StackTraceElement} in the current thread's stacktrace
should cause devtools to be disabled.
@param thread the current thread
@return {@code true} if devtools should be enabled skipped | [
"Checks",
"if",
"a",
"specific",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/DevtoolsEnablementDeducer.java#L50-L57 | train | Returns true if the given thread should be enabled. | [
30522,
2270,
10763,
22017,
20898,
2323,
8189,
3468,
1006,
11689,
11689,
1007,
1063,
2005,
1006,
9991,
6494,
3401,
12260,
3672,
5783,
1024,
11689,
1012,
4152,
2696,
3600,
6494,
3401,
1006,
1007,
1007,
1063,
2065,
1006,
26354,
3211,
11469,
91... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/Timer.java | Timer.time | public <T> T time(Callable<T> event) throws Exception {
final long startTime = clock.getTick();
try {
return event.call();
} finally {
update(clock.getTick() - startTime);
}
} | java | public <T> T time(Callable<T> event) throws Exception {
final long startTime = clock.getTick();
try {
return event.call();
} finally {
update(clock.getTick() - startTime);
}
} | [
"public",
"<",
"T",
">",
"T",
"time",
"(",
"Callable",
"<",
"T",
">",
"event",
")",
"throws",
"Exception",
"{",
"final",
"long",
"startTime",
"=",
"clock",
".",
"getTick",
"(",
")",
";",
"try",
"{",
"return",
"event",
".",
"call",
"(",
")",
";",
... | Times and records the duration of an event.
@param event a {@link Callable} whose {@link Callable#call()} method implements a process
whose duration should be timed
@param <T> the type of the value returned by {@code event}
@return the value returned by {@code event}
@throws Exception if {@code event} throws an {@link Exception} | [
"Times",
"and",
"records",
"the",
"duration",
"of",
"an",
"event",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/Timer.java#L119-L126 | train | Time a Callable. | [
30522,
2270,
1026,
1056,
1028,
1056,
2051,
1006,
2655,
3085,
1026,
1056,
1028,
2724,
1007,
11618,
6453,
1063,
2345,
2146,
2707,
7292,
1027,
5119,
1012,
2131,
26348,
1006,
1007,
1025,
3046,
1063,
2709,
2724,
1012,
2655,
1006,
1007,
1025,
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/date/DateUtil.java | DateUtil.yearAndQuarter | public static LinkedHashSet<String> yearAndQuarter(long startDate, long endDate) {
LinkedHashSet<String> quarters = new LinkedHashSet<>();
final Calendar cal = calendar(startDate);
while (startDate <= endDate) {
// 如果开始时间超出结束时间,让结束时间为开始时间,处理完后结束循环
quarters.add(yearAndQuarter(cal));
cal.add(Calendar.MONTH, 3);
startDate = cal.getTimeInMillis();
}
return quarters;
} | java | public static LinkedHashSet<String> yearAndQuarter(long startDate, long endDate) {
LinkedHashSet<String> quarters = new LinkedHashSet<>();
final Calendar cal = calendar(startDate);
while (startDate <= endDate) {
// 如果开始时间超出结束时间,让结束时间为开始时间,处理完后结束循环
quarters.add(yearAndQuarter(cal));
cal.add(Calendar.MONTH, 3);
startDate = cal.getTimeInMillis();
}
return quarters;
} | [
"public",
"static",
"LinkedHashSet",
"<",
"String",
">",
"yearAndQuarter",
"(",
"long",
"startDate",
",",
"long",
"endDate",
")",
"{",
"LinkedHashSet",
"<",
"String",
">",
"quarters",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
")",
";",
"final",
"Calendar",
"ca... | 获得指定日期区间内的年份和季节<br>
@param startDate 起始日期(包含)
@param endDate 结束日期(包含)
@return 季度列表 ,元素类似于 20132
@since 4.1.15 | [
"获得指定日期区间内的年份和季节<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L443-L455 | train | Gets the calendar year and quarter parts from the start date and end date. | [
30522,
2270,
10763,
5799,
14949,
7898,
3388,
1026,
5164,
1028,
2095,
5685,
16211,
19418,
1006,
2146,
2707,
13701,
1010,
2146,
2203,
13701,
1007,
1063,
5799,
14949,
7898,
3388,
1026,
5164,
1028,
7728,
1027,
2047,
5799,
14949,
7898,
3388,
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-connectors/flink-connector-kafka-0.8/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/Kafka08Fetcher.java | Kafka08Fetcher.createAndStartSimpleConsumerThread | private SimpleConsumerThread<T> createAndStartSimpleConsumerThread(
List<KafkaTopicPartitionState<TopicAndPartition>> seedPartitions,
Node leader,
ExceptionProxy errorHandler) throws IOException, ClassNotFoundException {
// each thread needs its own copy of the deserializer, because the deserializer is
// not necessarily thread safe
final KafkaDeserializationSchema<T> clonedDeserializer =
InstantiationUtil.clone(deserializer, runtimeContext.getUserCodeClassLoader());
// seed thread with list of fetch partitions (otherwise it would shut down immediately again
SimpleConsumerThread<T> brokerThread = new SimpleConsumerThread<>(
this, errorHandler, kafkaConfig, leader, seedPartitions, unassignedPartitionsQueue,
clonedDeserializer, invalidOffsetBehavior);
brokerThread.setName(String.format("SimpleConsumer - %s - broker-%s (%s:%d)",
runtimeContext.getTaskName(), leader.id(), leader.host(), leader.port()));
brokerThread.setDaemon(true);
brokerThread.start();
LOG.info("Starting thread {}", brokerThread.getName());
return brokerThread;
} | java | private SimpleConsumerThread<T> createAndStartSimpleConsumerThread(
List<KafkaTopicPartitionState<TopicAndPartition>> seedPartitions,
Node leader,
ExceptionProxy errorHandler) throws IOException, ClassNotFoundException {
// each thread needs its own copy of the deserializer, because the deserializer is
// not necessarily thread safe
final KafkaDeserializationSchema<T> clonedDeserializer =
InstantiationUtil.clone(deserializer, runtimeContext.getUserCodeClassLoader());
// seed thread with list of fetch partitions (otherwise it would shut down immediately again
SimpleConsumerThread<T> brokerThread = new SimpleConsumerThread<>(
this, errorHandler, kafkaConfig, leader, seedPartitions, unassignedPartitionsQueue,
clonedDeserializer, invalidOffsetBehavior);
brokerThread.setName(String.format("SimpleConsumer - %s - broker-%s (%s:%d)",
runtimeContext.getTaskName(), leader.id(), leader.host(), leader.port()));
brokerThread.setDaemon(true);
brokerThread.start();
LOG.info("Starting thread {}", brokerThread.getName());
return brokerThread;
} | [
"private",
"SimpleConsumerThread",
"<",
"T",
">",
"createAndStartSimpleConsumerThread",
"(",
"List",
"<",
"KafkaTopicPartitionState",
"<",
"TopicAndPartition",
">",
">",
"seedPartitions",
",",
"Node",
"leader",
",",
"ExceptionProxy",
"errorHandler",
")",
"throws",
"IOEx... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-0.8/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/Kafka08Fetcher.java#L384-L405 | train | Creates and starts a SimpleConsumerThread. | [
30522,
2797,
3722,
8663,
23545,
15265,
16416,
2094,
1026,
1056,
1028,
3443,
29560,
7559,
3215,
5714,
10814,
8663,
23545,
15265,
16416,
2094,
1006,
2862,
1026,
10556,
24316,
10610,
24330,
19362,
3775,
9285,
12259,
1026,
8476,
5685,
19362,
3775... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/convert/impl/ArrayConverter.java | ArrayConverter.convertObjectToArray | private Object convertObjectToArray(Object value) {
if (value instanceof CharSequence) {
if (targetComponentType == char.class || targetComponentType == Character.class) {
return convertArrayToArray(value.toString().toCharArray());
}
// 单纯字符串情况下按照逗号分隔后劈开
final String[] strings = StrUtil.split(value.toString(), StrUtil.COMMA);
return convertArrayToArray(strings);
}
final ConverterRegistry converter = ConverterRegistry.getInstance();
Object result = null;
if (value instanceof List) {
// List转数组
final List<?> list = (List<?>) value;
result = Array.newInstance(targetComponentType, list.size());
for (int i = 0; i < list.size(); i++) {
Array.set(result, i, converter.convert(targetComponentType, list.get(i)));
}
} else if (value instanceof Collection) {
// 集合转数组
final Collection<?> collection = (Collection<?>) value;
result = Array.newInstance(targetComponentType, collection.size());
int i = 0;
for (Object element : collection) {
Array.set(result, i, converter.convert(targetComponentType, element));
i++;
}
} else if (value instanceof Iterable) {
// 可循环对象转数组,可循环对象无法获取长度,因此先转为List后转为数组
final List<?> list = IterUtil.toList((Iterable<?>) value);
result = Array.newInstance(targetComponentType, list.size());
for (int i = 0; i < list.size(); i++) {
Array.set(result, i, converter.convert(targetComponentType, list.get(i)));
}
} else if (value instanceof Iterator) {
// 可循环对象转数组,可循环对象无法获取长度,因此先转为List后转为数组
final List<?> list = IterUtil.toList((Iterator<?>) value);
result = Array.newInstance(targetComponentType, list.size());
for (int i = 0; i < list.size(); i++) {
Array.set(result, i, converter.convert(targetComponentType, list.get(i)));
}
} else {
// everything else:
result = convertToSingleElementArray(value);
}
return result;
} | java | private Object convertObjectToArray(Object value) {
if (value instanceof CharSequence) {
if (targetComponentType == char.class || targetComponentType == Character.class) {
return convertArrayToArray(value.toString().toCharArray());
}
// 单纯字符串情况下按照逗号分隔后劈开
final String[] strings = StrUtil.split(value.toString(), StrUtil.COMMA);
return convertArrayToArray(strings);
}
final ConverterRegistry converter = ConverterRegistry.getInstance();
Object result = null;
if (value instanceof List) {
// List转数组
final List<?> list = (List<?>) value;
result = Array.newInstance(targetComponentType, list.size());
for (int i = 0; i < list.size(); i++) {
Array.set(result, i, converter.convert(targetComponentType, list.get(i)));
}
} else if (value instanceof Collection) {
// 集合转数组
final Collection<?> collection = (Collection<?>) value;
result = Array.newInstance(targetComponentType, collection.size());
int i = 0;
for (Object element : collection) {
Array.set(result, i, converter.convert(targetComponentType, element));
i++;
}
} else if (value instanceof Iterable) {
// 可循环对象转数组,可循环对象无法获取长度,因此先转为List后转为数组
final List<?> list = IterUtil.toList((Iterable<?>) value);
result = Array.newInstance(targetComponentType, list.size());
for (int i = 0; i < list.size(); i++) {
Array.set(result, i, converter.convert(targetComponentType, list.get(i)));
}
} else if (value instanceof Iterator) {
// 可循环对象转数组,可循环对象无法获取长度,因此先转为List后转为数组
final List<?> list = IterUtil.toList((Iterator<?>) value);
result = Array.newInstance(targetComponentType, list.size());
for (int i = 0; i < list.size(); i++) {
Array.set(result, i, converter.convert(targetComponentType, list.get(i)));
}
} else {
// everything else:
result = convertToSingleElementArray(value);
}
return result;
} | [
"private",
"Object",
"convertObjectToArray",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"instanceof",
"CharSequence",
")",
"{",
"if",
"(",
"targetComponentType",
"==",
"char",
".",
"class",
"||",
"targetComponentType",
"==",
"Character",
".",
"class",... | 非数组对数组转换
@param value 被转换值
@return 转换后的数组 | [
"非数组对数组转换"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/impl/ArrayConverter.java#L87-L137 | train | Convert object to array. | [
30522,
2797,
4874,
10463,
16429,
20614,
3406,
2906,
9447,
1006,
4874,
3643,
1007,
1063,
2065,
1006,
3643,
6013,
11253,
25869,
3366,
4226,
5897,
1007,
1063,
2065,
1006,
4539,
9006,
29513,
3372,
13874,
1027,
1027,
25869,
1012,
2465,
1064,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/OneForOneBlockFetcher.java | OneForOneBlockFetcher.start | public void start() {
if (blockIds.length == 0) {
throw new IllegalArgumentException("Zero-sized blockIds array");
}
client.sendRpc(openMessage.toByteBuffer(), new RpcResponseCallback() {
@Override
public void onSuccess(ByteBuffer response) {
try {
streamHandle = (StreamHandle) BlockTransferMessage.Decoder.fromByteBuffer(response);
logger.trace("Successfully opened blocks {}, preparing to fetch chunks.", streamHandle);
// Immediately request all chunks -- we expect that the total size of the request is
// reasonable due to higher level chunking in [[ShuffleBlockFetcherIterator]].
for (int i = 0; i < streamHandle.numChunks; i++) {
if (downloadFileManager != null) {
client.stream(OneForOneStreamManager.genStreamChunkId(streamHandle.streamId, i),
new DownloadCallback(i));
} else {
client.fetchChunk(streamHandle.streamId, i, chunkCallback);
}
}
} catch (Exception e) {
logger.error("Failed while starting block fetches after success", e);
failRemainingBlocks(blockIds, e);
}
}
@Override
public void onFailure(Throwable e) {
logger.error("Failed while starting block fetches", e);
failRemainingBlocks(blockIds, e);
}
});
} | java | public void start() {
if (blockIds.length == 0) {
throw new IllegalArgumentException("Zero-sized blockIds array");
}
client.sendRpc(openMessage.toByteBuffer(), new RpcResponseCallback() {
@Override
public void onSuccess(ByteBuffer response) {
try {
streamHandle = (StreamHandle) BlockTransferMessage.Decoder.fromByteBuffer(response);
logger.trace("Successfully opened blocks {}, preparing to fetch chunks.", streamHandle);
// Immediately request all chunks -- we expect that the total size of the request is
// reasonable due to higher level chunking in [[ShuffleBlockFetcherIterator]].
for (int i = 0; i < streamHandle.numChunks; i++) {
if (downloadFileManager != null) {
client.stream(OneForOneStreamManager.genStreamChunkId(streamHandle.streamId, i),
new DownloadCallback(i));
} else {
client.fetchChunk(streamHandle.streamId, i, chunkCallback);
}
}
} catch (Exception e) {
logger.error("Failed while starting block fetches after success", e);
failRemainingBlocks(blockIds, e);
}
}
@Override
public void onFailure(Throwable e) {
logger.error("Failed while starting block fetches", e);
failRemainingBlocks(blockIds, e);
}
});
} | [
"public",
"void",
"start",
"(",
")",
"{",
"if",
"(",
"blockIds",
".",
"length",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Zero-sized blockIds array\"",
")",
";",
"}",
"client",
".",
"sendRpc",
"(",
"openMessage",
".",
"toByteBu... | Begins the fetching process, calling the listener with every block fetched.
The given message will be serialized with the Java serializer, and the RPC must return a
{@link StreamHandle}. We will send all fetch requests immediately, without throttling. | [
"Begins",
"the",
"fetching",
"process",
"calling",
"the",
"listener",
"with",
"every",
"block",
"fetched",
".",
"The",
"given",
"message",
"will",
"be",
"serialized",
"with",
"the",
"Java",
"serializer",
"and",
"the",
"RPC",
"must",
"return",
"a",
"{"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/OneForOneBlockFetcher.java#L108-L142 | train | Starts the fetch process. | [
30522,
2270,
11675,
2707,
1006,
1007,
1063,
2065,
30524,
3351,
1012,
11291,
2618,
8569,
12494,
1006,
1007,
1010,
2047,
1054,
15042,
6072,
26029,
3366,
9289,
20850,
8684,
1006,
1007,
1063,
1030,
2058,
15637,
2270,
11675,
2006,
6342,
9468,
79... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/DynamicRegistrationBean.java | DynamicRegistrationBean.setInitParameters | public void setInitParameters(Map<String, String> initParameters) {
Assert.notNull(initParameters, "InitParameters must not be null");
this.initParameters = new LinkedHashMap<>(initParameters);
} | java | public void setInitParameters(Map<String, String> initParameters) {
Assert.notNull(initParameters, "InitParameters must not be null");
this.initParameters = new LinkedHashMap<>(initParameters);
} | [
"public",
"void",
"setInitParameters",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"initParameters",
")",
"{",
"Assert",
".",
"notNull",
"(",
"initParameters",
",",
"\"InitParameters must not be null\"",
")",
";",
"this",
".",
"initParameters",
"=",
"new",
"L... | Set init-parameters for this registration. Calling this method will replace any
existing init-parameters.
@param initParameters the init parameters
@see #getInitParameters
@see #addInitParameter | [
"Set",
"init",
"-",
"parameters",
"for",
"this",
"registration",
".",
"Calling",
"this",
"method",
"will",
"replace",
"any",
"existing",
"init",
"-",
"parameters",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/DynamicRegistrationBean.java#L84-L87 | train | Sets the init parameters. | [
30522,
2270,
11675,
2275,
5498,
25856,
5400,
22828,
2015,
1006,
4949,
1026,
5164,
1010,
5164,
1028,
1999,
4183,
28689,
22828,
2015,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
1999,
4183,
28689,
22828,
2015,
1010,
1000,
1999,
4183,
28... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/BufferUtil.java | BufferUtil.create | public static ByteBuffer create(CharSequence data, Charset charset) {
return create(StrUtil.bytes(data, charset));
} | java | public static ByteBuffer create(CharSequence data, Charset charset) {
return create(StrUtil.bytes(data, charset));
} | [
"public",
"static",
"ByteBuffer",
"create",
"(",
"CharSequence",
"data",
",",
"Charset",
"charset",
")",
"{",
"return",
"create",
"(",
"StrUtil",
".",
"bytes",
"(",
"data",
",",
"charset",
")",
")",
";",
"}"
] | 从字符串创建新Buffer
@param data 数据
@param charset 编码
@return {@link ByteBuffer}
@since 4.5.0 | [
"从字符串创建新Buffer"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/BufferUtil.java#L237-L239 | train | Creates a ByteBuffer from a char sequence. | [
30522,
2270,
10763,
24880,
8569,
12494,
3443,
1006,
25869,
3366,
4226,
5897,
2951,
1010,
25869,
13462,
25869,
13462,
1007,
1063,
2709,
3443,
1006,
2358,
22134,
4014,
1012,
27507,
1006,
2951,
1010,
25869,
13462,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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/SingleInputOperator.java | SingleInputOperator.accept | @Override
public void accept(Visitor<Operator<?>> visitor) {
if (visitor.preVisit(this)) {
this.input.accept(visitor);
for (Operator<?> c : this.broadcastInputs.values()) {
c.accept(visitor);
}
visitor.postVisit(this);
}
} | java | @Override
public void accept(Visitor<Operator<?>> visitor) {
if (visitor.preVisit(this)) {
this.input.accept(visitor);
for (Operator<?> c : this.broadcastInputs.values()) {
c.accept(visitor);
}
visitor.postVisit(this);
}
} | [
"@",
"Override",
"public",
"void",
"accept",
"(",
"Visitor",
"<",
"Operator",
"<",
"?",
">",
">",
"visitor",
")",
"{",
"if",
"(",
"visitor",
".",
"preVisit",
"(",
"this",
")",
")",
"{",
"this",
".",
"input",
".",
"accept",
"(",
"visitor",
")",
";",... | Accepts the visitor and applies it this instance. The visitors pre-visit method is called and, if returning
<tt>true</tt>, the visitor is recursively applied on the single input. After the recursion returned,
the post-visit method is called.
@param visitor The visitor.
@see org.apache.flink.util.Visitable#accept(org.apache.flink.util.Visitor) | [
"Accepts",
"the",
"visitor",
"and",
"applies",
"it",
"this",
"instance",
".",
"The",
"visitors",
"pre",
"-",
"visit",
"method",
"is",
"called",
"and",
"if",
"returning",
"<tt",
">",
"true<",
"/",
"tt",
">",
"the",
"visitor",
"is",
"recursively",
"applied",... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/SingleInputOperator.java#L196-L205 | train | Visit this operator. | [
30522,
1030,
2058,
15637,
2270,
11675,
5138,
1006,
10367,
1026,
6872,
1026,
1029,
1028,
1028,
10367,
1007,
1063,
2065,
1006,
10367,
1012,
3653,
11365,
4183,
1006,
2023,
1007,
1007,
1063,
2023,
1012,
7953,
1012,
5138,
1006,
10367,
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/incubator-shardingsphere | sharding-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/api/yaml/YamlOrchestrationMasterSlaveDataSourceFactory.java | YamlOrchestrationMasterSlaveDataSourceFactory.createDataSource | public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final File yamlFile) throws SQLException, IOException {
YamlOrchestrationMasterSlaveRuleConfiguration config = unmarshal(yamlFile);
return createDataSource(dataSourceMap, config.getMasterSlaveRule(), config.getProps(), config.getOrchestration());
} | java | public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final File yamlFile) throws SQLException, IOException {
YamlOrchestrationMasterSlaveRuleConfiguration config = unmarshal(yamlFile);
return createDataSource(dataSourceMap, config.getMasterSlaveRule(), config.getProps(), config.getOrchestration());
} | [
"public",
"static",
"DataSource",
"createDataSource",
"(",
"final",
"Map",
"<",
"String",
",",
"DataSource",
">",
"dataSourceMap",
",",
"final",
"File",
"yamlFile",
")",
"throws",
"SQLException",
",",
"IOException",
"{",
"YamlOrchestrationMasterSlaveRuleConfiguration",
... | Create master-slave data source.
@param dataSourceMap data source map
@param yamlFile YAML file for master-slave rule configuration without data sources
@return master-slave data source
@throws SQLException SQL exception
@throws IOException IO exception | [
"Create",
"master",
"-",
"slave",
"data",
"source",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/api/yaml/YamlOrchestrationMasterSlaveDataSourceFactory.java#L74-L77 | train | Create a DataSource from a yaml file. | [
30522,
2270,
10763,
2951,
6499,
3126,
3401,
2580,
6790,
6499,
3126,
3401,
1006,
2345,
4949,
1026,
5164,
1010,
2951,
6499,
3126,
3401,
1028,
2951,
6499,
3126,
3401,
2863,
2361,
1010,
2345,
5371,
8038,
19968,
8873,
2571,
1007,
11618,
29296,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/AbstractStreamOperator.java | AbstractStreamOperator.setup | @Override
public void setup(StreamTask<?, ?> containingTask, StreamConfig config, Output<StreamRecord<OUT>> output) {
final Environment environment = containingTask.getEnvironment();
this.container = containingTask;
this.config = config;
try {
OperatorMetricGroup operatorMetricGroup = environment.getMetricGroup().getOrAddOperator(config.getOperatorID(), config.getOperatorName());
this.output = new CountingOutput(output, operatorMetricGroup.getIOMetricGroup().getNumRecordsOutCounter());
if (config.isChainStart()) {
operatorMetricGroup.getIOMetricGroup().reuseInputMetricsForTask();
}
if (config.isChainEnd()) {
operatorMetricGroup.getIOMetricGroup().reuseOutputMetricsForTask();
}
this.metrics = operatorMetricGroup;
} catch (Exception e) {
LOG.warn("An error occurred while instantiating task metrics.", e);
this.metrics = UnregisteredMetricGroups.createUnregisteredOperatorMetricGroup();
this.output = output;
}
try {
Configuration taskManagerConfig = environment.getTaskManagerInfo().getConfiguration();
int historySize = taskManagerConfig.getInteger(MetricOptions.LATENCY_HISTORY_SIZE);
if (historySize <= 0) {
LOG.warn("{} has been set to a value equal or below 0: {}. Using default.", MetricOptions.LATENCY_HISTORY_SIZE, historySize);
historySize = MetricOptions.LATENCY_HISTORY_SIZE.defaultValue();
}
final String configuredGranularity = taskManagerConfig.getString(MetricOptions.LATENCY_SOURCE_GRANULARITY);
LatencyStats.Granularity granularity;
try {
granularity = LatencyStats.Granularity.valueOf(configuredGranularity.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException iae) {
granularity = LatencyStats.Granularity.OPERATOR;
LOG.warn(
"Configured value {} option for {} is invalid. Defaulting to {}.",
configuredGranularity,
MetricOptions.LATENCY_SOURCE_GRANULARITY.key(),
granularity);
}
TaskManagerJobMetricGroup jobMetricGroup = this.metrics.parent().parent();
this.latencyStats = new LatencyStats(jobMetricGroup.addGroup("latency"),
historySize,
container.getIndexInSubtaskGroup(),
getOperatorID(),
granularity);
} catch (Exception e) {
LOG.warn("An error occurred while instantiating latency metrics.", e);
this.latencyStats = new LatencyStats(
UnregisteredMetricGroups.createUnregisteredTaskManagerJobMetricGroup().addGroup("latency"),
1,
0,
new OperatorID(),
LatencyStats.Granularity.SINGLE);
}
this.runtimeContext = new StreamingRuntimeContext(this, environment, container.getAccumulatorMap());
stateKeySelector1 = config.getStatePartitioner(0, getUserCodeClassloader());
stateKeySelector2 = config.getStatePartitioner(1, getUserCodeClassloader());
} | java | @Override
public void setup(StreamTask<?, ?> containingTask, StreamConfig config, Output<StreamRecord<OUT>> output) {
final Environment environment = containingTask.getEnvironment();
this.container = containingTask;
this.config = config;
try {
OperatorMetricGroup operatorMetricGroup = environment.getMetricGroup().getOrAddOperator(config.getOperatorID(), config.getOperatorName());
this.output = new CountingOutput(output, operatorMetricGroup.getIOMetricGroup().getNumRecordsOutCounter());
if (config.isChainStart()) {
operatorMetricGroup.getIOMetricGroup().reuseInputMetricsForTask();
}
if (config.isChainEnd()) {
operatorMetricGroup.getIOMetricGroup().reuseOutputMetricsForTask();
}
this.metrics = operatorMetricGroup;
} catch (Exception e) {
LOG.warn("An error occurred while instantiating task metrics.", e);
this.metrics = UnregisteredMetricGroups.createUnregisteredOperatorMetricGroup();
this.output = output;
}
try {
Configuration taskManagerConfig = environment.getTaskManagerInfo().getConfiguration();
int historySize = taskManagerConfig.getInteger(MetricOptions.LATENCY_HISTORY_SIZE);
if (historySize <= 0) {
LOG.warn("{} has been set to a value equal or below 0: {}. Using default.", MetricOptions.LATENCY_HISTORY_SIZE, historySize);
historySize = MetricOptions.LATENCY_HISTORY_SIZE.defaultValue();
}
final String configuredGranularity = taskManagerConfig.getString(MetricOptions.LATENCY_SOURCE_GRANULARITY);
LatencyStats.Granularity granularity;
try {
granularity = LatencyStats.Granularity.valueOf(configuredGranularity.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException iae) {
granularity = LatencyStats.Granularity.OPERATOR;
LOG.warn(
"Configured value {} option for {} is invalid. Defaulting to {}.",
configuredGranularity,
MetricOptions.LATENCY_SOURCE_GRANULARITY.key(),
granularity);
}
TaskManagerJobMetricGroup jobMetricGroup = this.metrics.parent().parent();
this.latencyStats = new LatencyStats(jobMetricGroup.addGroup("latency"),
historySize,
container.getIndexInSubtaskGroup(),
getOperatorID(),
granularity);
} catch (Exception e) {
LOG.warn("An error occurred while instantiating latency metrics.", e);
this.latencyStats = new LatencyStats(
UnregisteredMetricGroups.createUnregisteredTaskManagerJobMetricGroup().addGroup("latency"),
1,
0,
new OperatorID(),
LatencyStats.Granularity.SINGLE);
}
this.runtimeContext = new StreamingRuntimeContext(this, environment, container.getAccumulatorMap());
stateKeySelector1 = config.getStatePartitioner(0, getUserCodeClassloader());
stateKeySelector2 = config.getStatePartitioner(1, getUserCodeClassloader());
} | [
"@",
"Override",
"public",
"void",
"setup",
"(",
"StreamTask",
"<",
"?",
",",
"?",
">",
"containingTask",
",",
"StreamConfig",
"config",
",",
"Output",
"<",
"StreamRecord",
"<",
"OUT",
">",
">",
"output",
")",
"{",
"final",
"Environment",
"environment",
"=... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/AbstractStreamOperator.java#L169-L230 | train | Setup the task. | [
30522,
1030,
2058,
15637,
2270,
11675,
16437,
1006,
5460,
10230,
2243,
1026,
1029,
1010,
1029,
1028,
4820,
10230,
2243,
1010,
5460,
8663,
8873,
2290,
9530,
8873,
2290,
1010,
6434,
1026,
5460,
2890,
27108,
2094,
1026,
2041,
1028,
1028,
6434,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-postgresql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/postgresql/packet/command/query/binary/bind/protocol/PostgreSQLBinaryProtocolValueFactory.java | PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue | public static PostgreSQLBinaryProtocolValue getBinaryProtocolValue(final PostgreSQLColumnType columnType) {
Preconditions.checkArgument(BINARY_PROTOCOL_VALUES.containsKey(columnType), "Cannot find PostgreSQL type '%s' in column type when process binary protocol value", columnType);
return BINARY_PROTOCOL_VALUES.get(columnType);
} | java | public static PostgreSQLBinaryProtocolValue getBinaryProtocolValue(final PostgreSQLColumnType columnType) {
Preconditions.checkArgument(BINARY_PROTOCOL_VALUES.containsKey(columnType), "Cannot find PostgreSQL type '%s' in column type when process binary protocol value", columnType);
return BINARY_PROTOCOL_VALUES.get(columnType);
} | [
"public",
"static",
"PostgreSQLBinaryProtocolValue",
"getBinaryProtocolValue",
"(",
"final",
"PostgreSQLColumnType",
"columnType",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"BINARY_PROTOCOL_VALUES",
".",
"containsKey",
"(",
"columnType",
")",
",",
"\"Cannot find... | Get binary protocol value.
@param columnType column type
@return binary protocol value | [
"Get",
"binary",
"protocol",
"value",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-postgresql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/postgresql/packet/command/query/binary/bind/protocol/PostgreSQLBinaryProtocolValueFactory.java#L95-L98 | train | Gets binary protocol value. | [
30522,
2270,
10763,
2695,
17603,
2015,
4160,
20850,
3981,
2854,
21572,
3406,
25778,
10175,
5657,
2131,
21114,
2854,
21572,
3406,
25778,
10175,
5657,
1006,
2345,
2695,
17603,
2015,
4160,
22499,
12942,
29405,
5051,
5930,
13874,
1007,
1063,
3653... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/IOUtils.java | IOUtils.copyBytes | public static void copyBytes(final InputStream in, final OutputStream out, final int buffSize, final boolean close)
throws IOException {
@SuppressWarnings("resource")
final PrintStream ps = out instanceof PrintStream ? (PrintStream) out : null;
final byte[] buf = new byte[buffSize];
try {
int bytesRead = in.read(buf);
while (bytesRead >= 0) {
out.write(buf, 0, bytesRead);
if ((ps != null) && ps.checkError()) {
throw new IOException("Unable to write to output stream.");
}
bytesRead = in.read(buf);
}
} finally {
if (close) {
out.close();
in.close();
}
}
} | java | public static void copyBytes(final InputStream in, final OutputStream out, final int buffSize, final boolean close)
throws IOException {
@SuppressWarnings("resource")
final PrintStream ps = out instanceof PrintStream ? (PrintStream) out : null;
final byte[] buf = new byte[buffSize];
try {
int bytesRead = in.read(buf);
while (bytesRead >= 0) {
out.write(buf, 0, bytesRead);
if ((ps != null) && ps.checkError()) {
throw new IOException("Unable to write to output stream.");
}
bytesRead = in.read(buf);
}
} finally {
if (close) {
out.close();
in.close();
}
}
} | [
"public",
"static",
"void",
"copyBytes",
"(",
"final",
"InputStream",
"in",
",",
"final",
"OutputStream",
"out",
",",
"final",
"int",
"buffSize",
",",
"final",
"boolean",
"close",
")",
"throws",
"IOException",
"{",
"@",
"SuppressWarnings",
"(",
"\"resource\"",
... | Copies from one stream to another.
@param in
InputStream to read from
@param out
OutputStream to write to
@param buffSize
the size of the buffer
@param close
whether or not close the InputStream and OutputStream at the end. The streams are closed in the finally
clause.
@throws IOException
thrown if an error occurred while writing to the output stream | [
"Copies",
"from",
"one",
"stream",
"to",
"another",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/IOUtils.java#L56-L77 | train | Copy bytes from the input stream to the output stream. | [
30522,
2270,
10763,
11675,
6100,
3762,
4570,
1006,
2345,
20407,
25379,
1999,
1010,
2345,
27852,
25379,
2041,
1010,
2345,
20014,
23176,
5332,
4371,
1010,
2345,
22017,
20898,
2485,
1007,
11618,
22834,
10288,
24422,
1063,
1030,
16081,
9028,
5582... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java | MailUtil.send | public static void send(String to, String subject, String content, boolean isHtml, File... files) {
send(splitAddress(to), subject, content, isHtml, files);
} | java | public static void send(String to, String subject, String content, boolean isHtml, File... files) {
send(splitAddress(to), subject, content, isHtml, files);
} | [
"public",
"static",
"void",
"send",
"(",
"String",
"to",
",",
"String",
"subject",
",",
"String",
"content",
",",
"boolean",
"isHtml",
",",
"File",
"...",
"files",
")",
"{",
"send",
"(",
"splitAddress",
"(",
"to",
")",
",",
"subject",
",",
"content",
"... | 使用配置文件中设置的账户发送邮件,发送单个或多个收件人<br>
多个收件人可以使用逗号“,”分隔,也可以通过分号“;”分隔
@param to 收件人
@param subject 标题
@param content 正文
@param isHtml 是否为HTML
@param files 附件列表 | [
"使用配置文件中设置的账户发送邮件,发送单个或多个收件人<br",
">",
"多个收件人可以使用逗号“",
"”分隔,也可以通过分号“",
";",
"”分隔"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java#L56-L58 | train | Send a message to a list of users. | [
30522,
2270,
10763,
11675,
4604,
1006,
5164,
2000,
1010,
5164,
3395,
1010,
5164,
4180,
1010,
22017,
20898,
2003,
11039,
19968,
1010,
5371,
1012,
1012,
1012,
6764,
1007,
1063,
4604,
1006,
3975,
4215,
16200,
4757,
1006,
2000,
1007,
1010,
3395... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-swift-fs-hadoop/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.substituteVars | private String substituteVars(String expr) {
if (expr == null) {
return null;
}
String eval = expr;
for (int s = 0; s < MAX_SUBST; s++) {
final int[] varBounds = findSubVariable(eval);
if (varBounds[SUB_START_IDX] == -1) {
return eval;
}
final String var = eval.substring(varBounds[SUB_START_IDX],
varBounds[SUB_END_IDX]);
String val = null;
try {
val = System.getProperty(var);
} catch(SecurityException se) {
LOG.warn("Unexpected SecurityException in Configuration", se);
}
if (val == null) {
val = getRaw(var);
}
if (val == null) {
return eval; // return literal ${var}: var is unbound
}
final int dollar = varBounds[SUB_START_IDX] - "${".length();
final int afterRightBrace = varBounds[SUB_END_IDX] + "}".length();
// substitute
eval = eval.substring(0, dollar)
+ val
+ eval.substring(afterRightBrace);
}
throw new IllegalStateException("Variable substitution depth too large: "
+ MAX_SUBST + " " + expr);
} | java | private String substituteVars(String expr) {
if (expr == null) {
return null;
}
String eval = expr;
for (int s = 0; s < MAX_SUBST; s++) {
final int[] varBounds = findSubVariable(eval);
if (varBounds[SUB_START_IDX] == -1) {
return eval;
}
final String var = eval.substring(varBounds[SUB_START_IDX],
varBounds[SUB_END_IDX]);
String val = null;
try {
val = System.getProperty(var);
} catch(SecurityException se) {
LOG.warn("Unexpected SecurityException in Configuration", se);
}
if (val == null) {
val = getRaw(var);
}
if (val == null) {
return eval; // return literal ${var}: var is unbound
}
final int dollar = varBounds[SUB_START_IDX] - "${".length();
final int afterRightBrace = varBounds[SUB_END_IDX] + "}".length();
// substitute
eval = eval.substring(0, dollar)
+ val
+ eval.substring(afterRightBrace);
}
throw new IllegalStateException("Variable substitution depth too large: "
+ MAX_SUBST + " " + expr);
} | [
"private",
"String",
"substituteVars",
"(",
"String",
"expr",
")",
"{",
"if",
"(",
"expr",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"eval",
"=",
"expr",
";",
"for",
"(",
"int",
"s",
"=",
"0",
";",
"s",
"<",
"MAX_SUBST",
";",
... | Attempts to repeatedly expand the value {@code expr} by replacing the
left-most substring of the form "${var}" in the following precedence order
<ol>
<li>by the value of the Java system property "var" if defined</li>
<li>by the value of the configuration key "var" if defined</li>
</ol>
If var is unbounded the current state of expansion "prefix${var}suffix" is
returned.
@param expr the literal value of a config key
@return null if expr is null, otherwise the value resulting from expanding
expr using the algorithm above.
@throws IllegalArgumentException when more than
{@link Configuration#MAX_SUBST} replacements are required | [
"Attempts",
"to",
"repeatedly",
"expand",
"the",
"value",
"{",
"@code",
"expr",
"}",
"by",
"replacing",
"the",
"left",
"-",
"most",
"substring",
"of",
"the",
"form",
"$",
"{",
"var",
"}",
"in",
"the",
"following",
"precedence",
"order",
"<ol",
">",
"<li"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-swift-fs-hadoop/src/main/java/org/apache/hadoop/conf/Configuration.java#L904-L937 | train | Substitute variables in the given expression. | [
30522,
2797,
5164,
7681,
10755,
2015,
1006,
5164,
4654,
18098,
1007,
1063,
2065,
1006,
4654,
18098,
1027,
1027,
19701,
1007,
1063,
2709,
19701,
1025,
1065,
5164,
9345,
2140,
1027,
4654,
18098,
1025,
2005,
1006,
20014,
1055,
1027,
1014,
1025... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/channel/PendingWriteQueue.java | PendingWriteQueue.removeAndFailAll | public void removeAndFailAll(Throwable cause) {
assert ctx.executor().inEventLoop();
if (cause == null) {
throw new NullPointerException("cause");
}
// It is possible for some of the failed promises to trigger more writes. The new writes
// will "revive" the queue, so we need to clean them up until the queue is empty.
for (PendingWrite write = head; write != null; write = head) {
head = tail = null;
size = 0;
bytes = 0;
while (write != null) {
PendingWrite next = write.next;
ReferenceCountUtil.safeRelease(write.msg);
ChannelPromise promise = write.promise;
recycle(write, false);
safeFail(promise, cause);
write = next;
}
}
assertEmpty();
} | java | public void removeAndFailAll(Throwable cause) {
assert ctx.executor().inEventLoop();
if (cause == null) {
throw new NullPointerException("cause");
}
// It is possible for some of the failed promises to trigger more writes. The new writes
// will "revive" the queue, so we need to clean them up until the queue is empty.
for (PendingWrite write = head; write != null; write = head) {
head = tail = null;
size = 0;
bytes = 0;
while (write != null) {
PendingWrite next = write.next;
ReferenceCountUtil.safeRelease(write.msg);
ChannelPromise promise = write.promise;
recycle(write, false);
safeFail(promise, cause);
write = next;
}
}
assertEmpty();
} | [
"public",
"void",
"removeAndFailAll",
"(",
"Throwable",
"cause",
")",
"{",
"assert",
"ctx",
".",
"executor",
"(",
")",
".",
"inEventLoop",
"(",
")",
";",
"if",
"(",
"cause",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"cause\"",
... | Remove all pending write operation and fail them with the given {@link Throwable}. The message will be released
via {@link ReferenceCountUtil#safeRelease(Object)}. | [
"Remove",
"all",
"pending",
"write",
"operation",
"and",
"fail",
"them",
"with",
"the",
"given",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/PendingWriteQueue.java#L166-L187 | train | Remove all pending writes and fail all the failed messages. | [
30522,
2270,
11675,
6366,
5685,
7011,
11733,
3363,
1006,
5466,
3085,
3426,
1007,
1063,
20865,
14931,
2595,
1012,
4654,
8586,
16161,
2099,
1006,
1007,
1012,
1999,
18697,
3372,
4135,
7361,
1006,
1007,
1025,
2065,
1006,
3426,
1027,
1027,
19701... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 6