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
listlengths
22
2.65k
docstring
stringlengths
2
5.35k
docstring_tokens
listlengths
1
369
sha
stringclasses
11 values
url
stringlengths
129
339
partition
stringclasses
1 value
summary
stringlengths
7
175
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
hankcs/HanLP
src/main/java/com/hankcs/hanlp/dependency/nnparser/NeuralNetworkParser.java
NeuralNetworkParser.get_features
void get_features(final State s, final List<Integer> cluster4, final List<Integer> cluster6, final List<Integer> cluster, List<Integer> features) { Context ctx = new Context(); get_context(s, ctx); get_basic_features(ctx, s.ref.forms, s.ref.postags, s.deprels, features); get_distance_features(ctx, features); get_valency_features(ctx, s.nr_left_children, s.nr_right_children, features); get_cluster_features(ctx, cluster4, cluster6, cluster, features); }
java
void get_features(final State s, final List<Integer> cluster4, final List<Integer> cluster6, final List<Integer> cluster, List<Integer> features) { Context ctx = new Context(); get_context(s, ctx); get_basic_features(ctx, s.ref.forms, s.ref.postags, s.deprels, features); get_distance_features(ctx, features); get_valency_features(ctx, s.nr_left_children, s.nr_right_children, features); get_cluster_features(ctx, cluster4, cluster6, cluster, features); }
[ "void", "get_features", "(", "final", "State", "s", ",", "final", "List", "<", "Integer", ">", "cluster4", ",", "final", "List", "<", "Integer", ">", "cluster6", ",", "final", "List", "<", "Integer", ">", "cluster", ",", "List", "<", "Integer", ">", "f...
生成特征 @param s 当前状态 @param cluster4 @param cluster6 @param cluster @param features 输出特征
[ "生成特征" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/NeuralNetworkParser.java#L608-L620
train
Get the features from a state.
[ 30522, 11675, 2131, 1035, 2838, 1006, 2345, 2110, 1055, 1010, 2345, 2862, 1026, 16109, 1028, 9324, 2549, 1010, 2345, 2862, 1026, 16109, 1028, 9324, 2575, 1010, 2345, 2862, 1026, 16109, 1028, 9324, 1010, 2862, 1026, 16109, 1028, 2838, 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-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java
Pattern.until
public Pattern<T, F> until(IterativeCondition<F> untilCondition) { Preconditions.checkNotNull(untilCondition, "The condition cannot be null"); if (this.untilCondition != null) { throw new MalformedPatternException("Only one until condition can be applied."); } if (!quantifier.hasProperty(Quantifier.QuantifierProperty.LOOPING)) { throw new MalformedPatternException("The until condition is only applicable to looping states."); } ClosureCleaner.clean(untilCondition, true); this.untilCondition = untilCondition; return this; }
java
public Pattern<T, F> until(IterativeCondition<F> untilCondition) { Preconditions.checkNotNull(untilCondition, "The condition cannot be null"); if (this.untilCondition != null) { throw new MalformedPatternException("Only one until condition can be applied."); } if (!quantifier.hasProperty(Quantifier.QuantifierProperty.LOOPING)) { throw new MalformedPatternException("The until condition is only applicable to looping states."); } ClosureCleaner.clean(untilCondition, true); this.untilCondition = untilCondition; return this; }
[ "public", "Pattern", "<", "T", ",", "F", ">", "until", "(", "IterativeCondition", "<", "F", ">", "untilCondition", ")", "{", "Preconditions", ".", "checkNotNull", "(", "untilCondition", ",", "\"The condition cannot be null\"", ")", ";", "if", "(", "this", ".",...
Applies a stop condition for a looping state. It allows cleaning the underlying state. @param untilCondition a condition an event has to satisfy to stop collecting events into looping state @return The same pattern with applied untilCondition
[ "Applies", "a", "stop", "condition", "for", "a", "looping", "state", ".", "It", "allows", "cleaning", "the", "underlying", "state", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java#L219-L234
train
Sets the until condition.
[ 30522, 2270, 5418, 1026, 1056, 1010, 1042, 1028, 2127, 1006, 2009, 25284, 8663, 20562, 1026, 1042, 1028, 2127, 8663, 20562, 1007, 1063, 3653, 8663, 20562, 2015, 30524, 2065, 1006, 2023, 1012, 2127, 8663, 20562, 999, 1027, 19701, 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...
apache/flink
flink-core/src/main/java/org/apache/flink/util/InstantiationUtil.java
InstantiationUtil.resolveClassByName
public static <T> Class<T> resolveClassByName( DataInputView in, ClassLoader cl) throws IOException { return resolveClassByName(in, cl, Object.class); }
java
public static <T> Class<T> resolveClassByName( DataInputView in, ClassLoader cl) throws IOException { return resolveClassByName(in, cl, Object.class); }
[ "public", "static", "<", "T", ">", "Class", "<", "T", ">", "resolveClassByName", "(", "DataInputView", "in", ",", "ClassLoader", "cl", ")", "throws", "IOException", "{", "return", "resolveClassByName", "(", "in", ",", "cl", ",", "Object", ".", "class", ")"...
Loads a class by name from the given input stream and reflectively instantiates it. <p>This method will use {@link DataInputView#readUTF()} to read the class name, and then attempt to load the class from the given ClassLoader. @param in The stream to read the class name from. @param cl The class loader to resolve the class. @throws IOException Thrown, if the class name could not be read, the class could not be found.
[ "Loads", "a", "class", "by", "name", "from", "the", "given", "input", "stream", "and", "reflectively", "instantiates", "it", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/InstantiationUtil.java#L678-L682
train
Resolves a class by name using the specified class loader.
[ 30522, 2270, 10763, 1026, 1056, 1028, 2465, 1026, 1056, 1028, 10663, 26266, 3762, 18442, 1006, 2951, 2378, 18780, 8584, 1999, 1010, 2465, 11066, 2121, 18856, 1007, 11618, 22834, 10288, 24422, 1063, 2709, 10663, 26266, 3762, 18442, 1006, 1999,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/functions/UserDefinedFunction.java
UserDefinedFunction.functionIdentifier
public final String functionIdentifier() { final String md5 = EncodingUtils.hex(EncodingUtils.md5(EncodingUtils.encodeObjectToString(this))); return getClass().getCanonicalName().replace('.', '$').concat("$").concat(md5); }
java
public final String functionIdentifier() { final String md5 = EncodingUtils.hex(EncodingUtils.md5(EncodingUtils.encodeObjectToString(this))); return getClass().getCanonicalName().replace('.', '$').concat("$").concat(md5); }
[ "public", "final", "String", "functionIdentifier", "(", ")", "{", "final", "String", "md5", "=", "EncodingUtils", ".", "hex", "(", "EncodingUtils", ".", "md5", "(", "EncodingUtils", ".", "encodeObjectToString", "(", "this", ")", ")", ")", ";", "return", "get...
Returns a unique, serialized representation for this function.
[ "Returns", "a", "unique", "serialized", "representation", "for", "this", "function", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/UserDefinedFunction.java#L36-L39
train
Returns the function identifier.
[ 30522, 2270, 2345, 5164, 3853, 5178, 16778, 8873, 2121, 1006, 1007, 1063, 2345, 5164, 9108, 2629, 1027, 17181, 21823, 4877, 1012, 2002, 2595, 1006, 17181, 21823, 4877, 1012, 9108, 2629, 1006, 17181, 21823, 4877, 1012, 4372, 16044, 16429, 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...
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlFunctionUtils.java
SqlFunctionUtils.splitIndex
public static String splitIndex(String str, int character, int index) { if (character > 255 || character < 1 || index < 0) { return null; } String[] values = StringUtils.splitPreserveAllTokens(str, (char) character); if (index >= values.length) { return null; } else { return values[index]; } }
java
public static String splitIndex(String str, int character, int index) { if (character > 255 || character < 1 || index < 0) { return null; } String[] values = StringUtils.splitPreserveAllTokens(str, (char) character); if (index >= values.length) { return null; } else { return values[index]; } }
[ "public", "static", "String", "splitIndex", "(", "String", "str", ",", "int", "character", ",", "int", "index", ")", "{", "if", "(", "character", ">", "255", "||", "character", "<", "1", "||", "index", "<", "0", ")", "{", "return", "null", ";", "}", ...
Split target string with custom separator and pick the index-th(start with 0) result. @param str target string. @param character int value of the separator character @param index index of the result which you want. @return the string at the index of split results.
[ "Split", "target", "string", "with", "custom", "separator", "and", "pick", "the", "index", "-", "th", "(", "start", "with", "0", ")", "result", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlFunctionUtils.java#L330-L340
train
Splits the string into the specified character and returns the index of the first occurrence of the character.
[ 30522, 2270, 10763, 5164, 3975, 22254, 10288, 1006, 5164, 2358, 2099, 1010, 20014, 2839, 1010, 20014, 5950, 1007, 1063, 2065, 1006, 2839, 1028, 20637, 1064, 1064, 2839, 1026, 1015, 1064, 1064, 5950, 1026, 1014, 1007, 1063, 2709, 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-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...
netty/netty
common/src/main/java/io/netty/util/concurrent/AbstractScheduledEventExecutor.java
AbstractScheduledEventExecutor.nextScheduledTaskNano
protected final long nextScheduledTaskNano() { Queue<ScheduledFutureTask<?>> scheduledTaskQueue = this.scheduledTaskQueue; ScheduledFutureTask<?> scheduledTask = scheduledTaskQueue == null ? null : scheduledTaskQueue.peek(); if (scheduledTask == null) { return -1; } return Math.max(0, scheduledTask.deadlineNanos() - nanoTime()); }
java
protected final long nextScheduledTaskNano() { Queue<ScheduledFutureTask<?>> scheduledTaskQueue = this.scheduledTaskQueue; ScheduledFutureTask<?> scheduledTask = scheduledTaskQueue == null ? null : scheduledTaskQueue.peek(); if (scheduledTask == null) { return -1; } return Math.max(0, scheduledTask.deadlineNanos() - nanoTime()); }
[ "protected", "final", "long", "nextScheduledTaskNano", "(", ")", "{", "Queue", "<", "ScheduledFutureTask", "<", "?", ">", ">", "scheduledTaskQueue", "=", "this", ".", "scheduledTaskQueue", ";", "ScheduledFutureTask", "<", "?", ">", "scheduledTask", "=", "scheduled...
Return the nanoseconds when the next scheduled task is ready to be run or {@code -1} if no task is scheduled.
[ "Return", "the", "nanoseconds", "when", "the", "next", "scheduled", "task", "is", "ready", "to", "be", "run", "or", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/AbstractScheduledEventExecutor.java#L120-L127
train
Gets the number of nanoseconds that the next scheduled task has.
[ 30522, 5123, 2345, 2146, 2279, 22842, 8566, 3709, 10230, 2243, 7229, 2080, 1006, 1007, 1063, 24240, 1026, 5115, 11263, 11244, 10230, 2243, 1026, 1029, 1028, 1028, 5115, 10230, 2243, 4226, 5657, 1027, 2023, 1012, 5115, 10230, 2243, 4226, 565...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.runFetchLoop
@Override public void runFetchLoop() throws Exception { // the map from broker to the thread that is connected to that broker final Map<Node, SimpleConsumerThread<T>> brokerToThread = new HashMap<>(); // this holds possible the exceptions from the concurrent broker connection threads final ExceptionProxy errorHandler = new ExceptionProxy(Thread.currentThread()); // the offset handler handles the communication with ZooKeeper, to commit externally visible offsets final ZookeeperOffsetHandler zookeeperOffsetHandler = new ZookeeperOffsetHandler(kafkaConfig); this.zookeeperOffsetHandler = zookeeperOffsetHandler; PeriodicOffsetCommitter periodicCommitter = null; try { // offsets in the state may still be placeholder sentinel values if we are starting fresh, or the // checkpoint / savepoint state we were restored with had not completely been replaced with actual offset // values yet; replace those with actual offsets, according to what the sentinel value represent. for (KafkaTopicPartitionState<TopicAndPartition> partition : subscribedPartitionStates()) { if (partition.getOffset() == KafkaTopicPartitionStateSentinel.EARLIEST_OFFSET) { // this will be replaced by an actual offset in SimpleConsumerThread partition.setOffset(OffsetRequest.EarliestTime()); } else if (partition.getOffset() == KafkaTopicPartitionStateSentinel.LATEST_OFFSET) { // this will be replaced by an actual offset in SimpleConsumerThread partition.setOffset(OffsetRequest.LatestTime()); } else if (partition.getOffset() == KafkaTopicPartitionStateSentinel.GROUP_OFFSET) { Long committedOffset = zookeeperOffsetHandler.getCommittedOffset(partition.getKafkaTopicPartition()); if (committedOffset != null) { // the committed offset in ZK represents the next record to process, // so we subtract it by 1 to correctly represent internal state partition.setOffset(committedOffset - 1); } else { // if we can't find an offset for a partition in ZK when using GROUP_OFFSETS, // we default to "auto.offset.reset" like the Kafka high-level consumer LOG.warn("No group offset can be found for partition {} in Zookeeper;" + " resetting starting offset to 'auto.offset.reset'", partition); partition.setOffset(invalidOffsetBehavior); } } else { // the partition already has a specific start offset and is ready to be consumed } } // start the periodic offset committer thread, if necessary if (autoCommitInterval > 0) { LOG.info("Starting periodic offset committer, with commit interval of {}ms", autoCommitInterval); periodicCommitter = new PeriodicOffsetCommitter( zookeeperOffsetHandler, subscribedPartitionStates(), errorHandler, autoCommitInterval); periodicCommitter.setName("Periodic Kafka partition offset committer"); periodicCommitter.setDaemon(true); periodicCommitter.start(); } // Main loop polling elements from the unassignedPartitions queue to the threads while (running) { // re-throw any exception from the concurrent fetcher threads errorHandler.checkAndThrowException(); // wait for max 5 seconds trying to get partitions to assign // if threads shut down, this poll returns earlier, because the threads inject the // special marker into the queue List<KafkaTopicPartitionState<TopicAndPartition>> partitionsToAssign = unassignedPartitionsQueue.getBatchBlocking(5000); // note: if there are more markers, remove them all partitionsToAssign.removeIf(MARKER::equals); if (!partitionsToAssign.isEmpty()) { LOG.info("Assigning {} partitions to broker threads", partitionsToAssign.size()); Map<Node, List<KafkaTopicPartitionState<TopicAndPartition>>> partitionsWithLeaders = findLeaderForPartitions(partitionsToAssign, kafkaConfig); // assign the partitions to the leaders (maybe start the threads) for (Map.Entry<Node, List<KafkaTopicPartitionState<TopicAndPartition>>> partitionsWithLeader : partitionsWithLeaders.entrySet()) { final Node leader = partitionsWithLeader.getKey(); final List<KafkaTopicPartitionState<TopicAndPartition>> partitions = partitionsWithLeader.getValue(); SimpleConsumerThread<T> brokerThread = brokerToThread.get(leader); if (!running) { break; } if (brokerThread == null || !brokerThread.getNewPartitionsQueue().isOpen()) { // start new thread brokerThread = createAndStartSimpleConsumerThread(partitions, leader, errorHandler); brokerToThread.put(leader, brokerThread); } else { // put elements into queue of thread ClosableBlockingQueue<KafkaTopicPartitionState<TopicAndPartition>> newPartitionsQueue = brokerThread.getNewPartitionsQueue(); for (KafkaTopicPartitionState<TopicAndPartition> fp : partitions) { if (!newPartitionsQueue.addIfOpen(fp)) { // we were unable to add the partition to the broker's queue // the broker has closed in the meantime (the thread will shut down) // create a new thread for connecting to this broker List<KafkaTopicPartitionState<TopicAndPartition>> seedPartitions = new ArrayList<>(); seedPartitions.add(fp); brokerThread = createAndStartSimpleConsumerThread(seedPartitions, leader, errorHandler); brokerToThread.put(leader, brokerThread); newPartitionsQueue = brokerThread.getNewPartitionsQueue(); // update queue for the subsequent partitions } } } } } else { // there were no partitions to assign. Check if any broker threads shut down. // we get into this section of the code, if either the poll timed out, or the // blocking poll was woken up by the marker element Iterator<SimpleConsumerThread<T>> bttIterator = brokerToThread.values().iterator(); while (bttIterator.hasNext()) { SimpleConsumerThread<T> thread = bttIterator.next(); if (!thread.getNewPartitionsQueue().isOpen()) { LOG.info("Removing stopped consumer thread {}", thread.getName()); bttIterator.remove(); } } } if (brokerToThread.size() == 0 && unassignedPartitionsQueue.isEmpty()) { if (unassignedPartitionsQueue.close()) { LOG.info("All consumer threads are finished, there are no more unassigned partitions. Stopping fetcher"); break; } // we end up here if somebody added something to the queue in the meantime --> continue to poll queue again } } } catch (InterruptedException e) { // this may be thrown because an exception on one of the concurrent fetcher threads // woke this thread up. make sure we throw the root exception instead in that case errorHandler.checkAndThrowException(); // no other root exception, throw the interrupted exception throw e; } finally { this.running = false; this.zookeeperOffsetHandler = null; // if we run a periodic committer thread, shut that down if (periodicCommitter != null) { periodicCommitter.shutdown(); } // clear the interruption flag // this allows the joining on consumer threads (on best effort) to happen in // case the initial interrupt already Thread.interrupted(); // make sure that in any case (completion, abort, error), all spawned threads are stopped try { int runningThreads; do { // check whether threads are alive and cancel them runningThreads = 0; Iterator<SimpleConsumerThread<T>> threads = brokerToThread.values().iterator(); while (threads.hasNext()) { SimpleConsumerThread<?> t = threads.next(); if (t.isAlive()) { t.cancel(); runningThreads++; } else { threads.remove(); } } // wait for the threads to finish, before issuing a cancel call again if (runningThreads > 0) { for (SimpleConsumerThread<?> t : brokerToThread.values()) { t.join(500 / runningThreads + 1); } } } while (runningThreads > 0); } catch (InterruptedException ignored) { // waiting for the thread shutdown apparently got interrupted // restore interrupted state and continue Thread.currentThread().interrupt(); } catch (Throwable t) { // we catch all here to preserve the original exception LOG.error("Exception while shutting down consumer threads", t); } try { zookeeperOffsetHandler.close(); } catch (Throwable t) { // we catch all here to preserve the original exception LOG.error("Exception while shutting down ZookeeperOffsetHandler", t); } } }
java
@Override public void runFetchLoop() throws Exception { // the map from broker to the thread that is connected to that broker final Map<Node, SimpleConsumerThread<T>> brokerToThread = new HashMap<>(); // this holds possible the exceptions from the concurrent broker connection threads final ExceptionProxy errorHandler = new ExceptionProxy(Thread.currentThread()); // the offset handler handles the communication with ZooKeeper, to commit externally visible offsets final ZookeeperOffsetHandler zookeeperOffsetHandler = new ZookeeperOffsetHandler(kafkaConfig); this.zookeeperOffsetHandler = zookeeperOffsetHandler; PeriodicOffsetCommitter periodicCommitter = null; try { // offsets in the state may still be placeholder sentinel values if we are starting fresh, or the // checkpoint / savepoint state we were restored with had not completely been replaced with actual offset // values yet; replace those with actual offsets, according to what the sentinel value represent. for (KafkaTopicPartitionState<TopicAndPartition> partition : subscribedPartitionStates()) { if (partition.getOffset() == KafkaTopicPartitionStateSentinel.EARLIEST_OFFSET) { // this will be replaced by an actual offset in SimpleConsumerThread partition.setOffset(OffsetRequest.EarliestTime()); } else if (partition.getOffset() == KafkaTopicPartitionStateSentinel.LATEST_OFFSET) { // this will be replaced by an actual offset in SimpleConsumerThread partition.setOffset(OffsetRequest.LatestTime()); } else if (partition.getOffset() == KafkaTopicPartitionStateSentinel.GROUP_OFFSET) { Long committedOffset = zookeeperOffsetHandler.getCommittedOffset(partition.getKafkaTopicPartition()); if (committedOffset != null) { // the committed offset in ZK represents the next record to process, // so we subtract it by 1 to correctly represent internal state partition.setOffset(committedOffset - 1); } else { // if we can't find an offset for a partition in ZK when using GROUP_OFFSETS, // we default to "auto.offset.reset" like the Kafka high-level consumer LOG.warn("No group offset can be found for partition {} in Zookeeper;" + " resetting starting offset to 'auto.offset.reset'", partition); partition.setOffset(invalidOffsetBehavior); } } else { // the partition already has a specific start offset and is ready to be consumed } } // start the periodic offset committer thread, if necessary if (autoCommitInterval > 0) { LOG.info("Starting periodic offset committer, with commit interval of {}ms", autoCommitInterval); periodicCommitter = new PeriodicOffsetCommitter( zookeeperOffsetHandler, subscribedPartitionStates(), errorHandler, autoCommitInterval); periodicCommitter.setName("Periodic Kafka partition offset committer"); periodicCommitter.setDaemon(true); periodicCommitter.start(); } // Main loop polling elements from the unassignedPartitions queue to the threads while (running) { // re-throw any exception from the concurrent fetcher threads errorHandler.checkAndThrowException(); // wait for max 5 seconds trying to get partitions to assign // if threads shut down, this poll returns earlier, because the threads inject the // special marker into the queue List<KafkaTopicPartitionState<TopicAndPartition>> partitionsToAssign = unassignedPartitionsQueue.getBatchBlocking(5000); // note: if there are more markers, remove them all partitionsToAssign.removeIf(MARKER::equals); if (!partitionsToAssign.isEmpty()) { LOG.info("Assigning {} partitions to broker threads", partitionsToAssign.size()); Map<Node, List<KafkaTopicPartitionState<TopicAndPartition>>> partitionsWithLeaders = findLeaderForPartitions(partitionsToAssign, kafkaConfig); // assign the partitions to the leaders (maybe start the threads) for (Map.Entry<Node, List<KafkaTopicPartitionState<TopicAndPartition>>> partitionsWithLeader : partitionsWithLeaders.entrySet()) { final Node leader = partitionsWithLeader.getKey(); final List<KafkaTopicPartitionState<TopicAndPartition>> partitions = partitionsWithLeader.getValue(); SimpleConsumerThread<T> brokerThread = brokerToThread.get(leader); if (!running) { break; } if (brokerThread == null || !brokerThread.getNewPartitionsQueue().isOpen()) { // start new thread brokerThread = createAndStartSimpleConsumerThread(partitions, leader, errorHandler); brokerToThread.put(leader, brokerThread); } else { // put elements into queue of thread ClosableBlockingQueue<KafkaTopicPartitionState<TopicAndPartition>> newPartitionsQueue = brokerThread.getNewPartitionsQueue(); for (KafkaTopicPartitionState<TopicAndPartition> fp : partitions) { if (!newPartitionsQueue.addIfOpen(fp)) { // we were unable to add the partition to the broker's queue // the broker has closed in the meantime (the thread will shut down) // create a new thread for connecting to this broker List<KafkaTopicPartitionState<TopicAndPartition>> seedPartitions = new ArrayList<>(); seedPartitions.add(fp); brokerThread = createAndStartSimpleConsumerThread(seedPartitions, leader, errorHandler); brokerToThread.put(leader, brokerThread); newPartitionsQueue = brokerThread.getNewPartitionsQueue(); // update queue for the subsequent partitions } } } } } else { // there were no partitions to assign. Check if any broker threads shut down. // we get into this section of the code, if either the poll timed out, or the // blocking poll was woken up by the marker element Iterator<SimpleConsumerThread<T>> bttIterator = brokerToThread.values().iterator(); while (bttIterator.hasNext()) { SimpleConsumerThread<T> thread = bttIterator.next(); if (!thread.getNewPartitionsQueue().isOpen()) { LOG.info("Removing stopped consumer thread {}", thread.getName()); bttIterator.remove(); } } } if (brokerToThread.size() == 0 && unassignedPartitionsQueue.isEmpty()) { if (unassignedPartitionsQueue.close()) { LOG.info("All consumer threads are finished, there are no more unassigned partitions. Stopping fetcher"); break; } // we end up here if somebody added something to the queue in the meantime --> continue to poll queue again } } } catch (InterruptedException e) { // this may be thrown because an exception on one of the concurrent fetcher threads // woke this thread up. make sure we throw the root exception instead in that case errorHandler.checkAndThrowException(); // no other root exception, throw the interrupted exception throw e; } finally { this.running = false; this.zookeeperOffsetHandler = null; // if we run a periodic committer thread, shut that down if (periodicCommitter != null) { periodicCommitter.shutdown(); } // clear the interruption flag // this allows the joining on consumer threads (on best effort) to happen in // case the initial interrupt already Thread.interrupted(); // make sure that in any case (completion, abort, error), all spawned threads are stopped try { int runningThreads; do { // check whether threads are alive and cancel them runningThreads = 0; Iterator<SimpleConsumerThread<T>> threads = brokerToThread.values().iterator(); while (threads.hasNext()) { SimpleConsumerThread<?> t = threads.next(); if (t.isAlive()) { t.cancel(); runningThreads++; } else { threads.remove(); } } // wait for the threads to finish, before issuing a cancel call again if (runningThreads > 0) { for (SimpleConsumerThread<?> t : brokerToThread.values()) { t.join(500 / runningThreads + 1); } } } while (runningThreads > 0); } catch (InterruptedException ignored) { // waiting for the thread shutdown apparently got interrupted // restore interrupted state and continue Thread.currentThread().interrupt(); } catch (Throwable t) { // we catch all here to preserve the original exception LOG.error("Exception while shutting down consumer threads", t); } try { zookeeperOffsetHandler.close(); } catch (Throwable t) { // we catch all here to preserve the original exception LOG.error("Exception while shutting down ZookeeperOffsetHandler", t); } } }
[ "@", "Override", "public", "void", "runFetchLoop", "(", ")", "throws", "Exception", "{", "// the map from broker to the thread that is connected to that broker", "final", "Map", "<", "Node", ",", "SimpleConsumerThread", "<", "T", ">", ">", "brokerToThread", "=", "new", ...
------------------------------------------------------------------------
[ "------------------------------------------------------------------------" ]
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#L124-L325
train
Run the fetch loop.
[ 30522, 1030, 2058, 15637, 2270, 11675, 2448, 7959, 10649, 4135, 7361, 1006, 1007, 11618, 6453, 1063, 1013, 1013, 1996, 4949, 2013, 20138, 2000, 1996, 11689, 2008, 2003, 4198, 2000, 2008, 20138, 2345, 4949, 1026, 13045, 1010, 3722, 8663, 235...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/SQLOperation.java
SQLOperation.prepare
public void prepare(HiveConf sqlOperationConf) throws HiveSQLException { setState(OperationState.RUNNING); try { driver = new Driver(sqlOperationConf, getParentSession().getUserName()); // set the operation handle information in Driver, so that thrift API users // can use the operation handle they receive, to lookup query information in // Yarn ATS String guid64 = Base64.encodeBase64URLSafeString(getHandle().getHandleIdentifier() .toTHandleIdentifier().getGuid()).trim(); driver.setOperationId(guid64); // In Hive server mode, we are not able to retry in the FetchTask // case, when calling fetch queries since execute() has returned. // For now, we disable the test attempts. driver.setTryCount(Integer.MAX_VALUE); String subStatement = new VariableSubstitution().substitute(sqlOperationConf, statement); response = driver.compileAndRespond(subStatement); if (0 != response.getResponseCode()) { throw toSQLException("Error while compiling statement", response); } mResultSchema = driver.getSchema(); // hasResultSet should be true only if the query has a FetchTask // "explain" is an exception for now if(driver.getPlan().getFetchTask() != null) { //Schema has to be set if (mResultSchema == null || !mResultSchema.isSetFieldSchemas()) { throw new HiveSQLException("Error compiling query: Schema and FieldSchema " + "should be set when query plan has a FetchTask"); } resultSchema = new TableSchema(mResultSchema); setHasResultSet(true); } else { setHasResultSet(false); } // Set hasResultSet true if the plan has ExplainTask // TODO explain should use a FetchTask for reading for (Task<? extends Serializable> task: driver.getPlan().getRootTasks()) { if (task.getClass() == ExplainTask.class) { resultSchema = new TableSchema(mResultSchema); setHasResultSet(true); break; } } } catch (HiveSQLException e) { setState(OperationState.ERROR); throw e; } catch (Exception e) { setState(OperationState.ERROR); throw new HiveSQLException("Error running query: " + e.toString(), e); } }
java
public void prepare(HiveConf sqlOperationConf) throws HiveSQLException { setState(OperationState.RUNNING); try { driver = new Driver(sqlOperationConf, getParentSession().getUserName()); // set the operation handle information in Driver, so that thrift API users // can use the operation handle they receive, to lookup query information in // Yarn ATS String guid64 = Base64.encodeBase64URLSafeString(getHandle().getHandleIdentifier() .toTHandleIdentifier().getGuid()).trim(); driver.setOperationId(guid64); // In Hive server mode, we are not able to retry in the FetchTask // case, when calling fetch queries since execute() has returned. // For now, we disable the test attempts. driver.setTryCount(Integer.MAX_VALUE); String subStatement = new VariableSubstitution().substitute(sqlOperationConf, statement); response = driver.compileAndRespond(subStatement); if (0 != response.getResponseCode()) { throw toSQLException("Error while compiling statement", response); } mResultSchema = driver.getSchema(); // hasResultSet should be true only if the query has a FetchTask // "explain" is an exception for now if(driver.getPlan().getFetchTask() != null) { //Schema has to be set if (mResultSchema == null || !mResultSchema.isSetFieldSchemas()) { throw new HiveSQLException("Error compiling query: Schema and FieldSchema " + "should be set when query plan has a FetchTask"); } resultSchema = new TableSchema(mResultSchema); setHasResultSet(true); } else { setHasResultSet(false); } // Set hasResultSet true if the plan has ExplainTask // TODO explain should use a FetchTask for reading for (Task<? extends Serializable> task: driver.getPlan().getRootTasks()) { if (task.getClass() == ExplainTask.class) { resultSchema = new TableSchema(mResultSchema); setHasResultSet(true); break; } } } catch (HiveSQLException e) { setState(OperationState.ERROR); throw e; } catch (Exception e) { setState(OperationState.ERROR); throw new HiveSQLException("Error running query: " + e.toString(), e); } }
[ "public", "void", "prepare", "(", "HiveConf", "sqlOperationConf", ")", "throws", "HiveSQLException", "{", "setState", "(", "OperationState", ".", "RUNNING", ")", ";", "try", "{", "driver", "=", "new", "Driver", "(", "sqlOperationConf", ",", "getParentSession", "...
* Compile the query and extract metadata @param sqlOperationConf @throws HiveSQLException
[ "*", "Compile", "the", "query", "and", "extract", "metadata" ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/SQLOperation.java#L90-L145
train
Prepare the query.
[ 30522, 2270, 11675, 7374, 1006, 26736, 8663, 2546, 29296, 25918, 3370, 8663, 2546, 1007, 11618, 26736, 2015, 4160, 2571, 2595, 24422, 1063, 4520, 12259, 1006, 3136, 12259, 1012, 2770, 1007, 1025, 3046, 1063, 4062, 1027, 2047, 4062, 1006, 29...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java
ExpectedConditions.visibilityOfAllElements
public static ExpectedCondition<List<WebElement>> visibilityOfAllElements( final WebElement... elements) { return visibilityOfAllElements(Arrays.asList(elements)); }
java
public static ExpectedCondition<List<WebElement>> visibilityOfAllElements( final WebElement... elements) { return visibilityOfAllElements(Arrays.asList(elements)); }
[ "public", "static", "ExpectedCondition", "<", "List", "<", "WebElement", ">", ">", "visibilityOfAllElements", "(", "final", "WebElement", "...", "elements", ")", "{", "return", "visibilityOfAllElements", "(", "Arrays", ".", "asList", "(", "elements", ")", ")", "...
An expectation for checking that all elements present on the web page that match the locator are visible. Visibility means that the elements are not only displayed but also have a height and width that is greater than 0. @param elements list of WebElements @return the list of WebElements once they are located
[ "An", "expectation", "for", "checking", "that", "all", "elements", "present", "on", "the", "web", "page", "that", "match", "the", "locator", "are", "visible", ".", "Visibility", "means", "that", "the", "elements", "are", "not", "only", "displayed", "but", "a...
7af172729f17b20269c8ca4ea6f788db48616535
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java#L255-L258
train
An expectation for checking that all elements in the array are visible.
[ 30522, 2270, 10763, 3517, 8663, 20562, 1026, 2862, 1026, 4773, 12260, 3672, 1028, 1028, 16476, 11253, 24164, 16930, 11187, 1006, 2345, 4773, 12260, 3672, 1012, 1012, 1012, 3787, 1007, 1063, 2709, 16476, 11253, 24164, 16930, 11187, 1006, 27448...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/LaunchableMesosWorker.java
LaunchableMesosWorker.configureArtifactServer
static void configureArtifactServer(MesosArtifactServer server, ContainerSpecification container) throws IOException { // serve the artifacts associated with the container environment for (ContainerSpecification.Artifact artifact : container.getArtifacts()) { server.addPath(artifact.source, artifact.dest); } }
java
static void configureArtifactServer(MesosArtifactServer server, ContainerSpecification container) throws IOException { // serve the artifacts associated with the container environment for (ContainerSpecification.Artifact artifact : container.getArtifacts()) { server.addPath(artifact.source, artifact.dest); } }
[ "static", "void", "configureArtifactServer", "(", "MesosArtifactServer", "server", ",", "ContainerSpecification", "container", ")", "throws", "IOException", "{", "// serve the artifacts associated with the container environment", "for", "(", "ContainerSpecification", ".", "Artifa...
Configures an artifact server to serve the artifacts associated with a container specification. @param server the server to configure. @param container the container with artifacts to serve. @throws IOException if the artifacts cannot be accessed.
[ "Configures", "an", "artifact", "server", "to", "serve", "the", "artifacts", "associated", "with", "a", "container", "specification", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/LaunchableMesosWorker.java#L379-L384
train
Configure the artifact server.
[ 30522, 10763, 11675, 9530, 8873, 27390, 14644, 3775, 7011, 16649, 2121, 6299, 1006, 2033, 17063, 8445, 10128, 18908, 8043, 6299, 8241, 1010, 16143, 5051, 6895, 10803, 11661, 1007, 11618, 22834, 10288, 24422, 1063, 1013, 1013, 3710, 1996, 1047...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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-json/src/main/java/cn/hutool/json/JSONUtil.java
JSONUtil.escape
public static String escape(String str) { if (StrUtil.isEmpty(str)) { return str; } final int len = str.length(); final StringBuilder builder = new StringBuilder(len); char c; for (int i = 0; i < len; i++) { c = str.charAt(i); builder.append(escape(c)); } return builder.toString(); }
java
public static String escape(String str) { if (StrUtil.isEmpty(str)) { return str; } final int len = str.length(); final StringBuilder builder = new StringBuilder(len); char c; for (int i = 0; i < len; i++) { c = str.charAt(i); builder.append(escape(c)); } return builder.toString(); }
[ "public", "static", "String", "escape", "(", "String", "str", ")", "{", "if", "(", "StrUtil", ".", "isEmpty", "(", "str", ")", ")", "{", "return", "str", ";", "}", "final", "int", "len", "=", "str", ".", "length", "(", ")", ";", "final", "StringBui...
转义显示不可见字符 @param str 字符串 @return 转义后的字符串
[ "转义显示不可见字符" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONUtil.java#L543-L556
train
Escape a string.
[ 30522, 2270, 10763, 5164, 4019, 1006, 5164, 2358, 2099, 1007, 1063, 2065, 1006, 2358, 22134, 4014, 1012, 2003, 6633, 13876, 2100, 1006, 2358, 2099, 1007, 1007, 1063, 2709, 2358, 2099, 1025, 1065, 2345, 20014, 18798, 1027, 2358, 2099, 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...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/collection/trie/datrie/IntArrayList.java
IntArrayList.loseWeight
public void loseWeight() { if (size == data.length) { return; } int[] newData = new int[size]; System.arraycopy(this.data, 0, newData, 0, size); this.data = newData; }
java
public void loseWeight() { if (size == data.length) { return; } int[] newData = new int[size]; System.arraycopy(this.data, 0, newData, 0, size); this.data = newData; }
[ "public", "void", "loseWeight", "(", ")", "{", "if", "(", "size", "==", "data", ".", "length", ")", "{", "return", ";", "}", "int", "[", "]", "newData", "=", "new", "int", "[", "size", "]", ";", "System", ".", "arraycopy", "(", "this", ".", "data...
去掉多余的buffer
[ "去掉多余的buffer" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/datrie/IntArrayList.java#L108-L117
train
This method is called to lose the weight of the record.
[ 30522, 2270, 11675, 4558, 11179, 1006, 1007, 1063, 2065, 1006, 2946, 1027, 1027, 2951, 1012, 3091, 1007, 1063, 2709, 1025, 1065, 20014, 1031, 1033, 2047, 2850, 2696, 1027, 2047, 20014, 1031, 2946, 1033, 1025, 2291, 1012, 9140, 3597, 7685, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/HttpConnection.java
HttpConnection.header
public HttpConnection header(String header, String value, boolean isOverride) { if (null != this.conn) { if (isOverride) { this.conn.setRequestProperty(header, value); } else { this.conn.addRequestProperty(header, value); } } return this; }
java
public HttpConnection header(String header, String value, boolean isOverride) { if (null != this.conn) { if (isOverride) { this.conn.setRequestProperty(header, value); } else { this.conn.addRequestProperty(header, value); } } return this; }
[ "public", "HttpConnection", "header", "(", "String", "header", ",", "String", "value", ",", "boolean", "isOverride", ")", "{", "if", "(", "null", "!=", "this", ".", "conn", ")", "{", "if", "(", "isOverride", ")", "{", "this", ".", "conn", ".", "setRequ...
设置请求头<br> 当请求头存在时,覆盖之 @param header 头名 @param value 头值 @param isOverride 是否覆盖旧值 @return HttpConnection
[ "设置请求头<br", ">", "当请求头存在时,覆盖之" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpConnection.java#L175-L185
train
Sets or overrides a request property.
[ 30522, 2270, 8299, 8663, 2638, 7542, 20346, 1006, 5164, 20346, 1010, 5164, 3643, 1010, 22017, 20898, 11163, 6299, 15637, 1007, 1063, 2065, 1006, 19701, 999, 1027, 2023, 1012, 9530, 2078, 1007, 1063, 2065, 1006, 11163, 6299, 15637, 1007, 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/flink
flink-core/src/main/java/org/apache/flink/util/WrappingRuntimeException.java
WrappingRuntimeException.unwrap
public Throwable unwrap() { Throwable cause = getCause(); return (cause instanceof WrappingRuntimeException) ? ((WrappingRuntimeException) cause).unwrap() : cause; }
java
public Throwable unwrap() { Throwable cause = getCause(); return (cause instanceof WrappingRuntimeException) ? ((WrappingRuntimeException) cause).unwrap() : cause; }
[ "public", "Throwable", "unwrap", "(", ")", "{", "Throwable", "cause", "=", "getCause", "(", ")", ";", "return", "(", "cause", "instanceof", "WrappingRuntimeException", ")", "?", "(", "(", "WrappingRuntimeException", ")", "cause", ")", ".", "unwrap", "(", ")"...
Recursively unwraps this WrappingRuntimeException and its causes, getting the first non wrapping exception. @return The first cause that is not a wrapping exception.
[ "Recursively", "unwraps", "this", "WrappingRuntimeException", "and", "its", "causes", "getting", "the", "first", "non", "wrapping", "exception", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/WrappingRuntimeException.java#L50-L53
train
Unwraps the wrapped exception.
[ 30522, 2270, 5466, 3085, 4895, 13088, 9331, 1006, 1007, 1063, 5466, 3085, 3426, 1027, 2131, 3540, 8557, 1006, 1007, 1025, 2709, 1006, 3426, 6013, 11253, 12252, 15532, 7292, 10288, 24422, 1007, 1029, 1006, 1006, 12252, 15532, 7292, 10288, 24...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/bootstrap/ServerBootstrap.java
ServerBootstrap.childOption
public <T> ServerBootstrap childOption(ChannelOption<T> childOption, T value) { if (childOption == null) { throw new NullPointerException("childOption"); } if (value == null) { synchronized (childOptions) { childOptions.remove(childOption); } } else { synchronized (childOptions) { childOptions.put(childOption, value); } } return this; }
java
public <T> ServerBootstrap childOption(ChannelOption<T> childOption, T value) { if (childOption == null) { throw new NullPointerException("childOption"); } if (value == null) { synchronized (childOptions) { childOptions.remove(childOption); } } else { synchronized (childOptions) { childOptions.put(childOption, value); } } return this; }
[ "public", "<", "T", ">", "ServerBootstrap", "childOption", "(", "ChannelOption", "<", "T", ">", "childOption", ",", "T", "value", ")", "{", "if", "(", "childOption", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"childOption\"", ")",...
Allow to specify a {@link ChannelOption} which is used for the {@link Channel} instances once they get created (after the acceptor accepted the {@link Channel}). Use a value of {@code null} to remove a previous set {@link ChannelOption}.
[ "Allow", "to", "specify", "a", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/bootstrap/ServerBootstrap.java#L97-L111
train
Sets the value of a childOption.
[ 30522, 2270, 1026, 1056, 1028, 8241, 27927, 20528, 2361, 2775, 7361, 3508, 1006, 3149, 7361, 3508, 1026, 1056, 1028, 2775, 7361, 3508, 1010, 1056, 3643, 1007, 1063, 2065, 1006, 2775, 7361, 3508, 1027, 1027, 19701, 1007, 1063, 5466, 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...
apache/flink
flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java
Configuration.addDeprecations
public static void addDeprecations(DeprecationDelta[] deltas) { DeprecationContext prev, next; do { prev = deprecationContext.get(); next = new DeprecationContext(prev, deltas); } while (!deprecationContext.compareAndSet(prev, next)); }
java
public static void addDeprecations(DeprecationDelta[] deltas) { DeprecationContext prev, next; do { prev = deprecationContext.get(); next = new DeprecationContext(prev, deltas); } while (!deprecationContext.compareAndSet(prev, next)); }
[ "public", "static", "void", "addDeprecations", "(", "DeprecationDelta", "[", "]", "deltas", ")", "{", "DeprecationContext", "prev", ",", "next", ";", "do", "{", "prev", "=", "deprecationContext", ".", "get", "(", ")", ";", "next", "=", "new", "DeprecationCon...
Adds a set of deprecated keys to the global deprecations. This method is lockless. It works by means of creating a new DeprecationContext based on the old one, and then atomically swapping in the new context. If someone else updated the context in between us reading the old context and swapping in the new one, we try again until we win the race. @param deltas The deprecations to add.
[ "Adds", "a", "set", "of", "deprecated", "keys", "to", "the", "global", "deprecations", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L456-L462
train
Add a list of deprecation deltas to the current deprecation context.
[ 30522, 2270, 10763, 11675, 5587, 3207, 28139, 10719, 2015, 1006, 2139, 28139, 10719, 9247, 2696, 1031, 1033, 7160, 2015, 1007, 1063, 2139, 28139, 10719, 8663, 18209, 3653, 2615, 1010, 2279, 1025, 2079, 1063, 3653, 2615, 1027, 2139, 28139, 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/multipart/HttpPostStandardRequestDecoder.java
HttpPostStandardRequestDecoder.parseBody
private void parseBody() { if (currentStatus == MultiPartStatus.PREEPILOGUE || currentStatus == MultiPartStatus.EPILOGUE) { if (isLastChunk) { currentStatus = MultiPartStatus.EPILOGUE; } return; } parseBodyAttributes(); }
java
private void parseBody() { if (currentStatus == MultiPartStatus.PREEPILOGUE || currentStatus == MultiPartStatus.EPILOGUE) { if (isLastChunk) { currentStatus = MultiPartStatus.EPILOGUE; } return; } parseBodyAttributes(); }
[ "private", "void", "parseBody", "(", ")", "{", "if", "(", "currentStatus", "==", "MultiPartStatus", ".", "PREEPILOGUE", "||", "currentStatus", "==", "MultiPartStatus", ".", "EPILOGUE", ")", "{", "if", "(", "isLastChunk", ")", "{", "currentStatus", "=", "MultiP...
This getMethod will parse as much as possible data and fill the list and map @throws ErrorDataDecoderException if there is a problem with the charset decoding or other errors
[ "This", "getMethod", "will", "parse", "as", "much", "as", "possible", "data", "and", "fill", "the", "list", "and", "map" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostStandardRequestDecoder.java#L353-L361
train
Parse the body of the message.
[ 30522, 2797, 11675, 11968, 3366, 23684, 1006, 1007, 1063, 2065, 1006, 14731, 29336, 2271, 1027, 1027, 4800, 26950, 29336, 2271, 1012, 3653, 13699, 22360, 9077, 1064, 1064, 14731, 29336, 2271, 1027, 1027, 4800, 30524, 1025, 1065, 11968, 3366, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/info/GitProperties.java
GitProperties.getShortCommitId
public String getShortCommitId() { String shortId = get("commit.id.abbrev"); if (shortId != null) { return shortId; } String id = getCommitId(); if (id == null) { return null; } return (id.length() > 7) ? id.substring(0, 7) : id; }
java
public String getShortCommitId() { String shortId = get("commit.id.abbrev"); if (shortId != null) { return shortId; } String id = getCommitId(); if (id == null) { return null; } return (id.length() > 7) ? id.substring(0, 7) : id; }
[ "public", "String", "getShortCommitId", "(", ")", "{", "String", "shortId", "=", "get", "(", "\"commit.id.abbrev\"", ")", ";", "if", "(", "shortId", "!=", "null", ")", "{", "return", "shortId", ";", "}", "String", "id", "=", "getCommitId", "(", ")", ";",...
Return the abbreviated id of the commit or {@code null}. @return the short commit id
[ "Return", "the", "abbreviated", "id", "of", "the", "commit", "or", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/GitProperties.java#L56-L66
train
Returns the commit id as a string.
[ 30522, 2270, 5164, 4152, 27794, 9006, 22930, 3593, 1006, 1007, 1063, 5164, 2460, 3593, 1027, 2131, 1006, 1000, 10797, 1012, 8909, 1012, 11113, 13578, 2615, 1000, 1007, 1025, 2065, 1006, 2460, 3593, 999, 1027, 19701, 1007, 1063, 2709, 2460, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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-filesystem/src/main/java/org/apache/flink/streaming/connectors/fs/bucketing/BucketingSink.java
BucketingSink.openNewPartFile
private void openNewPartFile(Path bucketPath, BucketState<T> bucketState) throws Exception { closeCurrentPartFile(bucketState); if (!fs.exists(bucketPath)) { try { if (fs.mkdirs(bucketPath)) { LOG.debug("Created new bucket directory: {}", bucketPath); } } catch (IOException e) { throw new RuntimeException("Could not create new bucket path.", e); } } // The following loop tries different partCounter values in ascending order until it reaches the minimum // that is not yet used. This works since there is only one parallel subtask that tries names with this // subtask id. Otherwise we would run into concurrency issues here. This is aligned with the way we now // clean the base directory in case of rescaling. int subtaskIndex = getRuntimeContext().getIndexOfThisSubtask(); Path partPath = assemblePartPath(bucketPath, subtaskIndex, bucketState.partCounter); while (fs.exists(partPath) || fs.exists(getPendingPathFor(partPath)) || fs.exists(getInProgressPathFor(partPath))) { bucketState.partCounter++; partPath = assemblePartPath(bucketPath, subtaskIndex, bucketState.partCounter); } // Record the creation time of the bucket bucketState.creationTime = processingTimeService.getCurrentProcessingTime(); // increase, so we don't have to check for this name next time bucketState.partCounter++; LOG.debug("Next part path is {}", partPath.toString()); bucketState.currentFile = partPath.toString(); Path inProgressPath = getInProgressPathFor(partPath); if (bucketState.writer == null) { bucketState.writer = writerTemplate.duplicate(); if (bucketState.writer == null) { throw new UnsupportedOperationException( "Could not duplicate writer. " + "Class '" + writerTemplate.getClass().getCanonicalName() + "' must implement the 'Writer.duplicate()' method." ); } } bucketState.writer.open(fs, inProgressPath); bucketState.isWriterOpen = true; }
java
private void openNewPartFile(Path bucketPath, BucketState<T> bucketState) throws Exception { closeCurrentPartFile(bucketState); if (!fs.exists(bucketPath)) { try { if (fs.mkdirs(bucketPath)) { LOG.debug("Created new bucket directory: {}", bucketPath); } } catch (IOException e) { throw new RuntimeException("Could not create new bucket path.", e); } } // The following loop tries different partCounter values in ascending order until it reaches the minimum // that is not yet used. This works since there is only one parallel subtask that tries names with this // subtask id. Otherwise we would run into concurrency issues here. This is aligned with the way we now // clean the base directory in case of rescaling. int subtaskIndex = getRuntimeContext().getIndexOfThisSubtask(); Path partPath = assemblePartPath(bucketPath, subtaskIndex, bucketState.partCounter); while (fs.exists(partPath) || fs.exists(getPendingPathFor(partPath)) || fs.exists(getInProgressPathFor(partPath))) { bucketState.partCounter++; partPath = assemblePartPath(bucketPath, subtaskIndex, bucketState.partCounter); } // Record the creation time of the bucket bucketState.creationTime = processingTimeService.getCurrentProcessingTime(); // increase, so we don't have to check for this name next time bucketState.partCounter++; LOG.debug("Next part path is {}", partPath.toString()); bucketState.currentFile = partPath.toString(); Path inProgressPath = getInProgressPathFor(partPath); if (bucketState.writer == null) { bucketState.writer = writerTemplate.duplicate(); if (bucketState.writer == null) { throw new UnsupportedOperationException( "Could not duplicate writer. " + "Class '" + writerTemplate.getClass().getCanonicalName() + "' must implement the 'Writer.duplicate()' method." ); } } bucketState.writer.open(fs, inProgressPath); bucketState.isWriterOpen = true; }
[ "private", "void", "openNewPartFile", "(", "Path", "bucketPath", ",", "BucketState", "<", "T", ">", "bucketState", ")", "throws", "Exception", "{", "closeCurrentPartFile", "(", "bucketState", ")", ";", "if", "(", "!", "fs", ".", "exists", "(", "bucketPath", ...
Closes the current part file and opens a new one with a new bucket path, as returned by the {@link Bucketer}. If the bucket is not new, then this will create a new file with the same path as its predecessor, but with an increased rolling counter (see {@link BucketingSink}.
[ "Closes", "the", "current", "part", "file", "and", "opens", "a", "new", "one", "with", "a", "new", "bucket", "path", "as", "returned", "by", "the", "{" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-filesystem/src/main/java/org/apache/flink/streaming/connectors/fs/bucketing/BucketingSink.java#L536-L585
train
Opens a new part file.
[ 30522, 2797, 11675, 2330, 2638, 2860, 19362, 24475, 9463, 1006, 4130, 13610, 15069, 1010, 13610, 9153, 2618, 1026, 1056, 1028, 13610, 9153, 2618, 1007, 11618, 6453, 1063, 2485, 10841, 14343, 3372, 19362, 24475, 9463, 1006, 13610, 9153, 2618, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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-blink/src/main/java/org/apache/flink/table/functions/aggfunctions/DeclarativeAggregateFunction.java
DeclarativeAggregateFunction.mergeOperand
public final UnresolvedReferenceExpression mergeOperand(UnresolvedReferenceExpression aggBuffer) { String name = String.valueOf(Arrays.asList(aggBufferAttributes()).indexOf(aggBuffer)); validateOperandName(name); return new UnresolvedReferenceExpression(name); }
java
public final UnresolvedReferenceExpression mergeOperand(UnresolvedReferenceExpression aggBuffer) { String name = String.valueOf(Arrays.asList(aggBufferAttributes()).indexOf(aggBuffer)); validateOperandName(name); return new UnresolvedReferenceExpression(name); }
[ "public", "final", "UnresolvedReferenceExpression", "mergeOperand", "(", "UnresolvedReferenceExpression", "aggBuffer", ")", "{", "String", "name", "=", "String", ".", "valueOf", "(", "Arrays", ".", "asList", "(", "aggBufferAttributes", "(", ")", ")", ".", "indexOf",...
Merge input of {@link #mergeExpressions()}, the input are AGG buffer generated by user definition.
[ "Merge", "input", "of", "{" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/functions/aggfunctions/DeclarativeAggregateFunction.java#L146-L150
train
Merge an operand into this one.
[ 30522, 2270, 2345, 4895, 6072, 16116, 2890, 25523, 10288, 20110, 3258, 13590, 25918, 5685, 1006, 4895, 6072, 16116, 2890, 25523, 10288, 20110, 3258, 12943, 18259, 16093, 7512, 1007, 1063, 5164, 2171, 1027, 5164, 1012, 3643, 11253, 1006, 27448...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.9/src/main/java/org/apache/flink/streaming/connectors/kafka/internal/Kafka09Fetcher.java
Kafka09Fetcher.emitRecord
protected void emitRecord( T record, KafkaTopicPartitionState<TopicPartition> partition, long offset, @SuppressWarnings("UnusedParameters") ConsumerRecord<?, ?> consumerRecord) throws Exception { // the 0.9 Fetcher does not try to extract a timestamp emitRecord(record, partition, offset); }
java
protected void emitRecord( T record, KafkaTopicPartitionState<TopicPartition> partition, long offset, @SuppressWarnings("UnusedParameters") ConsumerRecord<?, ?> consumerRecord) throws Exception { // the 0.9 Fetcher does not try to extract a timestamp emitRecord(record, partition, offset); }
[ "protected", "void", "emitRecord", "(", "T", "record", ",", "KafkaTopicPartitionState", "<", "TopicPartition", ">", "partition", ",", "long", "offset", ",", "@", "SuppressWarnings", "(", "\"UnusedParameters\"", ")", "ConsumerRecord", "<", "?", ",", "?", ">", "co...
------------------------------------------------------------------------
[ "------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-0.9/src/main/java/org/apache/flink/streaming/connectors/kafka/internal/Kafka09Fetcher.java#L190-L198
train
Emits a single record to the Kafka topic partition.
[ 30522, 5123, 11675, 12495, 7913, 27108, 2094, 1006, 1056, 2501, 1010, 10556, 24316, 10610, 24330, 19362, 3775, 9285, 12259, 1026, 8476, 19362, 3775, 3508, 1028, 13571, 1010, 2146, 16396, 1010, 1030, 16081, 9028, 5582, 2015, 1006, 1000, 15171,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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
launcher/src/main/java/org/apache/spark/launcher/SparkLauncher.java
SparkLauncher.startApplication
@Override public SparkAppHandle startApplication(SparkAppHandle.Listener... listeners) throws IOException { LauncherServer server = LauncherServer.getOrCreateServer(); ChildProcAppHandle handle = new ChildProcAppHandle(server); for (SparkAppHandle.Listener l : listeners) { handle.addListener(l); } String secret = server.registerHandle(handle); String loggerName = getLoggerName(); ProcessBuilder pb = createBuilder(); boolean outputToLog = outputStream == null; boolean errorToLog = !redirectErrorStream && errorStream == null; // Only setup stderr + stdout to logger redirection if user has not otherwise configured output // redirection. if (loggerName == null && (outputToLog || errorToLog)) { String appName; if (builder.appName != null) { appName = builder.appName; } else if (builder.mainClass != null) { int dot = builder.mainClass.lastIndexOf("."); if (dot >= 0 && dot < builder.mainClass.length() - 1) { appName = builder.mainClass.substring(dot + 1, builder.mainClass.length()); } else { appName = builder.mainClass; } } else if (builder.appResource != null) { appName = new File(builder.appResource).getName(); } else { appName = String.valueOf(COUNTER.incrementAndGet()); } String loggerPrefix = getClass().getPackage().getName(); loggerName = String.format("%s.app.%s", loggerPrefix, appName); } if (outputToLog && errorToLog) { pb.redirectErrorStream(true); } pb.environment().put(LauncherProtocol.ENV_LAUNCHER_PORT, String.valueOf(server.getPort())); pb.environment().put(LauncherProtocol.ENV_LAUNCHER_SECRET, secret); try { Process child = pb.start(); InputStream logStream = null; if (loggerName != null) { logStream = outputToLog ? child.getInputStream() : child.getErrorStream(); } handle.setChildProc(child, loggerName, logStream); } catch (IOException ioe) { handle.kill(); throw ioe; } return handle; }
java
@Override public SparkAppHandle startApplication(SparkAppHandle.Listener... listeners) throws IOException { LauncherServer server = LauncherServer.getOrCreateServer(); ChildProcAppHandle handle = new ChildProcAppHandle(server); for (SparkAppHandle.Listener l : listeners) { handle.addListener(l); } String secret = server.registerHandle(handle); String loggerName = getLoggerName(); ProcessBuilder pb = createBuilder(); boolean outputToLog = outputStream == null; boolean errorToLog = !redirectErrorStream && errorStream == null; // Only setup stderr + stdout to logger redirection if user has not otherwise configured output // redirection. if (loggerName == null && (outputToLog || errorToLog)) { String appName; if (builder.appName != null) { appName = builder.appName; } else if (builder.mainClass != null) { int dot = builder.mainClass.lastIndexOf("."); if (dot >= 0 && dot < builder.mainClass.length() - 1) { appName = builder.mainClass.substring(dot + 1, builder.mainClass.length()); } else { appName = builder.mainClass; } } else if (builder.appResource != null) { appName = new File(builder.appResource).getName(); } else { appName = String.valueOf(COUNTER.incrementAndGet()); } String loggerPrefix = getClass().getPackage().getName(); loggerName = String.format("%s.app.%s", loggerPrefix, appName); } if (outputToLog && errorToLog) { pb.redirectErrorStream(true); } pb.environment().put(LauncherProtocol.ENV_LAUNCHER_PORT, String.valueOf(server.getPort())); pb.environment().put(LauncherProtocol.ENV_LAUNCHER_SECRET, secret); try { Process child = pb.start(); InputStream logStream = null; if (loggerName != null) { logStream = outputToLog ? child.getInputStream() : child.getErrorStream(); } handle.setChildProc(child, loggerName, logStream); } catch (IOException ioe) { handle.kill(); throw ioe; } return handle; }
[ "@", "Override", "public", "SparkAppHandle", "startApplication", "(", "SparkAppHandle", ".", "Listener", "...", "listeners", ")", "throws", "IOException", "{", "LauncherServer", "server", "=", "LauncherServer", ".", "getOrCreateServer", "(", ")", ";", "ChildProcAppHan...
Starts a Spark application. <p> Applications launched by this launcher run as child processes. The child's stdout and stderr are merged and written to a logger (see <code>java.util.logging</code>) only if redirection has not otherwise been configured on this <code>SparkLauncher</code>. The logger's name can be defined by setting {@link #CHILD_PROCESS_LOGGER_NAME} in the app's configuration. If that option is not set, the code will try to derive a name from the application's name or main class / script file. If those cannot be determined, an internal, unique name will be used. In all cases, the logger name will start with "org.apache.spark.launcher.app", to fit more easily into the configuration of commonly-used logging systems. @since 1.6.0 @see AbstractLauncher#startApplication(SparkAppHandle.Listener...) @param listeners Listeners to add to the handle before the app is launched. @return A handle for the launched application.
[ "Starts", "a", "Spark", "application", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/SparkLauncher.java#L350-L407
train
Start the application.
[ 30522, 1030, 2058, 15637, 2270, 12125, 29098, 11774, 2571, 2707, 29098, 19341, 3508, 1006, 12125, 29098, 11774, 2571, 1012, 19373, 1012, 1012, 1012, 13810, 1007, 11618, 22834, 10288, 24422, 1063, 22742, 8043, 6299, 8241, 1027, 22742, 8043, 62...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/task/TaskExecutorBuilder.java
TaskExecutorBuilder.configure
public <T extends ThreadPoolTaskExecutor> T configure(T taskExecutor) { PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull(); map.from(this.queueCapacity).to(taskExecutor::setQueueCapacity); map.from(this.corePoolSize).to(taskExecutor::setCorePoolSize); map.from(this.maxPoolSize).to(taskExecutor::setMaxPoolSize); map.from(this.keepAlive).asInt(Duration::getSeconds) .to(taskExecutor::setKeepAliveSeconds); map.from(this.allowCoreThreadTimeOut).to(taskExecutor::setAllowCoreThreadTimeOut); map.from(this.awaitTermination) .to(taskExecutor::setWaitForTasksToCompleteOnShutdown); map.from(this.awaitTerminationPeriod).asInt(Duration::getSeconds) .to(taskExecutor::setAwaitTerminationSeconds); map.from(this.threadNamePrefix).whenHasText() .to(taskExecutor::setThreadNamePrefix); map.from(this.taskDecorator).to(taskExecutor::setTaskDecorator); if (!CollectionUtils.isEmpty(this.customizers)) { this.customizers.forEach((customizer) -> customizer.customize(taskExecutor)); } return taskExecutor; }
java
public <T extends ThreadPoolTaskExecutor> T configure(T taskExecutor) { PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull(); map.from(this.queueCapacity).to(taskExecutor::setQueueCapacity); map.from(this.corePoolSize).to(taskExecutor::setCorePoolSize); map.from(this.maxPoolSize).to(taskExecutor::setMaxPoolSize); map.from(this.keepAlive).asInt(Duration::getSeconds) .to(taskExecutor::setKeepAliveSeconds); map.from(this.allowCoreThreadTimeOut).to(taskExecutor::setAllowCoreThreadTimeOut); map.from(this.awaitTermination) .to(taskExecutor::setWaitForTasksToCompleteOnShutdown); map.from(this.awaitTerminationPeriod).asInt(Duration::getSeconds) .to(taskExecutor::setAwaitTerminationSeconds); map.from(this.threadNamePrefix).whenHasText() .to(taskExecutor::setThreadNamePrefix); map.from(this.taskDecorator).to(taskExecutor::setTaskDecorator); if (!CollectionUtils.isEmpty(this.customizers)) { this.customizers.forEach((customizer) -> customizer.customize(taskExecutor)); } return taskExecutor; }
[ "public", "<", "T", "extends", "ThreadPoolTaskExecutor", ">", "T", "configure", "(", "T", "taskExecutor", ")", "{", "PropertyMapper", "map", "=", "PropertyMapper", ".", "get", "(", ")", ".", "alwaysApplyingWhenNonNull", "(", ")", ";", "map", ".", "from", "("...
Configure the provided {@link ThreadPoolTaskExecutor} instance using this builder. @param <T> the type of task executor @param taskExecutor the {@link ThreadPoolTaskExecutor} to configure @return the task executor instance @see #build() @see #build(Class)
[ "Configure", "the", "provided", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskExecutorBuilder.java#L317-L336
train
Configure the given task executor.
[ 30522, 2270, 1026, 1056, 8908, 11689, 16869, 10230, 3489, 2595, 8586, 16161, 2099, 1028, 1056, 9530, 8873, 27390, 2063, 1006, 1056, 4708, 10288, 8586, 16161, 2099, 1007, 1063, 3200, 2863, 18620, 4949, 1027, 3200, 2863, 18620, 1012, 2131, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java
IterUtil.toMap
public static <K, V> Map<K, V> toMap(Iterator<K> keys, Iterator<V> values, boolean isOrder) { final Map<K, V> resultMap = MapUtil.newHashMap(isOrder); if (isNotEmpty(keys)) { while (keys.hasNext()) { resultMap.put(keys.next(), (null != values && values.hasNext()) ? values.next() : null); } } return resultMap; }
java
public static <K, V> Map<K, V> toMap(Iterator<K> keys, Iterator<V> values, boolean isOrder) { final Map<K, V> resultMap = MapUtil.newHashMap(isOrder); if (isNotEmpty(keys)) { while (keys.hasNext()) { resultMap.put(keys.next(), (null != values && values.hasNext()) ? values.next() : null); } } return resultMap; }
[ "public", "static", "<", "K", ",", "V", ">", "Map", "<", "K", ",", "V", ">", "toMap", "(", "Iterator", "<", "K", ">", "keys", ",", "Iterator", "<", "V", ">", "values", ",", "boolean", "isOrder", ")", "{", "final", "Map", "<", "K", ",", "V", "...
将键列表和值列表转换为Map<br> 以键为准,值与键位置需对应。如果键元素数多于值元素,多余部分值用null代替。<br> 如果值多于键,忽略多余的值。 @param <K> 键类型 @param <V> 值类型 @param keys 键列表 @param values 值列表 @param isOrder 是否有序 @return 标题内容Map @since 4.1.12
[ "将键列表和值列表转换为Map<br", ">", "以键为准,值与键位置需对应。如果键元素数多于值元素,多余部分值用null代替。<br", ">", "如果值多于键,忽略多余的值。" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java#L421-L429
train
Creates a map from the given iterator.
[ 30522, 2270, 10763, 1026, 1047, 1010, 1058, 1028, 4949, 1026, 1047, 1010, 1058, 1028, 3419, 9331, 1006, 2009, 6906, 4263, 1026, 1047, 1028, 6309, 1010, 2009, 6906, 4263, 1026, 1058, 1028, 5300, 1010, 22017, 20898, 11163, 26764, 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/collection/trie/DoubleArrayTrie.java
DoubleArrayTrie.load
public boolean load(byte[] bytes, int offset, V[] value) { if (bytes == null) return false; size = ByteUtil.bytesHighFirstToInt(bytes, offset); offset += 4; base = new int[size + 65535]; // 多留一些,防止越界 check = new int[size + 65535]; for (int i = 0; i < size; i++) { base[i] = ByteUtil.bytesHighFirstToInt(bytes, offset); offset += 4; check[i] = ByteUtil.bytesHighFirstToInt(bytes, offset); offset += 4; } v = value; return true; }
java
public boolean load(byte[] bytes, int offset, V[] value) { if (bytes == null) return false; size = ByteUtil.bytesHighFirstToInt(bytes, offset); offset += 4; base = new int[size + 65535]; // 多留一些,防止越界 check = new int[size + 65535]; for (int i = 0; i < size; i++) { base[i] = ByteUtil.bytesHighFirstToInt(bytes, offset); offset += 4; check[i] = ByteUtil.bytesHighFirstToInt(bytes, offset); offset += 4; } v = value; return true; }
[ "public", "boolean", "load", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ",", "V", "[", "]", "value", ")", "{", "if", "(", "bytes", "==", "null", ")", "return", "false", ";", "size", "=", "ByteUtil", ".", "bytesHighFirstToInt", "(", "bytes"...
从字节数组加载(发现在MacOS上,此方法比ByteArray更快) @param bytes @param offset @param value @return
[ "从字节数组加载(发现在MacOS上,此方法比ByteArray更快)" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java#L555-L571
train
Load a single class from the bytes.
[ 30522, 2270, 22017, 20898, 7170, 1006, 24880, 1031, 1033, 27507, 1010, 20014, 16396, 1010, 1058, 1031, 1033, 3643, 1007, 1063, 2065, 1006, 27507, 1027, 1027, 19701, 1007, 2709, 6270, 1025, 2946, 1027, 24880, 21823, 2140, 1012, 27507, 4048, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/NioUtils.java
NioUtils.deleteOldFiles
public static void deleteOldFiles(String dirPath, int olderThanMinute) { File folder = new File(dirPath); if (folder.exists()) { File[] listFiles = folder.listFiles(); long eligibleForDeletion = System.currentTimeMillis() - (olderThanMinute * 60 * 1000L); for (File listFile: listFiles) { if (listFile.lastModified() < eligibleForDeletion) { if (!listFile.delete()) { logger.error("Unable to delete file %s", listFile); } } } } }
java
public static void deleteOldFiles(String dirPath, int olderThanMinute) { File folder = new File(dirPath); if (folder.exists()) { File[] listFiles = folder.listFiles(); long eligibleForDeletion = System.currentTimeMillis() - (olderThanMinute * 60 * 1000L); for (File listFile: listFiles) { if (listFile.lastModified() < eligibleForDeletion) { if (!listFile.delete()) { logger.error("Unable to delete file %s", listFile); } } } } }
[ "public", "static", "void", "deleteOldFiles", "(", "String", "dirPath", ",", "int", "olderThanMinute", ")", "{", "File", "folder", "=", "new", "File", "(", "dirPath", ")", ";", "if", "(", "folder", ".", "exists", "(", ")", ")", "{", "File", "[", "]", ...
Delele old files @param dirPath path of the filesystem @param olderThanMinute the minutes that defines older files
[ "Delele", "old", "files" ]
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/NioUtils.java#L230-L244
train
Delete old files.
[ 30522, 2270, 10763, 11675, 3972, 12870, 11614, 8873, 4244, 1006, 5164, 16101, 15069, 1010, 20014, 3080, 21604, 10020, 10421, 1007, 1063, 5371, 19622, 1027, 2047, 5371, 1006, 16101, 15069, 1007, 1025, 2065, 1006, 19622, 1012, 6526, 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-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java
ExecutionEnvironment.registerTypeWithKryoSerializer
public void registerTypeWithKryoSerializer(Class<?> type, Class<? extends Serializer<?>> serializerClass) { config.registerTypeWithKryoSerializer(type, serializerClass); }
java
public void registerTypeWithKryoSerializer(Class<?> type, Class<? extends Serializer<?>> serializerClass) { config.registerTypeWithKryoSerializer(type, serializerClass); }
[ "public", "void", "registerTypeWithKryoSerializer", "(", "Class", "<", "?", ">", "type", ",", "Class", "<", "?", "extends", "Serializer", "<", "?", ">", ">", "serializerClass", ")", "{", "config", ".", "registerTypeWithKryoSerializer", "(", "type", ",", "seria...
Registers the given Serializer via its class as a serializer for the given type at the KryoSerializer. @param type The class of the types serialized with the given serializer. @param serializerClass The class of the serializer to use.
[ "Registers", "the", "given", "Serializer", "via", "its", "class", "as", "a", "serializer", "for", "the", "given", "type", "at", "the", "KryoSerializer", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java#L354-L356
train
Register a type with the Kryo serializer.
[ 30522, 2270, 11675, 4236, 13874, 24415, 21638, 7677, 8043, 4818, 17629, 1006, 2465, 1026, 1029, 1028, 2828, 1010, 2465, 1026, 1029, 8908, 7642, 17629, 1026, 1029, 1028, 1028, 7642, 17629, 26266, 1007, 1063, 9530, 8873, 2290, 1012, 4236, 138...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.writeNullableString
public static void writeNullableString(@Nullable String str, DataOutputView out) throws IOException { if (str != null) { out.writeBoolean(true); writeString(str, out); } else { out.writeBoolean(false); } }
java
public static void writeNullableString(@Nullable String str, DataOutputView out) throws IOException { if (str != null) { out.writeBoolean(true); writeString(str, out); } else { out.writeBoolean(false); } }
[ "public", "static", "void", "writeNullableString", "(", "@", "Nullable", "String", "str", ",", "DataOutputView", "out", ")", "throws", "IOException", "{", "if", "(", "str", "!=", "null", ")", "{", "out", ".", "writeBoolean", "(", "true", ")", ";", "writeSt...
Writes a String to the given output. The string may be null. The written string can be read with {@link #readNullableString(DataInputView)}- @param str The string to write, or null. @param out The output to write to. @throws IOException Thrown, if the writing or the serialization fails.
[ "Writes", "a", "String", "to", "the", "given", "output", ".", "The", "string", "may", "be", "null", ".", "The", "written", "string", "can", "be", "read", "with", "{", "@link", "#readNullableString", "(", "DataInputView", ")", "}", "-" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/StringUtils.java#L319-L326
train
Write a String to a DataOutputView.
[ 30522, 2270, 10763, 11675, 4339, 11231, 4571, 13510, 18886, 3070, 1006, 1030, 19701, 3085, 5164, 2358, 2099, 1010, 2951, 5833, 18780, 8584, 2041, 1007, 11618, 22834, 10288, 24422, 1063, 2065, 1006, 2358, 2099, 999, 1027, 19701, 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...
netty/netty
common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java
NativeLibraryLoader.patchShadedLibraryId
static boolean patchShadedLibraryId(InputStream in, OutputStream out, String originalName, String name) throws IOException { byte[] buffer = new byte[8192]; int length; // We read the whole native lib into memory to make it easier to monkey-patch the id. ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(in.available()); while ((length = in.read(buffer)) > 0) { byteArrayOutputStream.write(buffer, 0, length); } byteArrayOutputStream.flush(); byte[] bytes = byteArrayOutputStream.toByteArray(); byteArrayOutputStream.close(); final boolean patched; // Try to patch the library id. if (!patchShadedLibraryId(bytes, originalName, name)) { // We did not find the Id, check if we used a originalName that has the os and arch as suffix. // If this is the case we should also try to patch with the os and arch suffix removed. String os = PlatformDependent.normalizedOs(); String arch = PlatformDependent.normalizedArch(); String osArch = "_" + os + "_" + arch; if (originalName.endsWith(osArch)) { patched = patchShadedLibraryId(bytes, originalName.substring(0, originalName.length() - osArch.length()), name); } else { patched = false; } } else { patched = true; } out.write(bytes, 0, bytes.length); return patched; }
java
static boolean patchShadedLibraryId(InputStream in, OutputStream out, String originalName, String name) throws IOException { byte[] buffer = new byte[8192]; int length; // We read the whole native lib into memory to make it easier to monkey-patch the id. ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(in.available()); while ((length = in.read(buffer)) > 0) { byteArrayOutputStream.write(buffer, 0, length); } byteArrayOutputStream.flush(); byte[] bytes = byteArrayOutputStream.toByteArray(); byteArrayOutputStream.close(); final boolean patched; // Try to patch the library id. if (!patchShadedLibraryId(bytes, originalName, name)) { // We did not find the Id, check if we used a originalName that has the os and arch as suffix. // If this is the case we should also try to patch with the os and arch suffix removed. String os = PlatformDependent.normalizedOs(); String arch = PlatformDependent.normalizedArch(); String osArch = "_" + os + "_" + arch; if (originalName.endsWith(osArch)) { patched = patchShadedLibraryId(bytes, originalName.substring(0, originalName.length() - osArch.length()), name); } else { patched = false; } } else { patched = true; } out.write(bytes, 0, bytes.length); return patched; }
[ "static", "boolean", "patchShadedLibraryId", "(", "InputStream", "in", ",", "OutputStream", "out", ",", "String", "originalName", ",", "String", "name", ")", "throws", "IOException", "{", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "8192", "]", ";",...
Package-private for testing.
[ "Package", "-", "private", "for", "testing", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java#L241-L274
train
Patch the shaded library id.
[ 30522, 10763, 22017, 20898, 8983, 7377, 5732, 29521, 19848, 10139, 2094, 1006, 20407, 25379, 1999, 1010, 27852, 25379, 2041, 1010, 5164, 2434, 18442, 1010, 5164, 2171, 1007, 11618, 22834, 10288, 24422, 1063, 24880, 1031, 1033, 17698, 1027, 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...
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/IterativeStream.java
IterativeStream.withFeedbackType
public <F> ConnectedIterativeStreams<T, F> withFeedbackType(TypeInformation<F> feedbackType) { return new ConnectedIterativeStreams<>(originalInput, feedbackType, maxWaitTime); }
java
public <F> ConnectedIterativeStreams<T, F> withFeedbackType(TypeInformation<F> feedbackType) { return new ConnectedIterativeStreams<>(originalInput, feedbackType, maxWaitTime); }
[ "public", "<", "F", ">", "ConnectedIterativeStreams", "<", "T", ",", "F", ">", "withFeedbackType", "(", "TypeInformation", "<", "F", ">", "feedbackType", ")", "{", "return", "new", "ConnectedIterativeStreams", "<>", "(", "originalInput", ",", "feedbackType", ","...
Changes the feedback type of the iteration and allows the user to apply co-transformations on the input and feedback stream, as in a {@link ConnectedStreams}. <p>For type safety the user needs to define the feedback type @param feedbackType The type information of the feedback stream. @return A {@link ConnectedIterativeStreams}.
[ "Changes", "the", "feedback", "type", "of", "the", "iteration", "and", "allows", "the", "user", "to", "apply", "co", "-", "transformations", "on", "the", "input", "and", "feedback", "stream", "as", "in", "a", "{", "@link", "ConnectedStreams", "}", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/IterativeStream.java#L123-L125
train
Returns a new ConnectedIterativeStreams instance with the specified feedback type.
[ 30522, 2270, 1026, 1042, 1028, 4198, 21646, 8082, 21422, 2015, 1026, 1056, 1010, 1042, 1028, 2007, 7959, 2098, 5963, 13874, 1006, 2828, 2378, 14192, 3370, 1026, 1042, 1028, 12247, 13874, 1007, 1063, 2709, 2047, 4198, 21646, 8082, 21422, 201...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/ZipUtil.java
ZipUtil.copy
private static void copy(ZipFile zipFile, ZipEntry zipEntry, File outItemFile) throws IOException { InputStream in = null; OutputStream out = null; try { in = zipFile.getInputStream(zipEntry); out = FileUtil.getOutputStream(outItemFile); IoUtil.copy(in, out); } finally { IoUtil.close(out); IoUtil.close(in); } }
java
private static void copy(ZipFile zipFile, ZipEntry zipEntry, File outItemFile) throws IOException { InputStream in = null; OutputStream out = null; try { in = zipFile.getInputStream(zipEntry); out = FileUtil.getOutputStream(outItemFile); IoUtil.copy(in, out); } finally { IoUtil.close(out); IoUtil.close(in); } }
[ "private", "static", "void", "copy", "(", "ZipFile", "zipFile", ",", "ZipEntry", "zipEntry", ",", "File", "outItemFile", ")", "throws", "IOException", "{", "InputStream", "in", "=", "null", ";", "OutputStream", "out", "=", "null", ";", "try", "{", "in", "=...
从Zip文件流中拷贝文件出来 @param zipFile Zip文件 @param zipEntry zip文件中的子文件 @param outItemFile 输出到的文件 @throws IOException IO异常
[ "从Zip文件流中拷贝文件出来" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L905-L916
train
Copy the contents of the specified zip entry to the specified output item file.
[ 30522, 2797, 10763, 11675, 6100, 1006, 14101, 8873, 2571, 14101, 8873, 2571, 1010, 14101, 4765, 2854, 14101, 4765, 2854, 1010, 5371, 2041, 4221, 2213, 8873, 2571, 1007, 11618, 22834, 10288, 24422, 1063, 20407, 25379, 1999, 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...
alibaba/canal
dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java
LogBuffer.forward
public final LogBuffer forward(final int len) { if (position + len > origin + limit) throw new IllegalArgumentException("limit excceed: " + (position + len - origin)); this.position += len; return this; }
java
public final LogBuffer forward(final int len) { if (position + len > origin + limit) throw new IllegalArgumentException("limit excceed: " + (position + len - origin)); this.position += len; return this; }
[ "public", "final", "LogBuffer", "forward", "(", "final", "int", "len", ")", "{", "if", "(", "position", "+", "len", ">", "origin", "+", "limit", ")", "throw", "new", "IllegalArgumentException", "(", "\"limit excceed: \"", "+", "(", "position", "+", "len", ...
Forwards this buffer's position. @param len The forward distance @return This buffer
[ "Forwards", "this", "buffer", "s", "position", "." ]
8f088cddc0755f4350c5aaae95c6e4002d90a40f
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L114-L120
train
Forward to the end of the buffer.
[ 30522, 2270, 2345, 8833, 8569, 12494, 2830, 1006, 2345, 20014, 18798, 1007, 1063, 2065, 1006, 2597, 1009, 18798, 1028, 4761, 1009, 5787, 1007, 5466, 2047, 6206, 2906, 22850, 15781, 2595, 24422, 1006, 1000, 5787, 4654, 9468, 13089, 1024, 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...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/dictionary/nr/TranslatedPersonDictionary.java
TranslatedPersonDictionary.containsKey
public static boolean containsKey(String key, int length) { if (!trie.containsKey(key)) return false; return key.length() >= length; }
java
public static boolean containsKey(String key, int length) { if (!trie.containsKey(key)) return false; return key.length() >= length; }
[ "public", "static", "boolean", "containsKey", "(", "String", "key", ",", "int", "length", ")", "{", "if", "(", "!", "trie", ".", "containsKey", "(", "key", ")", ")", "return", "false", ";", "return", "key", ".", "length", "(", ")", ">=", "length", ";...
时报包含key,且key至少长length @param key @param length @return
[ "时报包含key,且key至少长length" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/nr/TranslatedPersonDictionary.java#L123-L127
train
Check if a key is present in the trie.
[ 30522, 2270, 10763, 22017, 20898, 3397, 14839, 1006, 5164, 3145, 1010, 20014, 3091, 1007, 1063, 2065, 1006, 999, 13012, 2063, 1012, 3397, 14839, 1006, 3145, 1007, 1007, 2709, 6270, 1025, 2709, 3145, 1012, 3091, 1006, 1007, 1028, 1027, 3091,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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
consul/src/main/java/com/networknt/consul/ConsulUtils.java
ConsulUtils.isSame
public static boolean isSame(List<URL> urls1, List<URL> urls2) { if (urls1 == null || urls2 == null) { return false; } if (urls1.size() != urls2.size()) { return false; } return urls1.containsAll(urls2); }
java
public static boolean isSame(List<URL> urls1, List<URL> urls2) { if (urls1 == null || urls2 == null) { return false; } if (urls1.size() != urls2.size()) { return false; } return urls1.containsAll(urls2); }
[ "public", "static", "boolean", "isSame", "(", "List", "<", "URL", ">", "urls1", ",", "List", "<", "URL", ">", "urls2", ")", "{", "if", "(", "urls1", "==", "null", "||", "urls2", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "url...
Check if two lists have the same urls. If any list is empty, return false @param urls1 first url list @param urls2 second url list @return boolean true when they are the same
[ "Check", "if", "two", "lists", "have", "the", "same", "urls", ".", "If", "any", "list", "is", "empty", "return", "false" ]
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/consul/src/main/java/com/networknt/consul/ConsulUtils.java#L38-L46
train
Check if two lists are the same.
[ 30522, 2270, 10763, 22017, 20898, 26354, 14074, 1006, 2862, 1026, 24471, 2140, 1028, 24471, 4877, 2487, 1010, 2862, 1026, 24471, 2140, 1028, 24471, 4877, 2475, 1007, 1063, 2065, 1006, 24471, 4877, 2487, 1027, 1027, 19701, 1064, 1064, 24471, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/map/multi/ListValueMap.java
ListValueMap.get
@Override public List<V> get(Object key) { return (List<V>) super.get(key); }
java
@Override public List<V> get(Object key) { return (List<V>) super.get(key); }
[ "@", "Override", "public", "List", "<", "V", ">", "get", "(", "Object", "key", ")", "{", "return", "(", "List", "<", "V", ">", ")", "super", ".", "get", "(", "key", ")", ";", "}" ]
------------------------------------------------------------------------- Constructor end
[ "-------------------------------------------------------------------------", "Constructor", "end" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/multi/ListValueMap.java#L69-L72
train
Override to return a list of objects that contain a reference to a managed object.
[ 30522, 1030, 2058, 15637, 2270, 2862, 1026, 1058, 1028, 2131, 1006, 4874, 3145, 1007, 1063, 2709, 1006, 2862, 1026, 1058, 1028, 1007, 3565, 1012, 2131, 1006, 3145, 1007, 1025, 1065, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/HttpUtil.java
HttpUtil.isUnsupportedExpectation
static boolean isUnsupportedExpectation(HttpMessage message) { if (!isExpectHeaderValid(message)) { return false; } final String expectValue = message.headers().get(HttpHeaderNames.EXPECT); return expectValue != null && !HttpHeaderValues.CONTINUE.toString().equalsIgnoreCase(expectValue); }
java
static boolean isUnsupportedExpectation(HttpMessage message) { if (!isExpectHeaderValid(message)) { return false; } final String expectValue = message.headers().get(HttpHeaderNames.EXPECT); return expectValue != null && !HttpHeaderValues.CONTINUE.toString().equalsIgnoreCase(expectValue); }
[ "static", "boolean", "isUnsupportedExpectation", "(", "HttpMessage", "message", ")", "{", "if", "(", "!", "isExpectHeaderValid", "(", "message", ")", ")", "{", "return", "false", ";", "}", "final", "String", "expectValue", "=", "message", ".", "headers", "(", ...
Returns {@code true} if the specified message contains an expect header specifying an expectation that is not supported. Note that this method returns {@code false} if the expect header is not valid for the message (e.g., the message is a response, or the version on the message is HTTP/1.0). @param message the message @return {@code true} if and only if an expectation is present that is not supported
[ "Returns", "{", "@code", "true", "}", "if", "the", "specified", "message", "contains", "an", "expect", "header", "specifying", "an", "expectation", "that", "is", "not", "supported", ".", "Note", "that", "this", "method", "returns", "{", "@code", "false", "}"...
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpUtil.java#L260-L267
train
Check if the given message contains unsupported expectations.
[ 30522, 10763, 22017, 20898, 2003, 4609, 6342, 9397, 15613, 10288, 5051, 25572, 3508, 1006, 8299, 7834, 3736, 3351, 4471, 1007, 1063, 2065, 1006, 999, 2003, 10288, 5051, 6593, 4974, 2121, 10175, 3593, 1006, 4471, 1007, 1007, 1063, 2709, 6270...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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-common/src/main/java/org/apache/shardingsphere/core/yaml/engine/YamlEngine.java
YamlEngine.unmarshal
public static <T extends YamlConfiguration> T unmarshal(final File yamlFile, final Class<T> classType) throws IOException { try ( FileInputStream fileInputStream = new FileInputStream(yamlFile); InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "UTF-8") ) { return new Yaml(new Constructor(classType)).loadAs(inputStreamReader, classType); } }
java
public static <T extends YamlConfiguration> T unmarshal(final File yamlFile, final Class<T> classType) throws IOException { try ( FileInputStream fileInputStream = new FileInputStream(yamlFile); InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "UTF-8") ) { return new Yaml(new Constructor(classType)).loadAs(inputStreamReader, classType); } }
[ "public", "static", "<", "T", "extends", "YamlConfiguration", ">", "T", "unmarshal", "(", "final", "File", "yamlFile", ",", "final", "Class", "<", "T", ">", "classType", ")", "throws", "IOException", "{", "try", "(", "FileInputStream", "fileInputStream", "=", ...
Unmarshal YAML. @param yamlFile YAML file @param classType class type @param <T> type of class @return object from YAML @throws IOException IO Exception
[ "Unmarshal", "YAML", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/yaml/engine/YamlEngine.java#L54-L61
train
Unmarshals a YAML file to an object of the specified class type.
[ 30522, 2270, 10763, 1026, 1056, 8908, 8038, 19968, 8663, 8873, 27390, 3370, 1028, 1056, 4895, 7849, 7377, 2140, 1006, 2345, 5371, 8038, 19968, 8873, 2571, 1010, 2345, 2465, 1026, 1056, 1028, 2465, 13874, 1007, 11618, 22834, 10288, 24422, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/metrics/MetricStore.java
MetricStore.getTaskMetricStore
public synchronized TaskMetricStore getTaskMetricStore(String jobID, String taskID) { JobMetricStore job = jobID == null ? null : jobs.get(jobID); if (job == null || taskID == null) { return null; } return TaskMetricStore.unmodifiable(job.getTaskMetricStore(taskID)); }
java
public synchronized TaskMetricStore getTaskMetricStore(String jobID, String taskID) { JobMetricStore job = jobID == null ? null : jobs.get(jobID); if (job == null || taskID == null) { return null; } return TaskMetricStore.unmodifiable(job.getTaskMetricStore(taskID)); }
[ "public", "synchronized", "TaskMetricStore", "getTaskMetricStore", "(", "String", "jobID", ",", "String", "taskID", ")", "{", "JobMetricStore", "job", "=", "jobID", "==", "null", "?", "null", ":", "jobs", ".", "get", "(", "jobID", ")", ";", "if", "(", "job...
Returns the {@link ComponentMetricStore} for the given job/task ID. @param jobID job ID @param taskID task ID @return ComponentMetricStore for given IDs, or null if no store for the given arguments exists
[ "Returns", "the", "{", "@link", "ComponentMetricStore", "}", "for", "the", "given", "job", "/", "task", "ID", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/metrics/MetricStore.java#L129-L135
train
Get the TaskMetricStore for the given job ID.
[ 30522, 2270, 25549, 4708, 12589, 23809, 2063, 2131, 10230, 22287, 3388, 7277, 23809, 2063, 1006, 5164, 3105, 3593, 1010, 5164, 4708, 3593, 1007, 1063, 3105, 12589, 23809, 2063, 3105, 1027, 3105, 3593, 1027, 1027, 19701, 1029, 19701, 1024, 5...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
alibaba/canal
client-adapter/launcher/src/main/java/com/alibaba/otter/canal/adapter/launcher/rest/CommonRest.java
CommonRest.destinations
@GetMapping("/destinations") public List<Map<String, String>> destinations() { List<Map<String, String>> result = new ArrayList<>(); Set<String> destinations = adapterCanalConfig.DESTINATIONS; for (String destination : destinations) { Map<String, String> resMap = new LinkedHashMap<>(); boolean status = syncSwitch.status(destination); String resStatus; if (status) { resStatus = "on"; } else { resStatus = "off"; } resMap.put("destination", destination); resMap.put("status", resStatus); result.add(resMap); } return result; }
java
@GetMapping("/destinations") public List<Map<String, String>> destinations() { List<Map<String, String>> result = new ArrayList<>(); Set<String> destinations = adapterCanalConfig.DESTINATIONS; for (String destination : destinations) { Map<String, String> resMap = new LinkedHashMap<>(); boolean status = syncSwitch.status(destination); String resStatus; if (status) { resStatus = "on"; } else { resStatus = "off"; } resMap.put("destination", destination); resMap.put("status", resStatus); result.add(resMap); } return result; }
[ "@", "GetMapping", "(", "\"/destinations\"", ")", "public", "List", "<", "Map", "<", "String", ",", "String", ">", ">", "destinations", "(", ")", "{", "List", "<", "Map", "<", "String", ",", "String", ">", ">", "result", "=", "new", "ArrayList", "<>", ...
返回所有实例 curl http://127.0.0.1:8081/destinations
[ "返回所有实例", "curl", "http", ":", "//", "127", ".", "0", ".", "0", ".", "1", ":", "8081", "/", "destinations" ]
8f088cddc0755f4350c5aaae95c6e4002d90a40f
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/launcher/src/main/java/com/alibaba/otter/canal/adapter/launcher/rest/CommonRest.java#L155-L173
train
Get a list of destination mappings.
[ 30522, 1030, 2131, 2863, 14853, 1006, 1000, 1013, 14345, 1000, 1007, 2270, 2862, 1026, 4949, 1026, 5164, 1010, 5164, 1028, 1028, 14345, 1006, 1007, 1063, 2862, 1026, 4949, 1026, 5164, 1010, 5164, 1028, 1028, 2765, 1027, 2047, 9140, 9863, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/bipartite/BipartiteGraph.java
BipartiteGraph.projectionBottomSimple
public Graph<KB, VVB, Tuple2<EV, EV>> projectionBottomSimple() { DataSet<Edge<KB, Tuple2<EV, EV>>> newEdges = edges.join(edges) .where(0) .equalTo(0) .with(new ProjectionBottomSimple<>()) .name("Simple bottom projection"); return Graph.fromDataSet(bottomVertices, newEdges, context); }
java
public Graph<KB, VVB, Tuple2<EV, EV>> projectionBottomSimple() { DataSet<Edge<KB, Tuple2<EV, EV>>> newEdges = edges.join(edges) .where(0) .equalTo(0) .with(new ProjectionBottomSimple<>()) .name("Simple bottom projection"); return Graph.fromDataSet(bottomVertices, newEdges, context); }
[ "public", "Graph", "<", "KB", ",", "VVB", ",", "Tuple2", "<", "EV", ",", "EV", ">", ">", "projectionBottomSimple", "(", ")", "{", "DataSet", "<", "Edge", "<", "KB", ",", "Tuple2", "<", "EV", ",", "EV", ">", ">", ">", "newEdges", "=", "edges", "."...
Convert a bipartite graph into an undirected graph that contains only bottom vertices. An edge between two vertices in the new graph will exist only if the original bipartite graph contains a top vertex they are both connected to. <p>The simple projection performs a single join and returns edges containing the bipartite edge values. <p>Note: KB must override .equals(). This requirement may be removed in a future release. @return simple bottom projection of the bipartite graph
[ "Convert", "a", "bipartite", "graph", "into", "an", "undirected", "graph", "that", "contains", "only", "bottom", "vertices", ".", "An", "edge", "between", "two", "vertices", "in", "the", "new", "graph", "will", "exist", "only", "if", "the", "original", "bipa...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/bipartite/BipartiteGraph.java#L171-L179
train
Projections the bottom vertices of this graph into a graph that is a simple bottom projection.
[ 30522, 2270, 10629, 1026, 21677, 1010, 1058, 26493, 1010, 10722, 10814, 2475, 1026, 23408, 1010, 23408, 1028, 1028, 13996, 18384, 20389, 5332, 23344, 1006, 1007, 1063, 2951, 13462, 1026, 3341, 1026, 21677, 1010, 10722, 10814, 2475, 1026, 2340...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/file/FileReader.java
FileReader.getInputStream
public BufferedInputStream getInputStream() throws IORuntimeException { try { return new BufferedInputStream(new FileInputStream(this.file)); } catch (IOException e) { throw new IORuntimeException(e); } }
java
public BufferedInputStream getInputStream() throws IORuntimeException { try { return new BufferedInputStream(new FileInputStream(this.file)); } catch (IOException e) { throw new IORuntimeException(e); } }
[ "public", "BufferedInputStream", "getInputStream", "(", ")", "throws", "IORuntimeException", "{", "try", "{", "return", "new", "BufferedInputStream", "(", "new", "FileInputStream", "(", "this", ".", "file", ")", ")", ";", "}", "catch", "(", "IOException", "e", ...
获得输入流 @return 输入流 @throws IORuntimeException IO异常
[ "获得输入流" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/file/FileReader.java#L239-L245
train
Returns an input stream for the file.
[ 30522, 2270, 17698, 2098, 2378, 18780, 21422, 2131, 2378, 18780, 21422, 1006, 1007, 11618, 22834, 15532, 7292, 10288, 24422, 1063, 3046, 1063, 2709, 2047, 17698, 2098, 2378, 18780, 21422, 1006, 2047, 5371, 2378, 18780, 21422, 1006, 2023, 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...
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java
DataStream.writeAsText
@PublicEvolving public DataStreamSink<T> writeAsText(String path, WriteMode writeMode) { TextOutputFormat<T> tof = new TextOutputFormat<>(new Path(path)); tof.setWriteMode(writeMode); return writeUsingOutputFormat(tof); }
java
@PublicEvolving public DataStreamSink<T> writeAsText(String path, WriteMode writeMode) { TextOutputFormat<T> tof = new TextOutputFormat<>(new Path(path)); tof.setWriteMode(writeMode); return writeUsingOutputFormat(tof); }
[ "@", "PublicEvolving", "public", "DataStreamSink", "<", "T", ">", "writeAsText", "(", "String", "path", ",", "WriteMode", "writeMode", ")", "{", "TextOutputFormat", "<", "T", ">", "tof", "=", "new", "TextOutputFormat", "<>", "(", "new", "Path", "(", "path", ...
Writes a DataStream to the file specified by path in text format. <p>For every element of the DataStream the result of {@link Object#toString()} is written. @param path The path pointing to the location the text file is written to @param writeMode Controls the behavior for existing files. Options are NO_OVERWRITE and OVERWRITE. @return The closed DataStream.
[ "Writes", "a", "DataStream", "to", "the", "file", "specified", "by", "path", "in", "text", "format", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java#L1041-L1046
train
Write the data stream to a text file.
[ 30522, 1030, 2270, 6777, 4747, 6455, 2270, 2951, 21422, 11493, 2243, 1026, 1056, 1028, 4339, 14083, 10288, 2102, 1006, 5164, 4130, 1010, 4339, 5302, 3207, 4339, 5302, 3207, 1007, 1063, 3793, 5833, 18780, 14192, 4017, 1026, 1056, 1028, 2000,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/digest/Digester.java
Digester.digestWithSalt
private byte[] digestWithSalt(InputStream data, int bufferLength) throws IOException { if (this.saltPosition <= 0) { // 加盐在开头 this.digest.update(this.salt); } final byte[] buffer = new byte[bufferLength]; int total = 0; int read; while ((read = data.read(buffer, 0, bufferLength)) > -1) { total += read; if (this.saltPosition > 0 && total >= this.saltPosition) { if (total != this.saltPosition) { digest.update(buffer, 0, total - this.saltPosition); } // 加盐在中间 this.digest.update(this.salt); this.digest.update(buffer, total - this.saltPosition, read); } else { this.digest.update(buffer, 0, read); } } if (total < this.saltPosition) { // 加盐在末尾 this.digest.update(this.salt); } return this.digest.digest(); }
java
private byte[] digestWithSalt(InputStream data, int bufferLength) throws IOException { if (this.saltPosition <= 0) { // 加盐在开头 this.digest.update(this.salt); } final byte[] buffer = new byte[bufferLength]; int total = 0; int read; while ((read = data.read(buffer, 0, bufferLength)) > -1) { total += read; if (this.saltPosition > 0 && total >= this.saltPosition) { if (total != this.saltPosition) { digest.update(buffer, 0, total - this.saltPosition); } // 加盐在中间 this.digest.update(this.salt); this.digest.update(buffer, total - this.saltPosition, read); } else { this.digest.update(buffer, 0, read); } } if (total < this.saltPosition) { // 加盐在末尾 this.digest.update(this.salt); } return this.digest.digest(); }
[ "private", "byte", "[", "]", "digestWithSalt", "(", "InputStream", "data", ",", "int", "bufferLength", ")", "throws", "IOException", "{", "if", "(", "this", ".", "saltPosition", "<=", "0", ")", "{", "// 加盐在开头\r", "this", ".", "digest", ".", "update", "(", ...
生成摘要 @param data {@link InputStream} 数据流 @param bufferLength 缓存长度,不足1使用 {@link IoUtil#DEFAULT_BUFFER_SIZE} 做为默认值 @return 摘要bytes @throws IOException 从流中读取数据引发的IO异常
[ "生成摘要" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/digest/Digester.java#L373-L402
train
Creates a byte array containing the digest of the data.
[ 30522, 2797, 24880, 1031, 1033, 17886, 24415, 12002, 2102, 1006, 20407, 25379, 2951, 1010, 20014, 17698, 7770, 13512, 2232, 1007, 11618, 22834, 10288, 24422, 1063, 2065, 1006, 2023, 1012, 5474, 26994, 1026, 1027, 1014, 1007, 1063, 1013, 1013,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/checkpoint/CheckpointProperties.java
CheckpointProperties.forCheckpoint
public static CheckpointProperties forCheckpoint(CheckpointRetentionPolicy policy) { switch (policy) { case NEVER_RETAIN_AFTER_TERMINATION: return CHECKPOINT_NEVER_RETAINED; case RETAIN_ON_FAILURE: return CHECKPOINT_RETAINED_ON_FAILURE; case RETAIN_ON_CANCELLATION: return CHECKPOINT_RETAINED_ON_CANCELLATION; default: throw new IllegalArgumentException("unknown policy: " + policy); } }
java
public static CheckpointProperties forCheckpoint(CheckpointRetentionPolicy policy) { switch (policy) { case NEVER_RETAIN_AFTER_TERMINATION: return CHECKPOINT_NEVER_RETAINED; case RETAIN_ON_FAILURE: return CHECKPOINT_RETAINED_ON_FAILURE; case RETAIN_ON_CANCELLATION: return CHECKPOINT_RETAINED_ON_CANCELLATION; default: throw new IllegalArgumentException("unknown policy: " + policy); } }
[ "public", "static", "CheckpointProperties", "forCheckpoint", "(", "CheckpointRetentionPolicy", "policy", ")", "{", "switch", "(", "policy", ")", "{", "case", "NEVER_RETAIN_AFTER_TERMINATION", ":", "return", "CHECKPOINT_NEVER_RETAINED", ";", "case", "RETAIN_ON_FAILURE", ":...
Creates the checkpoint properties for a checkpoint. <p>Checkpoints may be queued in case too many other checkpoints are currently happening. They are garbage collected automatically, except when the owning job terminates in state {@link JobStatus#FAILED}. The user is required to configure the clean up behaviour on job cancellation. @return Checkpoint properties for an external checkpoint.
[ "Creates", "the", "checkpoint", "properties", "for", "a", "checkpoint", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointProperties.java#L314-L325
train
Returns a checkpoint properties object for the given checkpoint retention policy.
[ 30522, 2270, 10763, 26520, 21572, 4842, 7368, 2005, 5403, 3600, 8400, 1006, 26520, 13465, 4765, 3258, 18155, 2594, 2100, 3343, 1007, 1063, 6942, 1006, 3343, 1007, 1063, 2553, 2196, 1035, 9279, 1035, 2044, 1035, 18287, 1024, 2709, 26520, 103...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/ReflectUtil.java
ReflectUtil.getPublicMethod
public static Method getPublicMethod(Class<?> clazz, String methodName, Class<?>... paramTypes) throws SecurityException { try { return clazz.getMethod(methodName, paramTypes); } catch (NoSuchMethodException ex) { return null; } }
java
public static Method getPublicMethod(Class<?> clazz, String methodName, Class<?>... paramTypes) throws SecurityException { try { return clazz.getMethod(methodName, paramTypes); } catch (NoSuchMethodException ex) { return null; } }
[ "public", "static", "Method", "getPublicMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "methodName", ",", "Class", "<", "?", ">", "...", "paramTypes", ")", "throws", "SecurityException", "{", "try", "{", "return", "clazz", ".", "getMethod", ...
查找指定Public方法 如果找不到对应的方法或方法不为public的则返回<code>null</code> @param clazz 类 @param methodName 方法名 @param paramTypes 参数类型 @return 方法 @throws SecurityException 无权访问抛出异常
[ "查找指定Public方法", "如果找不到对应的方法或方法不为public的则返回<code", ">", "null<", "/", "code", ">" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L372-L378
train
Gets the public method of the given class.
[ 30522, 2270, 10763, 4118, 2131, 14289, 16558, 2594, 11368, 6806, 2094, 1006, 2465, 1026, 1029, 1028, 18856, 10936, 2480, 1010, 5164, 4118, 18442, 1010, 2465, 1026, 1029, 1028, 1012, 1012, 1012, 11498, 20492, 18863, 2015, 1007, 11618, 3036, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/utility/LexiconUtility.java
LexiconUtility.getAttribute
public static CoreDictionary.Attribute getAttribute(String word) { CoreDictionary.Attribute attribute = CoreDictionary.get(word); if (attribute != null) return attribute; return CustomDictionary.get(word); }
java
public static CoreDictionary.Attribute getAttribute(String word) { CoreDictionary.Attribute attribute = CoreDictionary.get(word); if (attribute != null) return attribute; return CustomDictionary.get(word); }
[ "public", "static", "CoreDictionary", ".", "Attribute", "getAttribute", "(", "String", "word", ")", "{", "CoreDictionary", ".", "Attribute", "attribute", "=", "CoreDictionary", ".", "get", "(", "word", ")", ";", "if", "(", "attribute", "!=", "null", ")", "re...
从HanLP的词库中提取某个单词的属性(包括核心词典和用户词典) @param word 单词 @return 包含词性与频次的信息
[ "从HanLP的词库中提取某个单词的属性(包括核心词典和用户词典)" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/utility/LexiconUtility.java#L35-L40
train
Get the attribute for a word.
[ 30522, 2270, 10763, 4563, 29201, 3258, 5649, 1012, 17961, 2131, 19321, 3089, 8569, 2618, 1006, 5164, 2773, 1007, 1063, 4563, 29201, 3258, 5649, 1012, 17961, 17961, 1027, 4563, 29201, 3258, 5649, 1012, 2131, 1006, 2773, 1007, 1025, 2065, 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-planner/src/main/java/org/apache/flink/table/operations/SortOperationFactory.java
SortOperationFactory.createLimitWithFetch
public TableOperation createLimitWithFetch(int fetch, TableOperation child) { SortTableOperation previousSort = validateAndGetChildSort(child); if (fetch < 0) { throw new ValidationException("Fetch should be greater or equal 0"); } int offset = Math.max(previousSort.getOffset(), 0); return new SortTableOperation(previousSort.getOrder(), previousSort.getChild(), offset, fetch); }
java
public TableOperation createLimitWithFetch(int fetch, TableOperation child) { SortTableOperation previousSort = validateAndGetChildSort(child); if (fetch < 0) { throw new ValidationException("Fetch should be greater or equal 0"); } int offset = Math.max(previousSort.getOffset(), 0); return new SortTableOperation(previousSort.getOrder(), previousSort.getChild(), offset, fetch); }
[ "public", "TableOperation", "createLimitWithFetch", "(", "int", "fetch", ",", "TableOperation", "child", ")", "{", "SortTableOperation", "previousSort", "=", "validateAndGetChildSort", "(", "child", ")", ";", "if", "(", "fetch", "<", "0", ")", "{", "throw", "new...
Adds fetch to the underlying {@link SortTableOperation} if it is a valid one. @param fetch fetch number to add @param child should be {@link SortTableOperation} @return valid sort operation with applied fetch
[ "Adds", "fetch", "to", "the", "underlying", "{", "@link", "SortTableOperation", "}", "if", "it", "is", "a", "valid", "one", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/operations/SortOperationFactory.java#L94-L104
train
Create a limit operation with a fetch number.
[ 30522, 2270, 2795, 25918, 3370, 3443, 17960, 4183, 24415, 7959, 10649, 1006, 20014, 18584, 1010, 2795, 25918, 3370, 2775, 1007, 1063, 4066, 10880, 25918, 3370, 3025, 21748, 2102, 1027, 9398, 3686, 5685, 18150, 19339, 21748, 2102, 1006, 2775, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/SpringBootCondition.java
SpringBootCondition.anyMatches
protected final boolean anyMatches(ConditionContext context, AnnotatedTypeMetadata metadata, Condition... conditions) { for (Condition condition : conditions) { if (matches(context, metadata, condition)) { return true; } } return false; }
java
protected final boolean anyMatches(ConditionContext context, AnnotatedTypeMetadata metadata, Condition... conditions) { for (Condition condition : conditions) { if (matches(context, metadata, condition)) { return true; } } return false; }
[ "protected", "final", "boolean", "anyMatches", "(", "ConditionContext", "context", ",", "AnnotatedTypeMetadata", "metadata", ",", "Condition", "...", "conditions", ")", "{", "for", "(", "Condition", "condition", ":", "conditions", ")", "{", "if", "(", "matches", ...
Return true if any of the specified conditions match. @param context the context @param metadata the annotation meta-data @param conditions conditions to test @return {@code true} if any condition matches.
[ "Return", "true", "if", "any", "of", "the", "specified", "conditions", "match", "." ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/SpringBootCondition.java#L135-L143
train
Checks if any of the given conditions match the given context.
[ 30522, 5123, 2345, 22017, 20898, 2151, 18900, 8376, 1006, 4650, 8663, 18209, 6123, 1010, 5754, 17287, 3064, 13874, 11368, 8447, 2696, 27425, 1010, 4650, 1012, 1012, 1012, 3785, 1007, 1063, 2005, 1006, 4650, 4650, 1024, 3785, 1007, 1063, 206...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.regionMatches
public static boolean regionMatches(final CharSequence cs, final boolean ignoreCase, final int csStart, final CharSequence string, final int start, final int length) { if (cs == null || string == null) { return false; } if (cs instanceof String && string instanceof String) { return ((String) cs).regionMatches(ignoreCase, csStart, (String) string, start, length); } if (cs instanceof AsciiString) { return ((AsciiString) cs).regionMatches(ignoreCase, csStart, string, start, length); } return regionMatchesCharSequences(cs, csStart, string, start, length, ignoreCase ? GeneralCaseInsensitiveCharEqualityComparator.INSTANCE : DefaultCharEqualityComparator.INSTANCE); }
java
public static boolean regionMatches(final CharSequence cs, final boolean ignoreCase, final int csStart, final CharSequence string, final int start, final int length) { if (cs == null || string == null) { return false; } if (cs instanceof String && string instanceof String) { return ((String) cs).regionMatches(ignoreCase, csStart, (String) string, start, length); } if (cs instanceof AsciiString) { return ((AsciiString) cs).regionMatches(ignoreCase, csStart, string, start, length); } return regionMatchesCharSequences(cs, csStart, string, start, length, ignoreCase ? GeneralCaseInsensitiveCharEqualityComparator.INSTANCE : DefaultCharEqualityComparator.INSTANCE); }
[ "public", "static", "boolean", "regionMatches", "(", "final", "CharSequence", "cs", ",", "final", "boolean", "ignoreCase", ",", "final", "int", "csStart", ",", "final", "CharSequence", "string", ",", "final", "int", "start", ",", "final", "int", "length", ")",...
This methods make regionMatches operation correctly for any chars in strings @param cs the {@code CharSequence} to be processed @param ignoreCase specifies if case should be ignored. @param csStart the starting offset in the {@code cs} CharSequence @param string the {@code CharSequence} to compare. @param start the starting offset in the specified {@code string}. @param length the number of characters to compare. @return {@code true} if the ranges of characters are equal, {@code false} otherwise.
[ "This", "methods", "make", "regionMatches", "operation", "correctly", "for", "any", "chars", "in", "strings" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L1632-L1649
train
regionMatches Method.
[ 30522, 2270, 10763, 22017, 20898, 2555, 18900, 8376, 1006, 2345, 25869, 3366, 4226, 5897, 20116, 1010, 2345, 22017, 20898, 8568, 18382, 1010, 2345, 20014, 20116, 14117, 2102, 1010, 2345, 25869, 3366, 4226, 5897, 5164, 1010, 2345, 20014, 2707,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/NumberConverter.java
NumberConverter.toBigInteger
private BigInteger toBigInteger(Object value) { if (value instanceof Long) { return BigInteger.valueOf((Long) value); } else if(value instanceof Boolean) { return BigInteger.valueOf((boolean)value ? 1 : 0); } final String valueStr = convertToStr(value); if (StrUtil.isBlank(valueStr)) { return null; } return new BigInteger(valueStr); }
java
private BigInteger toBigInteger(Object value) { if (value instanceof Long) { return BigInteger.valueOf((Long) value); } else if(value instanceof Boolean) { return BigInteger.valueOf((boolean)value ? 1 : 0); } final String valueStr = convertToStr(value); if (StrUtil.isBlank(valueStr)) { return null; } return new BigInteger(valueStr); }
[ "private", "BigInteger", "toBigInteger", "(", "Object", "value", ")", "{", "if", "(", "value", "instanceof", "Long", ")", "{", "return", "BigInteger", ".", "valueOf", "(", "(", "Long", ")", "value", ")", ";", "}", "else", "if", "(", "value", "instanceof"...
转换为BigInteger<br> 如果给定的值为空,或者转换失败,返回默认值<br> 转换失败不会报错 @param value 被转换的值 @return 结果
[ "转换为BigInteger<br", ">", "如果给定的值为空,或者转换失败,返回默认值<br", ">", "转换失败不会报错" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/impl/NumberConverter.java#L185-L196
train
Converts the value to a BigInteger.
[ 30522, 2797, 2502, 18447, 26320, 2000, 5638, 11528, 2618, 4590, 1006, 4874, 3643, 1007, 1063, 2065, 1006, 3643, 6013, 11253, 2146, 1007, 1063, 2709, 2502, 18447, 26320, 1012, 3643, 11253, 1006, 1006, 2146, 1007, 3643, 1007, 1025, 1065, 2842...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java
JSONObject.optString
public String optString(String name, String fallback) { Object object = opt(name); String result = JSON.toString(object); return result != null ? result : fallback; }
java
public String optString(String name, String fallback) { Object object = opt(name); String result = JSON.toString(object); return result != null ? result : fallback; }
[ "public", "String", "optString", "(", "String", "name", ",", "String", "fallback", ")", "{", "Object", "object", "=", "opt", "(", "name", ")", ";", "String", "result", "=", "JSON", ".", "toString", "(", "object", ")", ";", "return", "result", "!=", "nu...
Returns the value mapped by {@code name} if it exists, coercing it if necessary. Returns {@code fallback} if no such mapping exists. @param name the name of the property @param fallback a fallback value @return the value or {@code fallback}
[ "Returns", "the", "value", "mapped", "by", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java#L586-L590
train
Get the property as a string or fallback if the property is not present or not a String.
[ 30522, 2270, 5164, 23569, 3367, 4892, 1006, 5164, 2171, 1010, 5164, 2991, 5963, 1007, 1063, 4874, 4874, 1027, 23569, 1006, 2171, 1007, 1025, 5164, 2765, 1027, 1046, 3385, 1012, 2000, 3367, 4892, 1006, 4874, 1007, 1025, 2709, 2765, 999, 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/api/common/operators/Operator.java
Operator.setResources
@PublicEvolving public void setResources(ResourceSpec minResources, ResourceSpec preferredResources) { this.minResources = minResources; this.preferredResources = preferredResources; }
java
@PublicEvolving public void setResources(ResourceSpec minResources, ResourceSpec preferredResources) { this.minResources = minResources; this.preferredResources = preferredResources; }
[ "@", "PublicEvolving", "public", "void", "setResources", "(", "ResourceSpec", "minResources", ",", "ResourceSpec", "preferredResources", ")", "{", "this", ".", "minResources", "=", "minResources", ";", "this", ".", "preferredResources", "=", "preferredResources", ";",...
Sets the minimum and preferred resources for this contract instance. The resource denotes how many memories and cpu cores of the user function will be consumed during the execution. @param minResources The minimum resource of this operator. @param preferredResources The preferred resource of this operator.
[ "Sets", "the", "minimum", "and", "preferred", "resources", "for", "this", "contract", "instance", ".", "The", "resource", "denotes", "how", "many", "memories", "and", "cpu", "cores", "of", "the", "user", "function", "will", "be", "consumed", "during", "the", ...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/Operator.java#L221-L225
train
Sets the minimum and preferred resources for the resource provider.
[ 30522, 1030, 2270, 6777, 4747, 6455, 2270, 11675, 2275, 6072, 8162, 9623, 1006, 4219, 5051, 2278, 8117, 6072, 8162, 9623, 1010, 4219, 5051, 2278, 6871, 6072, 8162, 9623, 1007, 1063, 2023, 1012, 8117, 6072, 8162, 9623, 1027, 8117, 6072, 81...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.parseText
@SuppressWarnings("unchecked") public Collection<Emit> parseText(String text) { checkForConstructedFailureStates(); int position = 0; State currentState = this.rootState; List<Emit> collectedEmits = new ArrayList<Emit>(); for (int i = 0; i < text.length(); ++i) { currentState = getState(currentState, text.charAt(i)); storeEmits(position, currentState, collectedEmits); ++position; } if (!trieConfig.isAllowOverlaps()) { IntervalTree intervalTree = new IntervalTree((List<Intervalable>) (List<?>) collectedEmits); intervalTree.removeOverlaps((List<Intervalable>) (List<?>) collectedEmits); } if (trieConfig.remainLongest) { remainLongest(collectedEmits); } return collectedEmits; }
java
@SuppressWarnings("unchecked") public Collection<Emit> parseText(String text) { checkForConstructedFailureStates(); int position = 0; State currentState = this.rootState; List<Emit> collectedEmits = new ArrayList<Emit>(); for (int i = 0; i < text.length(); ++i) { currentState = getState(currentState, text.charAt(i)); storeEmits(position, currentState, collectedEmits); ++position; } if (!trieConfig.isAllowOverlaps()) { IntervalTree intervalTree = new IntervalTree((List<Intervalable>) (List<?>) collectedEmits); intervalTree.removeOverlaps((List<Intervalable>) (List<?>) collectedEmits); } if (trieConfig.remainLongest) { remainLongest(collectedEmits); } return collectedEmits; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "Collection", "<", "Emit", ">", "parseText", "(", "String", "text", ")", "{", "checkForConstructedFailureStates", "(", ")", ";", "int", "position", "=", "0", ";", "State", "currentState", "=", "this...
模式匹配 @param text 待匹配的文本 @return 匹配到的模式串
[ "模式匹配" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/trie/Trie.java#L135-L162
train
Parses the text into a Collection of Emit objects.
[ 30522, 1030, 16081, 9028, 5582, 2015, 1006, 1000, 4895, 5403, 18141, 1000, 1007, 2270, 3074, 1026, 12495, 2102, 1028, 11968, 13462, 10288, 2102, 1006, 5164, 3793, 1007, 1063, 4638, 29278, 8663, 3367, 6820, 10985, 7011, 4014, 14900, 12259, 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...
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/Http2Exception.java
Http2Exception.streamError
public static Http2Exception streamError(int id, Http2Error error, Throwable cause, String fmt, Object... args) { return CONNECTION_STREAM_ID == id ? Http2Exception.connectionError(error, cause, fmt, args) : new StreamException(id, error, String.format(fmt, args), cause); }
java
public static Http2Exception streamError(int id, Http2Error error, Throwable cause, String fmt, Object... args) { return CONNECTION_STREAM_ID == id ? Http2Exception.connectionError(error, cause, fmt, args) : new StreamException(id, error, String.format(fmt, args), cause); }
[ "public", "static", "Http2Exception", "streamError", "(", "int", "id", ",", "Http2Error", "error", ",", "Throwable", "cause", ",", "String", "fmt", ",", "Object", "...", "args", ")", "{", "return", "CONNECTION_STREAM_ID", "==", "id", "?", "Http2Exception", "."...
Use if an error which can be isolated to a single stream has occurred. If the {@code id} is not {@link Http2CodecUtil#CONNECTION_STREAM_ID} then a {@link Http2Exception.StreamException} will be returned. Otherwise the error is considered a connection error and a {@link Http2Exception} is returned. @param id The stream id for which the error is isolated to. @param error The type of error as defined by the HTTP/2 specification. @param cause The object which caused the error. @param fmt String with the content and format for the additional debug data. @param args Objects which fit into the format defined by {@code fmt}. @return If the {@code id} is not {@link Http2CodecUtil#CONNECTION_STREAM_ID} then a {@link Http2Exception.StreamException} will be returned. Otherwise the error is considered a connection error and a {@link Http2Exception} is returned.
[ "Use", "if", "an", "error", "which", "can", "be", "isolated", "to", "a", "single", "stream", "has", "occurred", ".", "If", "the", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2Exception.java#L145-L150
train
Stream error.
[ 30522, 2270, 10763, 8299, 2475, 10288, 24422, 5460, 2121, 29165, 1006, 20014, 8909, 1010, 8299, 2475, 2121, 29165, 7561, 1010, 5466, 3085, 3426, 1010, 5164, 4718, 2102, 1010, 4874, 1012, 1012, 1012, 12098, 5620, 1007, 1063, 2709, 4434, 1035...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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-hadoop-fs/src/main/java/org/apache/flink/runtime/fs/hdfs/HadoopRecoverableFsDataOutputStream.java
HadoopRecoverableFsDataOutputStream.waitUntilLeaseIsRevoked
private static boolean waitUntilLeaseIsRevoked(final FileSystem fs, final Path path) throws IOException { Preconditions.checkState(fs instanceof DistributedFileSystem); final DistributedFileSystem dfs = (DistributedFileSystem) fs; dfs.recoverLease(path); final Deadline deadline = Deadline.now().plus(Duration.ofMillis(LEASE_TIMEOUT)); final StopWatch sw = new StopWatch(); sw.start(); boolean isClosed = dfs.isFileClosed(path); while (!isClosed && deadline.hasTimeLeft()) { try { Thread.sleep(500L); } catch (InterruptedException e1) { throw new IOException("Recovering the lease failed: ", e1); } isClosed = dfs.isFileClosed(path); } return isClosed; }
java
private static boolean waitUntilLeaseIsRevoked(final FileSystem fs, final Path path) throws IOException { Preconditions.checkState(fs instanceof DistributedFileSystem); final DistributedFileSystem dfs = (DistributedFileSystem) fs; dfs.recoverLease(path); final Deadline deadline = Deadline.now().plus(Duration.ofMillis(LEASE_TIMEOUT)); final StopWatch sw = new StopWatch(); sw.start(); boolean isClosed = dfs.isFileClosed(path); while (!isClosed && deadline.hasTimeLeft()) { try { Thread.sleep(500L); } catch (InterruptedException e1) { throw new IOException("Recovering the lease failed: ", e1); } isClosed = dfs.isFileClosed(path); } return isClosed; }
[ "private", "static", "boolean", "waitUntilLeaseIsRevoked", "(", "final", "FileSystem", "fs", ",", "final", "Path", "path", ")", "throws", "IOException", "{", "Preconditions", ".", "checkState", "(", "fs", "instanceof", "DistributedFileSystem", ")", ";", "final", "...
Called when resuming execution after a failure and waits until the lease of the file we are resuming is free. <p>The lease of the file we are resuming writing/committing to may still belong to the process that failed previously and whose state we are recovering. @param path The path to the file we want to resume writing to.
[ "Called", "when", "resuming", "execution", "after", "a", "failure", "and", "waits", "until", "the", "lease", "of", "the", "file", "we", "are", "resuming", "is", "free", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-hadoop-fs/src/main/java/org/apache/flink/runtime/fs/hdfs/HadoopRecoverableFsDataOutputStream.java#L321-L342
train
Wait until the lease is revoked.
[ 30522, 2797, 10763, 22017, 20898, 3524, 16671, 10484, 11022, 2483, 2890, 6767, 8126, 1006, 2345, 6764, 27268, 6633, 1042, 2015, 1010, 2345, 4130, 4130, 1007, 11618, 22834, 10288, 24422, 1063, 3653, 8663, 20562, 2015, 1012, 14148, 12259, 1006,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/HiveCommandOperation.java
HiveCommandOperation.readResults
private List<String> readResults(int nLines) throws HiveSQLException { if (resultReader == null) { SessionState sessionState = getParentSession().getSessionState(); File tmp = sessionState.getTmpOutputFile(); try { resultReader = new BufferedReader(new FileReader(tmp)); } catch (FileNotFoundException e) { LOG.error("File " + tmp + " not found. ", e); throw new HiveSQLException(e); } } List<String> results = new ArrayList<String>(); for (int i = 0; i < nLines || nLines <= 0; ++i) { try { String line = resultReader.readLine(); if (line == null) { // reached the end of the result file break; } else { results.add(line); } } catch (IOException e) { LOG.error("Reading temp results encountered an exception: ", e); throw new HiveSQLException(e); } } return results; }
java
private List<String> readResults(int nLines) throws HiveSQLException { if (resultReader == null) { SessionState sessionState = getParentSession().getSessionState(); File tmp = sessionState.getTmpOutputFile(); try { resultReader = new BufferedReader(new FileReader(tmp)); } catch (FileNotFoundException e) { LOG.error("File " + tmp + " not found. ", e); throw new HiveSQLException(e); } } List<String> results = new ArrayList<String>(); for (int i = 0; i < nLines || nLines <= 0; ++i) { try { String line = resultReader.readLine(); if (line == null) { // reached the end of the result file break; } else { results.add(line); } } catch (IOException e) { LOG.error("Reading temp results encountered an exception: ", e); throw new HiveSQLException(e); } } return results; }
[ "private", "List", "<", "String", ">", "readResults", "(", "int", "nLines", ")", "throws", "HiveSQLException", "{", "if", "(", "resultReader", "==", "null", ")", "{", "SessionState", "sessionState", "=", "getParentSession", "(", ")", ".", "getSessionState", "(...
Reads the temporary results for non-Hive (non-Driver) commands to the resulting List of strings. @param nLines number of lines read at once. If it is <= 0, then read all lines.
[ "Reads", "the", "temporary", "results", "for", "non", "-", "Hive", "(", "non", "-", "Driver", ")", "commands", "to", "the", "resulting", "List", "of", "strings", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/HiveCommandOperation.java#L170-L198
train
Read the results from the temp output file.
[ 30522, 2797, 2862, 1026, 5164, 1028, 3191, 6072, 11314, 2015, 1006, 20014, 17953, 10586, 1007, 11618, 26736, 2015, 4160, 2571, 2595, 24422, 1063, 2065, 1006, 2765, 16416, 4063, 1027, 1027, 19701, 1007, 1063, 6521, 12259, 6521, 12259, 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...
networknt/light-4j
body/src/main/java/com/networknt/body/BodyHandler.java
BodyHandler.handleRequest
@Override public void handleRequest(final HttpServerExchange exchange) throws Exception { // parse the body to map or list if content type is application/json String contentType = exchange.getRequestHeaders().getFirst(Headers.CONTENT_TYPE); if (contentType != null) { if (exchange.isInIoThread()) { exchange.dispatch(this); return; } exchange.startBlocking(); try { if (contentType.startsWith("application/json")) { InputStream inputStream = exchange.getInputStream(); String unparsedRequestBody = StringUtils.inputStreamToString(inputStream, StandardCharsets.UTF_8); // attach the unparsed request body into exchange if the cacheRequestBody is enabled in body.yml if (config.isCacheRequestBody()) { exchange.putAttachment(REQUEST_BODY_STRING, unparsedRequestBody); } // attach the parsed request body into exchange if the body parser is enabled attachJsonBody(exchange, unparsedRequestBody); } else if (contentType.startsWith("multipart/form-data") || contentType.startsWith("application/x-www-form-urlencoded")) { // attach the parsed request body into exchange if the body parser is enabled attachFormDataBody(exchange); } } catch (IOException e) { logger.error("IOException: ", e); setExchangeStatus(exchange, CONTENT_TYPE_MISMATCH, contentType); return; } } Handler.next(exchange, next); }
java
@Override public void handleRequest(final HttpServerExchange exchange) throws Exception { // parse the body to map or list if content type is application/json String contentType = exchange.getRequestHeaders().getFirst(Headers.CONTENT_TYPE); if (contentType != null) { if (exchange.isInIoThread()) { exchange.dispatch(this); return; } exchange.startBlocking(); try { if (contentType.startsWith("application/json")) { InputStream inputStream = exchange.getInputStream(); String unparsedRequestBody = StringUtils.inputStreamToString(inputStream, StandardCharsets.UTF_8); // attach the unparsed request body into exchange if the cacheRequestBody is enabled in body.yml if (config.isCacheRequestBody()) { exchange.putAttachment(REQUEST_BODY_STRING, unparsedRequestBody); } // attach the parsed request body into exchange if the body parser is enabled attachJsonBody(exchange, unparsedRequestBody); } else if (contentType.startsWith("multipart/form-data") || contentType.startsWith("application/x-www-form-urlencoded")) { // attach the parsed request body into exchange if the body parser is enabled attachFormDataBody(exchange); } } catch (IOException e) { logger.error("IOException: ", e); setExchangeStatus(exchange, CONTENT_TYPE_MISMATCH, contentType); return; } } Handler.next(exchange, next); }
[ "@", "Override", "public", "void", "handleRequest", "(", "final", "HttpServerExchange", "exchange", ")", "throws", "Exception", "{", "// parse the body to map or list if content type is application/json", "String", "contentType", "=", "exchange", ".", "getRequestHeaders", "("...
Check the header starts with application/json and parse it into map or list based on the first character "{" or "[". Otherwise, check the header starts with application/x-www-form-urlencoded or multipart/form-data and parse it into formdata @param exchange HttpServerExchange @throws Exception Exception
[ "Check", "the", "header", "starts", "with", "application", "/", "json", "and", "parse", "it", "into", "map", "or", "list", "based", "on", "the", "first", "character", "{", "or", "[", ".", "Otherwise", "check", "the", "header", "starts", "with", "applicatio...
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/body/src/main/java/com/networknt/body/BodyHandler.java#L86-L117
train
Handle the request.
[ 30522, 1030, 2058, 15637, 2270, 11675, 28213, 2063, 15500, 1006, 2345, 16770, 2121, 28943, 2595, 22305, 2063, 3863, 1007, 11618, 6453, 1063, 1013, 1013, 11968, 3366, 1996, 2303, 2000, 4949, 2030, 2862, 2065, 4180, 2828, 2003, 4646, 1013, 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/IOUtils.java
IOUtils.copyBytes
public static void copyBytes(final InputStream in, final OutputStream out, final boolean close) throws IOException { copyBytes(in, out, BLOCKSIZE, close); }
java
public static void copyBytes(final InputStream in, final OutputStream out, final boolean close) throws IOException { copyBytes(in, out, BLOCKSIZE, close); }
[ "public", "static", "void", "copyBytes", "(", "final", "InputStream", "in", ",", "final", "OutputStream", "out", ",", "final", "boolean", "close", ")", "throws", "IOException", "{", "copyBytes", "(", "in", ",", "out", ",", "BLOCKSIZE", ",", "close", ")", "...
Copies from one stream to another. @param in InputStream to read from @param out OutputStream to write to @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 I/O error occurs while copying
[ "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#L107-L109
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, 22017, 20898, 2485, 1007, 11618, 22834, 10288, 24422, 1063, 6100, 3762, 4570, 1006, 1999, 1010, 2041, 1010, 5991, 4697, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.defaultMessageConverters
public RestTemplateBuilder defaultMessageConverters() { return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri, Collections.unmodifiableSet( new LinkedHashSet<>(new RestTemplate().getMessageConverters())), this.requestFactorySupplier, this.uriTemplateHandler, this.errorHandler, this.basicAuthentication, this.restTemplateCustomizers, this.requestFactoryCustomizer, this.interceptors); }
java
public RestTemplateBuilder defaultMessageConverters() { return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri, Collections.unmodifiableSet( new LinkedHashSet<>(new RestTemplate().getMessageConverters())), this.requestFactorySupplier, this.uriTemplateHandler, this.errorHandler, this.basicAuthentication, this.restTemplateCustomizers, this.requestFactoryCustomizer, this.interceptors); }
[ "public", "RestTemplateBuilder", "defaultMessageConverters", "(", ")", "{", "return", "new", "RestTemplateBuilder", "(", "this", ".", "detectRequestFactory", ",", "this", ".", "rootUri", ",", "Collections", ".", "unmodifiableSet", "(", "new", "LinkedHashSet", "<>", ...
Set the {@link HttpMessageConverter HttpMessageConverters} that should be used with the {@link RestTemplate} to the default set. Calling this method will replace any previously defined converters. @return a new builder instance @see #messageConverters(HttpMessageConverter...)
[ "Set", "the", "{" ]
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#L228-L235
train
Default message converters.
[ 30522, 2270, 2717, 18532, 15725, 8569, 23891, 2099, 12398, 7834, 3736, 3351, 8663, 16874, 2545, 1006, 1007, 1063, 2709, 2047, 2717, 18532, 15725, 8569, 23891, 2099, 1006, 2023, 1012, 11487, 2890, 15500, 21450, 1010, 2023, 1012, 7117, 9496, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/ResourceGuard.java
ResourceGuard.close
@Override public void close() { synchronized (lock) { closed = true; while (leaseCount > 0) { try { lock.wait(); } catch (InterruptedException ignore) { // Even on interruption, we cannot terminate the loop until all open leases are closed. } } } }
java
@Override public void close() { synchronized (lock) { closed = true; while (leaseCount > 0) { try { lock.wait(); } catch (InterruptedException ignore) { // Even on interruption, we cannot terminate the loop until all open leases are closed. } } } }
[ "@", "Override", "public", "void", "close", "(", ")", "{", "synchronized", "(", "lock", ")", "{", "closed", "=", "true", ";", "while", "(", "leaseCount", ">", "0", ")", "{", "try", "{", "lock", ".", "wait", "(", ")", ";", "}", "catch", "(", "Inte...
Closed the resource guard. This method will block until all calls to {@link #acquireResource()} have seen their matching call to {@link #releaseResource()}.
[ "Closed", "the", "resource", "guard", ".", "This", "method", "will", "block", "until", "all", "calls", "to", "{" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/ResourceGuard.java#L101-L117
train
Close the connection.
[ 30522, 1030, 2058, 15637, 2270, 11675, 2485, 1006, 1007, 1063, 25549, 1006, 5843, 1007, 1063, 2701, 1027, 2995, 1025, 2096, 1006, 10084, 3597, 16671, 1028, 1014, 1007, 1063, 3046, 1063, 5843, 1012, 3524, 1006, 1007, 1025, 1065, 4608, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java
IoUtil.getPushBackReader
public static PushbackReader getPushBackReader(Reader reader, int pushBackSize) { return (reader instanceof PushbackReader) ? (PushbackReader) reader : new PushbackReader(reader, pushBackSize); }
java
public static PushbackReader getPushBackReader(Reader reader, int pushBackSize) { return (reader instanceof PushbackReader) ? (PushbackReader) reader : new PushbackReader(reader, pushBackSize); }
[ "public", "static", "PushbackReader", "getPushBackReader", "(", "Reader", "reader", ",", "int", "pushBackSize", ")", "{", "return", "(", "reader", "instanceof", "PushbackReader", ")", "?", "(", "PushbackReader", ")", "reader", ":", "new", "PushbackReader", "(", ...
获得{@link PushbackReader}<br> 如果是{@link PushbackReader}强转返回,否则新建 @param reader 普通Reader @param pushBackSize 推后的byte数 @return {@link PushbackReader} @since 3.1.0
[ "获得", "{", "@link", "PushbackReader", "}", "<br", ">", "如果是", "{", "@link", "PushbackReader", "}", "强转返回,否则新建" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L352-L354
train
Get a PushbackReader instance.
[ 30522, 2270, 10763, 5245, 5963, 16416, 4063, 2131, 12207, 2232, 5963, 16416, 4063, 1006, 8068, 8068, 1010, 20014, 5245, 12221, 4697, 1007, 1063, 2709, 1006, 8068, 6013, 11253, 5245, 5963, 16416, 4063, 1007, 1029, 1006, 5245, 5963, 16416, 40...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeInMemorySorter.java
UnsafeInMemorySorter.getSortedIterator
public UnsafeSorterIterator getSortedIterator() { int offset = 0; long start = System.nanoTime(); if (sortComparator != null) { if (this.radixSortSupport != null) { offset = RadixSort.sortKeyPrefixArray( array, nullBoundaryPos, (pos - nullBoundaryPos) / 2L, 0, 7, radixSortSupport.sortDescending(), radixSortSupport.sortSigned()); } else { MemoryBlock unused = new MemoryBlock( array.getBaseObject(), array.getBaseOffset() + pos * 8L, (array.size() - pos) * 8L); LongArray buffer = new LongArray(unused); Sorter<RecordPointerAndKeyPrefix, LongArray> sorter = new Sorter<>(new UnsafeSortDataFormat(buffer)); sorter.sort(array, 0, pos / 2, sortComparator); } } totalSortTimeNanos += System.nanoTime() - start; if (nullBoundaryPos > 0) { assert radixSortSupport != null : "Nulls are only stored separately with radix sort"; LinkedList<UnsafeSorterIterator> queue = new LinkedList<>(); // The null order is either LAST or FIRST, regardless of sorting direction (ASC|DESC) if (radixSortSupport.nullsFirst()) { queue.add(new SortedIterator(nullBoundaryPos / 2, 0)); queue.add(new SortedIterator((pos - nullBoundaryPos) / 2, offset)); } else { queue.add(new SortedIterator((pos - nullBoundaryPos) / 2, offset)); queue.add(new SortedIterator(nullBoundaryPos / 2, 0)); } return new UnsafeExternalSorter.ChainedIterator(queue); } else { return new SortedIterator(pos / 2, offset); } }
java
public UnsafeSorterIterator getSortedIterator() { int offset = 0; long start = System.nanoTime(); if (sortComparator != null) { if (this.radixSortSupport != null) { offset = RadixSort.sortKeyPrefixArray( array, nullBoundaryPos, (pos - nullBoundaryPos) / 2L, 0, 7, radixSortSupport.sortDescending(), radixSortSupport.sortSigned()); } else { MemoryBlock unused = new MemoryBlock( array.getBaseObject(), array.getBaseOffset() + pos * 8L, (array.size() - pos) * 8L); LongArray buffer = new LongArray(unused); Sorter<RecordPointerAndKeyPrefix, LongArray> sorter = new Sorter<>(new UnsafeSortDataFormat(buffer)); sorter.sort(array, 0, pos / 2, sortComparator); } } totalSortTimeNanos += System.nanoTime() - start; if (nullBoundaryPos > 0) { assert radixSortSupport != null : "Nulls are only stored separately with radix sort"; LinkedList<UnsafeSorterIterator> queue = new LinkedList<>(); // The null order is either LAST or FIRST, regardless of sorting direction (ASC|DESC) if (radixSortSupport.nullsFirst()) { queue.add(new SortedIterator(nullBoundaryPos / 2, 0)); queue.add(new SortedIterator((pos - nullBoundaryPos) / 2, offset)); } else { queue.add(new SortedIterator((pos - nullBoundaryPos) / 2, offset)); queue.add(new SortedIterator(nullBoundaryPos / 2, 0)); } return new UnsafeExternalSorter.ChainedIterator(queue); } else { return new SortedIterator(pos / 2, offset); } }
[ "public", "UnsafeSorterIterator", "getSortedIterator", "(", ")", "{", "int", "offset", "=", "0", ";", "long", "start", "=", "System", ".", "nanoTime", "(", ")", ";", "if", "(", "sortComparator", "!=", "null", ")", "{", "if", "(", "this", ".", "radixSortS...
Return an iterator over record pointers in sorted order. For efficiency, all calls to {@code next()} will return the same mutable object.
[ "Return", "an", "iterator", "over", "record", "pointers", "in", "sorted", "order", ".", "For", "efficiency", "all", "calls", "to", "{" ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeInMemorySorter.java#L344-L380
train
Get the sorted iterator.
[ 30522, 2270, 25135, 21748, 3334, 21646, 8844, 4152, 15613, 21646, 8844, 1006, 1007, 1063, 20014, 16396, 1027, 1014, 1025, 2146, 2707, 1027, 2291, 1012, 28991, 7292, 1006, 1007, 1025, 30524, 19701, 15494, 5649, 6873, 2015, 1010, 1006, 13433, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/pregel/VertexCentricIteration.java
VertexCentricIteration.setUpIteration
private void setUpIteration(DeltaIteration<?, ?> iteration) { // set up the iteration operator if (this.configuration != null) { iteration.name(this.configuration.getName("Vertex-centric iteration (" + computeFunction + ")")); iteration.parallelism(this.configuration.getParallelism()); iteration.setSolutionSetUnManaged(this.configuration.isSolutionSetUnmanagedMemory()); // register all aggregators for (Map.Entry<String, Aggregator<?>> entry : this.configuration.getAggregators().entrySet()) { iteration.registerAggregator(entry.getKey(), entry.getValue()); } } else { // no configuration provided; set default name iteration.name("Vertex-centric iteration (" + computeFunction + ")"); } }
java
private void setUpIteration(DeltaIteration<?, ?> iteration) { // set up the iteration operator if (this.configuration != null) { iteration.name(this.configuration.getName("Vertex-centric iteration (" + computeFunction + ")")); iteration.parallelism(this.configuration.getParallelism()); iteration.setSolutionSetUnManaged(this.configuration.isSolutionSetUnmanagedMemory()); // register all aggregators for (Map.Entry<String, Aggregator<?>> entry : this.configuration.getAggregators().entrySet()) { iteration.registerAggregator(entry.getKey(), entry.getValue()); } } else { // no configuration provided; set default name iteration.name("Vertex-centric iteration (" + computeFunction + ")"); } }
[ "private", "void", "setUpIteration", "(", "DeltaIteration", "<", "?", ",", "?", ">", "iteration", ")", "{", "// set up the iteration operator", "if", "(", "this", ".", "configuration", "!=", "null", ")", "{", "iteration", ".", "name", "(", "this", ".", "conf...
Helper method which sets up an iteration with the given vertex value. @param iteration
[ "Helper", "method", "which", "sets", "up", "an", "iteration", "with", "the", "given", "vertex", "value", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/pregel/VertexCentricIteration.java#L443-L461
train
Sets up the iteration operator.
[ 30522, 2797, 11675, 16437, 21646, 3370, 1006, 7160, 21646, 3370, 1026, 1029, 1010, 1029, 1028, 27758, 1007, 1063, 1013, 1013, 2275, 2039, 1996, 27758, 6872, 2065, 1006, 2023, 1012, 9563, 999, 1027, 19701, 1007, 1063, 27758, 1012, 2171, 1006...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/template/engine/TemplateFactory.java
TemplateFactory.doCreate
private static TemplateEngine doCreate(TemplateConfig config) { try { return new BeetlEngine(config); } catch (NoClassDefFoundError e) { // ignore } try { return new FreemarkerEngine(config); } catch (NoClassDefFoundError e) { // ignore } try { return new VelocityEngine(config); } catch (NoClassDefFoundError e) { // ignore } try { return new RythmEngine(config); } catch (NoClassDefFoundError e) { // ignore } try { return new EnjoyEngine(config); } catch (NoClassDefFoundError e) { // ignore } try { return new ThymeleafEngine(config); } catch (NoClassDefFoundError e) { // ignore } throw new TemplateException("No template found ! Please add one of template jar to your project !"); }
java
private static TemplateEngine doCreate(TemplateConfig config) { try { return new BeetlEngine(config); } catch (NoClassDefFoundError e) { // ignore } try { return new FreemarkerEngine(config); } catch (NoClassDefFoundError e) { // ignore } try { return new VelocityEngine(config); } catch (NoClassDefFoundError e) { // ignore } try { return new RythmEngine(config); } catch (NoClassDefFoundError e) { // ignore } try { return new EnjoyEngine(config); } catch (NoClassDefFoundError e) { // ignore } try { return new ThymeleafEngine(config); } catch (NoClassDefFoundError e) { // ignore } throw new TemplateException("No template found ! Please add one of template jar to your project !"); }
[ "private", "static", "TemplateEngine", "doCreate", "(", "TemplateConfig", "config", ")", "{", "try", "{", "return", "new", "BeetlEngine", "(", "config", ")", ";", "}", "catch", "(", "NoClassDefFoundError", "e", ")", "{", "// ignore\r", "}", "try", "{", "retu...
根据用户引入的模板引擎jar,自动创建对应的模板引擎对象 @param config 模板配置,包括编码、模板文件path等信息 @return {@link Engine}
[ "根据用户引入的模板引擎jar,自动创建对应的模板引擎对象" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/TemplateFactory.java#L42-L74
train
Creates a TemplateEngine object from the given TemplateConfig.
[ 30522, 2797, 10763, 23561, 13159, 3170, 9986, 29313, 1006, 23561, 8663, 8873, 2290, 9530, 8873, 2290, 1007, 1063, 3046, 1063, 2709, 2047, 7813, 3070, 3170, 1006, 9530, 8873, 2290, 1007, 1025, 1065, 4608, 1006, 2053, 26266, 3207, 4246, 28819...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/dataformat/BinaryRow.java
BinaryRow.isInFixedLengthPart
public static boolean isInFixedLengthPart(InternalType type) { if (type instanceof DecimalType) { return ((DecimalType) type).precision() <= DecimalType.MAX_COMPACT_PRECISION; } else { return MUTABLE_FIELD_TYPES.contains(type); } }
java
public static boolean isInFixedLengthPart(InternalType type) { if (type instanceof DecimalType) { return ((DecimalType) type).precision() <= DecimalType.MAX_COMPACT_PRECISION; } else { return MUTABLE_FIELD_TYPES.contains(type); } }
[ "public", "static", "boolean", "isInFixedLengthPart", "(", "InternalType", "type", ")", "{", "if", "(", "type", "instanceof", "DecimalType", ")", "{", "return", "(", "(", "DecimalType", ")", "type", ")", ".", "precision", "(", ")", "<=", "DecimalType", ".", ...
If it is a fixed-length field, we can call this BinaryRow's setXX method for in-place updates. If it is variable-length field, can't use this method, because the underlying data is stored continuously.
[ "If", "it", "is", "a", "fixed", "-", "length", "field", "we", "can", "call", "this", "BinaryRow", "s", "setXX", "method", "for", "in", "-", "place", "updates", ".", "If", "it", "is", "variable", "-", "length", "field", "can", "t", "use", "this", "met...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryRow.java#L98-L104
train
Returns true if the given type is a fixed length type.
[ 30522, 2270, 10763, 22017, 20898, 2003, 2378, 23901, 7770, 13512, 22269, 8445, 1006, 4722, 13874, 2828, 1007, 1063, 2065, 1006, 2828, 6013, 11253, 26066, 13874, 1007, 1063, 2709, 1006, 1006, 26066, 13874, 1007, 2828, 1007, 1012, 11718, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/mining/cluster/ClusterAnalyzer.java
ClusterAnalyzer.evaluate
public static double evaluate(String folderPath, String algorithm) { if (folderPath == null) throw new IllegalArgumentException("参数 folderPath == null"); File root = new File(folderPath); if (!root.exists()) throw new IllegalArgumentException(String.format("目录 %s 不存在", root.getAbsolutePath())); if (!root.isDirectory()) throw new IllegalArgumentException(String.format("目录 %s 不是一个目录", root.getAbsolutePath())); ClusterAnalyzer<String> analyzer = new ClusterAnalyzer<String>(); File[] folders = root.listFiles(); if (folders == null) return 1.; logger.start("根目录:%s\n加载中...\n", folderPath); int docSize = 0; int[] ni = new int[folders.length]; String[] cat = new String[folders.length]; int offset = 0; for (File folder : folders) { if (folder.isFile()) continue; File[] files = folder.listFiles(); if (files == null) continue; String category = folder.getName(); cat[offset] = category; logger.out("[%s]...", category); int b = 0; int e = files.length; int logEvery = (int) Math.ceil((e - b) / 10000f); for (int i = b; i < e; i++) { analyzer.addDocument(folder.getName() + " " + files[i].getName(), IOUtil.readTxt(files[i].getAbsolutePath())); if (i % logEvery == 0) { logger.out("%c[%s]...%.2f%%", 13, category, MathUtility.percentage(i - b + 1, e - b)); } ++docSize; ++ni[offset]; } logger.out(" %d 篇文档\n", e - b); ++offset; } logger.finish(" 加载了 %d 个类目,共 %d 篇文档\n", folders.length, docSize); logger.start(algorithm + "聚类中..."); List<Set<String>> clusterList = algorithm.replaceAll("[-\\s]", "").toLowerCase().equals("kmeans") ? analyzer.kmeans(ni.length) : analyzer.repeatedBisection(ni.length); logger.finish(" 完毕。\n"); double[] fi = new double[ni.length]; for (int i = 0; i < ni.length; i++) { for (Set<String> j : clusterList) { int nij = 0; for (String d : j) { if (d.startsWith(cat[i])) ++nij; } if (nij == 0) continue; double p = nij / (double) (j.size()); double r = nij / (double) (ni[i]); double f = 2 * p * r / (p + r); fi[i] = Math.max(fi[i], f); } } double f = 0; for (int i = 0; i < fi.length; i++) { f += fi[i] * ni[i] / docSize; } return f; }
java
public static double evaluate(String folderPath, String algorithm) { if (folderPath == null) throw new IllegalArgumentException("参数 folderPath == null"); File root = new File(folderPath); if (!root.exists()) throw new IllegalArgumentException(String.format("目录 %s 不存在", root.getAbsolutePath())); if (!root.isDirectory()) throw new IllegalArgumentException(String.format("目录 %s 不是一个目录", root.getAbsolutePath())); ClusterAnalyzer<String> analyzer = new ClusterAnalyzer<String>(); File[] folders = root.listFiles(); if (folders == null) return 1.; logger.start("根目录:%s\n加载中...\n", folderPath); int docSize = 0; int[] ni = new int[folders.length]; String[] cat = new String[folders.length]; int offset = 0; for (File folder : folders) { if (folder.isFile()) continue; File[] files = folder.listFiles(); if (files == null) continue; String category = folder.getName(); cat[offset] = category; logger.out("[%s]...", category); int b = 0; int e = files.length; int logEvery = (int) Math.ceil((e - b) / 10000f); for (int i = b; i < e; i++) { analyzer.addDocument(folder.getName() + " " + files[i].getName(), IOUtil.readTxt(files[i].getAbsolutePath())); if (i % logEvery == 0) { logger.out("%c[%s]...%.2f%%", 13, category, MathUtility.percentage(i - b + 1, e - b)); } ++docSize; ++ni[offset]; } logger.out(" %d 篇文档\n", e - b); ++offset; } logger.finish(" 加载了 %d 个类目,共 %d 篇文档\n", folders.length, docSize); logger.start(algorithm + "聚类中..."); List<Set<String>> clusterList = algorithm.replaceAll("[-\\s]", "").toLowerCase().equals("kmeans") ? analyzer.kmeans(ni.length) : analyzer.repeatedBisection(ni.length); logger.finish(" 完毕。\n"); double[] fi = new double[ni.length]; for (int i = 0; i < ni.length; i++) { for (Set<String> j : clusterList) { int nij = 0; for (String d : j) { if (d.startsWith(cat[i])) ++nij; } if (nij == 0) continue; double p = nij / (double) (j.size()); double r = nij / (double) (ni[i]); double f = 2 * p * r / (p + r); fi[i] = Math.max(fi[i], f); } } double f = 0; for (int i = 0; i < fi.length; i++) { f += fi[i] * ni[i] / docSize; } return f; }
[ "public", "static", "double", "evaluate", "(", "String", "folderPath", ",", "String", "algorithm", ")", "{", "if", "(", "folderPath", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"参数 folderPath == null\");", "", "", "File", "root", "=", ...
训练模型 @param folderPath 分类语料的根目录.目录必须满足如下结构:<br> 根目录<br> ├── 分类A<br> │ └── 1.txt<br> │ └── 2.txt<br> │ └── 3.txt<br> ├── 分类B<br> │ └── 1.txt<br> │ └── ...<br> └── ...<br> 文件不一定需要用数字命名,也不需要以txt作为后缀名,但一定需要是文本文件. @param algorithm kmeans 或 repeated bisection @throws IOException 任何可能的IO异常
[ "训练模型" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/cluster/ClusterAnalyzer.java#L366-L436
train
Evaluate the n - grams of a folder.
[ 30522, 2270, 10763, 3313, 16157, 1006, 5164, 19622, 15069, 1010, 5164, 9896, 1007, 1063, 2065, 1006, 19622, 15069, 1027, 1027, 19701, 1007, 5466, 2047, 6206, 2906, 22850, 15781, 2595, 24422, 1006, 1000, 100, 100, 19622, 15069, 1027, 1027, 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
common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java
SingleThreadEventExecutor.runAllTasks
protected boolean runAllTasks() { assert inEventLoop(); boolean fetchedAll; boolean ranAtLeastOne = false; do { fetchedAll = fetchFromScheduledTaskQueue(); if (runAllTasksFrom(taskQueue)) { ranAtLeastOne = true; } } while (!fetchedAll); // keep on processing until we fetched all scheduled tasks. if (ranAtLeastOne) { lastExecutionTime = ScheduledFutureTask.nanoTime(); } afterRunningAllTasks(); return ranAtLeastOne; }
java
protected boolean runAllTasks() { assert inEventLoop(); boolean fetchedAll; boolean ranAtLeastOne = false; do { fetchedAll = fetchFromScheduledTaskQueue(); if (runAllTasksFrom(taskQueue)) { ranAtLeastOne = true; } } while (!fetchedAll); // keep on processing until we fetched all scheduled tasks. if (ranAtLeastOne) { lastExecutionTime = ScheduledFutureTask.nanoTime(); } afterRunningAllTasks(); return ranAtLeastOne; }
[ "protected", "boolean", "runAllTasks", "(", ")", "{", "assert", "inEventLoop", "(", ")", ";", "boolean", "fetchedAll", ";", "boolean", "ranAtLeastOne", "=", "false", ";", "do", "{", "fetchedAll", "=", "fetchFromScheduledTaskQueue", "(", ")", ";", "if", "(", ...
Poll all tasks from the task queue and run them via {@link Runnable#run()} method. @return {@code true} if and only if at least one task was run
[ "Poll", "all", "tasks", "from", "the", "task", "queue", "and", "run", "them", "via", "{", "@link", "Runnable#run", "()", "}", "method", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java#L349-L366
train
Run all scheduled tasks.
[ 30522, 5123, 22017, 20898, 2448, 8095, 10230, 5705, 1006, 1007, 1063, 20865, 1999, 18697, 3372, 4135, 7361, 1006, 1007, 1025, 22017, 20898, 18584, 11960, 3363, 1025, 22017, 20898, 22175, 9286, 14083, 5643, 1027, 6270, 1025, 2079, 1063, 18584,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec/src/main/java/io/netty/handler/codec/compression/Snappy.java
Snappy.validateChecksum
static void validateChecksum(int expectedChecksum, ByteBuf data, int offset, int length) { final int actualChecksum = calculateChecksum(data, offset, length); if (actualChecksum != expectedChecksum) { throw new DecompressionException( "mismatching checksum: " + Integer.toHexString(actualChecksum) + " (expected: " + Integer.toHexString(expectedChecksum) + ')'); } }
java
static void validateChecksum(int expectedChecksum, ByteBuf data, int offset, int length) { final int actualChecksum = calculateChecksum(data, offset, length); if (actualChecksum != expectedChecksum) { throw new DecompressionException( "mismatching checksum: " + Integer.toHexString(actualChecksum) + " (expected: " + Integer.toHexString(expectedChecksum) + ')'); } }
[ "static", "void", "validateChecksum", "(", "int", "expectedChecksum", ",", "ByteBuf", "data", ",", "int", "offset", ",", "int", "length", ")", "{", "final", "int", "actualChecksum", "=", "calculateChecksum", "(", "data", ",", "offset", ",", "length", ")", ";...
Computes the CRC32C checksum of the supplied data, performs the "mask" operation on the computed checksum, and then compares the resulting masked checksum to the supplied checksum. @param expectedChecksum The checksum decoded from the stream to compare against @param data The input data to calculate the CRC32C checksum of @throws DecompressionException If the calculated and supplied checksums do not match
[ "Computes", "the", "CRC32C", "checksum", "of", "the", "supplied", "data", "performs", "the", "mask", "operation", "on", "the", "computed", "checksum", "and", "then", "compares", "the", "resulting", "masked", "checksum", "to", "the", "supplied", "checksum", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Snappy.java#L638-L645
train
Validate the checksum.
[ 30522, 10763, 11675, 9398, 3686, 5403, 10603, 2819, 1006, 20014, 3517, 5403, 10603, 2819, 1010, 24880, 8569, 2546, 2951, 1010, 20014, 16396, 1010, 20014, 3091, 1007, 1063, 2345, 20014, 5025, 5403, 10603, 2819, 1027, 18422, 5403, 10603, 2819, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.namedEntityRecognize
public String[] namedEntityRecognize(String[] wordArray, String[] posArray) { if (neRecognizer == null) { throw new IllegalStateException("未提供命名实体识别模型"); } return recognize(wordArray, posArray); }
java
public String[] namedEntityRecognize(String[] wordArray, String[] posArray) { if (neRecognizer == null) { throw new IllegalStateException("未提供命名实体识别模型"); } return recognize(wordArray, posArray); }
[ "public", "String", "[", "]", "namedEntityRecognize", "(", "String", "[", "]", "wordArray", ",", "String", "[", "]", "posArray", ")", "{", "if", "(", "neRecognizer", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"未提供命名实体识别模型\");", "...
命名实体识别 @param wordArray @param posArray @return
[ "命名实体识别" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronLexicalAnalyzer.java#L132-L139
train
recognize - returns a list of named entities
[ 30522, 2270, 5164, 1031, 1033, 2315, 4765, 3012, 2890, 3597, 29076, 4371, 1006, 5164, 1031, 1033, 2773, 2906, 9447, 1010, 5164, 1031, 1033, 13433, 10286, 9447, 1007, 1063, 2065, 1006, 11265, 2890, 3597, 29076, 6290, 1027, 1027, 19701, 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-cep/src/main/java/org/apache/flink/cep/PatternStream.java
PatternStream.select
@Deprecated public <L, R> SingleOutputStreamOperator<Either<L, R>> select( final PatternTimeoutFunction<T, L> patternTimeoutFunction, final PatternSelectFunction<T, R> patternSelectFunction) { final TypeInformation<R> mainTypeInfo = TypeExtractor.getUnaryOperatorReturnType( patternSelectFunction, PatternSelectFunction.class, 0, 1, TypeExtractor.NO_INDEX, builder.getInputType(), null, false); final TypeInformation<L> timeoutTypeInfo = TypeExtractor.getUnaryOperatorReturnType( patternTimeoutFunction, PatternTimeoutFunction.class, 0, 1, TypeExtractor.NO_INDEX, builder.getInputType(), null, false); final TypeInformation<Either<L, R>> outTypeInfo = new EitherTypeInfo<>(timeoutTypeInfo, mainTypeInfo); final OutputTag<L> outputTag = new OutputTag<>(UUID.randomUUID().toString(), timeoutTypeInfo); final PatternProcessFunction<T, R> processFunction = fromSelect(builder.clean(patternSelectFunction)) .withTimeoutHandler(outputTag, builder.clean(patternTimeoutFunction)) .build(); final SingleOutputStreamOperator<R> mainStream = process(processFunction, mainTypeInfo); final DataStream<L> timedOutStream = mainStream.getSideOutput(outputTag); return mainStream .connect(timedOutStream) .map(new CoMapTimeout<>()) .returns(outTypeInfo); }
java
@Deprecated public <L, R> SingleOutputStreamOperator<Either<L, R>> select( final PatternTimeoutFunction<T, L> patternTimeoutFunction, final PatternSelectFunction<T, R> patternSelectFunction) { final TypeInformation<R> mainTypeInfo = TypeExtractor.getUnaryOperatorReturnType( patternSelectFunction, PatternSelectFunction.class, 0, 1, TypeExtractor.NO_INDEX, builder.getInputType(), null, false); final TypeInformation<L> timeoutTypeInfo = TypeExtractor.getUnaryOperatorReturnType( patternTimeoutFunction, PatternTimeoutFunction.class, 0, 1, TypeExtractor.NO_INDEX, builder.getInputType(), null, false); final TypeInformation<Either<L, R>> outTypeInfo = new EitherTypeInfo<>(timeoutTypeInfo, mainTypeInfo); final OutputTag<L> outputTag = new OutputTag<>(UUID.randomUUID().toString(), timeoutTypeInfo); final PatternProcessFunction<T, R> processFunction = fromSelect(builder.clean(patternSelectFunction)) .withTimeoutHandler(outputTag, builder.clean(patternTimeoutFunction)) .build(); final SingleOutputStreamOperator<R> mainStream = process(processFunction, mainTypeInfo); final DataStream<L> timedOutStream = mainStream.getSideOutput(outputTag); return mainStream .connect(timedOutStream) .map(new CoMapTimeout<>()) .returns(outTypeInfo); }
[ "@", "Deprecated", "public", "<", "L", ",", "R", ">", "SingleOutputStreamOperator", "<", "Either", "<", "L", ",", "R", ">", ">", "select", "(", "final", "PatternTimeoutFunction", "<", "T", ",", "L", ">", "patternTimeoutFunction", ",", "final", "PatternSelect...
Applies a select function to the detected pattern sequence. For each pattern sequence the provided {@link PatternSelectFunction} is called. The pattern select function can produce exactly one resulting element. <p>Applies a timeout function to a partial pattern sequence which has timed out. For each partial pattern sequence the provided {@link PatternTimeoutFunction} is called. The pattern timeout function can produce exactly one resulting element. @param patternTimeoutFunction The pattern timeout function which is called for each partial pattern sequence which has timed out. @param patternSelectFunction The pattern select function which is called for each detected pattern sequence. @param <L> Type of the resulting timeout elements @param <R> Type of the resulting elements @deprecated Use {@link PatternStream#select(OutputTag, PatternTimeoutFunction, PatternSelectFunction)} that returns timed out events as a side-output @return {@link DataStream} which contains the resulting elements or the resulting timeout elements wrapped in an {@link Either} type.
[ "Applies", "a", "select", "function", "to", "the", "detected", "pattern", "sequence", ".", "For", "each", "pattern", "sequence", "the", "provided", "{", "@link", "PatternSelectFunction", "}", "is", "called", ".", "The", "pattern", "select", "function", "can", ...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/PatternStream.java#L275-L316
train
Select a sequence of two data streams using a pattern timeout function.
[ 30522, 1030, 2139, 28139, 12921, 2270, 1026, 1048, 1010, 1054, 1028, 2309, 5833, 18780, 21422, 25918, 8844, 1026, 2593, 1026, 1048, 1010, 1054, 1028, 1028, 7276, 1006, 2345, 5418, 7292, 5833, 11263, 27989, 1026, 1056, 1010, 1048, 1028, 5418...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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
buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java
CompositeByteBuf.removeComponents
public CompositeByteBuf removeComponents(int cIndex, int numComponents) { checkComponentIndex(cIndex, numComponents); if (numComponents == 0) { return this; } int endIndex = cIndex + numComponents; boolean needsUpdate = false; for (int i = cIndex; i < endIndex; ++i) { Component c = components[i]; if (c.length() > 0) { needsUpdate = true; } if (lastAccessed == c) { lastAccessed = null; } c.free(); } removeCompRange(cIndex, endIndex); if (needsUpdate) { // Only need to call updateComponentOffsets if the length was > 0 updateComponentOffsets(cIndex); } return this; }
java
public CompositeByteBuf removeComponents(int cIndex, int numComponents) { checkComponentIndex(cIndex, numComponents); if (numComponents == 0) { return this; } int endIndex = cIndex + numComponents; boolean needsUpdate = false; for (int i = cIndex; i < endIndex; ++i) { Component c = components[i]; if (c.length() > 0) { needsUpdate = true; } if (lastAccessed == c) { lastAccessed = null; } c.free(); } removeCompRange(cIndex, endIndex); if (needsUpdate) { // Only need to call updateComponentOffsets if the length was > 0 updateComponentOffsets(cIndex); } return this; }
[ "public", "CompositeByteBuf", "removeComponents", "(", "int", "cIndex", ",", "int", "numComponents", ")", "{", "checkComponentIndex", "(", "cIndex", ",", "numComponents", ")", ";", "if", "(", "numComponents", "==", "0", ")", "{", "return", "this", ";", "}", ...
Remove the number of {@link ByteBuf}s starting from the given index. @param cIndex the index on which the {@link ByteBuf}s will be started to removed @param numComponents the number of components to remove
[ "Remove", "the", "number", "of", "{", "@link", "ByteBuf", "}", "s", "starting", "from", "the", "given", "index", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java#L599-L624
train
Removes the specified number of components from this CompositeByteBuf.
[ 30522, 2270, 12490, 3762, 2618, 8569, 2546, 6366, 9006, 29513, 7666, 1006, 20014, 25022, 13629, 2595, 1010, 20014, 16371, 12458, 25377, 5643, 7666, 1007, 1063, 4638, 9006, 29513, 16778, 13629, 2595, 1006, 25022, 13629, 2595, 1010, 16371, 1245...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/dataformat/Decimal.java
Decimal.sround
public static Decimal sround(Decimal b0, int r) { if (r >= b0.scale) { return b0; } BigDecimal b2 = b0.toBigDecimal().movePointRight(r) .setScale(0, RoundingMode.HALF_UP) .movePointLeft(r); int p = b0.precision; int s = b0.scale; if (r < 0) { return fromBigDecimal(b2, Math.min(38, 1 + p - s), 0); } else { // 0 <= r < s return fromBigDecimal(b2, 1 + p - s + r, r); } }
java
public static Decimal sround(Decimal b0, int r) { if (r >= b0.scale) { return b0; } BigDecimal b2 = b0.toBigDecimal().movePointRight(r) .setScale(0, RoundingMode.HALF_UP) .movePointLeft(r); int p = b0.precision; int s = b0.scale; if (r < 0) { return fromBigDecimal(b2, Math.min(38, 1 + p - s), 0); } else { // 0 <= r < s return fromBigDecimal(b2, 1 + p - s + r, r); } }
[ "public", "static", "Decimal", "sround", "(", "Decimal", "b0", ",", "int", "r", ")", "{", "if", "(", "r", ">=", "b0", ".", "scale", ")", "{", "return", "b0", ";", "}", "BigDecimal", "b2", "=", "b0", ".", "toBigDecimal", "(", ")", ".", "movePointRig...
SQL <code>ROUND</code> operator applied to BigDecimal values.
[ "SQL", "<code", ">", "ROUND<", "/", "code", ">", "operator", "applied", "to", "BigDecimal", "values", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/Decimal.java#L449-L464
train
Scales a decimal to a given number of decimals.
[ 30522, 2270, 10763, 26066, 5034, 28819, 1006, 26066, 1038, 2692, 1010, 20014, 1054, 1007, 1063, 2065, 1006, 1054, 1028, 1027, 1038, 2692, 1012, 4094, 1007, 1063, 2709, 1038, 2692, 1025, 1065, 2502, 3207, 6895, 9067, 1038, 2475, 1027, 1038, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/incubator-shardingsphere
sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/util/StringUtil.java
StringUtil.isLongValue
public static boolean isLongValue(final String value) { try { Long.parseLong(value); return true; } catch (final NumberFormatException ex) { return false; } }
java
public static boolean isLongValue(final String value) { try { Long.parseLong(value); return true; } catch (final NumberFormatException ex) { return false; } }
[ "public", "static", "boolean", "isLongValue", "(", "final", "String", "value", ")", "{", "try", "{", "Long", ".", "parseLong", "(", "value", ")", ";", "return", "true", ";", "}", "catch", "(", "final", "NumberFormatException", "ex", ")", "{", "return", "...
Judge is long value or not. @param value to be judged string value @return is long value or not
[ "Judge", "is", "long", "value", "or", "not", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/util/StringUtil.java#L62-L69
train
Check if a String is a Long value.
[ 30522, 2270, 10763, 22017, 20898, 2003, 10052, 10175, 5657, 1006, 2345, 5164, 3643, 1007, 1063, 3046, 1063, 2146, 1012, 11968, 11246, 5063, 1006, 3643, 1007, 1025, 2709, 2995, 1025, 30524, 14192, 3686, 2595, 24422, 4654, 1007, 1063, 2709, 6...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/console/DefaultProxyHtmlRenderer.java
DefaultProxyHtmlRenderer.getPlatform
public static String getPlatform(RemoteProxy proxy) { if (proxy.getTestSlots().size() == 0) { return "Unknown"; } Platform res = getPlatform(proxy.getTestSlots().get(0)); for (TestSlot slot : proxy.getTestSlots()) { Platform tmp = getPlatform(slot); if (tmp != res) { return "mixed OS"; } res = tmp; } if (res == null) { return "not specified"; } return res.toString(); }
java
public static String getPlatform(RemoteProxy proxy) { if (proxy.getTestSlots().size() == 0) { return "Unknown"; } Platform res = getPlatform(proxy.getTestSlots().get(0)); for (TestSlot slot : proxy.getTestSlots()) { Platform tmp = getPlatform(slot); if (tmp != res) { return "mixed OS"; } res = tmp; } if (res == null) { return "not specified"; } return res.toString(); }
[ "public", "static", "String", "getPlatform", "(", "RemoteProxy", "proxy", ")", "{", "if", "(", "proxy", ".", "getTestSlots", "(", ")", ".", "size", "(", ")", "==", "0", ")", "{", "return", "\"Unknown\"", ";", "}", "Platform", "res", "=", "getPlatform", ...
return the platform for the proxy. It should be the same for all slots of the proxy, so checking that. @param proxy remote proxy @return Either the platform name, "Unknown", "mixed OS", or "not specified".
[ "return", "the", "platform", "for", "the", "proxy", ".", "It", "should", "be", "the", "same", "for", "all", "slots", "of", "the", "proxy", "so", "checking", "that", "." ]
7af172729f17b20269c8ca4ea6f788db48616535
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/web/servlet/console/DefaultProxyHtmlRenderer.java#L191-L208
train
Get the platform of the remote proxy.
[ 30522, 2270, 10763, 5164, 2131, 24759, 4017, 14192, 1006, 6556, 21572, 18037, 24540, 1007, 1063, 2065, 1006, 24540, 1012, 2131, 22199, 14540, 12868, 1006, 1007, 1012, 2946, 1006, 1007, 1027, 1027, 1014, 1007, 1063, 2709, 1000, 4242, 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/incubator-shardingsphere
sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/api/ShardingDataSourceFactory.java
ShardingDataSourceFactory.createDataSource
public static DataSource createDataSource( final Map<String, DataSource> dataSourceMap, final ShardingRuleConfiguration shardingRuleConfig, final Properties props) throws SQLException { return new ShardingDataSource(dataSourceMap, new ShardingRule(shardingRuleConfig, dataSourceMap.keySet()), props); }
java
public static DataSource createDataSource( final Map<String, DataSource> dataSourceMap, final ShardingRuleConfiguration shardingRuleConfig, final Properties props) throws SQLException { return new ShardingDataSource(dataSourceMap, new ShardingRule(shardingRuleConfig, dataSourceMap.keySet()), props); }
[ "public", "static", "DataSource", "createDataSource", "(", "final", "Map", "<", "String", ",", "DataSource", ">", "dataSourceMap", ",", "final", "ShardingRuleConfiguration", "shardingRuleConfig", ",", "final", "Properties", "props", ")", "throws", "SQLException", "{",...
Create sharding data source. @param dataSourceMap data source map @param shardingRuleConfig rule configuration for databases and tables sharding @param props properties for data source @return sharding data source @throws SQLException SQL exception
[ "Create", "sharding", "data", "source", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/api/ShardingDataSourceFactory.java#L48-L51
train
Create DataSource.
[ 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, 21146, 17080, 3070, 6820, 2571, 8663, 8873, 27390, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/NumberUtil.java
NumberUtil.parseNumber
public static Number parseNumber(String numberStr) { numberStr = removeNumberFlag(numberStr); try { return NumberFormat.getInstance().parse(numberStr); } catch (ParseException e) { throw new UtilException(e); } }
java
public static Number parseNumber(String numberStr) { numberStr = removeNumberFlag(numberStr); try { return NumberFormat.getInstance().parse(numberStr); } catch (ParseException e) { throw new UtilException(e); } }
[ "public", "static", "Number", "parseNumber", "(", "String", "numberStr", ")", "{", "numberStr", "=", "removeNumberFlag", "(", "numberStr", ")", ";", "try", "{", "return", "NumberFormat", ".", "getInstance", "(", ")", ".", "parse", "(", "numberStr", ")", ";",...
将指定字符串转换为{@link Number} 对象 @param numberStr Number字符串 @return Number对象 @since 4.1.15
[ "将指定字符串转换为", "{", "@link", "Number", "}", "对象" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L2185-L2192
train
Parses a number string.
[ 30522, 2270, 10763, 2193, 11968, 5054, 29440, 1006, 5164, 3616, 16344, 1007, 1063, 3616, 16344, 1027, 6366, 19172, 5677, 10258, 8490, 1006, 3616, 16344, 1007, 1025, 3046, 1063, 2709, 2193, 14192, 4017, 1012, 2131, 7076, 26897, 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/datastream/DataStream.java
DataStream.process
@Internal public <R> SingleOutputStreamOperator<R> process( ProcessFunction<T, R> processFunction, TypeInformation<R> outputType) { ProcessOperator<T, R> operator = new ProcessOperator<>(clean(processFunction)); return transform("Process", outputType, operator); }
java
@Internal public <R> SingleOutputStreamOperator<R> process( ProcessFunction<T, R> processFunction, TypeInformation<R> outputType) { ProcessOperator<T, R> operator = new ProcessOperator<>(clean(processFunction)); return transform("Process", outputType, operator); }
[ "@", "Internal", "public", "<", "R", ">", "SingleOutputStreamOperator", "<", "R", ">", "process", "(", "ProcessFunction", "<", "T", ",", "R", ">", "processFunction", ",", "TypeInformation", "<", "R", ">", "outputType", ")", "{", "ProcessOperator", "<", "T", ...
Applies the given {@link ProcessFunction} on the input stream, thereby creating a transformed output stream. <p>The function will be called for every element in the input streams and can produce zero or more output elements. @param processFunction The {@link ProcessFunction} that is called for each element in the stream. @param outputType {@link TypeInformation} for the result type of the function. @param <R> The type of elements emitted by the {@code ProcessFunction}. @return The transformed {@link DataStream}.
[ "Applies", "the", "given", "{", "@link", "ProcessFunction", "}", "on", "the", "input", "stream", "thereby", "creating", "a", "transformed", "output", "stream", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java#L663-L671
train
Process a single input stream.
[ 30522, 1030, 4722, 2270, 1026, 1054, 1028, 2309, 5833, 18780, 21422, 25918, 8844, 1026, 1054, 1028, 2832, 1006, 2832, 11263, 27989, 1026, 1056, 1010, 1054, 1028, 2832, 11263, 27989, 1010, 2828, 2378, 14192, 3370, 1026, 1054, 1028, 6434, 138...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Path.java
Path.depth
public int depth() { String path = uri.getPath(); int depth = 0; int slash = path.length() == 1 && path.charAt(0) == '/' ? -1 : 0; while (slash != -1) { depth++; slash = path.indexOf(SEPARATOR, slash + 1); } return depth; }
java
public int depth() { String path = uri.getPath(); int depth = 0; int slash = path.length() == 1 && path.charAt(0) == '/' ? -1 : 0; while (slash != -1) { depth++; slash = path.indexOf(SEPARATOR, slash + 1); } return depth; }
[ "public", "int", "depth", "(", ")", "{", "String", "path", "=", "uri", ".", "getPath", "(", ")", ";", "int", "depth", "=", "0", ";", "int", "slash", "=", "path", ".", "length", "(", ")", "==", "1", "&&", "path", ".", "charAt", "(", "0", ")", ...
Returns the number of elements in this path. @return the number of elements in this path
[ "Returns", "the", "number", "of", "elements", "in", "this", "path", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/fs/Path.java#L413-L422
train
Returns the depth of the path.
[ 30522, 2270, 20014, 5995, 1006, 1007, 1063, 5164, 4130, 1027, 24471, 2072, 1012, 2131, 15069, 1006, 1007, 1025, 20014, 5995, 1027, 1014, 1025, 20014, 18296, 1027, 4130, 1012, 3091, 1006, 1007, 1027, 1027, 1015, 1004, 1004, 4130, 1012, 25869...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/utils/RequiredParameters.java
RequiredParameters.applyTo
public ParameterTool applyTo(ParameterTool parameterTool) throws RequiredParametersException { List<String> missingArguments = new LinkedList<>(); HashMap<String, String> newParameters = new HashMap<>(parameterTool.toMap()); for (Option o : data.values()) { if (newParameters.containsKey(o.getName())) { if (Objects.equals(newParameters.get(o.getName()), ParameterTool.NO_VALUE_KEY)) { // the parameter has been passed, but no value, check if there is a default value checkAndApplyDefaultValue(o, newParameters); } else { // a value has been passed in the parameterTool, now check if it adheres to all constraints checkAmbiguousValues(o, newParameters); checkIsCastableToDefinedType(o, newParameters); checkChoices(o, newParameters); } } else { // check if there is a default name or a value passed for a possibly defined alternative name. if (hasNoDefaultValueAndNoValuePassedOnAlternativeName(o, newParameters)) { missingArguments.add(o.getName()); } } } if (!missingArguments.isEmpty()) { throw new RequiredParametersException(this.missingArgumentsText(missingArguments), missingArguments); } return ParameterTool.fromMap(newParameters); }
java
public ParameterTool applyTo(ParameterTool parameterTool) throws RequiredParametersException { List<String> missingArguments = new LinkedList<>(); HashMap<String, String> newParameters = new HashMap<>(parameterTool.toMap()); for (Option o : data.values()) { if (newParameters.containsKey(o.getName())) { if (Objects.equals(newParameters.get(o.getName()), ParameterTool.NO_VALUE_KEY)) { // the parameter has been passed, but no value, check if there is a default value checkAndApplyDefaultValue(o, newParameters); } else { // a value has been passed in the parameterTool, now check if it adheres to all constraints checkAmbiguousValues(o, newParameters); checkIsCastableToDefinedType(o, newParameters); checkChoices(o, newParameters); } } else { // check if there is a default name or a value passed for a possibly defined alternative name. if (hasNoDefaultValueAndNoValuePassedOnAlternativeName(o, newParameters)) { missingArguments.add(o.getName()); } } } if (!missingArguments.isEmpty()) { throw new RequiredParametersException(this.missingArgumentsText(missingArguments), missingArguments); } return ParameterTool.fromMap(newParameters); }
[ "public", "ParameterTool", "applyTo", "(", "ParameterTool", "parameterTool", ")", "throws", "RequiredParametersException", "{", "List", "<", "String", ">", "missingArguments", "=", "new", "LinkedList", "<>", "(", ")", ";", "HashMap", "<", "String", ",", "String", ...
Check for all required parameters defined: - has a value been passed - if not, does the parameter have an associated default value - does the type of the parameter match the one defined in RequiredParameters - does the value provided in the parameterTool adhere to the choices defined in the option. <p>If any check fails, a RequiredParametersException is thrown @param parameterTool - parameters supplied by the user. @return the updated ParameterTool containing all the required parameters @throws RequiredParametersException if any of the specified checks fail
[ "Check", "for", "all", "required", "parameters", "defined", ":", "-", "has", "a", "value", "been", "passed", "-", "if", "not", "does", "the", "parameter", "have", "an", "associated", "default", "value", "-", "does", "the", "type", "of", "the", "parameter",...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/RequiredParameters.java#L89-L117
train
Apply this option to the given parameter tool.
[ 30522, 2270, 16381, 3406, 4747, 6611, 3406, 1006, 16381, 3406, 4747, 16381, 3406, 4747, 1007, 11618, 3223, 28689, 22828, 3366, 2595, 24422, 1063, 2862, 1026, 5164, 1028, 4394, 2906, 22850, 11187, 1027, 2047, 5799, 9863, 1026, 1028, 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...
spring-projects/spring-boot
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java
RabbitProperties.determineVirtualHost
public String determineVirtualHost() { if (CollectionUtils.isEmpty(this.parsedAddresses)) { return getVirtualHost(); } Address address = this.parsedAddresses.get(0); return (address.virtualHost != null) ? address.virtualHost : getVirtualHost(); }
java
public String determineVirtualHost() { if (CollectionUtils.isEmpty(this.parsedAddresses)) { return getVirtualHost(); } Address address = this.parsedAddresses.get(0); return (address.virtualHost != null) ? address.virtualHost : getVirtualHost(); }
[ "public", "String", "determineVirtualHost", "(", ")", "{", "if", "(", "CollectionUtils", ".", "isEmpty", "(", "this", ".", "parsedAddresses", ")", ")", "{", "return", "getVirtualHost", "(", ")", ";", "}", "Address", "address", "=", "this", ".", "parsedAddres...
If addresses have been set and the first address has a virtual host it is returned. Otherwise returns the result of calling {@code getVirtualHost()}. @return the virtual host or {@code null} @see #setAddresses(String) @see #getVirtualHost()
[ "If", "addresses", "have", "been", "set", "and", "the", "first", "address", "has", "a", "virtual", "host", "it", "is", "returned", ".", "Otherwise", "returns", "the", "result", "of", "calling", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java#L255-L261
train
Determine the virtual host.
[ 30522, 2270, 5164, 5646, 21663, 26302, 28061, 3367, 1006, 1007, 1063, 2065, 1006, 3074, 21823, 4877, 1012, 2003, 6633, 13876, 2100, 1006, 2023, 1012, 11968, 6924, 4215, 16200, 11393, 2015, 1007, 1007, 1063, 2709, 2131, 21663, 26302, 28061, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/gen/java/org/apache/hive/service/cli/thrift/TGetInfoReq.java
TGetInfoReq.isSet
public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case SESSION_HANDLE: return isSetSessionHandle(); case INFO_TYPE: return isSetInfoType(); } throw new IllegalStateException(); }
java
public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case SESSION_HANDLE: return isSetSessionHandle(); case INFO_TYPE: return isSetInfoType(); } throw new IllegalStateException(); }
[ "public", "boolean", "isSet", "(", "_Fields", "field", ")", "{", "if", "(", "field", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "switch", "(", "field", ")", "{", "case", "SESSION_HANDLE", ":", "return", "isSet...
Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise
[ "Returns", "true", "if", "field", "corresponding", "to", "fieldID", "is", "set", "(", "has", "been", "assigned", "a", "value", ")", "and", "false", "otherwise" ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/gen/java/org/apache/hive/service/cli/thrift/TGetInfoReq.java#L248-L260
train
Checks if the specified field is set to a value of a CRAsCTYPE object.
[ 30522, 2270, 22017, 20898, 26354, 3388, 1006, 1035, 4249, 2492, 1007, 1063, 2065, 1006, 2492, 1027, 1027, 19701, 1007, 1063, 5466, 2047, 6206, 2906, 22850, 15781, 2595, 24422, 1006, 1007, 1025, 1065, 6942, 1006, 2492, 1007, 1063, 2553, 5219...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/NumberUtil.java
NumberUtil.div
public static BigDecimal div(String v1, String v2) { return div(v1, v2, DEFAUT_DIV_SCALE); }
java
public static BigDecimal div(String v1, String v2) { return div(v1, v2, DEFAUT_DIV_SCALE); }
[ "public", "static", "BigDecimal", "div", "(", "String", "v1", ",", "String", "v2", ")", "{", "return", "div", "(", "v1", ",", "v2", ",", "DEFAUT_DIV_SCALE", ")", ";", "}" ]
提供(相对)精确的除法运算,当发生除不尽的情况的时候,精确到小数点后10位,后面的四舍五入 @param v1 被除数 @param v2 除数 @return 两个参数的商
[ "提供", "(", "相对", ")", "精确的除法运算", "当发生除不尽的情况的时候", "精确到小数点后10位", "后面的四舍五入" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L550-L552
train
Divide two numbers.
[ 30522, 2270, 10763, 2502, 3207, 6895, 9067, 4487, 2615, 1006, 5164, 1058, 2487, 1010, 5164, 1058, 2475, 1007, 1063, 2709, 4487, 2615, 1006, 1058, 2487, 1010, 1058, 2475, 1010, 13366, 4887, 2102, 1035, 4487, 2615, 1035, 4094, 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...
netty/netty
codec/src/main/java/io/netty/handler/codec/DateFormatter.java
DateFormatter.parseHttpDate
public static Date parseHttpDate(CharSequence txt, int start, int end) { int length = end - start; if (length == 0) { return null; } else if (length < 0) { throw new IllegalArgumentException("Can't have end < start"); } else if (length > 64) { throw new IllegalArgumentException("Can't parse more than 64 chars," + "looks like a user error or a malformed header"); } return formatter().parse0(checkNotNull(txt, "txt"), start, end); }
java
public static Date parseHttpDate(CharSequence txt, int start, int end) { int length = end - start; if (length == 0) { return null; } else if (length < 0) { throw new IllegalArgumentException("Can't have end < start"); } else if (length > 64) { throw new IllegalArgumentException("Can't parse more than 64 chars," + "looks like a user error or a malformed header"); } return formatter().parse0(checkNotNull(txt, "txt"), start, end); }
[ "public", "static", "Date", "parseHttpDate", "(", "CharSequence", "txt", ",", "int", "start", ",", "int", "end", ")", "{", "int", "length", "=", "end", "-", "start", ";", "if", "(", "length", "==", "0", ")", "{", "return", "null", ";", "}", "else", ...
Parse some text into a {@link Date}, according to RFC6265 @param txt text to parse @param start the start index inside {@code txt} @param end the end index inside {@code txt} @return a {@link Date}, or null if text couldn't be parsed
[ "Parse", "some", "text", "into", "a", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/DateFormatter.java#L95-L106
train
Parse a date from a string of text.
[ 30522, 2270, 10763, 3058, 11968, 3366, 11039, 25856, 13701, 1006, 25869, 3366, 4226, 5897, 19067, 2102, 1010, 20014, 2707, 1010, 20014, 2203, 1007, 1063, 20014, 3091, 1027, 2203, 1011, 2707, 1025, 2065, 1006, 3091, 1027, 1027, 1014, 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...
netty/netty
transport/src/main/java/io/netty/channel/ChannelOutboundBuffer.java
ChannelOutboundBuffer.addMessage
public void addMessage(Object msg, int size, ChannelPromise promise) { Entry entry = Entry.newInstance(msg, size, total(msg), promise); if (tailEntry == null) { flushedEntry = null; } else { Entry tail = tailEntry; tail.next = entry; } tailEntry = entry; if (unflushedEntry == null) { unflushedEntry = entry; } // increment pending bytes after adding message to the unflushed arrays. // See https://github.com/netty/netty/issues/1619 incrementPendingOutboundBytes(entry.pendingSize, false); }
java
public void addMessage(Object msg, int size, ChannelPromise promise) { Entry entry = Entry.newInstance(msg, size, total(msg), promise); if (tailEntry == null) { flushedEntry = null; } else { Entry tail = tailEntry; tail.next = entry; } tailEntry = entry; if (unflushedEntry == null) { unflushedEntry = entry; } // increment pending bytes after adding message to the unflushed arrays. // See https://github.com/netty/netty/issues/1619 incrementPendingOutboundBytes(entry.pendingSize, false); }
[ "public", "void", "addMessage", "(", "Object", "msg", ",", "int", "size", ",", "ChannelPromise", "promise", ")", "{", "Entry", "entry", "=", "Entry", ".", "newInstance", "(", "msg", ",", "size", ",", "total", "(", "msg", ")", ",", "promise", ")", ";", ...
Add given message to this {@link ChannelOutboundBuffer}. The given {@link ChannelPromise} will be notified once the message was written.
[ "Add", "given", "message", "to", "this", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/ChannelOutboundBuffer.java#L112-L128
train
Add a message to the cache.
[ 30522, 2270, 11675, 5587, 7834, 3736, 3351, 1006, 4874, 5796, 2290, 1010, 20014, 2946, 1010, 3149, 21572, 28732, 4872, 1007, 1063, 4443, 4443, 1027, 4443, 1012, 2047, 7076, 26897, 1006, 5796, 2290, 1010, 2946, 1010, 2561, 1006, 5796, 2290, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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-socket/src/main/java/cn/hutool/socket/aio/AioSession.java
AioSession.closeIn
public AioSession closeIn() { if (null != this.channel) { try { this.channel.shutdownInput(); } catch (IOException e) { throw new IORuntimeException(e); } } return this; }
java
public AioSession closeIn() { if (null != this.channel) { try { this.channel.shutdownInput(); } catch (IOException e) { throw new IORuntimeException(e); } } return this; }
[ "public", "AioSession", "closeIn", "(", ")", "{", "if", "(", "null", "!=", "this", ".", "channel", ")", "{", "try", "{", "this", ".", "channel", ".", "shutdownInput", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "...
关闭输出 @return this
[ "关闭输出" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-socket/src/main/java/cn/hutool/socket/aio/AioSession.java#L163-L172
train
Closes the input channel.
[ 30522, 2270, 9932, 27465, 10992, 2485, 2378, 1006, 1007, 1063, 2065, 1006, 19701, 999, 1027, 2023, 1012, 3149, 1007, 1063, 3046, 1063, 2023, 1012, 3149, 1012, 3844, 7698, 2378, 18780, 1006, 1007, 1025, 1065, 4608, 1006, 22834, 10288, 24422,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/InstrumentedExecutors.java
InstrumentedExecutors.newScheduledThreadPool
public static InstrumentedScheduledExecutorService newScheduledThreadPool( int corePoolSize, MetricRegistry registry) { return new InstrumentedScheduledExecutorService( Executors.newScheduledThreadPool(corePoolSize), registry); }
java
public static InstrumentedScheduledExecutorService newScheduledThreadPool( int corePoolSize, MetricRegistry registry) { return new InstrumentedScheduledExecutorService( Executors.newScheduledThreadPool(corePoolSize), registry); }
[ "public", "static", "InstrumentedScheduledExecutorService", "newScheduledThreadPool", "(", "int", "corePoolSize", ",", "MetricRegistry", "registry", ")", "{", "return", "new", "InstrumentedScheduledExecutorService", "(", "Executors", ".", "newScheduledThreadPool", "(", "coreP...
Creates an instrumented thread pool that can schedule commands to run after a given delay, or to execute periodically. @param corePoolSize the number of threads to keep in the pool, even if they are idle @param registry the {@link MetricRegistry} that will contain the metrics. @return a newly created scheduled thread pool @throws IllegalArgumentException if {@code corePoolSize < 0} @see Executors#newScheduledThreadPool(int)
[ "Creates", "an", "instrumented", "thread", "pool", "that", "can", "schedule", "commands", "to", "run", "after", "a", "given", "delay", "or", "to", "execute", "periodically", "." ]
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/InstrumentedExecutors.java#L418-L422
train
Create a new scheduled thread pool instrumented from the specified corePoolSize.
[ 30522, 2270, 10763, 6602, 2098, 22842, 8566, 3709, 10288, 8586, 16161, 22573, 2099, 7903, 2063, 2739, 7690, 18696, 2705, 16416, 18927, 13669, 1006, 20014, 4563, 16869, 5332, 4371, 1010, 12046, 2890, 24063, 2854, 15584, 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...
spring-projects/spring-boot
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java
SpringApplication.configurePropertySources
protected void configurePropertySources(ConfigurableEnvironment environment, String[] args) { MutablePropertySources sources = environment.getPropertySources(); if (this.defaultProperties != null && !this.defaultProperties.isEmpty()) { sources.addLast( new MapPropertySource("defaultProperties", this.defaultProperties)); } if (this.addCommandLineProperties && args.length > 0) { String name = CommandLinePropertySource.COMMAND_LINE_PROPERTY_SOURCE_NAME; if (sources.contains(name)) { PropertySource<?> source = sources.get(name); CompositePropertySource composite = new CompositePropertySource(name); composite.addPropertySource(new SimpleCommandLinePropertySource( "springApplicationCommandLineArgs", args)); composite.addPropertySource(source); sources.replace(name, composite); } else { sources.addFirst(new SimpleCommandLinePropertySource(args)); } } }
java
protected void configurePropertySources(ConfigurableEnvironment environment, String[] args) { MutablePropertySources sources = environment.getPropertySources(); if (this.defaultProperties != null && !this.defaultProperties.isEmpty()) { sources.addLast( new MapPropertySource("defaultProperties", this.defaultProperties)); } if (this.addCommandLineProperties && args.length > 0) { String name = CommandLinePropertySource.COMMAND_LINE_PROPERTY_SOURCE_NAME; if (sources.contains(name)) { PropertySource<?> source = sources.get(name); CompositePropertySource composite = new CompositePropertySource(name); composite.addPropertySource(new SimpleCommandLinePropertySource( "springApplicationCommandLineArgs", args)); composite.addPropertySource(source); sources.replace(name, composite); } else { sources.addFirst(new SimpleCommandLinePropertySource(args)); } } }
[ "protected", "void", "configurePropertySources", "(", "ConfigurableEnvironment", "environment", ",", "String", "[", "]", "args", ")", "{", "MutablePropertySources", "sources", "=", "environment", ".", "getPropertySources", "(", ")", ";", "if", "(", "this", ".", "d...
Add, remove or re-order any {@link PropertySource}s in this application's environment. @param environment this application's environment @param args arguments passed to the {@code run} method @see #configureEnvironment(ConfigurableEnvironment, String[])
[ "Add", "remove", "or", "re", "-", "order", "any", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java#L508-L529
train
Configure property sources.
[ 30522, 5123, 11675, 9530, 8873, 27390, 13699, 18981, 15010, 6499, 3126, 9623, 1006, 9530, 8873, 27390, 3085, 2368, 21663, 2239, 3672, 4044, 1010, 5164, 1031, 1033, 12098, 5620, 1007, 1063, 14163, 10880, 21572, 4842, 3723, 6499, 3126, 9623, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/PojoSerializer.java
PojoSerializer.getRegisteredSubclassesFromExecutionConfig
private static LinkedHashSet<Class<?>> getRegisteredSubclassesFromExecutionConfig( Class<?> basePojoClass, ExecutionConfig executionConfig) { LinkedHashSet<Class<?>> subclassesInRegistrationOrder = new LinkedHashSet<>(executionConfig.getRegisteredPojoTypes().size()); for (Class<?> registeredClass : executionConfig.getRegisteredPojoTypes()) { if (registeredClass.equals(basePojoClass)) { continue; } if (!basePojoClass.isAssignableFrom(registeredClass)) { continue; } subclassesInRegistrationOrder.add(registeredClass); } return subclassesInRegistrationOrder; }
java
private static LinkedHashSet<Class<?>> getRegisteredSubclassesFromExecutionConfig( Class<?> basePojoClass, ExecutionConfig executionConfig) { LinkedHashSet<Class<?>> subclassesInRegistrationOrder = new LinkedHashSet<>(executionConfig.getRegisteredPojoTypes().size()); for (Class<?> registeredClass : executionConfig.getRegisteredPojoTypes()) { if (registeredClass.equals(basePojoClass)) { continue; } if (!basePojoClass.isAssignableFrom(registeredClass)) { continue; } subclassesInRegistrationOrder.add(registeredClass); } return subclassesInRegistrationOrder; }
[ "private", "static", "LinkedHashSet", "<", "Class", "<", "?", ">", ">", "getRegisteredSubclassesFromExecutionConfig", "(", "Class", "<", "?", ">", "basePojoClass", ",", "ExecutionConfig", "executionConfig", ")", "{", "LinkedHashSet", "<", "Class", "<", "?", ">", ...
Extracts the subclasses of the base POJO class registered in the execution config.
[ "Extracts", "the", "subclasses", "of", "the", "base", "POJO", "class", "registered", "in", "the", "execution", "config", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializer.java#L1001-L1017
train
Get the registered subclasses from the given execution config.
[ 30522, 2797, 10763, 5799, 14949, 7898, 3388, 1026, 2465, 1026, 1029, 1028, 1028, 2131, 2890, 24063, 6850, 6342, 9818, 27102, 2229, 19699, 8462, 2595, 8586, 13700, 8663, 8873, 2290, 1006, 2465, 1026, 1029, 1028, 2918, 6873, 5558, 26266, 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...
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/symmetric/SymmetricCrypto.java
SymmetricCrypto.decrypt
public byte[] decrypt(byte[] bytes) { lock.lock(); try { if (null == this.params) { cipher.init(Cipher.DECRYPT_MODE, secretKey); } else { cipher.init(Cipher.DECRYPT_MODE, secretKey, params); } return cipher.doFinal(bytes); } catch (Exception e) { throw new CryptoException(e); } finally { lock.unlock(); } }
java
public byte[] decrypt(byte[] bytes) { lock.lock(); try { if (null == this.params) { cipher.init(Cipher.DECRYPT_MODE, secretKey); } else { cipher.init(Cipher.DECRYPT_MODE, secretKey, params); } return cipher.doFinal(bytes); } catch (Exception e) { throw new CryptoException(e); } finally { lock.unlock(); } }
[ "public", "byte", "[", "]", "decrypt", "(", "byte", "[", "]", "bytes", ")", "{", "lock", ".", "lock", "(", ")", ";", "try", "{", "if", "(", "null", "==", "this", ".", "params", ")", "{", "cipher", ".", "init", "(", "Cipher", ".", "DECRYPT_MODE", ...
解密 @param bytes 被解密的bytes @return 解密后的bytes
[ "解密" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/symmetric/SymmetricCrypto.java#L293-L307
train
Decrypt the bytes.
[ 30522, 2270, 24880, 1031, 1033, 11703, 2854, 13876, 1006, 24880, 1031, 1033, 27507, 1007, 1063, 5843, 1012, 5843, 1006, 1007, 1025, 3046, 1063, 2065, 1006, 19701, 1027, 1027, 2023, 1012, 11498, 5244, 1007, 1063, 27715, 1012, 1999, 4183, 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-clients/src/main/java/org/apache/flink/client/LocalExecutor.java
LocalExecutor.execute
public static JobExecutionResult execute(Program pa, String... args) throws Exception { return execute(pa.getPlan(args)); }
java
public static JobExecutionResult execute(Program pa, String... args) throws Exception { return execute(pa.getPlan(args)); }
[ "public", "static", "JobExecutionResult", "execute", "(", "Program", "pa", ",", "String", "...", "args", ")", "throws", "Exception", "{", "return", "execute", "(", "pa", ".", "getPlan", "(", "args", ")", ")", ";", "}" ]
Executes the given program. @param pa The program. @param args The parameters. @return The execution result of the program. @throws Exception Thrown, if either the startup of the local execution context, or the execution caused an exception.
[ "Executes", "the", "given", "program", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/LocalExecutor.java#L274-L276
train
Execute a program.
[ 30522, 2270, 10763, 3105, 10288, 8586, 13700, 6072, 11314, 15389, 1006, 2565, 6643, 1010, 5164, 1012, 1012, 1012, 12098, 5620, 1007, 11618, 6453, 1063, 2709, 15389, 1006, 6643, 1012, 2131, 24759, 2319, 1006, 12098, 5620, 1007, 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...
networknt/light-4j
metrics/src/main/java/io/dropwizard/metrics/MetricName.java
MetricName.resolve
public MetricName resolve(String p) { final String next; if (p != null && !p.isEmpty()) { if (key != null && !key.isEmpty()) { next = key + SEPARATOR + p; } else { next = p; } } else { next = this.key; } return new MetricName(next, tags); }
java
public MetricName resolve(String p) { final String next; if (p != null && !p.isEmpty()) { if (key != null && !key.isEmpty()) { next = key + SEPARATOR + p; } else { next = p; } } else { next = this.key; } return new MetricName(next, tags); }
[ "public", "MetricName", "resolve", "(", "String", "p", ")", "{", "final", "String", "next", ";", "if", "(", "p", "!=", "null", "&&", "!", "p", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "key", "!=", "null", "&&", "!", "key", ".", "isEmpty", ...
Build the MetricName that is this with another path appended to it. The new MetricName inherits the tags of this one. @param p The extra path element to add to the new metric. @return A new metric name relative to the original by the path specified in p.
[ "Build", "the", "MetricName", "that", "is", "this", "with", "another", "path", "appended", "to", "it", "." ]
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/MetricName.java#L82-L96
train
Resolves the metric name to a new metric name.
[ 30522, 2270, 12046, 18442, 10663, 1006, 5164, 1052, 1007, 1063, 2345, 5164, 2279, 1025, 2065, 1006, 1052, 999, 1027, 19701, 1004, 1004, 999, 1052, 1012, 2003, 6633, 13876, 2100, 1006, 1007, 1007, 1063, 2065, 1006, 3145, 999, 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...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java
CollUtil.newHashSet
public static <T> HashSet<T> newHashSet(boolean isSorted, Enumeration<T> enumration) { if (null == enumration) { return newHashSet(isSorted, (T[]) null); } final HashSet<T> set = isSorted ? new LinkedHashSet<T>() : new HashSet<T>(); while (enumration.hasMoreElements()) { set.add(enumration.nextElement()); } return set; }
java
public static <T> HashSet<T> newHashSet(boolean isSorted, Enumeration<T> enumration) { if (null == enumration) { return newHashSet(isSorted, (T[]) null); } final HashSet<T> set = isSorted ? new LinkedHashSet<T>() : new HashSet<T>(); while (enumration.hasMoreElements()) { set.add(enumration.nextElement()); } return set; }
[ "public", "static", "<", "T", ">", "HashSet", "<", "T", ">", "newHashSet", "(", "boolean", "isSorted", ",", "Enumeration", "<", "T", ">", "enumration", ")", "{", "if", "(", "null", "==", "enumration", ")", "{", "return", "newHashSet", "(", "isSorted", ...
新建一个HashSet @param <T> 集合元素类型 @param isSorted 是否有序,有序返回 {@link LinkedHashSet},否则返回{@link HashSet} @param enumration {@link Enumeration} @return HashSet对象 @since 3.0.8
[ "新建一个HashSet" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L492-L501
train
Creates a new HashSet from an enumeration.
[ 30522, 2270, 10763, 1026, 1056, 1028, 23325, 13462, 1026, 1056, 1028, 2047, 14949, 7898, 3388, 1006, 22017, 20898, 26354, 15613, 1010, 4372, 17897, 8156, 1026, 1056, 1028, 4372, 2819, 8156, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 4372, 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...
spring-projects/spring-boot
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/webservices/client/HttpWebServiceMessageSenderBuilder.java
HttpWebServiceMessageSenderBuilder.requestFactory
public HttpWebServiceMessageSenderBuilder requestFactory( Supplier<ClientHttpRequestFactory> requestFactorySupplier) { Assert.notNull(requestFactorySupplier, "RequestFactory Supplier must not be null"); this.requestFactorySupplier = requestFactorySupplier; return this; }
java
public HttpWebServiceMessageSenderBuilder requestFactory( Supplier<ClientHttpRequestFactory> requestFactorySupplier) { Assert.notNull(requestFactorySupplier, "RequestFactory Supplier must not be null"); this.requestFactorySupplier = requestFactorySupplier; return this; }
[ "public", "HttpWebServiceMessageSenderBuilder", "requestFactory", "(", "Supplier", "<", "ClientHttpRequestFactory", ">", "requestFactorySupplier", ")", "{", "Assert", ".", "notNull", "(", "requestFactorySupplier", ",", "\"RequestFactory Supplier must not be null\"", ")", ";", ...
Set the {@code Supplier} of {@link ClientHttpRequestFactory} that should be called to create the HTTP-based {@link WebServiceMessageSender}. @param requestFactorySupplier the supplier for the request factory @return a new builder instance
[ "Set", "the", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/webservices/client/HttpWebServiceMessageSenderBuilder.java#L71-L77
train
Sets the request factory supplier.
[ 30522, 2270, 8299, 8545, 5910, 2121, 7903, 21382, 11488, 30524, 14355, 1007, 1063, 20865, 1012, 2025, 11231, 3363, 1006, 5227, 21450, 6342, 9397, 14355, 1010, 1000, 5227, 21450, 17024, 2442, 2025, 2022, 19701, 1000, 1007, 1025, 2023, 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...
alibaba/canal
driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/client/SemiAckCommandPacket.java
SemiAckCommandPacket.toBytes
public byte[] toBytes() throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); // 0 write semi mark out.write(0xef); // 1 write 8 bytes for position ByteHelper.write8ByteUnsignedIntLittleEndian(binlogPosition, out); // 2 write binlog filename if (StringUtils.isNotEmpty(binlogFileName)) { out.write(binlogFileName.getBytes()); } return out.toByteArray(); }
java
public byte[] toBytes() throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); // 0 write semi mark out.write(0xef); // 1 write 8 bytes for position ByteHelper.write8ByteUnsignedIntLittleEndian(binlogPosition, out); // 2 write binlog filename if (StringUtils.isNotEmpty(binlogFileName)) { out.write(binlogFileName.getBytes()); } return out.toByteArray(); }
[ "public", "byte", "[", "]", "toBytes", "(", ")", "throws", "IOException", "{", "ByteArrayOutputStream", "out", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "// 0 write semi mark", "out", ".", "write", "(", "0xef", ")", ";", "// 1 write 8 bytes for position"...
<pre> Bytes Name -------------------------------------------------------- Bytes Name ----- ---- 1 semi mark 8 binlog position to start at (little endian) n binlog file name </pre>
[ "<pre", ">", "Bytes", "Name", "--------------------------------------------------------", "Bytes", "Name", "-----", "----", "1", "semi", "mark", "8", "binlog", "position", "to", "start", "at", "(", "little", "endian", ")", "n", "binlog", "file", "name" ]
8f088cddc0755f4350c5aaae95c6e4002d90a40f
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/client/SemiAckCommandPacket.java#L41-L53
train
Serialize the record to bytes.
[ 30522, 2270, 24880, 1031, 1033, 11291, 4570, 1006, 1007, 11618, 22834, 10288, 24422, 1063, 24880, 2906, 9447, 5833, 18780, 21422, 2041, 1027, 2047, 24880, 2906, 9447, 5833, 18780, 21422, 1006, 1007, 1025, 1013, 1013, 1014, 4339, 4100, 2928, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/restart/Restarter.java
Restarter.stop
protected void stop() throws Exception { this.logger.debug("Stopping application"); this.stopLock.lock(); try { for (ConfigurableApplicationContext context : this.rootContexts) { context.close(); this.rootContexts.remove(context); } cleanupCaches(); if (this.forceReferenceCleanup) { forceReferenceCleanup(); } } finally { this.stopLock.unlock(); } System.gc(); System.runFinalization(); }
java
protected void stop() throws Exception { this.logger.debug("Stopping application"); this.stopLock.lock(); try { for (ConfigurableApplicationContext context : this.rootContexts) { context.close(); this.rootContexts.remove(context); } cleanupCaches(); if (this.forceReferenceCleanup) { forceReferenceCleanup(); } } finally { this.stopLock.unlock(); } System.gc(); System.runFinalization(); }
[ "protected", "void", "stop", "(", ")", "throws", "Exception", "{", "this", ".", "logger", ".", "debug", "(", "\"Stopping application\"", ")", ";", "this", ".", "stopLock", ".", "lock", "(", ")", ";", "try", "{", "for", "(", "ConfigurableApplicationContext", ...
Stop the application. @throws Exception in case of errors
[ "Stop", "the", "application", "." ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java#L307-L325
train
Stop the application.
[ 30522, 5123, 11675, 2644, 1006, 1007, 11618, 6453, 1063, 30524, 1006, 1007, 1025, 3046, 1063, 2005, 1006, 9530, 8873, 27390, 3085, 29098, 19341, 3508, 8663, 18209, 6123, 1024, 2023, 1012, 7117, 8663, 18209, 2015, 1007, 1063, 6123, 1012, 248...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/tunnel/payload/HttpTunnelPayload.java
HttpTunnelPayload.get
public static HttpTunnelPayload get(HttpInputMessage message) throws IOException { long length = message.getHeaders().getContentLength(); if (length <= 0) { return null; } String seqHeader = message.getHeaders().getFirst(SEQ_HEADER); Assert.state(StringUtils.hasLength(seqHeader), "Missing sequence header"); ReadableByteChannel body = Channels.newChannel(message.getBody()); ByteBuffer payload = ByteBuffer.allocate((int) length); while (payload.hasRemaining()) { body.read(payload); } body.close(); payload.flip(); return new HttpTunnelPayload(Long.valueOf(seqHeader), payload); }
java
public static HttpTunnelPayload get(HttpInputMessage message) throws IOException { long length = message.getHeaders().getContentLength(); if (length <= 0) { return null; } String seqHeader = message.getHeaders().getFirst(SEQ_HEADER); Assert.state(StringUtils.hasLength(seqHeader), "Missing sequence header"); ReadableByteChannel body = Channels.newChannel(message.getBody()); ByteBuffer payload = ByteBuffer.allocate((int) length); while (payload.hasRemaining()) { body.read(payload); } body.close(); payload.flip(); return new HttpTunnelPayload(Long.valueOf(seqHeader), payload); }
[ "public", "static", "HttpTunnelPayload", "get", "(", "HttpInputMessage", "message", ")", "throws", "IOException", "{", "long", "length", "=", "message", ".", "getHeaders", "(", ")", ".", "getContentLength", "(", ")", ";", "if", "(", "length", "<=", "0", ")",...
Return the {@link HttpTunnelPayload} for the given message or {@code null} if there is no payload. @param message the HTTP message @return the payload or {@code null} @throws IOException in case of I/O errors
[ "Return", "the", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayload.java#L113-L128
train
Get tunnel payload from input message.
[ 30522, 2270, 10763, 8299, 8525, 10087, 14277, 4710, 11066, 2131, 1006, 8299, 2378, 18780, 7834, 3736, 3351, 4471, 1007, 11618, 22834, 10288, 24422, 1063, 2146, 3091, 1027, 4471, 1012, 2131, 4974, 2545, 1006, 1007, 1012, 2131, 8663, 6528, 92...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/GenericWriteAheadSink.java
GenericWriteAheadSink.saveHandleInState
private void saveHandleInState(final long checkpointId, final long timestamp) throws Exception { //only add handle if a new OperatorState was created since the last snapshot if (out != null) { int subtaskIdx = getRuntimeContext().getIndexOfThisSubtask(); StreamStateHandle handle = out.closeAndGetHandle(); PendingCheckpoint pendingCheckpoint = new PendingCheckpoint( checkpointId, subtaskIdx, timestamp, handle); if (pendingCheckpoints.contains(pendingCheckpoint)) { //we already have a checkpoint stored for that ID that may have been partially written, //so we discard this "alternate version" and use the stored checkpoint handle.discardState(); } else { pendingCheckpoints.add(pendingCheckpoint); } out = null; } }
java
private void saveHandleInState(final long checkpointId, final long timestamp) throws Exception { //only add handle if a new OperatorState was created since the last snapshot if (out != null) { int subtaskIdx = getRuntimeContext().getIndexOfThisSubtask(); StreamStateHandle handle = out.closeAndGetHandle(); PendingCheckpoint pendingCheckpoint = new PendingCheckpoint( checkpointId, subtaskIdx, timestamp, handle); if (pendingCheckpoints.contains(pendingCheckpoint)) { //we already have a checkpoint stored for that ID that may have been partially written, //so we discard this "alternate version" and use the stored checkpoint handle.discardState(); } else { pendingCheckpoints.add(pendingCheckpoint); } out = null; } }
[ "private", "void", "saveHandleInState", "(", "final", "long", "checkpointId", ",", "final", "long", "timestamp", ")", "throws", "Exception", "{", "//only add handle if a new OperatorState was created since the last snapshot", "if", "(", "out", "!=", "null", ")", "{", "i...
Called when a checkpoint barrier arrives. It closes any open streams to the backend and marks them as pending for committing to the external, third-party storage system. @param checkpointId the id of the latest received checkpoint. @throws IOException in case something went wrong when handling the stream to the backend.
[ "Called", "when", "a", "checkpoint", "barrier", "arrives", ".", "It", "closes", "any", "open", "streams", "to", "the", "backend", "and", "marks", "them", "as", "pending", "for", "committing", "to", "the", "external", "third", "-", "party", "storage", "system...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/GenericWriteAheadSink.java#L136-L155
train
Saves a handle in the state.
[ 30522, 2797, 11675, 3828, 11774, 19856, 9153, 2618, 1006, 2345, 2146, 26520, 3593, 1010, 2345, 2146, 2335, 15464, 2361, 1007, 11618, 6453, 1063, 1013, 1013, 2069, 5587, 5047, 2065, 1037, 2047, 9224, 12259, 2001, 2580, 2144, 1996, 2197, 2005...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java
VelocityUtil.toWriter
public static void toWriter(VelocityEngine ve, String templateFileName, VelocityContext context, Writer writer) { final Template template = ve.getTemplate(templateFileName); merge(template, context, writer); }
java
public static void toWriter(VelocityEngine ve, String templateFileName, VelocityContext context, Writer writer) { final Template template = ve.getTemplate(templateFileName); merge(template, context, writer); }
[ "public", "static", "void", "toWriter", "(", "VelocityEngine", "ve", ",", "String", "templateFileName", ",", "VelocityContext", "context", ",", "Writer", "writer", ")", "{", "final", "Template", "template", "=", "ve", ".", "getTemplate", "(", "templateFileName", ...
生成内容写入流<br> 会自动关闭Writer @param ve 引擎 @param templateFileName 模板文件名 @param context 上下文 @param writer 流
[ "生成内容写入流<br", ">", "会自动关闭Writer" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java#L186-L189
train
Write a Velocity template to a Writer.
[ 30522, 2270, 10763, 11675, 15805, 17625, 2099, 1006, 10146, 13159, 3170, 2310, 1010, 5164, 23561, 8873, 20844, 4168, 1010, 10146, 8663, 18209, 6123, 1010, 3213, 3213, 1007, 1063, 2345, 23561, 23561, 1027, 2310, 1012, 2131, 18532, 15725, 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-common/src/main/java/org/apache/spark/network/sasl/SaslClientBootstrap.java
SaslClientBootstrap.doBootstrap
@Override public void doBootstrap(TransportClient client, Channel channel) { SparkSaslClient saslClient = new SparkSaslClient(appId, secretKeyHolder, conf.saslEncryption()); try { byte[] payload = saslClient.firstToken(); while (!saslClient.isComplete()) { SaslMessage msg = new SaslMessage(appId, payload); ByteBuf buf = Unpooled.buffer(msg.encodedLength() + (int) msg.body().size()); msg.encode(buf); buf.writeBytes(msg.body().nioByteBuffer()); ByteBuffer response = client.sendRpcSync(buf.nioBuffer(), conf.authRTTimeoutMs()); payload = saslClient.response(JavaUtils.bufferToArray(response)); } client.setClientId(appId); if (conf.saslEncryption()) { if (!SparkSaslServer.QOP_AUTH_CONF.equals(saslClient.getNegotiatedProperty(Sasl.QOP))) { throw new RuntimeException( new SaslException("Encryption requests by negotiated non-encrypted connection.")); } SaslEncryption.addToChannel(channel, saslClient, conf.maxSaslEncryptedBlockSize()); saslClient = null; logger.debug("Channel {} configured for encryption.", client); } } catch (IOException ioe) { throw new RuntimeException(ioe); } finally { if (saslClient != null) { try { // Once authentication is complete, the server will trust all remaining communication. saslClient.dispose(); } catch (RuntimeException e) { logger.error("Error while disposing SASL client", e); } } } }
java
@Override public void doBootstrap(TransportClient client, Channel channel) { SparkSaslClient saslClient = new SparkSaslClient(appId, secretKeyHolder, conf.saslEncryption()); try { byte[] payload = saslClient.firstToken(); while (!saslClient.isComplete()) { SaslMessage msg = new SaslMessage(appId, payload); ByteBuf buf = Unpooled.buffer(msg.encodedLength() + (int) msg.body().size()); msg.encode(buf); buf.writeBytes(msg.body().nioByteBuffer()); ByteBuffer response = client.sendRpcSync(buf.nioBuffer(), conf.authRTTimeoutMs()); payload = saslClient.response(JavaUtils.bufferToArray(response)); } client.setClientId(appId); if (conf.saslEncryption()) { if (!SparkSaslServer.QOP_AUTH_CONF.equals(saslClient.getNegotiatedProperty(Sasl.QOP))) { throw new RuntimeException( new SaslException("Encryption requests by negotiated non-encrypted connection.")); } SaslEncryption.addToChannel(channel, saslClient, conf.maxSaslEncryptedBlockSize()); saslClient = null; logger.debug("Channel {} configured for encryption.", client); } } catch (IOException ioe) { throw new RuntimeException(ioe); } finally { if (saslClient != null) { try { // Once authentication is complete, the server will trust all remaining communication. saslClient.dispose(); } catch (RuntimeException e) { logger.error("Error while disposing SASL client", e); } } } }
[ "@", "Override", "public", "void", "doBootstrap", "(", "TransportClient", "client", ",", "Channel", "channel", ")", "{", "SparkSaslClient", "saslClient", "=", "new", "SparkSaslClient", "(", "appId", ",", "secretKeyHolder", ",", "conf", ".", "saslEncryption", "(", ...
Performs SASL authentication by sending a token, and then proceeding with the SASL challenge-response tokens until we either successfully authenticate or throw an exception due to mismatch.
[ "Performs", "SASL", "authentication", "by", "sending", "a", "token", "and", "then", "proceeding", "with", "the", "SASL", "challenge", "-", "response", "tokens", "until", "we", "either", "successfully", "authenticate", "or", "throw", "an", "exception", "due", "to...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/sasl/SaslClientBootstrap.java#L58-L98
train
Bootstrap the server.
[ 30522, 1030, 2058, 15637, 2270, 11675, 2079, 27927, 20528, 2361, 1006, 3665, 20464, 11638, 7396, 1010, 3149, 3149, 1007, 1063, 12300, 3022, 15472, 8751, 3372, 21871, 15472, 8751, 3372, 1027, 2047, 12300, 3022, 15472, 8751, 3372, 1006, 10439, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...