repo
stringclasses
11 values
path
stringlengths
41
214
func_name
stringlengths
7
82
original_string
stringlengths
77
11.9k
language
stringclasses
1 value
code
stringlengths
77
11.9k
code_tokens
listlengths
22
1.57k
docstring
stringlengths
2
2.27k
docstring_tokens
listlengths
1
352
sha
stringclasses
11 values
url
stringlengths
129
319
partition
stringclasses
1 value
summary
stringlengths
7
191
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java
IoUtil.contentEquals
public static boolean contentEquals(Reader input1, Reader input2) throws IORuntimeException { input1 = getReader(input1); input2 = getReader(input2); try { int ch = input1.read(); while (EOF != ch) { int ch2 = input2.read(); if (ch != ch2) { return false; } ch = input1.read(); } int ch2 = input2.read(); return ch2 == EOF; } catch (IOException e) { throw new IORuntimeException(e); } }
java
public static boolean contentEquals(Reader input1, Reader input2) throws IORuntimeException { input1 = getReader(input1); input2 = getReader(input2); try { int ch = input1.read(); while (EOF != ch) { int ch2 = input2.read(); if (ch != ch2) { return false; } ch = input1.read(); } int ch2 = input2.read(); return ch2 == EOF; } catch (IOException e) { throw new IORuntimeException(e); } }
[ "public", "static", "boolean", "contentEquals", "(", "Reader", "input1", ",", "Reader", "input2", ")", "throws", "IORuntimeException", "{", "input1", "=", "getReader", "(", "input1", ")", ";", "input2", "=", "getReader", "(", "input2", ")", ";", "try", "{", ...
对比两个Reader的内容是否一致<br> 内部会转换流为 {@link BufferedInputStream} @param input1 第一个reader @param input2 第二个reader @return 两个流的内容一致返回true,否则false @throws IORuntimeException IO异常 @since 4.0.6
[ "对比两个Reader的内容是否一致<br", ">", "内部会转换流为", "{", "@link", "BufferedInputStream", "}" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L1057-L1076
train
Returns true if the contents of two Reader objects are equal.
[ 30522, 2270, 10763, 22017, 20898, 4180, 2063, 26426, 2015, 1006, 8068, 7953, 2487, 1010, 8068, 7953, 2475, 1007, 11618, 22834, 15532, 7292, 10288, 24422, 1063, 7953, 2487, 1027, 2131, 16416, 4063, 1006, 7953, 2487, 1007, 1025, 7953, 2475, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
StreamExecutionEnvironment.socketTextStream
@PublicEvolving public DataStreamSource<String> socketTextStream(String hostname, int port, String delimiter) { return socketTextStream(hostname, port, delimiter, 0); }
java
@PublicEvolving public DataStreamSource<String> socketTextStream(String hostname, int port, String delimiter) { return socketTextStream(hostname, port, delimiter, 0); }
[ "@", "PublicEvolving", "public", "DataStreamSource", "<", "String", ">", "socketTextStream", "(", "String", "hostname", ",", "int", "port", ",", "String", "delimiter", ")", "{", "return", "socketTextStream", "(", "hostname", ",", "port", ",", "delimiter", ",", ...
Creates a new data stream that contains the strings received infinitely from a socket. Received strings are decoded by the system's default character set. The reader is terminated immediately when the socket is down. @param hostname The host name which a server socket binds @param port The port number which a server socket binds. A port number of 0 means that the port number is automatically allocated. @param delimiter A string which splits received strings into records @return A data stream containing the strings received from the socket
[ "Creates", "a", "new", "data", "stream", "that", "contains", "the", "strings", "received", "infinitely", "from", "a", "socket", ".", "Received", "strings", "are", "decoded", "by", "the", "system", "s", "default", "character", "set", ".", "The", "reader", "is...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L1254-L1257
train
Returns a DataStreamSource that reads from the specified hostname on the specified port using the specified delimiter.
[ 30522, 1030, 2270, 6777, 4747, 6455, 2270, 2951, 21422, 6499, 3126, 3401, 1026, 5164, 1028, 22278, 18209, 21422, 1006, 5164, 3677, 18442, 1010, 20014, 3417, 1010, 5164, 3972, 27605, 3334, 1007, 1063, 2709, 22278, 18209, 21422, 1006, 3677, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java
Pattern.notNext
public Pattern<T, T> notNext(final String name) { if (quantifier.hasProperty(Quantifier.QuantifierProperty.OPTIONAL)) { throw new UnsupportedOperationException( "Specifying a pattern with an optional path to NOT condition is not supported yet. " + "You can simulate such pattern with two independent patterns, one with and the other without " + "the optional part."); } return new Pattern<>(name, this, ConsumingStrategy.NOT_NEXT, afterMatchSkipStrategy); }
java
public Pattern<T, T> notNext(final String name) { if (quantifier.hasProperty(Quantifier.QuantifierProperty.OPTIONAL)) { throw new UnsupportedOperationException( "Specifying a pattern with an optional path to NOT condition is not supported yet. " + "You can simulate such pattern with two independent patterns, one with and the other without " + "the optional part."); } return new Pattern<>(name, this, ConsumingStrategy.NOT_NEXT, afterMatchSkipStrategy); }
[ "public", "Pattern", "<", "T", ",", "T", ">", "notNext", "(", "final", "String", "name", ")", "{", "if", "(", "quantifier", ".", "hasProperty", "(", "Quantifier", ".", "QuantifierProperty", ".", "OPTIONAL", ")", ")", "{", "throw", "new", "UnsupportedOperat...
Appends a new pattern to the existing one. The new pattern enforces that there is no event matching this pattern right after the preceding matched event. @param name Name of the new pattern @return A new pattern which is appended to this one
[ "Appends", "a", "new", "pattern", "to", "the", "existing", "one", ".", "The", "new", "pattern", "enforces", "that", "there", "is", "no", "event", "matching", "this", "pattern", "right", "after", "the", "preceding", "matched", "event", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java#L272-L280
train
Creates a pattern that matches only the next occurrence of the pattern.
[ 30522, 2270, 5418, 1026, 1056, 1010, 1056, 1028, 2025, 2638, 18413, 1006, 2345, 5164, 2171, 1007, 1063, 2065, 1006, 24110, 3775, 8873, 2121, 1012, 2038, 21572, 4842, 3723, 1006, 24110, 3775, 8873, 2121, 1012, 24110, 3775, 8873, 2121, 21572,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.parseFromResourceBundle
public static JSONObject parseFromResourceBundle(ResourceBundle bundle) { JSONObject jsonObject = new JSONObject(); Enumeration<String> keys = bundle.getKeys(); while (keys.hasMoreElements()) { String key = keys.nextElement(); if (key != null) { InternalJSONUtil.propertyPut(jsonObject, key, bundle.getString(key)); } } return jsonObject; }
java
public static JSONObject parseFromResourceBundle(ResourceBundle bundle) { JSONObject jsonObject = new JSONObject(); Enumeration<String> keys = bundle.getKeys(); while (keys.hasMoreElements()) { String key = keys.nextElement(); if (key != null) { InternalJSONUtil.propertyPut(jsonObject, key, bundle.getString(key)); } } return jsonObject; }
[ "public", "static", "JSONObject", "parseFromResourceBundle", "(", "ResourceBundle", "bundle", ")", "{", "JSONObject", "jsonObject", "=", "new", "JSONObject", "(", ")", ";", "Enumeration", "<", "String", ">", "keys", "=", "bundle", ".", "getKeys", "(", ")", ";"...
ResourceBundle转化为JSONObject @param bundle ResourceBundle文件 @return JSONObject
[ "ResourceBundle转化为JSONObject" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONUtil.java#L190-L200
train
Creates a new JSONObject from a ResourceBundle.
[ 30522, 2270, 10763, 1046, 3385, 16429, 20614, 11968, 20106, 21716, 6072, 8162, 3401, 27265, 2571, 1006, 7692, 27265, 2571, 14012, 1007, 1063, 1046, 3385, 16429, 20614, 1046, 3385, 16429, 20614, 1027, 2047, 1046, 3385, 16429, 20614, 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...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/tokenizer/NLPTokenizer.java
NLPTokenizer.seg2sentence
public static List<List<Term>> seg2sentence(String text, boolean shortest) { return ANALYZER.seg2sentence(text, shortest); }
java
public static List<List<Term>> seg2sentence(String text, boolean shortest) { return ANALYZER.seg2sentence(text, shortest); }
[ "public", "static", "List", "<", "List", "<", "Term", ">", ">", "seg2sentence", "(", "String", "text", ",", "boolean", "shortest", ")", "{", "return", "ANALYZER", ".", "seg2sentence", "(", "text", ",", "shortest", ")", ";", "}" ]
分词断句 输出句子形式 @param text 待分词句子 @param shortest 是否断句为最细的子句(将逗号也视作分隔符) @return 句子列表,每个句子由一个单词列表组成
[ "分词断句", "输出句子形式" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/tokenizer/NLPTokenizer.java#L92-L95
train
seg2sentence - returns a list of lists of terms from a sentence.
[ 30522, 2270, 10763, 2862, 1026, 2862, 1026, 2744, 1028, 1028, 7367, 2290, 2475, 5054, 6528, 3401, 1006, 5164, 3793, 1010, 22017, 20898, 20047, 1007, 1063, 2709, 17908, 2099, 1012, 7367, 2290, 2475, 5054, 6528, 3401, 1006, 3793, 1010, 20047,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/asm/translate/Translate.java
Translate.translateEdgeValues
@SuppressWarnings("unchecked") public static <K, OLD, NEW> DataSet<Edge<K, NEW>> translateEdgeValues(DataSet<Edge<K, OLD>> edges, TranslateFunction<OLD, NEW> translator, int parallelism) { Preconditions.checkNotNull(edges); Preconditions.checkNotNull(translator); Class<Edge<K, NEW>> edgeClass = (Class<Edge<K, NEW>>) (Class<? extends Edge>) Edge.class; TypeInformation<K> idType = ((TupleTypeInfo<Edge<K, OLD>>) edges.getType()).getTypeAt(0); TypeInformation<OLD> oldType = ((TupleTypeInfo<Edge<K, OLD>>) edges.getType()).getTypeAt(2); TypeInformation<NEW> newType = TypeExtractor.getUnaryOperatorReturnType( translator, TranslateFunction.class, 0, 1, new int[]{1}, oldType, null, false); TupleTypeInfo<Edge<K, NEW>> returnType = new TupleTypeInfo<>(edgeClass, idType, idType, newType); return edges .map(new TranslateEdgeValue<>(translator)) .returns(returnType) .setParallelism(parallelism) .name("Translate edge values"); }
java
@SuppressWarnings("unchecked") public static <K, OLD, NEW> DataSet<Edge<K, NEW>> translateEdgeValues(DataSet<Edge<K, OLD>> edges, TranslateFunction<OLD, NEW> translator, int parallelism) { Preconditions.checkNotNull(edges); Preconditions.checkNotNull(translator); Class<Edge<K, NEW>> edgeClass = (Class<Edge<K, NEW>>) (Class<? extends Edge>) Edge.class; TypeInformation<K> idType = ((TupleTypeInfo<Edge<K, OLD>>) edges.getType()).getTypeAt(0); TypeInformation<OLD> oldType = ((TupleTypeInfo<Edge<K, OLD>>) edges.getType()).getTypeAt(2); TypeInformation<NEW> newType = TypeExtractor.getUnaryOperatorReturnType( translator, TranslateFunction.class, 0, 1, new int[]{1}, oldType, null, false); TupleTypeInfo<Edge<K, NEW>> returnType = new TupleTypeInfo<>(edgeClass, idType, idType, newType); return edges .map(new TranslateEdgeValue<>(translator)) .returns(returnType) .setParallelism(parallelism) .name("Translate edge values"); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "K", ",", "OLD", ",", "NEW", ">", "DataSet", "<", "Edge", "<", "K", ",", "NEW", ">", ">", "translateEdgeValues", "(", "DataSet", "<", "Edge", "<", "K", ",", "OLD", ">", ">",...
Translate {@link Edge} values using the given {@link TranslateFunction}. @param edges input edges @param translator implements conversion from {@code OLD} to {@code NEW} @param parallelism operator parallelism @param <K> vertex ID type @param <OLD> old edge value type @param <NEW> new edge value type @return translated edges
[ "Translate", "{", "@link", "Edge", "}", "values", "using", "the", "given", "{", "@link", "TranslateFunction", "}", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/Translate.java#L319-L344
train
Translate edge values.
[ 30522, 1030, 16081, 9028, 5582, 2015, 1006, 1000, 4895, 5403, 18141, 1000, 1007, 2270, 10763, 1026, 1047, 1010, 2214, 1010, 2047, 1028, 2951, 13462, 1026, 3341, 1026, 1047, 1010, 2047, 1028, 1028, 17637, 24225, 10175, 15808, 1006, 2951, 134...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializerSnapshot.java
PojoSerializerSnapshot.restoreSerializers
private static <K> LinkedHashMap<K, TypeSerializer<?>> restoreSerializers(LinkedHashMap<K, TypeSerializerSnapshot<?>> snapshotsMap) { final LinkedHashMap<K, TypeSerializer<?>> restoredSerializersMap = new LinkedHashMap<>(snapshotsMap.size()); snapshotsMap.forEach((key, snapshot) -> restoredSerializersMap.put(key, snapshot.restoreSerializer())); return restoredSerializersMap; }
java
private static <K> LinkedHashMap<K, TypeSerializer<?>> restoreSerializers(LinkedHashMap<K, TypeSerializerSnapshot<?>> snapshotsMap) { final LinkedHashMap<K, TypeSerializer<?>> restoredSerializersMap = new LinkedHashMap<>(snapshotsMap.size()); snapshotsMap.forEach((key, snapshot) -> restoredSerializersMap.put(key, snapshot.restoreSerializer())); return restoredSerializersMap; }
[ "private", "static", "<", "K", ">", "LinkedHashMap", "<", "K", ",", "TypeSerializer", "<", "?", ">", ">", "restoreSerializers", "(", "LinkedHashMap", "<", "K", ",", "TypeSerializerSnapshot", "<", "?", ">", ">", "snapshotsMap", ")", "{", "final", "LinkedHashM...
Transforms a {@link LinkedHashMap} with {@link TypeSerializerSnapshot}s as the value to {@link TypeSerializer} as the value by restoring the snapshot.
[ "Transforms", "a", "{" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializerSnapshot.java#L234-L238
train
Restore serializers from the given map.
[ 30522, 2797, 10763, 1026, 1047, 1028, 5799, 14949, 22444, 2361, 1026, 1047, 1010, 4127, 11610, 28863, 1026, 1029, 1028, 1028, 9239, 8043, 4818, 17629, 2015, 1006, 5799, 14949, 22444, 2361, 1026, 1047, 1010, 4127, 11610, 28863, 2015, 2532, 4...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/thread/ThreadUtil.java
ThreadUtil.currentThreadGroup
public static ThreadGroup currentThreadGroup() { final SecurityManager s = System.getSecurityManager(); return (null != s) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup(); }
java
public static ThreadGroup currentThreadGroup() { final SecurityManager s = System.getSecurityManager(); return (null != s) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup(); }
[ "public", "static", "ThreadGroup", "currentThreadGroup", "(", ")", "{", "final", "SecurityManager", "s", "=", "System", ".", "getSecurityManager", "(", ")", ";", "return", "(", "null", "!=", "s", ")", "?", "s", ".", "getThreadGroup", "(", ")", ":", "Thread...
获取当前线程的线程组 @return 线程组 @since 3.1.2
[ "获取当前线程的线程组" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/thread/ThreadUtil.java#L383-L386
train
Gets the ThreadGroup for the current thread.
[ 30522, 2270, 10763, 11689, 17058, 2783, 2705, 16416, 2094, 17058, 1006, 1007, 1063, 2345, 3036, 24805, 4590, 1055, 1027, 2291, 1012, 4152, 8586, 25137, 24805, 4590, 1006, 1007, 1025, 2709, 1006, 19701, 999, 1027, 1055, 1007, 1029, 1055, 305...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
java/server/src/org/openqa/grid/internal/DefaultGridRegistry.java
DefaultGridRegistry._release
private void _release(TestSlot testSlot, SessionTerminationReason reason) { if (!testSlot.startReleaseProcess()) { return; } if (!testSlot.performAfterSessionEvent()) { return; } final String internalKey = testSlot.getInternalKey(); try { lock.lock(); testSlot.finishReleaseProcess(); release(internalKey, reason); } finally { lock.unlock(); } }
java
private void _release(TestSlot testSlot, SessionTerminationReason reason) { if (!testSlot.startReleaseProcess()) { return; } if (!testSlot.performAfterSessionEvent()) { return; } final String internalKey = testSlot.getInternalKey(); try { lock.lock(); testSlot.finishReleaseProcess(); release(internalKey, reason); } finally { lock.unlock(); } }
[ "private", "void", "_release", "(", "TestSlot", "testSlot", ",", "SessionTerminationReason", "reason", ")", "{", "if", "(", "!", "testSlot", ".", "startReleaseProcess", "(", ")", ")", "{", "return", ";", "}", "if", "(", "!", "testSlot", ".", "performAfterSes...
Release the test slot. Free the resource on the slot itself and the registry. If also invokes the {@link org.openqa.grid.internal.listeners.TestSessionListener#afterSession(TestSession)} if applicable. @param testSlot The slot to release
[ "Release", "the", "test", "slot", ".", "Free", "the", "resource", "on", "the", "slot", "itself", "and", "the", "registry", ".", "If", "also", "invokes", "the", "{", "@link", "org", ".", "openqa", ".", "grid", ".", "internal", ".", "listeners", ".", "Te...
7af172729f17b20269c8ca4ea6f788db48616535
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/internal/DefaultGridRegistry.java#L126-L144
train
Release the test slot.
[ 30522, 2797, 11675, 1035, 2713, 1006, 5852, 10994, 5852, 10994, 1010, 5219, 3334, 22311, 3508, 16416, 3385, 3114, 1007, 1063, 2065, 1006, 999, 5852, 10994, 1012, 2707, 16570, 19500, 21572, 9623, 2015, 1006, 1007, 1007, 1063, 2709, 1025, 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...
networknt/light-4j
service/src/main/java/com/networknt/service/ServiceUtil.java
ServiceUtil.construct
public static Object construct(Object something) throws Exception { if (something instanceof String) { return Class.forName((String)something).getConstructor().newInstance(); } else if (something instanceof Map) { // keys are the class name, values are the parameters. for (Map.Entry<String, Object> entry : ((Map<String, Object>) something).entrySet()) { if (entry.getValue() instanceof Map) { return constructByNamedParams(Class.forName(entry.getKey()), (Map)entry.getValue()); } else if (entry.getValue() instanceof List) { return constructByParameterizedConstructor(Class.forName(entry.getKey()), (List)entry.getValue()); } } } return null; }
java
public static Object construct(Object something) throws Exception { if (something instanceof String) { return Class.forName((String)something).getConstructor().newInstance(); } else if (something instanceof Map) { // keys are the class name, values are the parameters. for (Map.Entry<String, Object> entry : ((Map<String, Object>) something).entrySet()) { if (entry.getValue() instanceof Map) { return constructByNamedParams(Class.forName(entry.getKey()), (Map)entry.getValue()); } else if (entry.getValue() instanceof List) { return constructByParameterizedConstructor(Class.forName(entry.getKey()), (List)entry.getValue()); } } } return null; }
[ "public", "static", "Object", "construct", "(", "Object", "something", ")", "throws", "Exception", "{", "if", "(", "something", "instanceof", "String", ")", "{", "return", "Class", ".", "forName", "(", "(", "String", ")", "something", ")", ".", "getConstruct...
Instantiates and returns an object out of a given configuration. If the configuration is simply a class name, assume default empty constructor. If the configuration is a map, assume keyed by class name, with values being one of 2 options: - map: keys are field names, values are field values. - list: items are each maps of type to value, constructor is called with given set. @param something parameter that can be a string or a map. @return constructed object @throws Exception when construction fails.
[ "Instantiates", "and", "returns", "an", "object", "out", "of", "a", "given", "configuration", ".", "If", "the", "configuration", "is", "simply", "a", "class", "name", "assume", "default", "empty", "constructor", ".", "If", "the", "configuration", "is", "a", ...
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/service/src/main/java/com/networknt/service/ServiceUtil.java#L43-L57
train
Construct an object from a Map or a String.
[ 30522, 2270, 10763, 4874, 9570, 1006, 4874, 2242, 1007, 11618, 6453, 1063, 2065, 1006, 2242, 6013, 11253, 5164, 1007, 1063, 2709, 2465, 1012, 2005, 18442, 1006, 1006, 5164, 1007, 2242, 1007, 1012, 2131, 8663, 3367, 6820, 16761, 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...
networknt/light-4j
utility/src/main/java/com/networknt/utility/NioUtils.java
NioUtils.list
public static void list(String zipFilename) throws IOException{ if(logger.isDebugEnabled()) logger.debug("Listing Archive: %s",zipFilename); //create the file system try (FileSystem zipFileSystem = createZipFileSystem(zipFilename, false)) { final Path root = zipFileSystem.getPath("/"); //walk the file tree and print out the directory and filenames Files.walkFileTree(root, new SimpleFileVisitor<Path>(){ @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { print(file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { print(dir); return FileVisitResult.CONTINUE; } /** * prints out details about the specified path * such as size and modification time * @param file * @throws IOException */ private void print(Path file) throws IOException{ final DateFormat df = new SimpleDateFormat("MM/dd/yyyy-HH:mm:ss"); final String modTime= df.format(new Date( Files.getLastModifiedTime(file).toMillis())); if(logger.isDebugEnabled()) { logger.debug("%d %s %s", Files.size(file), modTime, file); } } }); } }
java
public static void list(String zipFilename) throws IOException{ if(logger.isDebugEnabled()) logger.debug("Listing Archive: %s",zipFilename); //create the file system try (FileSystem zipFileSystem = createZipFileSystem(zipFilename, false)) { final Path root = zipFileSystem.getPath("/"); //walk the file tree and print out the directory and filenames Files.walkFileTree(root, new SimpleFileVisitor<Path>(){ @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { print(file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { print(dir); return FileVisitResult.CONTINUE; } /** * prints out details about the specified path * such as size and modification time * @param file * @throws IOException */ private void print(Path file) throws IOException{ final DateFormat df = new SimpleDateFormat("MM/dd/yyyy-HH:mm:ss"); final String modTime= df.format(new Date( Files.getLastModifiedTime(file).toMillis())); if(logger.isDebugEnabled()) { logger.debug("%d %s %s", Files.size(file), modTime, file); } } }); } }
[ "public", "static", "void", "list", "(", "String", "zipFilename", ")", "throws", "IOException", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "logger", ".", "debug", "(", "\"Listing Archive: %s\"", ",", "zipFilename", ")", ";", "//create the...
List the contents of the specified zip file @param zipFilename zip filename @throws IOException IOException
[ "List", "the", "contents", "of", "the", "specified", "zip", "file" ]
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/NioUtils.java#L179-L222
train
List the contents of a zip file.
[ 30522, 2270, 10763, 11675, 2862, 1006, 5164, 14101, 8873, 20844, 4168, 1007, 11618, 22834, 10288, 24422, 1063, 2065, 1006, 8833, 4590, 1012, 2003, 3207, 8569, 6914, 3085, 2094, 1006, 1007, 1007, 8833, 4590, 1012, 2139, 8569, 2290, 1006, 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/dependency/nnparser/NeuralNetworkParser.java
NeuralNetworkParser.load
public boolean load(ByteArray byteArray) { if (byteArray == null) return false; model_header = byteArray.nextString(); root = byteArray.nextString(); use_distance = byteArray.nextInt() == 1; use_valency = byteArray.nextInt() == 1; use_cluster = byteArray.nextInt() == 1; W1 = new Matrix(); W1.load(byteArray); W2 = new Matrix(); W2.load(byteArray); E = new Matrix(); E .load(byteArray); b1 = new Matrix(); b1 .load(byteArray); saved = new Matrix(); saved .load(byteArray); forms_alphabet = new Alphabet(); forms_alphabet .load(byteArray); postags_alphabet = new Alphabet(); postags_alphabet .load(byteArray); deprels_alphabet = new Alphabet(); deprels_alphabet .load(byteArray); precomputation_id_encoder = read_map(byteArray); if (use_cluster) { cluster4_types_alphabet = new Alphabet(); cluster4_types_alphabet.load(byteArray); cluster6_types_alphabet = new Alphabet(); cluster6_types_alphabet .load(byteArray); cluster_types_alphabet = new Alphabet(); cluster_types_alphabet .load(byteArray); form_to_cluster4 = read_map(byteArray); form_to_cluster6 = read_map(byteArray); form_to_cluster = read_map(byteArray); } assert !byteArray.hasMore() : "文件有残留,可能是读取逻辑不对"; classifier = new NeuralNetworkClassifier(W1, W2, E, b1, saved, precomputation_id_encoder); classifier.canonical(); return true; }
java
public boolean load(ByteArray byteArray) { if (byteArray == null) return false; model_header = byteArray.nextString(); root = byteArray.nextString(); use_distance = byteArray.nextInt() == 1; use_valency = byteArray.nextInt() == 1; use_cluster = byteArray.nextInt() == 1; W1 = new Matrix(); W1.load(byteArray); W2 = new Matrix(); W2.load(byteArray); E = new Matrix(); E .load(byteArray); b1 = new Matrix(); b1 .load(byteArray); saved = new Matrix(); saved .load(byteArray); forms_alphabet = new Alphabet(); forms_alphabet .load(byteArray); postags_alphabet = new Alphabet(); postags_alphabet .load(byteArray); deprels_alphabet = new Alphabet(); deprels_alphabet .load(byteArray); precomputation_id_encoder = read_map(byteArray); if (use_cluster) { cluster4_types_alphabet = new Alphabet(); cluster4_types_alphabet.load(byteArray); cluster6_types_alphabet = new Alphabet(); cluster6_types_alphabet .load(byteArray); cluster_types_alphabet = new Alphabet(); cluster_types_alphabet .load(byteArray); form_to_cluster4 = read_map(byteArray); form_to_cluster6 = read_map(byteArray); form_to_cluster = read_map(byteArray); } assert !byteArray.hasMore() : "文件有残留,可能是读取逻辑不对"; classifier = new NeuralNetworkClassifier(W1, W2, E, b1, saved, precomputation_id_encoder); classifier.canonical(); return true; }
[ "public", "boolean", "load", "(", "ByteArray", "byteArray", ")", "{", "if", "(", "byteArray", "==", "null", ")", "return", "false", ";", "model_header", "=", "byteArray", ".", "nextString", "(", ")", ";", "root", "=", "byteArray", ".", "nextString", "(", ...
从bin加载 @param byteArray @return
[ "从bin加载" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/NeuralNetworkParser.java#L238-L288
train
Load the class file from the specified byte array.
[ 30522, 2270, 22017, 20898, 7170, 1006, 24880, 2906, 9447, 24880, 2906, 9447, 1007, 1063, 2065, 1006, 24880, 2906, 9447, 1027, 1027, 19701, 1007, 2709, 6270, 1025, 2944, 1035, 20346, 1027, 24880, 2906, 9447, 1012, 2279, 3367, 4892, 1006, 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...
netty/netty
resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolver.java
DnsNameResolver.resolveAll
public final Future<List<InetAddress>> resolveAll(String inetHost, Iterable<DnsRecord> additionals, Promise<List<InetAddress>> promise) { checkNotNull(promise, "promise"); DnsRecord[] additionalsArray = toArray(additionals, true); try { doResolveAll(inetHost, additionalsArray, promise, resolveCache); return promise; } catch (Exception e) { return promise.setFailure(e); } }
java
public final Future<List<InetAddress>> resolveAll(String inetHost, Iterable<DnsRecord> additionals, Promise<List<InetAddress>> promise) { checkNotNull(promise, "promise"); DnsRecord[] additionalsArray = toArray(additionals, true); try { doResolveAll(inetHost, additionalsArray, promise, resolveCache); return promise; } catch (Exception e) { return promise.setFailure(e); } }
[ "public", "final", "Future", "<", "List", "<", "InetAddress", ">", ">", "resolveAll", "(", "String", "inetHost", ",", "Iterable", "<", "DnsRecord", ">", "additionals", ",", "Promise", "<", "List", "<", "InetAddress", ">", ">", "promise", ")", "{", "checkNo...
Resolves the specified host name and port into a list of address. @param inetHost the name to resolve @param additionals additional records ({@code OPT}) @param promise the {@link Promise} which will be fulfilled when the name resolution is finished @return the list of the address as the result of the resolution
[ "Resolves", "the", "specified", "host", "name", "and", "port", "into", "a", "list", "of", "address", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolver.java#L683-L693
train
Resolves all the dns records in the specified inet host.
[ 30522, 2270, 2345, 2925, 1026, 2862, 1026, 1999, 12928, 14141, 8303, 30524, 2862, 1026, 1999, 12928, 14141, 8303, 1028, 1028, 4872, 1007, 1063, 4638, 17048, 11231, 3363, 1006, 4872, 1010, 1000, 4872, 1000, 1007, 1025, 1040, 3619, 2890, 2710...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/types/Record.java
Record.writeVarLengthInt
private static final void writeVarLengthInt(DataOutput out, int value) throws IOException { while (value >= MAX_BIT) { out.write(value | MAX_BIT); value >>= 7; } out.write(value); }
java
private static final void writeVarLengthInt(DataOutput out, int value) throws IOException { while (value >= MAX_BIT) { out.write(value | MAX_BIT); value >>= 7; } out.write(value); }
[ "private", "static", "final", "void", "writeVarLengthInt", "(", "DataOutput", "out", ",", "int", "value", ")", "throws", "IOException", "{", "while", "(", "value", ">=", "MAX_BIT", ")", "{", "out", ".", "write", "(", "value", "|", "MAX_BIT", ")", ";", "v...
--------------------------------------------------------------------------------------------
[ "--------------------------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/Record.java#L1239-L1245
train
Write var length int.
[ 30522, 2797, 10763, 2345, 11675, 4339, 10755, 7770, 13512, 10606, 2102, 1006, 2951, 5833, 18780, 2041, 1010, 20014, 3643, 1007, 11618, 22834, 10288, 24422, 1063, 2096, 1006, 3643, 1028, 1027, 4098, 1035, 2978, 1007, 1063, 2041, 1012, 4339, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
handler/src/main/java/io/netty/handler/traffic/TrafficCounter.java
TrafficCounter.readTimeToWait
public long readTimeToWait(final long size, final long limitTraffic, final long maxTime, final long now) { bytesRecvFlowControl(size); if (size == 0 || limitTraffic == 0) { return 0; } final long lastTimeCheck = lastTime.get(); long sum = currentReadBytes.get(); long localReadingTime = readingTime; long lastRB = lastReadBytes; final long interval = now - lastTimeCheck; long pastDelay = Math.max(lastReadingTime - lastTimeCheck, 0); if (interval > AbstractTrafficShapingHandler.MINIMAL_WAIT) { // Enough interval time to compute shaping long time = sum * 1000 / limitTraffic - interval + pastDelay; if (time > AbstractTrafficShapingHandler.MINIMAL_WAIT) { if (logger.isDebugEnabled()) { logger.debug("Time: " + time + ':' + sum + ':' + interval + ':' + pastDelay); } if (time > maxTime && now + time - localReadingTime > maxTime) { time = maxTime; } readingTime = Math.max(localReadingTime, now + time); return time; } readingTime = Math.max(localReadingTime, now); return 0; } // take the last read interval check to get enough interval time long lastsum = sum + lastRB; long lastinterval = interval + checkInterval.get(); long time = lastsum * 1000 / limitTraffic - lastinterval + pastDelay; if (time > AbstractTrafficShapingHandler.MINIMAL_WAIT) { if (logger.isDebugEnabled()) { logger.debug("Time: " + time + ':' + lastsum + ':' + lastinterval + ':' + pastDelay); } if (time > maxTime && now + time - localReadingTime > maxTime) { time = maxTime; } readingTime = Math.max(localReadingTime, now + time); return time; } readingTime = Math.max(localReadingTime, now); return 0; }
java
public long readTimeToWait(final long size, final long limitTraffic, final long maxTime, final long now) { bytesRecvFlowControl(size); if (size == 0 || limitTraffic == 0) { return 0; } final long lastTimeCheck = lastTime.get(); long sum = currentReadBytes.get(); long localReadingTime = readingTime; long lastRB = lastReadBytes; final long interval = now - lastTimeCheck; long pastDelay = Math.max(lastReadingTime - lastTimeCheck, 0); if (interval > AbstractTrafficShapingHandler.MINIMAL_WAIT) { // Enough interval time to compute shaping long time = sum * 1000 / limitTraffic - interval + pastDelay; if (time > AbstractTrafficShapingHandler.MINIMAL_WAIT) { if (logger.isDebugEnabled()) { logger.debug("Time: " + time + ':' + sum + ':' + interval + ':' + pastDelay); } if (time > maxTime && now + time - localReadingTime > maxTime) { time = maxTime; } readingTime = Math.max(localReadingTime, now + time); return time; } readingTime = Math.max(localReadingTime, now); return 0; } // take the last read interval check to get enough interval time long lastsum = sum + lastRB; long lastinterval = interval + checkInterval.get(); long time = lastsum * 1000 / limitTraffic - lastinterval + pastDelay; if (time > AbstractTrafficShapingHandler.MINIMAL_WAIT) { if (logger.isDebugEnabled()) { logger.debug("Time: " + time + ':' + lastsum + ':' + lastinterval + ':' + pastDelay); } if (time > maxTime && now + time - localReadingTime > maxTime) { time = maxTime; } readingTime = Math.max(localReadingTime, now + time); return time; } readingTime = Math.max(localReadingTime, now); return 0; }
[ "public", "long", "readTimeToWait", "(", "final", "long", "size", ",", "final", "long", "limitTraffic", ",", "final", "long", "maxTime", ",", "final", "long", "now", ")", "{", "bytesRecvFlowControl", "(", "size", ")", ";", "if", "(", "size", "==", "0", "...
Returns the time to wait (if any) for the given length message, using the given limitTraffic and the max wait time. @param size the recv size @param limitTraffic the traffic limit in bytes per second @param maxTime the max time in ms to wait in case of excess of traffic. @param now the current time @return the current time to wait (in ms) if needed for Read operation.
[ "Returns", "the", "time", "to", "wait", "(", "if", "any", ")", "for", "the", "given", "length", "message", "using", "the", "given", "limitTraffic", "and", "the", "max", "wait", "time", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/traffic/TrafficCounter.java#L498-L541
train
readTimeToWait This method is used to determine how long to wait for a message to be read.
[ 30522, 2270, 2146, 3191, 7292, 18790, 4886, 30524, 2146, 4098, 7292, 1010, 2345, 2146, 2085, 1007, 1063, 27507, 2890, 2278, 2615, 12314, 8663, 13181, 2140, 1006, 2946, 1007, 1025, 2065, 1006, 2946, 1027, 1027, 1014, 1064, 1064, 5787, 6494, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.addAll
public static <T> Collection<T> addAll(Collection<T> collection, Iterable<T> iterable) { return addAll(collection, iterable.iterator()); }
java
public static <T> Collection<T> addAll(Collection<T> collection, Iterable<T> iterable) { return addAll(collection, iterable.iterator()); }
[ "public", "static", "<", "T", ">", "Collection", "<", "T", ">", "addAll", "(", "Collection", "<", "T", ">", "collection", ",", "Iterable", "<", "T", ">", "iterable", ")", "{", "return", "addAll", "(", "collection", ",", "iterable", ".", "iterator", "("...
加入全部 @param <T> 集合元素类型 @param collection 被加入的集合 {@link Collection} @param iterable 要加入的内容{@link Iterable} @return 原集合
[ "加入全部" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1771-L1773
train
Adds all elements from the iterable to the collection.
[ 30522, 2270, 10763, 1026, 1056, 1028, 3074, 1026, 1056, 1028, 5587, 8095, 1006, 3074, 1026, 1056, 1028, 3074, 1010, 2009, 6906, 3468, 1026, 1056, 1028, 2009, 6906, 3468, 1007, 1063, 2709, 5587, 8095, 1006, 3074, 1010, 2009, 6906, 3468, 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-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/TunnelClient.java
TunnelClient.stop
public void stop() throws IOException { synchronized (this.monitor) { if (this.serverThread != null) { this.serverThread.close(); try { this.serverThread.join(2000); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } this.serverThread = null; } } }
java
public void stop() throws IOException { synchronized (this.monitor) { if (this.serverThread != null) { this.serverThread.close(); try { this.serverThread.join(2000); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } this.serverThread = null; } } }
[ "public", "void", "stop", "(", ")", "throws", "IOException", "{", "synchronized", "(", "this", ".", "monitor", ")", "{", "if", "(", "this", ".", "serverThread", "!=", "null", ")", "{", "this", ".", "serverThread", ".", "close", "(", ")", ";", "try", ...
Stop the client, disconnecting any servers. @throws IOException in case of I/O errors
[ "Stop", "the", "client", "disconnecting", "any", "servers", "." ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/TunnelClient.java#L102-L115
train
Stop the server.
[ 30522, 2270, 11675, 2644, 1006, 1007, 11618, 22834, 10288, 24422, 1063, 25549, 1006, 2023, 1012, 8080, 1007, 1063, 2065, 1006, 2023, 1012, 8241, 2705, 16416, 2094, 999, 1027, 19701, 1007, 1063, 2023, 1012, 8241, 2705, 16416, 2094, 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...
looly/hutool
hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java
SqlConnRunner.update
public int update(Connection conn, Entity record, Entity where) throws SQLException { checkConn(conn); if(CollectionUtil.isEmpty(record)){ throw new SQLException("Empty entity provided!"); } if(CollectionUtil.isEmpty(where)){ //不允许做全表更新 throw new SQLException("Empty where provided!"); } //表名可以从被更新记录的Entity中获得,也可以从Where中获得 String tableName = record.getTableName(); if(StrUtil.isBlank(tableName)){ tableName = where.getTableName(); record.setTableName(tableName); } final Query query = new Query(SqlUtil.buildConditions(where), tableName); PreparedStatement ps = null; try { ps = dialect.psForUpdate(conn, record, query); return ps.executeUpdate(); } catch (SQLException e) { throw e; } finally { DbUtil.close(ps); } }
java
public int update(Connection conn, Entity record, Entity where) throws SQLException { checkConn(conn); if(CollectionUtil.isEmpty(record)){ throw new SQLException("Empty entity provided!"); } if(CollectionUtil.isEmpty(where)){ //不允许做全表更新 throw new SQLException("Empty where provided!"); } //表名可以从被更新记录的Entity中获得,也可以从Where中获得 String tableName = record.getTableName(); if(StrUtil.isBlank(tableName)){ tableName = where.getTableName(); record.setTableName(tableName); } final Query query = new Query(SqlUtil.buildConditions(where), tableName); PreparedStatement ps = null; try { ps = dialect.psForUpdate(conn, record, query); return ps.executeUpdate(); } catch (SQLException e) { throw e; } finally { DbUtil.close(ps); } }
[ "public", "int", "update", "(", "Connection", "conn", ",", "Entity", "record", ",", "Entity", "where", ")", "throws", "SQLException", "{", "checkConn", "(", "conn", ")", ";", "if", "(", "CollectionUtil", ".", "isEmpty", "(", "record", ")", ")", "{", "thr...
更新数据<br> 此方法不会关闭Connection @param conn 数据库连接 @param record 记录 @param where 条件 @return 影响行数 @throws SQLException SQL执行异常
[ "更新数据<br", ">", "此方法不会关闭Connection" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java#L263-L290
train
Updates the specified entity in the database.
[ 30522, 2270, 20014, 10651, 1006, 4434, 9530, 2078, 1010, 9178, 2501, 1010, 9178, 2073, 1007, 11618, 29296, 10288, 24422, 1063, 4638, 8663, 2078, 1006, 9530, 2078, 1007, 1025, 2065, 1006, 3074, 21823, 2140, 1012, 2003, 6633, 13876, 2100, 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-core/src/main/java/org/apache/flink/util/FileUtils.java
FileUtils.writeCompletely
public static void writeCompletely(WritableByteChannel channel, ByteBuffer src) throws IOException { while (src.hasRemaining()) { channel.write(src); } }
java
public static void writeCompletely(WritableByteChannel channel, ByteBuffer src) throws IOException { while (src.hasRemaining()) { channel.write(src); } }
[ "public", "static", "void", "writeCompletely", "(", "WritableByteChannel", "channel", ",", "ByteBuffer", "src", ")", "throws", "IOException", "{", "while", "(", "src", ".", "hasRemaining", "(", ")", ")", "{", "channel", ".", "write", "(", "src", ")", ";", ...
------------------------------------------------------------------------
[ "------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/FileUtils.java#L74-L78
train
Write a complete ByteBuffer to a channel.
[ 30522, 2270, 10763, 11675, 4339, 9006, 10814, 9834, 2100, 1006, 25697, 3085, 3762, 15007, 20147, 2140, 3149, 1010, 24880, 8569, 12494, 5034, 2278, 1007, 11618, 22834, 10288, 24422, 1063, 2096, 1006, 5034, 2278, 1012, 2038, 28578, 8113, 2075, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.flatSelect
public <L, R> SingleOutputStreamOperator<R> flatSelect( final OutputTag<L> timedOutPartialMatchesTag, final PatternFlatTimeoutFunction<T, L> patternFlatTimeoutFunction, final TypeInformation<R> outTypeInfo, final PatternFlatSelectFunction<T, R> patternFlatSelectFunction) { final PatternProcessFunction<T, R> processFunction = fromFlatSelect(builder.clean(patternFlatSelectFunction)) .withTimeoutHandler(timedOutPartialMatchesTag, builder.clean(patternFlatTimeoutFunction)) .build(); return process(processFunction, outTypeInfo); }
java
public <L, R> SingleOutputStreamOperator<R> flatSelect( final OutputTag<L> timedOutPartialMatchesTag, final PatternFlatTimeoutFunction<T, L> patternFlatTimeoutFunction, final TypeInformation<R> outTypeInfo, final PatternFlatSelectFunction<T, R> patternFlatSelectFunction) { final PatternProcessFunction<T, R> processFunction = fromFlatSelect(builder.clean(patternFlatSelectFunction)) .withTimeoutHandler(timedOutPartialMatchesTag, builder.clean(patternFlatTimeoutFunction)) .build(); return process(processFunction, outTypeInfo); }
[ "public", "<", "L", ",", "R", ">", "SingleOutputStreamOperator", "<", "R", ">", "flatSelect", "(", "final", "OutputTag", "<", "L", ">", "timedOutPartialMatchesTag", ",", "final", "PatternFlatTimeoutFunction", "<", "T", ",", "L", ">", "patternFlatTimeoutFunction", ...
Applies a flat select function to the detected pattern sequence. For each pattern sequence the provided {@link PatternFlatSelectFunction} 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 PatternFlatTimeoutFunction} is called. The pattern timeout function can produce exactly one resulting element. <p>You can get the stream of timed-out data resulting from the {@link SingleOutputStreamOperator#getSideOutput(OutputTag)} on the {@link SingleOutputStreamOperator} resulting from the select operation with the same {@link OutputTag}. @param timedOutPartialMatchesTag {@link OutputTag} that identifies side output with timed out patterns @param patternFlatTimeoutFunction The pattern timeout function which is called for each partial pattern sequence which has timed out. @param patternFlatSelectFunction The pattern select function which is called for each detected pattern sequence. @param outTypeInfo Explicit specification of output type. @param <L> Type of the resulting timeout elements @param <R> Type of the resulting elements @return {@link DataStream} which contains the resulting elements with the resulting timeout elements in a side output.
[ "Applies", "a", "flat", "select", "function", "to", "the", "detected", "pattern", "sequence", ".", "For", "each", "pattern", "sequence", "the", "provided", "{", "@link", "PatternFlatSelectFunction", "}", "is", "called", ".", "The", "pattern", "select", "function...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/PatternStream.java#L440-L452
train
Flat select.
[ 30522, 2270, 1026, 1048, 1010, 1054, 1028, 2309, 5833, 18780, 21422, 25918, 8844, 1026, 1054, 1028, 14201, 12260, 6593, 1006, 2345, 6434, 15900, 1026, 1048, 1028, 22313, 5833, 19362, 20925, 18900, 8376, 15900, 1010, 2345, 5418, 10258, 19321, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/io/SplitDataProperties.java
SplitDataProperties.splitsOrderedBy
public SplitDataProperties<T> splitsOrderedBy(String orderFields, Order[] orders) { if (orderFields == null || orders == null) { throw new InvalidProgramException("OrderFields or Orders may not be null."); } String[] orderKeysA = orderFields.split(";"); if (orderKeysA.length == 0) { throw new InvalidProgramException("OrderFields may not be empty."); } else if (orders.length == 0) { throw new InvalidProgramException("Orders may not be empty"); } else if (orderKeysA.length != orders.length) { throw new InvalidProgramException("Number of OrderFields and Orders must match."); } if (this.splitGroupKeys != null) { throw new InvalidProgramException("DataSource may either be grouped or sorted."); } this.splitOrdering = new Ordering(); for (int i = 0; i < orderKeysA.length; i++) { String keyExp = orderKeysA[i]; Keys.ExpressionKeys<T> ek = new Keys.ExpressionKeys<>(keyExp, this.type); int[] flatKeys = ek.computeLogicalKeyPositions(); for (int key : flatKeys) { // check for duplicates for (int okey : splitOrdering.getFieldPositions()) { if (key == okey) { throw new InvalidProgramException("Duplicate field in field expression " + keyExp); } } // append key this.splitOrdering.appendOrdering(key, null, orders[i]); } } return this; }
java
public SplitDataProperties<T> splitsOrderedBy(String orderFields, Order[] orders) { if (orderFields == null || orders == null) { throw new InvalidProgramException("OrderFields or Orders may not be null."); } String[] orderKeysA = orderFields.split(";"); if (orderKeysA.length == 0) { throw new InvalidProgramException("OrderFields may not be empty."); } else if (orders.length == 0) { throw new InvalidProgramException("Orders may not be empty"); } else if (orderKeysA.length != orders.length) { throw new InvalidProgramException("Number of OrderFields and Orders must match."); } if (this.splitGroupKeys != null) { throw new InvalidProgramException("DataSource may either be grouped or sorted."); } this.splitOrdering = new Ordering(); for (int i = 0; i < orderKeysA.length; i++) { String keyExp = orderKeysA[i]; Keys.ExpressionKeys<T> ek = new Keys.ExpressionKeys<>(keyExp, this.type); int[] flatKeys = ek.computeLogicalKeyPositions(); for (int key : flatKeys) { // check for duplicates for (int okey : splitOrdering.getFieldPositions()) { if (key == okey) { throw new InvalidProgramException("Duplicate field in field expression " + keyExp); } } // append key this.splitOrdering.appendOrdering(key, null, orders[i]); } } return this; }
[ "public", "SplitDataProperties", "<", "T", ">", "splitsOrderedBy", "(", "String", "orderFields", ",", "Order", "[", "]", "orders", ")", "{", "if", "(", "orderFields", "==", "null", "||", "orders", "==", "null", ")", "{", "throw", "new", "InvalidProgramExcept...
Defines that the data within an input split is sorted on the fields defined by the field expressions in the specified orders. Multiple field expressions must be separated by the semicolon ';' character. All records of an input split must be emitted by the input format in the defined order. <p><b> IMPORTANT: Providing wrong information with SplitDataProperties can cause wrong results! </b> @param orderFields The field expressions of the grouping key. @param orders The orders of the fields. @return This SplitDataProperties object.
[ "Defines", "that", "the", "data", "within", "an", "input", "split", "is", "sorted", "on", "the", "fields", "defined", "by", "the", "field", "expressions", "in", "the", "specified", "orders", ".", "Multiple", "field", "expressions", "must", "be", "separated", ...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/io/SplitDataProperties.java#L312-L350
train
Splits the data in the data source in order by the specified fields.
[ 30522, 2270, 3975, 2850, 2696, 21572, 4842, 7368, 1026, 1056, 1028, 19584, 8551, 6850, 3762, 1006, 5164, 2344, 15155, 1010, 2344, 1031, 1033, 4449, 1007, 1063, 2065, 1006, 2344, 15155, 1027, 1027, 19701, 1064, 1064, 4449, 1027, 1027, 19701,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/dependency/nnparser/NeuralNetworkParser.java
NeuralNetworkParser.DEPREL
int DEPREL(final List<Integer> deprels, int id) { return ((id != -1) ? (deprels.get(id) + kDeprelInFeaturespace) : kNilDeprel); }
java
int DEPREL(final List<Integer> deprels, int id) { return ((id != -1) ? (deprels.get(id) + kDeprelInFeaturespace) : kNilDeprel); }
[ "int", "DEPREL", "(", "final", "List", "<", "Integer", ">", "deprels", ",", "int", "id", ")", "{", "return", "(", "(", "id", "!=", "-", "1", ")", "?", "(", "deprels", ".", "get", "(", "id", ")", "+", "kDeprelInFeaturespace", ")", ":", "kNilDeprel",...
获取依存 @param deprels 依存列表 @param id 依存下标 @return 依存
[ "获取依存" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/NeuralNetworkParser.java#L650-L653
train
Get the DEPREL value for a given ID.
[ 30522, 20014, 2139, 28139, 2140, 1006, 2345, 2862, 1026, 16109, 1028, 2139, 28139, 4877, 1010, 20014, 8909, 1007, 1063, 2709, 1006, 1006, 8909, 999, 1027, 1011, 1015, 1007, 1029, 1006, 2139, 28139, 4877, 1012, 2131, 1006, 8909, 1007, 1009, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/JobVertex.java
JobVertex.getInvokableClass
public Class<? extends AbstractInvokable> getInvokableClass(ClassLoader cl) { if (cl == null) { throw new NullPointerException("The classloader must not be null."); } if (invokableClassName == null) { return null; } try { return Class.forName(invokableClassName, true, cl).asSubclass(AbstractInvokable.class); } catch (ClassNotFoundException e) { throw new RuntimeException("The user-code class could not be resolved.", e); } catch (ClassCastException e) { throw new RuntimeException("The user-code class is no subclass of " + AbstractInvokable.class.getName(), e); } }
java
public Class<? extends AbstractInvokable> getInvokableClass(ClassLoader cl) { if (cl == null) { throw new NullPointerException("The classloader must not be null."); } if (invokableClassName == null) { return null; } try { return Class.forName(invokableClassName, true, cl).asSubclass(AbstractInvokable.class); } catch (ClassNotFoundException e) { throw new RuntimeException("The user-code class could not be resolved.", e); } catch (ClassCastException e) { throw new RuntimeException("The user-code class is no subclass of " + AbstractInvokable.class.getName(), e); } }
[ "public", "Class", "<", "?", "extends", "AbstractInvokable", ">", "getInvokableClass", "(", "ClassLoader", "cl", ")", "{", "if", "(", "cl", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"The classloader must not be null.\"", ")", ";", "}...
Returns the invokable class which represents the task of this vertex @param cl The classloader used to resolve user-defined classes @return The invokable class, <code>null</code> if it is not set
[ "Returns", "the", "invokable", "class", "which", "represents", "the", "task", "of", "this", "vertex" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/JobVertex.java#L257-L274
train
Returns the user - code class that is invoked by the specified classloader.
[ 30522, 2270, 2465, 1026, 1029, 8908, 10061, 2378, 6767, 2912, 3468, 1028, 2131, 2378, 6767, 2912, 3468, 26266, 1006, 2465, 11066, 2121, 18856, 1007, 1063, 2065, 1006, 18856, 1027, 1027, 19701, 1007, 1063, 5466, 2047, 19701, 8400, 7869, 2595...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/utility/Utility.java
Utility.convertSentenceToNER
public static List<String[]> convertSentenceToNER(Sentence sentence, NERTagSet tagSet) { List<String[]> collector = new LinkedList<String[]>(); Set<String> nerLabels = tagSet.nerLabels; for (IWord word : sentence.wordList) { if (word instanceof CompoundWord) { List<Word> wordList = ((CompoundWord) word).innerList; Word[] words = wordList.toArray(new Word[0]); if (nerLabels.contains(word.getLabel())) { collector.add(new String[]{words[0].value, words[0].label, tagSet.B_TAG_PREFIX + word.getLabel()}); for (int i = 1; i < words.length - 1; i++) { collector.add(new String[]{words[i].value, words[i].label, tagSet.M_TAG_PREFIX + word.getLabel()}); } collector.add(new String[]{words[words.length - 1].value, words[words.length - 1].label, tagSet.E_TAG_PREFIX + word.getLabel()}); } else { for (Word w : words) { collector.add(new String[]{w.value, w.label, tagSet.O_TAG}); } } } else { if (nerLabels.contains(word.getLabel())) { // 单个实体 collector.add(new String[]{word.getValue(), word.getLabel(), tagSet.S_TAG}); } else { collector.add(new String[]{word.getValue(), word.getLabel(), tagSet.O_TAG}); } } } return collector; }
java
public static List<String[]> convertSentenceToNER(Sentence sentence, NERTagSet tagSet) { List<String[]> collector = new LinkedList<String[]>(); Set<String> nerLabels = tagSet.nerLabels; for (IWord word : sentence.wordList) { if (word instanceof CompoundWord) { List<Word> wordList = ((CompoundWord) word).innerList; Word[] words = wordList.toArray(new Word[0]); if (nerLabels.contains(word.getLabel())) { collector.add(new String[]{words[0].value, words[0].label, tagSet.B_TAG_PREFIX + word.getLabel()}); for (int i = 1; i < words.length - 1; i++) { collector.add(new String[]{words[i].value, words[i].label, tagSet.M_TAG_PREFIX + word.getLabel()}); } collector.add(new String[]{words[words.length - 1].value, words[words.length - 1].label, tagSet.E_TAG_PREFIX + word.getLabel()}); } else { for (Word w : words) { collector.add(new String[]{w.value, w.label, tagSet.O_TAG}); } } } else { if (nerLabels.contains(word.getLabel())) { // 单个实体 collector.add(new String[]{word.getValue(), word.getLabel(), tagSet.S_TAG}); } else { collector.add(new String[]{word.getValue(), word.getLabel(), tagSet.O_TAG}); } } } return collector; }
[ "public", "static", "List", "<", "String", "[", "]", ">", "convertSentenceToNER", "(", "Sentence", "sentence", ",", "NERTagSet", "tagSet", ")", "{", "List", "<", "String", "[", "]", ">", "collector", "=", "new", "LinkedList", "<", "String", "[", "]", ">"...
将句子转换为 (单词,词性,NER标签)三元组 @param sentence @param tagSet @return
[ "将句子转换为", "(单词,词性,NER标签)三元组" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/utility/Utility.java#L316-L359
train
Convert sentence to nER tag set
[ 30522, 2270, 10763, 2862, 1026, 5164, 1031, 1033, 1028, 19884, 15781, 5897, 5524, 2099, 1006, 6251, 6251, 1010, 11265, 13320, 5620, 3388, 22073, 3388, 1007, 1063, 2862, 1026, 5164, 1031, 1033, 1028, 10018, 1027, 2047, 5799, 9863, 1026, 5164...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.toStream
public static ByteArrayInputStream toStream(String content, String charsetName) { return toStream(content, CharsetUtil.charset(charsetName)); }
java
public static ByteArrayInputStream toStream(String content, String charsetName) { return toStream(content, CharsetUtil.charset(charsetName)); }
[ "public", "static", "ByteArrayInputStream", "toStream", "(", "String", "content", ",", "String", "charsetName", ")", "{", "return", "toStream", "(", "content", ",", "CharsetUtil", ".", "charset", "(", "charsetName", ")", ")", ";", "}" ]
String 转为流 @param content 内容 @param charsetName 编码 @return 字节流
[ "String", "转为流" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L739-L741
train
Converts a String to an InputStream.
[ 30522, 2270, 10763, 24880, 2906, 9447, 2378, 18780, 21422, 2000, 21422, 1006, 5164, 4180, 1010, 5164, 25869, 13462, 18442, 1007, 1063, 2709, 2000, 21422, 1006, 4180, 1010, 25869, 13462, 21823, 2140, 1012, 25869, 13462, 1006, 25869, 13462, 184...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
java/server/src/org/openqa/grid/internal/utils/SelfRegisteringRemote.java
SelfRegisteringRemote.addBrowser
public void addBrowser(DesiredCapabilities cap, int instances) { String s = cap.getBrowserName(); if (s == null || "".equals(s)) { throw new InvalidParameterException(cap + " does seems to be a valid browser."); } if (cap.getPlatform() == null) { cap.setPlatform(Platform.getCurrent()); } cap.setCapability(RegistrationRequest.MAX_INSTANCES, instances); registrationRequest.getConfiguration().capabilities.add(cap); registrationRequest.getConfiguration().fixUpCapabilities(); }
java
public void addBrowser(DesiredCapabilities cap, int instances) { String s = cap.getBrowserName(); if (s == null || "".equals(s)) { throw new InvalidParameterException(cap + " does seems to be a valid browser."); } if (cap.getPlatform() == null) { cap.setPlatform(Platform.getCurrent()); } cap.setCapability(RegistrationRequest.MAX_INSTANCES, instances); registrationRequest.getConfiguration().capabilities.add(cap); registrationRequest.getConfiguration().fixUpCapabilities(); }
[ "public", "void", "addBrowser", "(", "DesiredCapabilities", "cap", ",", "int", "instances", ")", "{", "String", "s", "=", "cap", ".", "getBrowserName", "(", ")", ";", "if", "(", "s", "==", "null", "||", "\"\"", ".", "equals", "(", "s", ")", ")", "{",...
Adding the browser described by the capability, automatically finding out what platform the node is launched from @param cap describing the browser @param instances number of times this browser can be started on the node.
[ "Adding", "the", "browser", "described", "by", "the", "capability", "automatically", "finding", "out", "what", "platform", "the", "node", "is", "launched", "from" ]
7af172729f17b20269c8ca4ea6f788db48616535
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/internal/utils/SelfRegisteringRemote.java#L139-L150
train
Add a browser to the configuration
[ 30522, 2270, 11675, 5587, 12618, 9333, 2121, 1006, 9059, 17695, 28518, 15909, 3111, 6178, 1010, 20014, 12107, 1007, 1063, 5164, 1055, 1027, 6178, 1012, 2131, 12618, 9333, 30524, 1063, 5466, 2047, 19528, 28689, 22828, 10288, 24422, 1006, 6178,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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-sql-client/src/main/java/org/apache/flink/table/client/cli/CliClient.java
CliClient.createDefaultTerminal
private static Terminal createDefaultTerminal() { try { return TerminalBuilder.builder() .name(CliStrings.CLI_NAME) .build(); } catch (IOException e) { throw new SqlClientException("Error opening command line interface.", e); } }
java
private static Terminal createDefaultTerminal() { try { return TerminalBuilder.builder() .name(CliStrings.CLI_NAME) .build(); } catch (IOException e) { throw new SqlClientException("Error opening command line interface.", e); } }
[ "private", "static", "Terminal", "createDefaultTerminal", "(", ")", "{", "try", "{", "return", "TerminalBuilder", ".", "builder", "(", ")", ".", "name", "(", "CliStrings", ".", "CLI_NAME", ")", ".", "build", "(", ")", ";", "}", "catch", "(", "IOException",...
--------------------------------------------------------------------------------------------
[ "--------------------------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/CliClient.java#L554-L562
train
Creates a Terminal instance with default settings.
[ 30522, 2797, 10763, 5536, 2580, 12879, 23505, 3334, 22311, 2140, 1006, 1007, 1063, 3046, 1063, 2709, 5536, 8569, 23891, 2099, 1012, 12508, 1006, 1007, 1012, 2171, 1006, 18856, 2923, 4892, 2015, 1012, 18856, 2072, 1035, 2171, 1007, 1012, 385...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/generated/CompileUtils.java
CompileUtils.compile
public static <T> Class<T> compile(ClassLoader cl, String name, String code) { Tuple2<ClassLoader, String> cacheKey = Tuple2.of(cl, name); Class<?> clazz = COMPILED_CACHE.getIfPresent(cacheKey); if (clazz == null) { clazz = doCompile(cl, name, code); COMPILED_CACHE.put(cacheKey, clazz); } //noinspection unchecked return (Class<T>) clazz; }
java
public static <T> Class<T> compile(ClassLoader cl, String name, String code) { Tuple2<ClassLoader, String> cacheKey = Tuple2.of(cl, name); Class<?> clazz = COMPILED_CACHE.getIfPresent(cacheKey); if (clazz == null) { clazz = doCompile(cl, name, code); COMPILED_CACHE.put(cacheKey, clazz); } //noinspection unchecked return (Class<T>) clazz; }
[ "public", "static", "<", "T", ">", "Class", "<", "T", ">", "compile", "(", "ClassLoader", "cl", ",", "String", "name", ",", "String", "code", ")", "{", "Tuple2", "<", "ClassLoader", ",", "String", ">", "cacheKey", "=", "Tuple2", ".", "of", "(", "cl",...
Compiles a generated code to a Class. @param cl the ClassLoader used to load the class @param name the class name @param code the generated code @param <T> the class type @return the compiled class
[ "Compiles", "a", "generated", "code", "to", "a", "Class", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/generated/CompileUtils.java#L61-L70
train
Compile a class with the given name and code.
[ 30522, 2270, 10763, 1026, 1056, 1028, 2465, 1026, 1056, 1028, 4012, 22090, 1006, 2465, 11066, 2121, 18856, 1010, 5164, 2171, 1010, 5164, 3642, 1007, 1063, 10722, 10814, 2475, 1026, 2465, 11066, 2121, 1010, 5164, 1028, 17053, 14839, 1027, 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-yarn/src/main/java/org/apache/flink/yarn/Utils.java
Utils.createTaskExecutorContext
static ContainerLaunchContext createTaskExecutorContext( org.apache.flink.configuration.Configuration flinkConfig, YarnConfiguration yarnConfig, Map<String, String> env, ContaineredTaskManagerParameters tmParams, org.apache.flink.configuration.Configuration taskManagerConfig, String workingDirectory, Class<?> taskManagerMainClass, Logger log) throws Exception { // get and validate all relevant variables String remoteFlinkJarPath = env.get(YarnConfigKeys.FLINK_JAR_PATH); require(remoteFlinkJarPath != null, "Environment variable %s not set", YarnConfigKeys.FLINK_JAR_PATH); String appId = env.get(YarnConfigKeys.ENV_APP_ID); require(appId != null, "Environment variable %s not set", YarnConfigKeys.ENV_APP_ID); String clientHomeDir = env.get(YarnConfigKeys.ENV_CLIENT_HOME_DIR); require(clientHomeDir != null, "Environment variable %s not set", YarnConfigKeys.ENV_CLIENT_HOME_DIR); String shipListString = env.get(YarnConfigKeys.ENV_CLIENT_SHIP_FILES); require(shipListString != null, "Environment variable %s not set", YarnConfigKeys.ENV_CLIENT_SHIP_FILES); String yarnClientUsername = env.get(YarnConfigKeys.ENV_HADOOP_USER_NAME); require(yarnClientUsername != null, "Environment variable %s not set", YarnConfigKeys.ENV_HADOOP_USER_NAME); final String remoteKeytabPath = env.get(YarnConfigKeys.KEYTAB_PATH); final String remoteKeytabPrincipal = env.get(YarnConfigKeys.KEYTAB_PRINCIPAL); final String remoteYarnConfPath = env.get(YarnConfigKeys.ENV_YARN_SITE_XML_PATH); final String remoteKrb5Path = env.get(YarnConfigKeys.ENV_KRB5_PATH); if (log.isDebugEnabled()) { log.debug("TM:remote keytab path obtained {}", remoteKeytabPath); log.debug("TM:remote keytab principal obtained {}", remoteKeytabPrincipal); log.debug("TM:remote yarn conf path obtained {}", remoteYarnConfPath); log.debug("TM:remote krb5 path obtained {}", remoteKrb5Path); } String classPathString = env.get(ENV_FLINK_CLASSPATH); require(classPathString != null, "Environment variable %s not set", YarnConfigKeys.ENV_FLINK_CLASSPATH); //register keytab LocalResource keytabResource = null; if (remoteKeytabPath != null) { log.info("Adding keytab {} to the AM container local resource bucket", remoteKeytabPath); Path keytabPath = new Path(remoteKeytabPath); FileSystem fs = keytabPath.getFileSystem(yarnConfig); keytabResource = registerLocalResource(fs, keytabPath); } //To support Yarn Secure Integration Test Scenario LocalResource yarnConfResource = null; LocalResource krb5ConfResource = null; boolean hasKrb5 = false; if (remoteYarnConfPath != null && remoteKrb5Path != null) { log.info("TM:Adding remoteYarnConfPath {} to the container local resource bucket", remoteYarnConfPath); Path yarnConfPath = new Path(remoteYarnConfPath); FileSystem fs = yarnConfPath.getFileSystem(yarnConfig); yarnConfResource = registerLocalResource(fs, yarnConfPath); log.info("TM:Adding remoteKrb5Path {} to the container local resource bucket", remoteKrb5Path); Path krb5ConfPath = new Path(remoteKrb5Path); fs = krb5ConfPath.getFileSystem(yarnConfig); krb5ConfResource = registerLocalResource(fs, krb5ConfPath); hasKrb5 = true; } // register Flink Jar with remote HDFS final LocalResource flinkJar; { Path remoteJarPath = new Path(remoteFlinkJarPath); FileSystem fs = remoteJarPath.getFileSystem(yarnConfig); flinkJar = registerLocalResource(fs, remoteJarPath); } // register conf with local fs final LocalResource flinkConf; { // write the TaskManager configuration to a local file final File taskManagerConfigFile = new File(workingDirectory, UUID.randomUUID() + "-taskmanager-conf.yaml"); log.debug("Writing TaskManager configuration to {}", taskManagerConfigFile.getAbsolutePath()); BootstrapTools.writeConfiguration(taskManagerConfig, taskManagerConfigFile); try { Path homeDirPath = new Path(clientHomeDir); FileSystem fs = homeDirPath.getFileSystem(yarnConfig); flinkConf = setupLocalResource( fs, appId, new Path(taskManagerConfigFile.toURI()), homeDirPath, "").f1; log.debug("Prepared local resource for modified yaml: {}", flinkConf); } finally { try { FileUtils.deleteFileOrDirectory(taskManagerConfigFile); } catch (IOException e) { log.info("Could not delete temporary configuration file " + taskManagerConfigFile.getAbsolutePath() + '.', e); } } } Map<String, LocalResource> taskManagerLocalResources = new HashMap<>(); taskManagerLocalResources.put("flink.jar", flinkJar); taskManagerLocalResources.put("flink-conf.yaml", flinkConf); //To support Yarn Secure Integration Test Scenario if (yarnConfResource != null && krb5ConfResource != null) { taskManagerLocalResources.put(YARN_SITE_FILE_NAME, yarnConfResource); taskManagerLocalResources.put(KRB5_FILE_NAME, krb5ConfResource); } if (keytabResource != null) { taskManagerLocalResources.put(KEYTAB_FILE_NAME, keytabResource); } // prepare additional files to be shipped for (String pathStr : shipListString.split(",")) { if (!pathStr.isEmpty()) { String[] keyAndPath = pathStr.split("="); require(keyAndPath.length == 2, "Invalid entry in ship file list: %s", pathStr); Path path = new Path(keyAndPath[1]); LocalResource resource = registerLocalResource(path.getFileSystem(yarnConfig), path); taskManagerLocalResources.put(keyAndPath[0], resource); } } // now that all resources are prepared, we can create the launch context log.info("Creating container launch context for TaskManagers"); boolean hasLogback = new File(workingDirectory, "logback.xml").exists(); boolean hasLog4j = new File(workingDirectory, "log4j.properties").exists(); String launchCommand = BootstrapTools.getTaskManagerShellCommand( flinkConfig, tmParams, ".", ApplicationConstants.LOG_DIR_EXPANSION_VAR, hasLogback, hasLog4j, hasKrb5, taskManagerMainClass); if (log.isDebugEnabled()) { log.debug("Starting TaskManagers with command: " + launchCommand); } else { log.info("Starting TaskManagers"); } ContainerLaunchContext ctx = Records.newRecord(ContainerLaunchContext.class); ctx.setCommands(Collections.singletonList(launchCommand)); ctx.setLocalResources(taskManagerLocalResources); Map<String, String> containerEnv = new HashMap<>(); containerEnv.putAll(tmParams.taskManagerEnv()); // add YARN classpath, etc to the container environment containerEnv.put(ENV_FLINK_CLASSPATH, classPathString); setupYarnClassPath(yarnConfig, containerEnv); containerEnv.put(YarnConfigKeys.ENV_HADOOP_USER_NAME, UserGroupInformation.getCurrentUser().getUserName()); if (remoteKeytabPath != null && remoteKeytabPrincipal != null) { containerEnv.put(YarnConfigKeys.KEYTAB_PATH, remoteKeytabPath); containerEnv.put(YarnConfigKeys.KEYTAB_PRINCIPAL, remoteKeytabPrincipal); } ctx.setEnvironment(containerEnv); // For TaskManager YARN container context, read the tokens from the jobmanager yarn container local file. // NOTE: must read the tokens from the local file, not from the UGI context, because if UGI is login // using Kerberos keytabs, there is no HDFS delegation token in the UGI context. final String fileLocation = System.getenv(UserGroupInformation.HADOOP_TOKEN_FILE_LOCATION); if (fileLocation != null) { log.debug("Adding security tokens to TaskExecutor's container launch context."); try (DataOutputBuffer dob = new DataOutputBuffer()) { Method readTokenStorageFileMethod = Credentials.class.getMethod( "readTokenStorageFile", File.class, org.apache.hadoop.conf.Configuration.class); Credentials cred = (Credentials) readTokenStorageFileMethod.invoke( null, new File(fileLocation), HadoopUtils.getHadoopConfiguration(flinkConfig)); cred.writeTokenStorageToStream(dob); ByteBuffer securityTokens = ByteBuffer.wrap(dob.getData(), 0, dob.getLength()); ctx.setTokens(securityTokens); } catch (Throwable t) { log.error("Failed to add Hadoop's security tokens.", t); } } else { log.info("Could not set security tokens because Hadoop's token file location is unknown."); } return ctx; }
java
static ContainerLaunchContext createTaskExecutorContext( org.apache.flink.configuration.Configuration flinkConfig, YarnConfiguration yarnConfig, Map<String, String> env, ContaineredTaskManagerParameters tmParams, org.apache.flink.configuration.Configuration taskManagerConfig, String workingDirectory, Class<?> taskManagerMainClass, Logger log) throws Exception { // get and validate all relevant variables String remoteFlinkJarPath = env.get(YarnConfigKeys.FLINK_JAR_PATH); require(remoteFlinkJarPath != null, "Environment variable %s not set", YarnConfigKeys.FLINK_JAR_PATH); String appId = env.get(YarnConfigKeys.ENV_APP_ID); require(appId != null, "Environment variable %s not set", YarnConfigKeys.ENV_APP_ID); String clientHomeDir = env.get(YarnConfigKeys.ENV_CLIENT_HOME_DIR); require(clientHomeDir != null, "Environment variable %s not set", YarnConfigKeys.ENV_CLIENT_HOME_DIR); String shipListString = env.get(YarnConfigKeys.ENV_CLIENT_SHIP_FILES); require(shipListString != null, "Environment variable %s not set", YarnConfigKeys.ENV_CLIENT_SHIP_FILES); String yarnClientUsername = env.get(YarnConfigKeys.ENV_HADOOP_USER_NAME); require(yarnClientUsername != null, "Environment variable %s not set", YarnConfigKeys.ENV_HADOOP_USER_NAME); final String remoteKeytabPath = env.get(YarnConfigKeys.KEYTAB_PATH); final String remoteKeytabPrincipal = env.get(YarnConfigKeys.KEYTAB_PRINCIPAL); final String remoteYarnConfPath = env.get(YarnConfigKeys.ENV_YARN_SITE_XML_PATH); final String remoteKrb5Path = env.get(YarnConfigKeys.ENV_KRB5_PATH); if (log.isDebugEnabled()) { log.debug("TM:remote keytab path obtained {}", remoteKeytabPath); log.debug("TM:remote keytab principal obtained {}", remoteKeytabPrincipal); log.debug("TM:remote yarn conf path obtained {}", remoteYarnConfPath); log.debug("TM:remote krb5 path obtained {}", remoteKrb5Path); } String classPathString = env.get(ENV_FLINK_CLASSPATH); require(classPathString != null, "Environment variable %s not set", YarnConfigKeys.ENV_FLINK_CLASSPATH); //register keytab LocalResource keytabResource = null; if (remoteKeytabPath != null) { log.info("Adding keytab {} to the AM container local resource bucket", remoteKeytabPath); Path keytabPath = new Path(remoteKeytabPath); FileSystem fs = keytabPath.getFileSystem(yarnConfig); keytabResource = registerLocalResource(fs, keytabPath); } //To support Yarn Secure Integration Test Scenario LocalResource yarnConfResource = null; LocalResource krb5ConfResource = null; boolean hasKrb5 = false; if (remoteYarnConfPath != null && remoteKrb5Path != null) { log.info("TM:Adding remoteYarnConfPath {} to the container local resource bucket", remoteYarnConfPath); Path yarnConfPath = new Path(remoteYarnConfPath); FileSystem fs = yarnConfPath.getFileSystem(yarnConfig); yarnConfResource = registerLocalResource(fs, yarnConfPath); log.info("TM:Adding remoteKrb5Path {} to the container local resource bucket", remoteKrb5Path); Path krb5ConfPath = new Path(remoteKrb5Path); fs = krb5ConfPath.getFileSystem(yarnConfig); krb5ConfResource = registerLocalResource(fs, krb5ConfPath); hasKrb5 = true; } // register Flink Jar with remote HDFS final LocalResource flinkJar; { Path remoteJarPath = new Path(remoteFlinkJarPath); FileSystem fs = remoteJarPath.getFileSystem(yarnConfig); flinkJar = registerLocalResource(fs, remoteJarPath); } // register conf with local fs final LocalResource flinkConf; { // write the TaskManager configuration to a local file final File taskManagerConfigFile = new File(workingDirectory, UUID.randomUUID() + "-taskmanager-conf.yaml"); log.debug("Writing TaskManager configuration to {}", taskManagerConfigFile.getAbsolutePath()); BootstrapTools.writeConfiguration(taskManagerConfig, taskManagerConfigFile); try { Path homeDirPath = new Path(clientHomeDir); FileSystem fs = homeDirPath.getFileSystem(yarnConfig); flinkConf = setupLocalResource( fs, appId, new Path(taskManagerConfigFile.toURI()), homeDirPath, "").f1; log.debug("Prepared local resource for modified yaml: {}", flinkConf); } finally { try { FileUtils.deleteFileOrDirectory(taskManagerConfigFile); } catch (IOException e) { log.info("Could not delete temporary configuration file " + taskManagerConfigFile.getAbsolutePath() + '.', e); } } } Map<String, LocalResource> taskManagerLocalResources = new HashMap<>(); taskManagerLocalResources.put("flink.jar", flinkJar); taskManagerLocalResources.put("flink-conf.yaml", flinkConf); //To support Yarn Secure Integration Test Scenario if (yarnConfResource != null && krb5ConfResource != null) { taskManagerLocalResources.put(YARN_SITE_FILE_NAME, yarnConfResource); taskManagerLocalResources.put(KRB5_FILE_NAME, krb5ConfResource); } if (keytabResource != null) { taskManagerLocalResources.put(KEYTAB_FILE_NAME, keytabResource); } // prepare additional files to be shipped for (String pathStr : shipListString.split(",")) { if (!pathStr.isEmpty()) { String[] keyAndPath = pathStr.split("="); require(keyAndPath.length == 2, "Invalid entry in ship file list: %s", pathStr); Path path = new Path(keyAndPath[1]); LocalResource resource = registerLocalResource(path.getFileSystem(yarnConfig), path); taskManagerLocalResources.put(keyAndPath[0], resource); } } // now that all resources are prepared, we can create the launch context log.info("Creating container launch context for TaskManagers"); boolean hasLogback = new File(workingDirectory, "logback.xml").exists(); boolean hasLog4j = new File(workingDirectory, "log4j.properties").exists(); String launchCommand = BootstrapTools.getTaskManagerShellCommand( flinkConfig, tmParams, ".", ApplicationConstants.LOG_DIR_EXPANSION_VAR, hasLogback, hasLog4j, hasKrb5, taskManagerMainClass); if (log.isDebugEnabled()) { log.debug("Starting TaskManagers with command: " + launchCommand); } else { log.info("Starting TaskManagers"); } ContainerLaunchContext ctx = Records.newRecord(ContainerLaunchContext.class); ctx.setCommands(Collections.singletonList(launchCommand)); ctx.setLocalResources(taskManagerLocalResources); Map<String, String> containerEnv = new HashMap<>(); containerEnv.putAll(tmParams.taskManagerEnv()); // add YARN classpath, etc to the container environment containerEnv.put(ENV_FLINK_CLASSPATH, classPathString); setupYarnClassPath(yarnConfig, containerEnv); containerEnv.put(YarnConfigKeys.ENV_HADOOP_USER_NAME, UserGroupInformation.getCurrentUser().getUserName()); if (remoteKeytabPath != null && remoteKeytabPrincipal != null) { containerEnv.put(YarnConfigKeys.KEYTAB_PATH, remoteKeytabPath); containerEnv.put(YarnConfigKeys.KEYTAB_PRINCIPAL, remoteKeytabPrincipal); } ctx.setEnvironment(containerEnv); // For TaskManager YARN container context, read the tokens from the jobmanager yarn container local file. // NOTE: must read the tokens from the local file, not from the UGI context, because if UGI is login // using Kerberos keytabs, there is no HDFS delegation token in the UGI context. final String fileLocation = System.getenv(UserGroupInformation.HADOOP_TOKEN_FILE_LOCATION); if (fileLocation != null) { log.debug("Adding security tokens to TaskExecutor's container launch context."); try (DataOutputBuffer dob = new DataOutputBuffer()) { Method readTokenStorageFileMethod = Credentials.class.getMethod( "readTokenStorageFile", File.class, org.apache.hadoop.conf.Configuration.class); Credentials cred = (Credentials) readTokenStorageFileMethod.invoke( null, new File(fileLocation), HadoopUtils.getHadoopConfiguration(flinkConfig)); cred.writeTokenStorageToStream(dob); ByteBuffer securityTokens = ByteBuffer.wrap(dob.getData(), 0, dob.getLength()); ctx.setTokens(securityTokens); } catch (Throwable t) { log.error("Failed to add Hadoop's security tokens.", t); } } else { log.info("Could not set security tokens because Hadoop's token file location is unknown."); } return ctx; }
[ "static", "ContainerLaunchContext", "createTaskExecutorContext", "(", "org", ".", "apache", ".", "flink", ".", "configuration", ".", "Configuration", "flinkConfig", ",", "YarnConfiguration", "yarnConfig", ",", "Map", "<", "String", ",", "String", ">", "env", ",", ...
Creates the launch context, which describes how to bring up a TaskExecutor / TaskManager process in an allocated YARN container. <p>This code is extremely YARN specific and registers all the resources that the TaskExecutor needs (such as JAR file, config file, ...) and all environment variables in a YARN container launch context. The launch context then ensures that those resources will be copied into the containers transient working directory. @param flinkConfig The Flink configuration object. @param yarnConfig The YARN configuration object. @param env The environment variables. @param tmParams The TaskExecutor container memory parameters. @param taskManagerConfig The configuration for the TaskExecutors. @param workingDirectory The current application master container's working directory. @param taskManagerMainClass The class with the main method. @param log The logger. @return The launch context for the TaskManager processes. @throws Exception Thrown if the launch context could not be created, for example if the resources could not be copied.
[ "Creates", "the", "launch", "context", "which", "describes", "how", "to", "bring", "up", "a", "TaskExecutor", "/", "TaskManager", "process", "in", "an", "allocated", "YARN", "container", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-yarn/src/main/java/org/apache/flink/yarn/Utils.java#L380-L579
train
Create a new container executor context.
[ 30522, 10763, 11661, 17298, 12680, 8663, 18209, 3443, 10230, 3489, 2595, 8586, 16161, 29566, 10111, 18413, 1006, 8917, 1012, 15895, 1012, 13109, 19839, 1012, 9563, 1012, 9563, 13109, 19839, 8663, 8873, 2290, 1010, 27158, 8663, 8873, 27390, 33...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
java/client/src/org/openqa/selenium/net/NetworkUtils.java
NetworkUtils.getNonLoopbackAddressOfThisMachine
public String getNonLoopbackAddressOfThisMachine() { InetAddress ip4NonLoopbackAddressOfThisMachine = getIp4NonLoopbackAddressOfThisMachine(); if (! Objects.equals(cachedIp4NonLoopbackAddressOfThisMachine, ip4NonLoopbackAddressOfThisMachine)) { cachedIp4NonLoopbackAddressOfThisMachine = ip4NonLoopbackAddressOfThisMachine; cachedIp4NonLoopbackAddressHostName = ip4NonLoopbackAddressOfThisMachine.getHostName(); } return cachedIp4NonLoopbackAddressHostName; }
java
public String getNonLoopbackAddressOfThisMachine() { InetAddress ip4NonLoopbackAddressOfThisMachine = getIp4NonLoopbackAddressOfThisMachine(); if (! Objects.equals(cachedIp4NonLoopbackAddressOfThisMachine, ip4NonLoopbackAddressOfThisMachine)) { cachedIp4NonLoopbackAddressOfThisMachine = ip4NonLoopbackAddressOfThisMachine; cachedIp4NonLoopbackAddressHostName = ip4NonLoopbackAddressOfThisMachine.getHostName(); } return cachedIp4NonLoopbackAddressHostName; }
[ "public", "String", "getNonLoopbackAddressOfThisMachine", "(", ")", "{", "InetAddress", "ip4NonLoopbackAddressOfThisMachine", "=", "getIp4NonLoopbackAddressOfThisMachine", "(", ")", ";", "if", "(", "!", "Objects", ".", "equals", "(", "cachedIp4NonLoopbackAddressOfThisMachine"...
Used by the mobile emulators that refuse to access localhost or 127.0.0.1 The IP4/IP6 requirements of this method are as-of-yet unspecified, but we return the string that is associated with the IP4 interface @return A String representing the host name or non-loopback IP4 address of this machine.
[ "Used", "by", "the", "mobile", "emulators", "that", "refuse", "to", "access", "localhost", "or", "127", ".", "0", ".", "0", ".", "1", "The", "IP4", "/", "IP6", "requirements", "of", "this", "method", "are", "as", "-", "of", "-", "yet", "unspecified", ...
7af172729f17b20269c8ca4ea6f788db48616535
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/net/NetworkUtils.java#L84-L91
train
Get the Non - loopback address of this machine.
[ 30522, 2270, 5164, 2131, 8540, 4135, 7361, 5963, 4215, 16200, 24137, 6199, 23108, 21046, 2638, 1006, 1007, 1063, 1999, 12928, 14141, 8303, 12997, 2549, 8540, 4135, 7361, 5963, 4215, 16200, 24137, 6199, 23108, 21046, 2638, 1027, 2131, 11514, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ftp/Ftp.java
Ftp.lsFiles
public FTPFile[] lsFiles(String path){ String pwd = null; if(StrUtil.isNotBlank(path)) { pwd = pwd(); cd(path); } FTPFile[] ftpFiles; try { ftpFiles = this.client.listFiles(); } catch (IOException e) { throw new FtpException(e); } if(StrUtil.isNotBlank(pwd)) { // 回到原目录 cd(pwd); } return ftpFiles; }
java
public FTPFile[] lsFiles(String path){ String pwd = null; if(StrUtil.isNotBlank(path)) { pwd = pwd(); cd(path); } FTPFile[] ftpFiles; try { ftpFiles = this.client.listFiles(); } catch (IOException e) { throw new FtpException(e); } if(StrUtil.isNotBlank(pwd)) { // 回到原目录 cd(pwd); } return ftpFiles; }
[ "public", "FTPFile", "[", "]", "lsFiles", "(", "String", "path", ")", "{", "String", "pwd", "=", "null", ";", "if", "(", "StrUtil", ".", "isNotBlank", "(", "path", ")", ")", "{", "pwd", "=", "pwd", "(", ")", ";", "cd", "(", "path", ")", ";", "}...
遍历某个目录下所有文件和目录,不会递归遍历 @param path 目录 @return 文件或目录列表
[ "遍历某个目录下所有文件和目录,不会递归遍历" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java#L250-L270
train
Gets the contents of a directory and its contents.
[ 30522, 2270, 3027, 14376, 9463, 1031, 1033, 1048, 22747, 9463, 2015, 1006, 5164, 4130, 1007, 1063, 5164, 1052, 21724, 1027, 19701, 1025, 2065, 1006, 2358, 22134, 4014, 1012, 3475, 4140, 28522, 8950, 1006, 4130, 1007, 1007, 1063, 1052, 21724...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/hooks/MasterHooks.java
MasterHooks.restoreMasterHooks
public static void restoreMasterHooks( final Map<String, MasterTriggerRestoreHook<?>> masterHooks, final Collection<MasterState> states, final long checkpointId, final boolean allowUnmatchedState, final Logger log) throws FlinkException { // early out if (states == null || states.isEmpty() || masterHooks == null || masterHooks.isEmpty()) { log.info("No master state to restore"); return; } log.info("Calling master restore hooks"); // collect the hooks final LinkedHashMap<String, MasterTriggerRestoreHook<?>> allHooks = new LinkedHashMap<>(masterHooks); // first, deserialize all hook state final ArrayList<Tuple2<MasterTriggerRestoreHook<?>, Object>> hooksAndStates = new ArrayList<>(); for (MasterState state : states) { if (state != null) { final String name = state.name(); final MasterTriggerRestoreHook<?> hook = allHooks.remove(name); if (hook != null) { log.debug("Found state to restore for hook '{}'", name); Object deserializedState = deserializeState(state, hook); hooksAndStates.add(new Tuple2<>(hook, deserializedState)); } else if (!allowUnmatchedState) { throw new IllegalStateException("Found state '" + state.name() + "' which is not resumed by any hook."); } else { log.info("Dropping unmatched state from '{}'", name); } } } // now that all is deserialized, call the hooks for (Tuple2<MasterTriggerRestoreHook<?>, Object> hookAndState : hooksAndStates) { restoreHook(hookAndState.f1, hookAndState.f0, checkpointId); } // trigger the remaining hooks without checkpointed state for (MasterTriggerRestoreHook<?> hook : allHooks.values()) { restoreHook(null, hook, checkpointId); } }
java
public static void restoreMasterHooks( final Map<String, MasterTriggerRestoreHook<?>> masterHooks, final Collection<MasterState> states, final long checkpointId, final boolean allowUnmatchedState, final Logger log) throws FlinkException { // early out if (states == null || states.isEmpty() || masterHooks == null || masterHooks.isEmpty()) { log.info("No master state to restore"); return; } log.info("Calling master restore hooks"); // collect the hooks final LinkedHashMap<String, MasterTriggerRestoreHook<?>> allHooks = new LinkedHashMap<>(masterHooks); // first, deserialize all hook state final ArrayList<Tuple2<MasterTriggerRestoreHook<?>, Object>> hooksAndStates = new ArrayList<>(); for (MasterState state : states) { if (state != null) { final String name = state.name(); final MasterTriggerRestoreHook<?> hook = allHooks.remove(name); if (hook != null) { log.debug("Found state to restore for hook '{}'", name); Object deserializedState = deserializeState(state, hook); hooksAndStates.add(new Tuple2<>(hook, deserializedState)); } else if (!allowUnmatchedState) { throw new IllegalStateException("Found state '" + state.name() + "' which is not resumed by any hook."); } else { log.info("Dropping unmatched state from '{}'", name); } } } // now that all is deserialized, call the hooks for (Tuple2<MasterTriggerRestoreHook<?>, Object> hookAndState : hooksAndStates) { restoreHook(hookAndState.f1, hookAndState.f0, checkpointId); } // trigger the remaining hooks without checkpointed state for (MasterTriggerRestoreHook<?> hook : allHooks.values()) { restoreHook(null, hook, checkpointId); } }
[ "public", "static", "void", "restoreMasterHooks", "(", "final", "Map", "<", "String", ",", "MasterTriggerRestoreHook", "<", "?", ">", ">", "masterHooks", ",", "final", "Collection", "<", "MasterState", ">", "states", ",", "final", "long", "checkpointId", ",", ...
Calls the restore method given checkpoint master hooks and passes the given master state to them where state with a matching name is found. <p>If state is found and no hook with the same name is found, the method throws an exception, unless the {@code allowUnmatchedState} flag is set. @param masterHooks The hooks to call restore on @param states The state to pass to the hooks @param checkpointId The checkpoint ID of the restored checkpoint @param allowUnmatchedState If true, the method fails if not all states are picked up by a hook. @param log The logger for log messages @throws FlinkException Thrown, if the hooks throw an exception, or the state+ deserialization fails.
[ "Calls", "the", "restore", "method", "given", "checkpoint", "master", "hooks", "and", "passes", "the", "given", "master", "state", "to", "them", "where", "state", "with", "a", "matching", "name", "is", "found", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/hooks/MasterHooks.java#L225-L276
train
Restore the master hooks.
[ 30522, 2270, 10763, 11675, 9239, 8706, 6806, 6559, 2015, 1006, 2345, 4949, 1026, 5164, 1010, 3040, 18886, 13327, 28533, 5686, 6806, 6559, 1026, 1029, 1028, 1028, 3040, 6806, 6559, 2015, 1010, 2345, 3074, 1026, 5972, 12259, 1028, 2163, 1010,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java
Graph.groupReduceOnEdges
public <T> DataSet<T> groupReduceOnEdges(EdgesFunctionWithVertexValue<K, VV, EV, T> edgesFunction, EdgeDirection direction) throws IllegalArgumentException { switch (direction) { case IN: return vertices.coGroup(edges).where(0).equalTo(1) .with(new ApplyCoGroupFunction<>(edgesFunction)).name("GroupReduce on in-edges"); case OUT: return vertices.coGroup(edges).where(0).equalTo(0) .with(new ApplyCoGroupFunction<>(edgesFunction)).name("GroupReduce on out-edges"); case ALL: return vertices.coGroup(edges.flatMap(new EmitOneEdgePerNode<>()) .name("Emit edge")) .where(0).equalTo(0).with(new ApplyCoGroupFunctionOnAllEdges<>(edgesFunction)) .name("GroupReduce on in- and out-edges"); default: throw new IllegalArgumentException("Illegal edge direction"); } }
java
public <T> DataSet<T> groupReduceOnEdges(EdgesFunctionWithVertexValue<K, VV, EV, T> edgesFunction, EdgeDirection direction) throws IllegalArgumentException { switch (direction) { case IN: return vertices.coGroup(edges).where(0).equalTo(1) .with(new ApplyCoGroupFunction<>(edgesFunction)).name("GroupReduce on in-edges"); case OUT: return vertices.coGroup(edges).where(0).equalTo(0) .with(new ApplyCoGroupFunction<>(edgesFunction)).name("GroupReduce on out-edges"); case ALL: return vertices.coGroup(edges.flatMap(new EmitOneEdgePerNode<>()) .name("Emit edge")) .where(0).equalTo(0).with(new ApplyCoGroupFunctionOnAllEdges<>(edgesFunction)) .name("GroupReduce on in- and out-edges"); default: throw new IllegalArgumentException("Illegal edge direction"); } }
[ "public", "<", "T", ">", "DataSet", "<", "T", ">", "groupReduceOnEdges", "(", "EdgesFunctionWithVertexValue", "<", "K", ",", "VV", ",", "EV", ",", "T", ">", "edgesFunction", ",", "EdgeDirection", "direction", ")", "throws", "IllegalArgumentException", "{", "sw...
Groups by vertex and computes a GroupReduce transformation over the edge values of each vertex. The edgesFunction applied on the edges has access to both the id and the value of the grouping vertex. <p>For each vertex, the edgesFunction can iterate over all edges of this vertex with the specified direction, and emit any number of output elements, including none. @param edgesFunction the group reduce function to apply to the neighboring edges of each vertex. @param direction the edge direction (in-, out-, all-). @param <T> the output type @return a DataSet containing elements of type T @throws IllegalArgumentException
[ "Groups", "by", "vertex", "and", "computes", "a", "GroupReduce", "transformation", "over", "the", "edge", "values", "of", "each", "vertex", ".", "The", "edgesFunction", "applied", "on", "the", "edges", "has", "access", "to", "both", "the", "id", "and", "the"...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L1006-L1024
train
Group reduce on edges.
[ 30522, 2270, 1026, 1056, 1028, 2951, 13462, 1026, 1056, 1028, 2177, 5596, 18796, 17799, 8449, 1006, 7926, 11263, 27989, 24415, 16874, 10288, 10175, 5657, 1026, 1047, 1010, 1058, 2615, 1010, 23408, 1010, 1056, 1028, 7926, 11263, 27989, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/WeightedFairQueueByteDistributor.java
WeightedFairQueueByteDistributor.isChild
boolean isChild(int childId, int parentId, short weight) { State parent = state(parentId); State child; return parent.children.containsKey(childId) && (child = state(childId)).parent == parent && child.weight == weight; }
java
boolean isChild(int childId, int parentId, short weight) { State parent = state(parentId); State child; return parent.children.containsKey(childId) && (child = state(childId)).parent == parent && child.weight == weight; }
[ "boolean", "isChild", "(", "int", "childId", ",", "int", "parentId", ",", "short", "weight", ")", "{", "State", "parent", "=", "state", "(", "parentId", ")", ";", "State", "child", ";", "return", "parent", ".", "children", ".", "containsKey", "(", "child...
For testing only!
[ "For", "testing", "only!" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/WeightedFairQueueByteDistributor.java#L357-L362
train
Is child.
[ 30522, 22017, 20898, 2003, 19339, 1006, 20014, 2775, 3593, 1010, 20014, 6687, 3593, 1010, 2460, 3635, 1007, 1063, 2110, 6687, 1027, 2110, 1006, 6687, 3593, 1007, 1025, 2110, 2775, 1025, 2709, 6687, 1012, 2336, 1012, 3397, 14839, 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...
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java
SqlDateTimeUtils.dateFormat
public static String dateFormat(String dateStr, String fromFormat, String toFormat, TimeZone tz) { SimpleDateFormat fromFormatter = FORMATTER_CACHE.get(fromFormat); fromFormatter.setTimeZone(tz); SimpleDateFormat toFormatter = FORMATTER_CACHE.get(toFormat); toFormatter.setTimeZone(tz); try { return toFormatter.format(fromFormatter.parse(dateStr)); } catch (ParseException e) { LOG.error("Exception when formatting: '" + dateStr + "' from: '" + fromFormat + "' to: '" + toFormat + "'", e); return null; } }
java
public static String dateFormat(String dateStr, String fromFormat, String toFormat, TimeZone tz) { SimpleDateFormat fromFormatter = FORMATTER_CACHE.get(fromFormat); fromFormatter.setTimeZone(tz); SimpleDateFormat toFormatter = FORMATTER_CACHE.get(toFormat); toFormatter.setTimeZone(tz); try { return toFormatter.format(fromFormatter.parse(dateStr)); } catch (ParseException e) { LOG.error("Exception when formatting: '" + dateStr + "' from: '" + fromFormat + "' to: '" + toFormat + "'", e); return null; } }
[ "public", "static", "String", "dateFormat", "(", "String", "dateStr", ",", "String", "fromFormat", ",", "String", "toFormat", ",", "TimeZone", "tz", ")", "{", "SimpleDateFormat", "fromFormatter", "=", "FORMATTER_CACHE", ".", "get", "(", "fromFormat", ")", ";", ...
Format a string datetime as specific. @param dateStr the string datetime. @param fromFormat the original date format. @param toFormat the target date format. @param tz the time zone.
[ "Format", "a", "string", "datetime", "as", "specific", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java#L340-L352
train
Format a date string using the given formats.
[ 30522, 2270, 10763, 5164, 3058, 14192, 4017, 1006, 5164, 5246, 16344, 1010, 5164, 2013, 14192, 4017, 1010, 5164, 2000, 14192, 4017, 1010, 2051, 15975, 1056, 2480, 1007, 1063, 3722, 13701, 14192, 4017, 2013, 14192, 20097, 1027, 4289, 3334, 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...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/seg/WordBasedSegment.java
WordBasedSegment.mergeContinueNumIntoOne
private static void mergeContinueNumIntoOne(List<Vertex> linkedArray) { if (linkedArray.size() < 2) return; ListIterator<Vertex> listIterator = linkedArray.listIterator(); Vertex next = listIterator.next(); Vertex current = next; while (listIterator.hasNext()) { next = listIterator.next(); // System.out.println("current:" + current + " next:" + next); if ((TextUtility.isAllNum(current.realWord) || TextUtility.isAllChineseNum(current.realWord)) && (TextUtility.isAllNum(next.realWord) || TextUtility.isAllChineseNum(next.realWord))) { /////////// 这部分从逻辑上等同于current.realWord = current.realWord + next.realWord; // 但是current指针被几个路径共享,需要备份,不然修改了一处就修改了全局 current = Vertex.newNumberInstance(current.realWord + next.realWord); listIterator.previous(); listIterator.previous(); listIterator.set(current); listIterator.next(); listIterator.next(); /////////// end 这部分 // System.out.println("before:" + linkedArray); listIterator.remove(); // System.out.println("after:" + linkedArray); } else { current = next; } } // logger.trace("数字识别后:" + Graph.parseResult(linkedArray)); }
java
private static void mergeContinueNumIntoOne(List<Vertex> linkedArray) { if (linkedArray.size() < 2) return; ListIterator<Vertex> listIterator = linkedArray.listIterator(); Vertex next = listIterator.next(); Vertex current = next; while (listIterator.hasNext()) { next = listIterator.next(); // System.out.println("current:" + current + " next:" + next); if ((TextUtility.isAllNum(current.realWord) || TextUtility.isAllChineseNum(current.realWord)) && (TextUtility.isAllNum(next.realWord) || TextUtility.isAllChineseNum(next.realWord))) { /////////// 这部分从逻辑上等同于current.realWord = current.realWord + next.realWord; // 但是current指针被几个路径共享,需要备份,不然修改了一处就修改了全局 current = Vertex.newNumberInstance(current.realWord + next.realWord); listIterator.previous(); listIterator.previous(); listIterator.set(current); listIterator.next(); listIterator.next(); /////////// end 这部分 // System.out.println("before:" + linkedArray); listIterator.remove(); // System.out.println("after:" + linkedArray); } else { current = next; } } // logger.trace("数字识别后:" + Graph.parseResult(linkedArray)); }
[ "private", "static", "void", "mergeContinueNumIntoOne", "(", "List", "<", "Vertex", ">", "linkedArray", ")", "{", "if", "(", "linkedArray", ".", "size", "(", ")", "<", "2", ")", "return", ";", "ListIterator", "<", "Vertex", ">", "listIterator", "=", "linke...
将连续的数字节点合并为一个 @param linkedArray
[ "将连续的数字节点合并为一个" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/WordBasedSegment.java#L345-L379
train
Merge continue num into one.
[ 30522, 2797, 10763, 11675, 13590, 8663, 7629, 24997, 12717, 13663, 5643, 1006, 2862, 1026, 19449, 1028, 5799, 2906, 9447, 1007, 1063, 2065, 1006, 5799, 2906, 9447, 1012, 2946, 1006, 1007, 1026, 1016, 1007, 2709, 1025, 2862, 21646, 8844, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java
ExcelWriter.getInitedAliasComparator
private Comparator<String> getInitedAliasComparator() { if (MapUtil.isEmpty(this.headerAlias)) { return null; } Comparator<String> aliasComparator = this.aliasComparator; if (null == aliasComparator) { Set<String> keySet = this.headerAlias.keySet(); aliasComparator = new IndexedComparator<>(keySet.toArray(new String[keySet.size()])); this.aliasComparator = aliasComparator; } return aliasComparator; }
java
private Comparator<String> getInitedAliasComparator() { if (MapUtil.isEmpty(this.headerAlias)) { return null; } Comparator<String> aliasComparator = this.aliasComparator; if (null == aliasComparator) { Set<String> keySet = this.headerAlias.keySet(); aliasComparator = new IndexedComparator<>(keySet.toArray(new String[keySet.size()])); this.aliasComparator = aliasComparator; } return aliasComparator; }
[ "private", "Comparator", "<", "String", ">", "getInitedAliasComparator", "(", ")", "{", "if", "(", "MapUtil", ".", "isEmpty", "(", "this", ".", "headerAlias", ")", ")", "{", "return", "null", ";", "}", "Comparator", "<", "String", ">", "aliasComparator", "...
获取单例的别名比较器,比较器的顺序为别名加入的顺序 @return Comparator @since 4.1.5
[ "获取单例的别名比较器,比较器的顺序为别名加入的顺序" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java#L901-L912
train
Gets the initialized aliasComparator.
[ 30522, 2797, 4012, 28689, 4263, 1026, 5164, 1028, 2131, 5498, 3064, 22786, 9363, 8737, 25879, 2953, 1006, 1007, 1063, 2065, 1006, 4949, 21823, 2140, 1012, 2003, 6633, 13876, 2100, 1006, 2023, 1012, 20346, 22786, 2015, 1007, 1007, 1063, 2709...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaInvocationHandler.java
AkkaInvocationHandler.extractRpcTimeout
private static Time extractRpcTimeout(Annotation[][] parameterAnnotations, Object[] args, Time defaultTimeout) { if (args != null) { Preconditions.checkArgument(parameterAnnotations.length == args.length); for (int i = 0; i < parameterAnnotations.length; i++) { if (isRpcTimeout(parameterAnnotations[i])) { if (args[i] instanceof Time) { return (Time) args[i]; } else { throw new RuntimeException("The rpc timeout parameter must be of type " + Time.class.getName() + ". The type " + args[i].getClass().getName() + " is not supported."); } } } } return defaultTimeout; }
java
private static Time extractRpcTimeout(Annotation[][] parameterAnnotations, Object[] args, Time defaultTimeout) { if (args != null) { Preconditions.checkArgument(parameterAnnotations.length == args.length); for (int i = 0; i < parameterAnnotations.length; i++) { if (isRpcTimeout(parameterAnnotations[i])) { if (args[i] instanceof Time) { return (Time) args[i]; } else { throw new RuntimeException("The rpc timeout parameter must be of type " + Time.class.getName() + ". The type " + args[i].getClass().getName() + " is not supported."); } } } } return defaultTimeout; }
[ "private", "static", "Time", "extractRpcTimeout", "(", "Annotation", "[", "]", "[", "]", "parameterAnnotations", ",", "Object", "[", "]", "args", ",", "Time", "defaultTimeout", ")", "{", "if", "(", "args", "!=", "null", ")", "{", "Preconditions", ".", "che...
Extracts the {@link RpcTimeout} annotated rpc timeout value from the list of given method arguments. If no {@link RpcTimeout} annotated parameter could be found, then the default timeout is returned. @param parameterAnnotations Parameter annotations @param args Array of arguments @param defaultTimeout Default timeout to return if no {@link RpcTimeout} annotated parameter has been found @return Timeout extracted from the array of arguments or the default timeout
[ "Extracts", "the", "{", "@link", "RpcTimeout", "}", "annotated", "rpc", "timeout", "value", "from", "the", "list", "of", "given", "method", "arguments", ".", "If", "no", "{", "@link", "RpcTimeout", "}", "annotated", "parameter", "could", "be", "found", "then...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaInvocationHandler.java#L298-L316
train
Extract the rpc timeout from the arguments.
[ 30522, 2797, 10763, 2051, 14817, 14536, 6593, 14428, 5833, 1006, 5754, 17287, 3508, 1031, 1033, 1031, 1033, 16381, 11639, 17287, 9285, 1010, 4874, 1031, 1033, 12098, 5620, 1010, 2051, 12398, 7292, 30524, 1025, 1045, 1026, 16381, 11639, 17287,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/HashedWheelTimer.java
HashedWheelTimer.start
public void start() { switch (WORKER_STATE_UPDATER.get(this)) { case WORKER_STATE_INIT: if (WORKER_STATE_UPDATER.compareAndSet(this, WORKER_STATE_INIT, WORKER_STATE_STARTED)) { workerThread.start(); } break; case WORKER_STATE_STARTED: break; case WORKER_STATE_SHUTDOWN: throw new IllegalStateException("cannot be started once stopped"); default: throw new Error("Invalid WorkerState"); } // Wait until the startTime is initialized by the worker. while (startTime == 0) { try { startTimeInitialized.await(); } catch (InterruptedException ignore) { // Ignore - it will be ready very soon. } } }
java
public void start() { switch (WORKER_STATE_UPDATER.get(this)) { case WORKER_STATE_INIT: if (WORKER_STATE_UPDATER.compareAndSet(this, WORKER_STATE_INIT, WORKER_STATE_STARTED)) { workerThread.start(); } break; case WORKER_STATE_STARTED: break; case WORKER_STATE_SHUTDOWN: throw new IllegalStateException("cannot be started once stopped"); default: throw new Error("Invalid WorkerState"); } // Wait until the startTime is initialized by the worker. while (startTime == 0) { try { startTimeInitialized.await(); } catch (InterruptedException ignore) { // Ignore - it will be ready very soon. } } }
[ "public", "void", "start", "(", ")", "{", "switch", "(", "WORKER_STATE_UPDATER", ".", "get", "(", "this", ")", ")", "{", "case", "WORKER_STATE_INIT", ":", "if", "(", "WORKER_STATE_UPDATER", ".", "compareAndSet", "(", "this", ",", "WORKER_STATE_INIT", ",", "W...
Starts the background thread explicitly. The background thread will start automatically on demand even if you did not call this method. @throws IllegalStateException if this timer has been {@linkplain #stop() stopped} already
[ "Starts", "the", "background", "thread", "explicitly", ".", "The", "background", "thread", "will", "start", "automatically", "on", "demand", "even", "if", "you", "did", "not", "call", "this", "method", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/HashedWheelTimer.java#L340-L363
train
Start the worker thread.
[ 30522, 2270, 11675, 2707, 1006, 1007, 1063, 6942, 1006, 7309, 1035, 2110, 1035, 10651, 2099, 1012, 2131, 1006, 2023, 1007, 1007, 1063, 2553, 7309, 1035, 2110, 1035, 1999, 4183, 1024, 2065, 1006, 7309, 1035, 2110, 1035, 10651, 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...
apache/flink
flink-connectors/flink-hbase/src/main/java/org/apache/flink/addons/hbase/TableInputFormat.java
TableInputFormat.configure
@Override public void configure(Configuration parameters) { table = createTable(); if (table != null) { scan = getScanner(); } }
java
@Override public void configure(Configuration parameters) { table = createTable(); if (table != null) { scan = getScanner(); } }
[ "@", "Override", "public", "void", "configure", "(", "Configuration", "parameters", ")", "{", "table", "=", "createTable", "(", ")", ";", "if", "(", "table", "!=", "null", ")", "{", "scan", "=", "getScanner", "(", ")", ";", "}", "}" ]
Creates a {@link Scan} object and opens the {@link HTable} connection. These are opened here because they are needed in the createInputSplits which is called before the openInputFormat method. So the connection is opened in {@link #configure(Configuration)} and closed in {@link #closeInputFormat()}. @param parameters The configuration that is to be used @see Configuration
[ "Creates", "a", "{", "@link", "Scan", "}", "object", "and", "opens", "the", "{", "@link", "HTable", "}", "connection", ".", "These", "are", "opened", "here", "because", "they", "are", "needed", "in", "the", "createInputSplits", "which", "is", "called", "be...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hbase/src/main/java/org/apache/flink/addons/hbase/TableInputFormat.java#L67-L73
train
Override this to configure the table and scan.
[ 30522, 1030, 2058, 15637, 2270, 11675, 9530, 8873, 27390, 2063, 1006, 9563, 11709, 1007, 1063, 2795, 1027, 3443, 10880, 1006, 1007, 1025, 2065, 1006, 2795, 999, 1027, 19701, 1007, 1063, 13594, 1027, 4152, 9336, 3678, 1006, 1007, 1025, 1065,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java
TaskSlotTable.addTask
public boolean addTask(Task task) throws SlotNotFoundException, SlotNotActiveException { Preconditions.checkNotNull(task); TaskSlot taskSlot = getTaskSlot(task.getAllocationId()); if (taskSlot != null) { if (taskSlot.isActive(task.getJobID(), task.getAllocationId())) { if (taskSlot.add(task)) { taskSlotMappings.put(task.getExecutionId(), new TaskSlotMapping(task, taskSlot)); return true; } else { return false; } } else { throw new SlotNotActiveException(task.getJobID(), task.getAllocationId()); } } else { throw new SlotNotFoundException(task.getAllocationId()); } }
java
public boolean addTask(Task task) throws SlotNotFoundException, SlotNotActiveException { Preconditions.checkNotNull(task); TaskSlot taskSlot = getTaskSlot(task.getAllocationId()); if (taskSlot != null) { if (taskSlot.isActive(task.getJobID(), task.getAllocationId())) { if (taskSlot.add(task)) { taskSlotMappings.put(task.getExecutionId(), new TaskSlotMapping(task, taskSlot)); return true; } else { return false; } } else { throw new SlotNotActiveException(task.getJobID(), task.getAllocationId()); } } else { throw new SlotNotFoundException(task.getAllocationId()); } }
[ "public", "boolean", "addTask", "(", "Task", "task", ")", "throws", "SlotNotFoundException", ",", "SlotNotActiveException", "{", "Preconditions", ".", "checkNotNull", "(", "task", ")", ";", "TaskSlot", "taskSlot", "=", "getTaskSlot", "(", "task", ".", "getAllocati...
Add the given task to the slot identified by the task's allocation id. @param task to add to the task slot with the respective allocation id @throws SlotNotFoundException if there was no slot for the given allocation id @throws SlotNotActiveException if there was no slot active for task's job and allocation id @return True if the task could be added to the task slot; otherwise false
[ "Add", "the", "given", "task", "to", "the", "slot", "identified", "by", "the", "task", "s", "allocation", "id", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java#L471-L491
train
Adds a task to the task slot.
[ 30522, 2270, 22017, 20898, 5587, 10230, 2243, 1006, 4708, 4708, 1007, 11618, 10453, 17048, 14876, 8630, 10288, 24422, 1010, 10453, 17048, 19620, 10288, 24422, 1063, 3653, 8663, 20562, 2015, 1012, 4638, 17048, 11231, 3363, 1006, 4708, 1007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
alibaba/canal
client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/service/ESSyncService.java
ESSyncService.update
private void update(ESSyncConfig config, Dml dml) { List<Map<String, Object>> dataList = dml.getData(); List<Map<String, Object>> oldList = dml.getOld(); if (dataList == null || dataList.isEmpty() || oldList == null || oldList.isEmpty()) { return; } SchemaItem schemaItem = config.getEsMapping().getSchemaItem(); int i = 0; for (Map<String, Object> data : dataList) { Map<String, Object> old = oldList.get(i); if (data == null || data.isEmpty() || old == null || old.isEmpty()) { continue; } if (schemaItem.getAliasTableItems().size() == 1 && schemaItem.isAllFieldsSimple()) { // ------单表 & 所有字段都为简单字段------ singleTableSimpleFiledUpdate(config, dml, data, old); } else { // ------主表 查询sql来更新------ if (schemaItem.getMainTable().getTableName().equalsIgnoreCase(dml.getTable())) { ESMapping mapping = config.getEsMapping(); String idFieldName = mapping.get_id() == null ? mapping.getPk() : mapping.get_id(); FieldItem idFieldItem = schemaItem.getSelectFields().get(idFieldName); boolean idFieldSimple = true; if (idFieldItem.isMethod() || idFieldItem.isBinaryOp()) { idFieldSimple = false; } boolean allUpdateFieldSimple = true; out: for (FieldItem fieldItem : schemaItem.getSelectFields().values()) { for (ColumnItem columnItem : fieldItem.getColumnItems()) { if (old.containsKey(columnItem.getColumnName())) { if (fieldItem.isMethod() || fieldItem.isBinaryOp()) { allUpdateFieldSimple = false; break out; } } } } // 不支持主键更新!! // 判断是否有外键更新 boolean fkChanged = false; for (TableItem tableItem : schemaItem.getAliasTableItems().values()) { if (tableItem.isMain()) { continue; } boolean changed = false; for (List<FieldItem> fieldItems : tableItem.getRelationTableFields().values()) { for (FieldItem fieldItem : fieldItems) { if (old.containsKey(fieldItem.getColumn().getColumnName())) { fkChanged = true; changed = true; break; } } } // 如果外键有修改,则更新所对应该表的所有查询条件数据 if (changed) { for (FieldItem fieldItem : tableItem.getRelationSelectFieldItems()) { fieldItem.getColumnItems() .forEach(columnItem -> old.put(columnItem.getColumnName(), null)); } } } // 判断主键和所更新的字段是否全为简单字段 if (idFieldSimple && allUpdateFieldSimple && !fkChanged) { singleTableSimpleFiledUpdate(config, dml, data, old); } else { mainTableUpdate(config, dml, data, old); } } // 从表的操作 for (TableItem tableItem : schemaItem.getAliasTableItems().values()) { if (tableItem.isMain()) { continue; } if (!tableItem.getTableName().equals(dml.getTable())) { continue; } // 关联条件出现在主表查询条件是否为简单字段 boolean allFieldsSimple = true; for (FieldItem fieldItem : tableItem.getRelationSelectFieldItems()) { if (fieldItem.isMethod() || fieldItem.isBinaryOp()) { allFieldsSimple = false; break; } } // 所有查询字段均为简单字段 if (allFieldsSimple) { // 不是子查询 if (!tableItem.isSubQuery()) { // ------关联表简单字段更新------ Map<String, Object> esFieldData = new LinkedHashMap<>(); for (FieldItem fieldItem : tableItem.getRelationSelectFieldItems()) { if (old.containsKey(fieldItem.getColumn().getColumnName())) { Object value = esTemplate.getValFromData(config.getEsMapping(), data, fieldItem.getFieldName(), fieldItem.getColumn().getColumnName()); esFieldData.put(Util.cleanColumn(fieldItem.getFieldName()), value); } } joinTableSimpleFieldOperation(config, dml, data, tableItem, esFieldData); } else { // ------关联子表简单字段更新------ subTableSimpleFieldOperation(config, dml, data, old, tableItem); } } else { // ------关联子表复杂字段更新 执行全sql更新es------ wholeSqlOperation(config, dml, data, old, tableItem); } } } i++; } }
java
private void update(ESSyncConfig config, Dml dml) { List<Map<String, Object>> dataList = dml.getData(); List<Map<String, Object>> oldList = dml.getOld(); if (dataList == null || dataList.isEmpty() || oldList == null || oldList.isEmpty()) { return; } SchemaItem schemaItem = config.getEsMapping().getSchemaItem(); int i = 0; for (Map<String, Object> data : dataList) { Map<String, Object> old = oldList.get(i); if (data == null || data.isEmpty() || old == null || old.isEmpty()) { continue; } if (schemaItem.getAliasTableItems().size() == 1 && schemaItem.isAllFieldsSimple()) { // ------单表 & 所有字段都为简单字段------ singleTableSimpleFiledUpdate(config, dml, data, old); } else { // ------主表 查询sql来更新------ if (schemaItem.getMainTable().getTableName().equalsIgnoreCase(dml.getTable())) { ESMapping mapping = config.getEsMapping(); String idFieldName = mapping.get_id() == null ? mapping.getPk() : mapping.get_id(); FieldItem idFieldItem = schemaItem.getSelectFields().get(idFieldName); boolean idFieldSimple = true; if (idFieldItem.isMethod() || idFieldItem.isBinaryOp()) { idFieldSimple = false; } boolean allUpdateFieldSimple = true; out: for (FieldItem fieldItem : schemaItem.getSelectFields().values()) { for (ColumnItem columnItem : fieldItem.getColumnItems()) { if (old.containsKey(columnItem.getColumnName())) { if (fieldItem.isMethod() || fieldItem.isBinaryOp()) { allUpdateFieldSimple = false; break out; } } } } // 不支持主键更新!! // 判断是否有外键更新 boolean fkChanged = false; for (TableItem tableItem : schemaItem.getAliasTableItems().values()) { if (tableItem.isMain()) { continue; } boolean changed = false; for (List<FieldItem> fieldItems : tableItem.getRelationTableFields().values()) { for (FieldItem fieldItem : fieldItems) { if (old.containsKey(fieldItem.getColumn().getColumnName())) { fkChanged = true; changed = true; break; } } } // 如果外键有修改,则更新所对应该表的所有查询条件数据 if (changed) { for (FieldItem fieldItem : tableItem.getRelationSelectFieldItems()) { fieldItem.getColumnItems() .forEach(columnItem -> old.put(columnItem.getColumnName(), null)); } } } // 判断主键和所更新的字段是否全为简单字段 if (idFieldSimple && allUpdateFieldSimple && !fkChanged) { singleTableSimpleFiledUpdate(config, dml, data, old); } else { mainTableUpdate(config, dml, data, old); } } // 从表的操作 for (TableItem tableItem : schemaItem.getAliasTableItems().values()) { if (tableItem.isMain()) { continue; } if (!tableItem.getTableName().equals(dml.getTable())) { continue; } // 关联条件出现在主表查询条件是否为简单字段 boolean allFieldsSimple = true; for (FieldItem fieldItem : tableItem.getRelationSelectFieldItems()) { if (fieldItem.isMethod() || fieldItem.isBinaryOp()) { allFieldsSimple = false; break; } } // 所有查询字段均为简单字段 if (allFieldsSimple) { // 不是子查询 if (!tableItem.isSubQuery()) { // ------关联表简单字段更新------ Map<String, Object> esFieldData = new LinkedHashMap<>(); for (FieldItem fieldItem : tableItem.getRelationSelectFieldItems()) { if (old.containsKey(fieldItem.getColumn().getColumnName())) { Object value = esTemplate.getValFromData(config.getEsMapping(), data, fieldItem.getFieldName(), fieldItem.getColumn().getColumnName()); esFieldData.put(Util.cleanColumn(fieldItem.getFieldName()), value); } } joinTableSimpleFieldOperation(config, dml, data, tableItem, esFieldData); } else { // ------关联子表简单字段更新------ subTableSimpleFieldOperation(config, dml, data, old, tableItem); } } else { // ------关联子表复杂字段更新 执行全sql更新es------ wholeSqlOperation(config, dml, data, old, tableItem); } } } i++; } }
[ "private", "void", "update", "(", "ESSyncConfig", "config", ",", "Dml", "dml", ")", "{", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", "dataList", "=", "dml", ".", "getData", "(", ")", ";", "List", "<", "Map", "<", "String", ",", "Obj...
更新操作dml @param config es配置 @param dml dml数据
[ "更新操作dml" ]
8f088cddc0755f4350c5aaae95c6e4002d90a40f
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/service/ESSyncService.java#L193-L316
train
Update DML.
[ 30522, 2797, 11675, 10651, 1006, 9686, 6508, 12273, 8663, 8873, 2290, 9530, 8873, 2290, 1010, 1040, 19968, 1040, 19968, 1007, 1063, 2862, 1026, 4949, 1026, 5164, 1010, 4874, 1028, 1028, 2951, 9863, 1027, 1040, 19968, 1012, 2131, 2850, 2696,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/factories/TableFormatFactoryBase.java
TableFormatFactoryBase.deriveSchema
public static TableSchema deriveSchema(Map<String, String> properties) { final DescriptorProperties descriptorProperties = new DescriptorProperties(); descriptorProperties.putProperties(properties); final TableSchema.Builder builder = TableSchema.builder(); final TableSchema baseSchema = descriptorProperties.getTableSchema(SCHEMA); for (int i = 0; i < baseSchema.getFieldCount(); i++) { final String fieldName = baseSchema.getFieldNames()[i]; final TypeInformation<?> fieldType = baseSchema.getFieldTypes()[i]; final boolean isProctime = descriptorProperties .getOptionalBoolean(SCHEMA + '.' + i + '.' + SCHEMA_PROCTIME) .orElse(false); final String timestampKey = SCHEMA + '.' + i + '.' + ROWTIME_TIMESTAMPS_TYPE; final boolean isRowtime = descriptorProperties.containsKey(timestampKey); if (!isProctime && !isRowtime) { // check for aliasing final String aliasName = descriptorProperties .getOptionalString(SCHEMA + '.' + i + '.' + SCHEMA_FROM) .orElse(fieldName); builder.field(aliasName, fieldType); } // only use the rowtime attribute if it references a field else if (isRowtime && descriptorProperties.isValue(timestampKey, ROWTIME_TIMESTAMPS_TYPE_VALUE_FROM_FIELD)) { final String aliasName = descriptorProperties .getString(SCHEMA + '.' + i + '.' + ROWTIME_TIMESTAMPS_FROM); builder.field(aliasName, fieldType); } } return builder.build(); }
java
public static TableSchema deriveSchema(Map<String, String> properties) { final DescriptorProperties descriptorProperties = new DescriptorProperties(); descriptorProperties.putProperties(properties); final TableSchema.Builder builder = TableSchema.builder(); final TableSchema baseSchema = descriptorProperties.getTableSchema(SCHEMA); for (int i = 0; i < baseSchema.getFieldCount(); i++) { final String fieldName = baseSchema.getFieldNames()[i]; final TypeInformation<?> fieldType = baseSchema.getFieldTypes()[i]; final boolean isProctime = descriptorProperties .getOptionalBoolean(SCHEMA + '.' + i + '.' + SCHEMA_PROCTIME) .orElse(false); final String timestampKey = SCHEMA + '.' + i + '.' + ROWTIME_TIMESTAMPS_TYPE; final boolean isRowtime = descriptorProperties.containsKey(timestampKey); if (!isProctime && !isRowtime) { // check for aliasing final String aliasName = descriptorProperties .getOptionalString(SCHEMA + '.' + i + '.' + SCHEMA_FROM) .orElse(fieldName); builder.field(aliasName, fieldType); } // only use the rowtime attribute if it references a field else if (isRowtime && descriptorProperties.isValue(timestampKey, ROWTIME_TIMESTAMPS_TYPE_VALUE_FROM_FIELD)) { final String aliasName = descriptorProperties .getString(SCHEMA + '.' + i + '.' + ROWTIME_TIMESTAMPS_FROM); builder.field(aliasName, fieldType); } } return builder.build(); }
[ "public", "static", "TableSchema", "deriveSchema", "(", "Map", "<", "String", ",", "String", ">", "properties", ")", "{", "final", "DescriptorProperties", "descriptorProperties", "=", "new", "DescriptorProperties", "(", ")", ";", "descriptorProperties", ".", "putPro...
Finds the table schema that can be used for a format schema (without time attributes).
[ "Finds", "the", "table", "schema", "that", "can", "be", "used", "for", "a", "format", "schema", "(", "without", "time", "attributes", ")", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableFormatFactoryBase.java#L131-L164
train
Derive the schema from the given properties.
[ 30522, 2270, 10763, 7251, 5403, 2863, 12153, 5403, 2863, 1006, 4949, 1026, 5164, 1010, 5164, 1028, 5144, 1007, 1063, 2345, 4078, 23235, 2953, 21572, 4842, 7368, 4078, 23235, 2953, 21572, 4842, 7368, 1027, 2047, 4078, 23235, 2953, 21572, 484...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ExceptionUtils.java
ExceptionUtils.rethrowIOException
public static void rethrowIOException(Throwable t) throws IOException { if (t instanceof IOException) { throw (IOException) t; } else if (t instanceof RuntimeException) { throw (RuntimeException) t; } else if (t instanceof Error) { throw (Error) t; } else { throw new IOException(t.getMessage(), t); } }
java
public static void rethrowIOException(Throwable t) throws IOException { if (t instanceof IOException) { throw (IOException) t; } else if (t instanceof RuntimeException) { throw (RuntimeException) t; } else if (t instanceof Error) { throw (Error) t; } else { throw new IOException(t.getMessage(), t); } }
[ "public", "static", "void", "rethrowIOException", "(", "Throwable", "t", ")", "throws", "IOException", "{", "if", "(", "t", "instanceof", "IOException", ")", "{", "throw", "(", "IOException", ")", "t", ";", "}", "else", "if", "(", "t", "instanceof", "Runti...
Re-throws the given {@code Throwable} in scenarios where the signatures allows only IOExceptions (and RuntimeException and Error). <p>Throws this exception directly, if it is an IOException, a RuntimeException, or an Error. Otherwise it wraps it in an IOException and throws it. @param t The Throwable to be thrown.
[ "Re", "-", "throws", "the", "given", "{", "@code", "Throwable", "}", "in", "scenarios", "where", "the", "signatures", "allows", "only", "IOExceptions", "(", "and", "RuntimeException", "and", "Error", ")", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java#L302-L315
train
Re - throws an IOException.
[ 30522, 2270, 10763, 11675, 2128, 2705, 10524, 3695, 10288, 24422, 1006, 5466, 3085, 1056, 1007, 11618, 22834, 10288, 24422, 1063, 2065, 1006, 1056, 6013, 11253, 22834, 10288, 24422, 1007, 1063, 5466, 1006, 22834, 10288, 24422, 1007, 1056, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostBodyUtil.java
HttpPostBodyUtil.findNonWhitespace
static int findNonWhitespace(String sb, int offset) { int result; for (result = offset; result < sb.length(); result ++) { if (!Character.isWhitespace(sb.charAt(result))) { break; } } return result; }
java
static int findNonWhitespace(String sb, int offset) { int result; for (result = offset; result < sb.length(); result ++) { if (!Character.isWhitespace(sb.charAt(result))) { break; } } return result; }
[ "static", "int", "findNonWhitespace", "(", "String", "sb", ",", "int", "offset", ")", "{", "int", "result", ";", "for", "(", "result", "=", "offset", ";", "result", "<", "sb", ".", "length", "(", ")", ";", "result", "++", ")", "{", "if", "(", "!", ...
Find the first non whitespace @return the rank of the first non whitespace
[ "Find", "the", "first", "non", "whitespace" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostBodyUtil.java#L129-L137
train
Find the first non - whitespace character in the string.
[ 30522, 10763, 20014, 2424, 8540, 2860, 16584, 2229, 15327, 1006, 5164, 24829, 1010, 20014, 16396, 1007, 1063, 20014, 2765, 1025, 2005, 1006, 2765, 1027, 16396, 1025, 2765, 1026, 24829, 1012, 3091, 1006, 1007, 1025, 2765, 1009, 1009, 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
example/src/main/java/io/netty/example/ocsp/OcspRequestBuilder.java
OcspRequestBuilder.build
public OCSPReq build() throws OCSPException, IOException, CertificateEncodingException { SecureRandom generator = checkNotNull(this.generator, "generator"); DigestCalculator calculator = checkNotNull(this.calculator, "calculator"); X509Certificate certificate = checkNotNull(this.certificate, "certificate"); X509Certificate issuer = checkNotNull(this.issuer, "issuer"); BigInteger serial = certificate.getSerialNumber(); CertificateID certId = new CertificateID(calculator, new X509CertificateHolder(issuer.getEncoded()), serial); OCSPReqBuilder builder = new OCSPReqBuilder(); builder.addRequest(certId); byte[] nonce = new byte[8]; generator.nextBytes(nonce); Extension[] extensions = new Extension[] { new Extension(OCSPObjectIdentifiers.id_pkix_ocsp_nonce, false, new DEROctetString(nonce)) }; builder.setRequestExtensions(new Extensions(extensions)); return builder.build(); }
java
public OCSPReq build() throws OCSPException, IOException, CertificateEncodingException { SecureRandom generator = checkNotNull(this.generator, "generator"); DigestCalculator calculator = checkNotNull(this.calculator, "calculator"); X509Certificate certificate = checkNotNull(this.certificate, "certificate"); X509Certificate issuer = checkNotNull(this.issuer, "issuer"); BigInteger serial = certificate.getSerialNumber(); CertificateID certId = new CertificateID(calculator, new X509CertificateHolder(issuer.getEncoded()), serial); OCSPReqBuilder builder = new OCSPReqBuilder(); builder.addRequest(certId); byte[] nonce = new byte[8]; generator.nextBytes(nonce); Extension[] extensions = new Extension[] { new Extension(OCSPObjectIdentifiers.id_pkix_ocsp_nonce, false, new DEROctetString(nonce)) }; builder.setRequestExtensions(new Extensions(extensions)); return builder.build(); }
[ "public", "OCSPReq", "build", "(", ")", "throws", "OCSPException", ",", "IOException", ",", "CertificateEncodingException", "{", "SecureRandom", "generator", "=", "checkNotNull", "(", "this", ".", "generator", ",", "\"generator\"", ")", ";", "DigestCalculator", "cal...
ATTENTION: The returned {@link OCSPReq} is not re-usable/cacheable! It contains a one-time nonce and CA's will (should) reject subsequent requests that have the same nonce value.
[ "ATTENTION", ":", "The", "returned", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/example/src/main/java/io/netty/example/ocsp/OcspRequestBuilder.java#L79-L103
train
Build an OCSPReq object.
[ 30522, 2270, 1051, 6169, 28139, 4160, 3857, 1006, 1007, 11618, 1051, 6169, 5051, 2595, 24422, 1010, 22834, 10288, 24422, 1010, 8196, 2368, 3597, 4667, 10288, 24422, 1063, 5851, 13033, 5358, 13103, 1027, 4638, 17048, 11231, 3363, 1006, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/windowing/evictors/TimeEvictor.java
TimeEvictor.hasTimestamp
private boolean hasTimestamp(Iterable<TimestampedValue<Object>> elements) { Iterator<TimestampedValue<Object>> it = elements.iterator(); if (it.hasNext()) { return it.next().hasTimestamp(); } return false; }
java
private boolean hasTimestamp(Iterable<TimestampedValue<Object>> elements) { Iterator<TimestampedValue<Object>> it = elements.iterator(); if (it.hasNext()) { return it.next().hasTimestamp(); } return false; }
[ "private", "boolean", "hasTimestamp", "(", "Iterable", "<", "TimestampedValue", "<", "Object", ">", ">", "elements", ")", "{", "Iterator", "<", "TimestampedValue", "<", "Object", ">>", "it", "=", "elements", ".", "iterator", "(", ")", ";", "if", "(", "it",...
Returns true if the first element in the Iterable of {@link TimestampedValue} has a timestamp.
[ "Returns", "true", "if", "the", "first", "element", "in", "the", "Iterable", "of", "{" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/TimeEvictor.java#L86-L92
train
Checks if the given iterable contains a timestamp.
[ 30522, 2797, 22017, 20898, 2038, 7292, 9153, 8737, 1006, 2009, 6906, 3468, 1026, 2335, 15464, 5669, 10175, 5657, 1026, 4874, 1028, 1028, 3787, 1007, 1063, 2009, 6906, 4263, 1026, 2335, 15464, 5669, 10175, 5657, 1026, 4874, 1028, 1028, 2009,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/PartitionRequestClientHandler.java
PartitionRequestClientHandler.exceptionCaught
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { if (cause instanceof TransportException) { notifyAllChannelsOfErrorAndClose(cause); } else { final SocketAddress remoteAddr = ctx.channel().remoteAddress(); final TransportException tex; // Improve on the connection reset by peer error message if (cause instanceof IOException && cause.getMessage().equals("Connection reset by peer")) { tex = new RemoteTransportException( "Lost connection to task manager '" + remoteAddr + "'. This indicates " + "that the remote task manager was lost.", remoteAddr, cause); } else { SocketAddress localAddr = ctx.channel().localAddress(); tex = new LocalTransportException( String.format("%s (connection to '%s')", cause.getMessage(), remoteAddr), localAddr, cause); } notifyAllChannelsOfErrorAndClose(tex); } }
java
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { if (cause instanceof TransportException) { notifyAllChannelsOfErrorAndClose(cause); } else { final SocketAddress remoteAddr = ctx.channel().remoteAddress(); final TransportException tex; // Improve on the connection reset by peer error message if (cause instanceof IOException && cause.getMessage().equals("Connection reset by peer")) { tex = new RemoteTransportException( "Lost connection to task manager '" + remoteAddr + "'. This indicates " + "that the remote task manager was lost.", remoteAddr, cause); } else { SocketAddress localAddr = ctx.channel().localAddress(); tex = new LocalTransportException( String.format("%s (connection to '%s')", cause.getMessage(), remoteAddr), localAddr, cause); } notifyAllChannelsOfErrorAndClose(tex); } }
[ "@", "Override", "public", "void", "exceptionCaught", "(", "ChannelHandlerContext", "ctx", ",", "Throwable", "cause", ")", "throws", "Exception", "{", "if", "(", "cause", "instanceof", "TransportException", ")", "{", "notifyAllChannelsOfErrorAndClose", "(", "cause", ...
Called on exceptions in the client handler pipeline. <p> Remote exceptions are received as regular payload.
[ "Called", "on", "exceptions", "in", "the", "client", "handler", "pipeline", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/PartitionRequestClientHandler.java#L145-L174
train
Override exceptionCaught to handle TransportExceptions.
[ 30522, 1030, 2058, 15637, 2270, 11675, 6453, 3540, 18533, 1006, 3149, 11774, 3917, 8663, 18209, 14931, 2595, 1010, 5466, 3085, 3426, 1007, 11618, 6453, 1063, 2065, 1006, 3426, 6013, 11253, 3665, 10288, 24422, 1007, 1063, 2025, 8757, 8095, 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-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java
ConditionMessage.forCondition
public static Builder forCondition(String condition, Object... details) { return new ConditionMessage().andCondition(condition, details); }
java
public static Builder forCondition(String condition, Object... details) { return new ConditionMessage().andCondition(condition, details); }
[ "public", "static", "Builder", "forCondition", "(", "String", "condition", ",", "Object", "...", "details", ")", "{", "return", "new", "ConditionMessage", "(", ")", ".", "andCondition", "(", "condition", ",", "details", ")", ";", "}" ]
Factory method for a builder to construct a new {@link ConditionMessage} for a condition. @param condition the condition @param details details of the condition @return a {@link Builder} builder @see #forCondition(Class, Object...) @see #andCondition(String, Object...)
[ "Factory", "method", "for", "a", "builder", "to", "construct", "a", "new", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java#L194-L196
train
Creates a builder for a condition message.
[ 30522, 2270, 10763, 12508, 2005, 8663, 20562, 1006, 5164, 4650, 1010, 4874, 1012, 1012, 1012, 4751, 1007, 1063, 2709, 2047, 4650, 7834, 3736, 3351, 1006, 1007, 1012, 1998, 8663, 20562, 1006, 4650, 1010, 4751, 1007, 1025, 1065, 102, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/swing/clipboard/ClipboardUtil.java
ClipboardUtil.get
public static Object get(Transferable content, DataFlavor flavor) { if (null != content && content.isDataFlavorSupported(flavor)) { try { return content.getTransferData(flavor); } catch (UnsupportedFlavorException | IOException e) { throw new UtilException(e); } } return null; }
java
public static Object get(Transferable content, DataFlavor flavor) { if (null != content && content.isDataFlavorSupported(flavor)) { try { return content.getTransferData(flavor); } catch (UnsupportedFlavorException | IOException e) { throw new UtilException(e); } } return null; }
[ "public", "static", "Object", "get", "(", "Transferable", "content", ",", "DataFlavor", "flavor", ")", "{", "if", "(", "null", "!=", "content", "&&", "content", ".", "isDataFlavorSupported", "(", "flavor", ")", ")", "{", "try", "{", "return", "content", "....
获取剪贴板内容 @param content {@link Transferable} @param flavor 数据元信息,标识数据类型 @return 剪贴板内容,类型根据flavor不同而不同
[ "获取剪贴板内容" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/swing/clipboard/ClipboardUtil.java#L68-L77
train
Gets the object that represents the specified transferable object with the specified data flavor.
[ 30522, 2270, 10763, 4874, 2131, 1006, 4651, 3085, 4180, 1010, 2951, 10258, 11431, 2953, 14894, 1007, 1063, 2065, 1006, 19701, 999, 1027, 4180, 1004, 1004, 4180, 1012, 2003, 2850, 2696, 10258, 11431, 5668, 6279, 6442, 2098, 1006, 14894, 1007...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java
KeyUtil.getCertificateFactory
public static CertificateFactory getCertificateFactory(String type) { final Provider provider = GlobalBouncyCastleProvider.INSTANCE.getProvider(); CertificateFactory factory; try { factory = (null == provider) ? CertificateFactory.getInstance(type) : CertificateFactory.getInstance(type, provider); } catch (CertificateException e) { throw new CryptoException(e); } return factory; }
java
public static CertificateFactory getCertificateFactory(String type) { final Provider provider = GlobalBouncyCastleProvider.INSTANCE.getProvider(); CertificateFactory factory; try { factory = (null == provider) ? CertificateFactory.getInstance(type) : CertificateFactory.getInstance(type, provider); } catch (CertificateException e) { throw new CryptoException(e); } return factory; }
[ "public", "static", "CertificateFactory", "getCertificateFactory", "(", "String", "type", ")", "{", "final", "Provider", "provider", "=", "GlobalBouncyCastleProvider", ".", "INSTANCE", ".", "getProvider", "(", ")", ";", "CertificateFactory", "factory", ";", "try", "...
获取{@link CertificateFactory} @param type 类型,例如X.509 @return {@link KeyPairGenerator} @since 4.5.0
[ "获取", "{", "@link", "CertificateFactory", "}" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java#L723-L733
train
Gets the CertificateFactory for the given type.
[ 30522, 2270, 10763, 8196, 21450, 2131, 17119, 3775, 8873, 16280, 21450, 1006, 5164, 2828, 1007, 1063, 2345, 10802, 10802, 1027, 3795, 5092, 4609, 5666, 23662, 21572, 17258, 2121, 1012, 6013, 1012, 2131, 21572, 17258, 2121, 1006, 1007, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/thread/GlobalThreadPool.java
GlobalThreadPool.execute
public static void execute(Runnable runnable) { try { executor.execute(runnable); } catch (Exception e) { throw new UtilException(e, "Exception when running task!"); } }
java
public static void execute(Runnable runnable) { try { executor.execute(runnable); } catch (Exception e) { throw new UtilException(e, "Exception when running task!"); } }
[ "public", "static", "void", "execute", "(", "Runnable", "runnable", ")", "{", "try", "{", "executor", ".", "execute", "(", "runnable", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "UtilException", "(", "e", ",", "\"Exception w...
直接在公共线程池中执行线程 @param runnable 可运行对象
[ "直接在公共线程池中执行线程" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/thread/GlobalThreadPool.java#L64-L70
train
Execute a Runnable.
[ 30522, 2270, 10763, 11675, 15389, 1006, 2448, 22966, 2448, 22966, 1007, 1063, 3046, 1063, 4654, 8586, 16161, 2099, 1012, 15389, 1006, 2448, 22966, 1007, 1025, 1065, 4608, 1006, 6453, 1041, 1007, 1063, 5466, 2047, 21183, 9463, 2595, 24422, 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/spark
core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java
TaskMemoryManager.cleanUpAllAllocatedMemory
public long cleanUpAllAllocatedMemory() { synchronized (this) { for (MemoryConsumer c: consumers) { if (c != null && c.getUsed() > 0) { // In case of failed task, it's normal to see leaked memory logger.debug("unreleased " + Utils.bytesToString(c.getUsed()) + " memory from " + c); } } consumers.clear(); for (MemoryBlock page : pageTable) { if (page != null) { logger.debug("unreleased page: " + page + " in task " + taskAttemptId); page.pageNumber = MemoryBlock.FREED_IN_TMM_PAGE_NUMBER; memoryManager.tungstenMemoryAllocator().free(page); } } Arrays.fill(pageTable, null); } // release the memory that is not used by any consumer (acquired for pages in tungsten mode). memoryManager.releaseExecutionMemory(acquiredButNotUsed, taskAttemptId, tungstenMemoryMode); return memoryManager.releaseAllExecutionMemoryForTask(taskAttemptId); }
java
public long cleanUpAllAllocatedMemory() { synchronized (this) { for (MemoryConsumer c: consumers) { if (c != null && c.getUsed() > 0) { // In case of failed task, it's normal to see leaked memory logger.debug("unreleased " + Utils.bytesToString(c.getUsed()) + " memory from " + c); } } consumers.clear(); for (MemoryBlock page : pageTable) { if (page != null) { logger.debug("unreleased page: " + page + " in task " + taskAttemptId); page.pageNumber = MemoryBlock.FREED_IN_TMM_PAGE_NUMBER; memoryManager.tungstenMemoryAllocator().free(page); } } Arrays.fill(pageTable, null); } // release the memory that is not used by any consumer (acquired for pages in tungsten mode). memoryManager.releaseExecutionMemory(acquiredButNotUsed, taskAttemptId, tungstenMemoryMode); return memoryManager.releaseAllExecutionMemoryForTask(taskAttemptId); }
[ "public", "long", "cleanUpAllAllocatedMemory", "(", ")", "{", "synchronized", "(", "this", ")", "{", "for", "(", "MemoryConsumer", "c", ":", "consumers", ")", "{", "if", "(", "c", "!=", "null", "&&", "c", ".", "getUsed", "(", ")", ">", "0", ")", "{",...
Clean up all allocated memory and pages. Returns the number of bytes freed. A non-zero return value can be used to detect memory leaks.
[ "Clean", "up", "all", "allocated", "memory", "and", "pages", ".", "Returns", "the", "number", "of", "bytes", "freed", ".", "A", "non", "-", "zero", "return", "value", "can", "be", "used", "to", "detect", "memory", "leaks", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java#L428-L452
train
Clean up all allocated memory.
[ 30522, 2270, 2146, 27686, 25425, 7174, 12921, 4168, 5302, 2854, 1006, 1007, 1063, 25549, 1006, 2023, 1007, 1063, 2005, 1006, 3638, 8663, 23545, 2099, 1039, 1024, 10390, 1007, 1063, 2065, 1006, 1039, 999, 1027, 19701, 1004, 1004, 1039, 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-core/src/main/java/org/apache/flink/api/common/typeinfo/Types.java
Types.OBJECT_ARRAY
@SuppressWarnings("unchecked") public static <E> TypeInformation<E[]> OBJECT_ARRAY(TypeInformation<E> elementType) { if (elementType == Types.STRING) { return (TypeInformation) BasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO; } return ObjectArrayTypeInfo.getInfoFor(elementType); }
java
@SuppressWarnings("unchecked") public static <E> TypeInformation<E[]> OBJECT_ARRAY(TypeInformation<E> elementType) { if (elementType == Types.STRING) { return (TypeInformation) BasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO; } return ObjectArrayTypeInfo.getInfoFor(elementType); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "E", ">", "TypeInformation", "<", "E", "[", "]", ">", "OBJECT_ARRAY", "(", "TypeInformation", "<", "E", ">", "elementType", ")", "{", "if", "(", "elementType", "==", "Types", ".",...
Returns type information for Java arrays of object types (such as <code>String[]</code>, <code>Integer[]</code>). The array itself must not be null. Null values for elements are supported. @param elementType element type of the array
[ "Returns", "type", "information", "for", "Java", "arrays", "of", "object", "types", "(", "such", "as", "<code", ">", "String", "[]", "<", "/", "code", ">", "<code", ">", "Integer", "[]", "<", "/", "code", ">", ")", ".", "The", "array", "itself", "mus...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/Types.java#L373-L379
train
Returns the type information for an object array type.
[ 30522, 1030, 16081, 9028, 5582, 2015, 1006, 1000, 4895, 5403, 18141, 1000, 1007, 2270, 10763, 1026, 1041, 1028, 2828, 2378, 14192, 3370, 1026, 1041, 1031, 1033, 1028, 4874, 1035, 9140, 1006, 2828, 2378, 14192, 3370, 1026, 1041, 1028, 5783, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/mining/word/TfIdf.java
TfIdf.tfIdf
public static <TERM> Map<TERM, Double> tfIdf(Map<TERM, Double> tf, Map<TERM, Double> idf) { return tfIdf(tf, idf, Normalization.NONE); }
java
public static <TERM> Map<TERM, Double> tfIdf(Map<TERM, Double> tf, Map<TERM, Double> idf) { return tfIdf(tf, idf, Normalization.NONE); }
[ "public", "static", "<", "TERM", ">", "Map", "<", "TERM", ",", "Double", ">", "tfIdf", "(", "Map", "<", "TERM", ",", "Double", ">", "tf", ",", "Map", "<", "TERM", ",", "Double", ">", "idf", ")", "{", "return", "tfIdf", "(", "tf", ",", "idf", ",...
计算文档的tf-idf(不正规化) @param tf 词频 @param idf 倒排频率 @param <TERM> 词语类型 @return 一个词语->tf-idf的Map
[ "计算文档的tf", "-", "idf(不正规化)" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/word/TfIdf.java#L217-L220
train
Get the TF IDF map.
[ 30522, 2270, 10763, 1026, 2744, 1028, 4949, 1026, 2744, 1010, 3313, 1028, 1056, 8873, 20952, 1006, 4949, 1026, 2744, 1010, 3313, 1028, 1056, 2546, 1010, 4949, 1026, 2744, 1010, 3313, 1028, 24011, 1007, 1063, 2709, 1056, 8873, 20952, 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/util/ArrayUtil.java
ArrayUtil.join
public static String join(Object array, CharSequence conjunction) { if (isArray(array)) { final Class<?> componentType = array.getClass().getComponentType(); if (componentType.isPrimitive()) { final String componentTypeName = componentType.getName(); switch (componentTypeName) { case "long": return join((long[]) array, conjunction); case "int": return join((int[]) array, conjunction); case "short": return join((short[]) array, conjunction); case "char": return join((char[]) array, conjunction); case "byte": return join((byte[]) array, conjunction); case "boolean": return join((boolean[]) array, conjunction); case "float": return join((float[]) array, conjunction); case "double": return join((double[]) array, conjunction); default: throw new UtilException("Unknown primitive type: [{}]", componentTypeName); } } else { return join((Object[]) array, conjunction); } } throw new UtilException(StrUtil.format("[{}] is not a Array!", array.getClass())); }
java
public static String join(Object array, CharSequence conjunction) { if (isArray(array)) { final Class<?> componentType = array.getClass().getComponentType(); if (componentType.isPrimitive()) { final String componentTypeName = componentType.getName(); switch (componentTypeName) { case "long": return join((long[]) array, conjunction); case "int": return join((int[]) array, conjunction); case "short": return join((short[]) array, conjunction); case "char": return join((char[]) array, conjunction); case "byte": return join((byte[]) array, conjunction); case "boolean": return join((boolean[]) array, conjunction); case "float": return join((float[]) array, conjunction); case "double": return join((double[]) array, conjunction); default: throw new UtilException("Unknown primitive type: [{}]", componentTypeName); } } else { return join((Object[]) array, conjunction); } } throw new UtilException(StrUtil.format("[{}] is not a Array!", array.getClass())); }
[ "public", "static", "String", "join", "(", "Object", "array", ",", "CharSequence", "conjunction", ")", "{", "if", "(", "isArray", "(", "array", ")", ")", "{", "final", "Class", "<", "?", ">", "componentType", "=", "array", ".", "getClass", "(", ")", "....
以 conjunction 为分隔符将数组转换为字符串 @param array 数组 @param conjunction 分隔符 @return 连接后的字符串
[ "以", "conjunction", "为分隔符将数组转换为字符串" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L2541-L2571
train
Returns a String containing the elements of the specified array in the specified conjunction.
[ 30522, 2270, 10763, 5164, 3693, 1006, 4874, 9140, 1010, 25869, 3366, 4226, 5897, 9595, 1007, 1063, 2065, 1006, 18061, 11335, 2100, 1006, 9140, 1007, 1007, 1063, 2345, 2465, 1026, 1029, 1028, 6922, 13874, 1027, 9140, 1012, 2131, 26266, 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/net/URLEncoder.java
URLEncoder.encode
public String encode(String path, Charset charset) { int maxBytesPerChar = 10; final StringBuilder rewrittenPath = new StringBuilder(path.length()); ByteArrayOutputStream buf = new ByteArrayOutputStream(maxBytesPerChar); OutputStreamWriter writer = new OutputStreamWriter(buf, charset); int c; for (int i = 0; i < path.length(); i++) { c = path.charAt(i); if (safeCharacters.get(c)) { rewrittenPath.append((char) c); } else if (encodeSpaceAsPlus && c == CharUtil.SPACE) { // 对于空格单独处理 rewrittenPath.append('+'); } else { // convert to external encoding before hex conversion try { writer.write((char) c); writer.flush(); } catch (IOException e) { buf.reset(); continue; } byte[] ba = buf.toByteArray(); for (int j = 0; j < ba.length; j++) { // Converting each byte in the buffer byte toEncode = ba[j]; rewrittenPath.append('%'); HexUtil.appendHex(rewrittenPath, toEncode, false); } buf.reset(); } } return rewrittenPath.toString(); }
java
public String encode(String path, Charset charset) { int maxBytesPerChar = 10; final StringBuilder rewrittenPath = new StringBuilder(path.length()); ByteArrayOutputStream buf = new ByteArrayOutputStream(maxBytesPerChar); OutputStreamWriter writer = new OutputStreamWriter(buf, charset); int c; for (int i = 0; i < path.length(); i++) { c = path.charAt(i); if (safeCharacters.get(c)) { rewrittenPath.append((char) c); } else if (encodeSpaceAsPlus && c == CharUtil.SPACE) { // 对于空格单独处理 rewrittenPath.append('+'); } else { // convert to external encoding before hex conversion try { writer.write((char) c); writer.flush(); } catch (IOException e) { buf.reset(); continue; } byte[] ba = buf.toByteArray(); for (int j = 0; j < ba.length; j++) { // Converting each byte in the buffer byte toEncode = ba[j]; rewrittenPath.append('%'); HexUtil.appendHex(rewrittenPath, toEncode, false); } buf.reset(); } } return rewrittenPath.toString(); }
[ "public", "String", "encode", "(", "String", "path", ",", "Charset", "charset", ")", "{", "int", "maxBytesPerChar", "=", "10", ";", "final", "StringBuilder", "rewrittenPath", "=", "new", "StringBuilder", "(", "path", ".", "length", "(", ")", ")", ";", "Byt...
将URL中的字符串编码为%形式 @param path 需要编码的字符串 @param charset 编码 @return 编码后的字符串
[ "将URL中的字符串编码为%形式" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/net/URLEncoder.java#L196-L232
train
Encodes the given path using the given charset.
[ 30522, 2270, 5164, 4372, 16044, 1006, 5164, 4130, 1010, 25869, 13462, 25869, 13462, 1007, 1063, 20014, 4098, 3762, 4570, 4842, 7507, 2099, 1027, 2184, 1025, 2345, 5164, 8569, 23891, 2099, 2128, 15773, 15069, 1027, 2047, 5164, 8569, 23891, 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...
apache/spark
core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java
UnsafeExternalSorter.getMemoryUsage
private long getMemoryUsage() { long totalPageSize = 0; for (MemoryBlock page : allocatedPages) { totalPageSize += page.size(); } return ((inMemSorter == null) ? 0 : inMemSorter.getMemoryUsage()) + totalPageSize; }
java
private long getMemoryUsage() { long totalPageSize = 0; for (MemoryBlock page : allocatedPages) { totalPageSize += page.size(); } return ((inMemSorter == null) ? 0 : inMemSorter.getMemoryUsage()) + totalPageSize; }
[ "private", "long", "getMemoryUsage", "(", ")", "{", "long", "totalPageSize", "=", "0", ";", "for", "(", "MemoryBlock", "page", ":", "allocatedPages", ")", "{", "totalPageSize", "+=", "page", ".", "size", "(", ")", ";", "}", "return", "(", "(", "inMemSort...
Return the total memory usage of this sorter, including the data pages and the sorter's pointer array.
[ "Return", "the", "total", "memory", "usage", "of", "this", "sorter", "including", "the", "data", "pages", "and", "the", "sorter", "s", "pointer", "array", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java#L242-L248
train
Get the memory usage of the in - memory sorter.
[ 30522, 2797, 2146, 2131, 4168, 5302, 2854, 10383, 3351, 1006, 1007, 1063, 2146, 2561, 13704, 5332, 4371, 1027, 1014, 1025, 2005, 1006, 3638, 30524, 1006, 1007, 1025, 1065, 2709, 1006, 1006, 1999, 4168, 5244, 11589, 2121, 1027, 1027, 19701, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/backpressure/StackTraceSampleCoordinator.java
StackTraceSampleCoordinator.triggerStackTraceSample
@SuppressWarnings("unchecked") public CompletableFuture<StackTraceSample> triggerStackTraceSample( ExecutionVertex[] tasksToSample, int numSamples, Time delayBetweenSamples, int maxStackTraceDepth) { checkNotNull(tasksToSample, "Tasks to sample"); checkArgument(tasksToSample.length >= 1, "No tasks to sample"); checkArgument(numSamples >= 1, "No number of samples"); checkArgument(maxStackTraceDepth >= 0, "Negative maximum stack trace depth"); // Execution IDs of running tasks ExecutionAttemptID[] triggerIds = new ExecutionAttemptID[tasksToSample.length]; Execution[] executions = new Execution[tasksToSample.length]; // Check that all tasks are RUNNING before triggering anything. The // triggering can still fail. for (int i = 0; i < triggerIds.length; i++) { Execution execution = tasksToSample[i].getCurrentExecutionAttempt(); if (execution != null && execution.getState() == ExecutionState.RUNNING) { executions[i] = execution; triggerIds[i] = execution.getAttemptId(); } else { return FutureUtils.completedExceptionally(new IllegalStateException("Task " + tasksToSample[i] .getTaskNameWithSubtaskIndex() + " is not running.")); } } synchronized (lock) { if (isShutDown) { return FutureUtils.completedExceptionally(new IllegalStateException("Shut down")); } final int sampleId = sampleIdCounter++; LOG.debug("Triggering stack trace sample {}", sampleId); final PendingStackTraceSample pending = new PendingStackTraceSample( sampleId, triggerIds); // Discard the sample if it takes too long. We don't send cancel // messages to the task managers, but only wait for the responses // and then ignore them. long expectedDuration = numSamples * delayBetweenSamples.toMilliseconds(); Time timeout = Time.milliseconds(expectedDuration + sampleTimeout); // Add the pending sample before scheduling the discard task to // prevent races with removing it again. pendingSamples.put(sampleId, pending); // Trigger all samples for (Execution execution: executions) { final CompletableFuture<StackTraceSampleResponse> stackTraceSampleFuture = execution.requestStackTraceSample( sampleId, numSamples, delayBetweenSamples, maxStackTraceDepth, timeout); stackTraceSampleFuture.handleAsync( (StackTraceSampleResponse stackTraceSampleResponse, Throwable throwable) -> { if (stackTraceSampleResponse != null) { collectStackTraces( stackTraceSampleResponse.getSampleId(), stackTraceSampleResponse.getExecutionAttemptID(), stackTraceSampleResponse.getSamples()); } else { cancelStackTraceSample(sampleId, throwable); } return null; }, executor); } return pending.getStackTraceSampleFuture(); } }
java
@SuppressWarnings("unchecked") public CompletableFuture<StackTraceSample> triggerStackTraceSample( ExecutionVertex[] tasksToSample, int numSamples, Time delayBetweenSamples, int maxStackTraceDepth) { checkNotNull(tasksToSample, "Tasks to sample"); checkArgument(tasksToSample.length >= 1, "No tasks to sample"); checkArgument(numSamples >= 1, "No number of samples"); checkArgument(maxStackTraceDepth >= 0, "Negative maximum stack trace depth"); // Execution IDs of running tasks ExecutionAttemptID[] triggerIds = new ExecutionAttemptID[tasksToSample.length]; Execution[] executions = new Execution[tasksToSample.length]; // Check that all tasks are RUNNING before triggering anything. The // triggering can still fail. for (int i = 0; i < triggerIds.length; i++) { Execution execution = tasksToSample[i].getCurrentExecutionAttempt(); if (execution != null && execution.getState() == ExecutionState.RUNNING) { executions[i] = execution; triggerIds[i] = execution.getAttemptId(); } else { return FutureUtils.completedExceptionally(new IllegalStateException("Task " + tasksToSample[i] .getTaskNameWithSubtaskIndex() + " is not running.")); } } synchronized (lock) { if (isShutDown) { return FutureUtils.completedExceptionally(new IllegalStateException("Shut down")); } final int sampleId = sampleIdCounter++; LOG.debug("Triggering stack trace sample {}", sampleId); final PendingStackTraceSample pending = new PendingStackTraceSample( sampleId, triggerIds); // Discard the sample if it takes too long. We don't send cancel // messages to the task managers, but only wait for the responses // and then ignore them. long expectedDuration = numSamples * delayBetweenSamples.toMilliseconds(); Time timeout = Time.milliseconds(expectedDuration + sampleTimeout); // Add the pending sample before scheduling the discard task to // prevent races with removing it again. pendingSamples.put(sampleId, pending); // Trigger all samples for (Execution execution: executions) { final CompletableFuture<StackTraceSampleResponse> stackTraceSampleFuture = execution.requestStackTraceSample( sampleId, numSamples, delayBetweenSamples, maxStackTraceDepth, timeout); stackTraceSampleFuture.handleAsync( (StackTraceSampleResponse stackTraceSampleResponse, Throwable throwable) -> { if (stackTraceSampleResponse != null) { collectStackTraces( stackTraceSampleResponse.getSampleId(), stackTraceSampleResponse.getExecutionAttemptID(), stackTraceSampleResponse.getSamples()); } else { cancelStackTraceSample(sampleId, throwable); } return null; }, executor); } return pending.getStackTraceSampleFuture(); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "CompletableFuture", "<", "StackTraceSample", ">", "triggerStackTraceSample", "(", "ExecutionVertex", "[", "]", "tasksToSample", ",", "int", "numSamples", ",", "Time", "delayBetweenSamples", ",", "int", "ma...
Triggers a stack trace sample to all tasks. @param tasksToSample Tasks to sample. @param numSamples Number of stack trace samples to collect. @param delayBetweenSamples Delay between consecutive samples. @param maxStackTraceDepth Maximum depth of the stack trace. 0 indicates no maximum and keeps the complete stack trace. @return A future of the completed stack trace sample
[ "Triggers", "a", "stack", "trace", "sample", "to", "all", "tasks", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/backpressure/StackTraceSampleCoordinator.java#L106-L184
train
Triggers a stack trace sample.
[ 30522, 1030, 16081, 9028, 5582, 2015, 1006, 1000, 4895, 5403, 18141, 1000, 1007, 2270, 4012, 10814, 10880, 11263, 11244, 1026, 9991, 6494, 30524, 4244, 1010, 2051, 8536, 20915, 28394, 3619, 16613, 4244, 1010, 20014, 4098, 9153, 3600, 6494, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBIncrementalCheckpointUtils.java
RocksDBIncrementalCheckpointUtils.beforeThePrefixBytes
public static boolean beforeThePrefixBytes(@Nonnull byte[] bytes, @Nonnull byte[] prefixBytes) { final int prefixLength = prefixBytes.length; for (int i = 0; i < prefixLength; ++i) { int r = (char) prefixBytes[i] - (char) bytes[i]; if (r != 0) { return r > 0; } } return false; }
java
public static boolean beforeThePrefixBytes(@Nonnull byte[] bytes, @Nonnull byte[] prefixBytes) { final int prefixLength = prefixBytes.length; for (int i = 0; i < prefixLength; ++i) { int r = (char) prefixBytes[i] - (char) bytes[i]; if (r != 0) { return r > 0; } } return false; }
[ "public", "static", "boolean", "beforeThePrefixBytes", "(", "@", "Nonnull", "byte", "[", "]", "bytes", ",", "@", "Nonnull", "byte", "[", "]", "prefixBytes", ")", "{", "final", "int", "prefixLength", "=", "prefixBytes", ".", "length", ";", "for", "(", "int"...
check whether the bytes is before prefixBytes in the character order.
[ "check", "whether", "the", "bytes", "is", "before", "prefixBytes", "in", "the", "character", "order", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBIncrementalCheckpointUtils.java#L138-L147
train
Returns true if the bytes are before the prefix bytes.
[ 30522, 2270, 10763, 22017, 20898, 2077, 10760, 28139, 8873, 2595, 3762, 4570, 1006, 1030, 2512, 11231, 3363, 24880, 1031, 1033, 27507, 1010, 1030, 2512, 11231, 3363, 24880, 1031, 1033, 17576, 3762, 4570, 1007, 1063, 2345, 20014, 17576, 7770, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java
ClassUtil.isSimpleTypeOrArray
public static boolean isSimpleTypeOrArray(Class<?> clazz) { if (null == clazz) { return false; } return isSimpleValueType(clazz) || (clazz.isArray() && isSimpleValueType(clazz.getComponentType())); }
java
public static boolean isSimpleTypeOrArray(Class<?> clazz) { if (null == clazz) { return false; } return isSimpleValueType(clazz) || (clazz.isArray() && isSimpleValueType(clazz.getComponentType())); }
[ "public", "static", "boolean", "isSimpleTypeOrArray", "(", "Class", "<", "?", ">", "clazz", ")", "{", "if", "(", "null", "==", "clazz", ")", "{", "return", "false", ";", "}", "return", "isSimpleValueType", "(", "clazz", ")", "||", "(", "clazz", ".", "i...
是否简单值类型或简单值类型的数组<br> 包括:原始类型,、String、other CharSequence, a Number, a Date, a URI, a URL, a Locale or a Class及其数组 @param clazz 属性类 @return 是否简单值类型或简单值类型的数组
[ "是否简单值类型或简单值类型的数组<br", ">", "包括:原始类型", "、String、other", "CharSequence", "a", "Number", "a", "Date", "a", "URI", "a", "URL", "a", "Locale", "or", "a", "Class及其数组" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L733-L738
train
Checks if the given class is a simple type or array type.
[ 30522, 2270, 10763, 22017, 20898, 26354, 5714, 10814, 13874, 6525, 11335, 2100, 1006, 2465, 1026, 1029, 1028, 18856, 10936, 2480, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 18856, 10936, 2480, 1007, 1063, 2709, 6270, 1025, 1065, 2709, 26354, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Graph.java
Graph.runGatherSumApplyIteration
public <M> Graph<K, VV, EV> runGatherSumApplyIteration( org.apache.flink.graph.gsa.GatherFunction<VV, EV, M> gatherFunction, SumFunction<VV, EV, M> sumFunction, ApplyFunction<K, VV, M> applyFunction, int maximumNumberOfIterations, GSAConfiguration parameters) { GatherSumApplyIteration<K, VV, EV, M> iteration = GatherSumApplyIteration.withEdges( edges, gatherFunction, sumFunction, applyFunction, maximumNumberOfIterations); iteration.configure(parameters); DataSet<Vertex<K, VV>> newVertices = vertices.runOperation(iteration); return new Graph<>(newVertices, this.edges, this.context); }
java
public <M> Graph<K, VV, EV> runGatherSumApplyIteration( org.apache.flink.graph.gsa.GatherFunction<VV, EV, M> gatherFunction, SumFunction<VV, EV, M> sumFunction, ApplyFunction<K, VV, M> applyFunction, int maximumNumberOfIterations, GSAConfiguration parameters) { GatherSumApplyIteration<K, VV, EV, M> iteration = GatherSumApplyIteration.withEdges( edges, gatherFunction, sumFunction, applyFunction, maximumNumberOfIterations); iteration.configure(parameters); DataSet<Vertex<K, VV>> newVertices = vertices.runOperation(iteration); return new Graph<>(newVertices, this.edges, this.context); }
[ "public", "<", "M", ">", "Graph", "<", "K", ",", "VV", ",", "EV", ">", "runGatherSumApplyIteration", "(", "org", ".", "apache", ".", "flink", ".", "graph", ".", "gsa", ".", "GatherFunction", "<", "VV", ",", "EV", ",", "M", ">", "gatherFunction", ",",...
Runs a Gather-Sum-Apply iteration on the graph with configuration options. @param gatherFunction the gather function collects information about adjacent vertices and edges @param sumFunction the sum function aggregates the gathered information @param applyFunction the apply function updates the vertex values with the aggregates @param maximumNumberOfIterations maximum number of iterations to perform @param parameters the iteration configuration parameters @param <M> the intermediate type used between gather, sum and apply @return the updated Graph after the gather-sum-apply iteration has converged or after maximumNumberOfIterations.
[ "Runs", "a", "Gather", "-", "Sum", "-", "Apply", "iteration", "on", "the", "graph", "with", "configuration", "options", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L1799-L1812
train
Runs a Gather Sum Apply Iteration on the graph.
[ 30522, 2270, 1026, 1049, 1028, 10629, 1026, 1047, 1010, 1058, 2615, 1010, 23408, 1028, 2448, 20697, 22328, 12248, 9397, 2135, 21646, 3370, 1006, 8917, 1012, 15895, 1012, 13109, 19839, 1012, 10629, 1012, 28177, 2050, 1012, 8587, 11263, 27989, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/types/StringValue.java
StringValue.readString
public static String readString(DataInput in) throws IOException { // the length we read is offset by one, because a length of zero indicates a null value int len = in.readUnsignedByte(); if (len == 0) { return null; } if (len >= HIGH_BIT) { int shift = 7; int curr; len = len & 0x7f; while ((curr = in.readUnsignedByte()) >= HIGH_BIT) { len |= (curr & 0x7f) << shift; shift += 7; } len |= curr << shift; } // subtract one for the null length len -= 1; final char[] data = new char[len]; for (int i = 0; i < len; i++) { int c = in.readUnsignedByte(); if (c < HIGH_BIT) { data[i] = (char) c; } else { int shift = 7; int curr; c = c & 0x7f; while ((curr = in.readUnsignedByte()) >= HIGH_BIT) { c |= (curr & 0x7f) << shift; shift += 7; } c |= curr << shift; data[i] = (char) c; } } return new String(data, 0, len); }
java
public static String readString(DataInput in) throws IOException { // the length we read is offset by one, because a length of zero indicates a null value int len = in.readUnsignedByte(); if (len == 0) { return null; } if (len >= HIGH_BIT) { int shift = 7; int curr; len = len & 0x7f; while ((curr = in.readUnsignedByte()) >= HIGH_BIT) { len |= (curr & 0x7f) << shift; shift += 7; } len |= curr << shift; } // subtract one for the null length len -= 1; final char[] data = new char[len]; for (int i = 0; i < len; i++) { int c = in.readUnsignedByte(); if (c < HIGH_BIT) { data[i] = (char) c; } else { int shift = 7; int curr; c = c & 0x7f; while ((curr = in.readUnsignedByte()) >= HIGH_BIT) { c |= (curr & 0x7f) << shift; shift += 7; } c |= curr << shift; data[i] = (char) c; } } return new String(data, 0, len); }
[ "public", "static", "String", "readString", "(", "DataInput", "in", ")", "throws", "IOException", "{", "// the length we read is offset by one, because a length of zero indicates a null value", "int", "len", "=", "in", ".", "readUnsignedByte", "(", ")", ";", "if", "(", ...
--------------------------------------------------------------------------------------------
[ "--------------------------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/StringValue.java#L744-L786
train
Reads a String from the specified input.
[ 30522, 2270, 10763, 5164, 9631, 18886, 3070, 1006, 2951, 2378, 18780, 1999, 1007, 11618, 22834, 10288, 24422, 1063, 1013, 1013, 1996, 3091, 2057, 3191, 2003, 16396, 2011, 2028, 1010, 2138, 1037, 3091, 1997, 5717, 7127, 1037, 19701, 3643, 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/incubator-shardingsphere
sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/encrypt/ShardingEncryptorEngine.java
ShardingEncryptorEngine.getShardingEncryptor
public Optional<ShardingEncryptor> getShardingEncryptor(final String logicTableName, final String columnName) { for (ShardingEncryptorStrategy each : shardingEncryptorStrategies.values()) { Optional<ShardingEncryptor> result = each.getShardingEncryptor(logicTableName, columnName); if (result.isPresent()) { return result; } } return Optional.absent(); }
java
public Optional<ShardingEncryptor> getShardingEncryptor(final String logicTableName, final String columnName) { for (ShardingEncryptorStrategy each : shardingEncryptorStrategies.values()) { Optional<ShardingEncryptor> result = each.getShardingEncryptor(logicTableName, columnName); if (result.isPresent()) { return result; } } return Optional.absent(); }
[ "public", "Optional", "<", "ShardingEncryptor", ">", "getShardingEncryptor", "(", "final", "String", "logicTableName", ",", "final", "String", "columnName", ")", "{", "for", "(", "ShardingEncryptorStrategy", "each", ":", "shardingEncryptorStrategies", ".", "values", "...
Get sharding encryptor. @param logicTableName logic table name @param columnName column name @return optional of sharding encryptor
[ "Get", "sharding", "encryptor", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/encrypt/ShardingEncryptorEngine.java#L56-L64
train
Get sharding encryptor Optional.
[ 30522, 2270, 11887, 1026, 21146, 17080, 25997, 26775, 22571, 4263, 1028, 4152, 11783, 15542, 26775, 22571, 4263, 1006, 2345, 5164, 7961, 10880, 18442, 1010, 2345, 5164, 5930, 18442, 1007, 1063, 2005, 1006, 21146, 17080, 25997, 26775, 22571, 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...
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java
QrCodeUtil.decode
public static String decode(Image image, boolean isTryHarder, boolean isPureBarcode) { final MultiFormatReader formatReader = new MultiFormatReader(); final LuminanceSource source = new BufferedImageLuminanceSource(ImgUtil.toBufferedImage(image)); final Binarizer binarizer = new HybridBinarizer(source); final BinaryBitmap binaryBitmap = new BinaryBitmap(binarizer); final HashMap<DecodeHintType, Object> hints = new HashMap<>(); hints.put(DecodeHintType.CHARACTER_SET, CharsetUtil.UTF_8); // 优化精度 hints.put(DecodeHintType.TRY_HARDER, Boolean.valueOf(isTryHarder)); // 复杂模式,开启PURE_BARCODE模式 hints.put(DecodeHintType.PURE_BARCODE, Boolean.valueOf(isPureBarcode)); Result result; try { result = formatReader.decode(binaryBitmap, hints); } catch (NotFoundException e) { // 报错尝试关闭复杂模式 hints.remove(DecodeHintType.PURE_BARCODE); try { result = formatReader.decode(binaryBitmap, hints); } catch (NotFoundException e1) { throw new QrCodeException(e1); } } return result.getText(); }
java
public static String decode(Image image, boolean isTryHarder, boolean isPureBarcode) { final MultiFormatReader formatReader = new MultiFormatReader(); final LuminanceSource source = new BufferedImageLuminanceSource(ImgUtil.toBufferedImage(image)); final Binarizer binarizer = new HybridBinarizer(source); final BinaryBitmap binaryBitmap = new BinaryBitmap(binarizer); final HashMap<DecodeHintType, Object> hints = new HashMap<>(); hints.put(DecodeHintType.CHARACTER_SET, CharsetUtil.UTF_8); // 优化精度 hints.put(DecodeHintType.TRY_HARDER, Boolean.valueOf(isTryHarder)); // 复杂模式,开启PURE_BARCODE模式 hints.put(DecodeHintType.PURE_BARCODE, Boolean.valueOf(isPureBarcode)); Result result; try { result = formatReader.decode(binaryBitmap, hints); } catch (NotFoundException e) { // 报错尝试关闭复杂模式 hints.remove(DecodeHintType.PURE_BARCODE); try { result = formatReader.decode(binaryBitmap, hints); } catch (NotFoundException e1) { throw new QrCodeException(e1); } } return result.getText(); }
[ "public", "static", "String", "decode", "(", "Image", "image", ",", "boolean", "isTryHarder", ",", "boolean", "isPureBarcode", ")", "{", "final", "MultiFormatReader", "formatReader", "=", "new", "MultiFormatReader", "(", ")", ";", "final", "LuminanceSource", "sour...
将二维码图片解码为文本 @param image {@link Image} 二维码图片 @param isTryHarder 是否优化精度 @param isPureBarcode 是否使用复杂模式,扫描带logo的二维码设为true @return 解码后的文本 @since 4.3.1
[ "将二维码图片解码为文本" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java#L303-L330
train
Decodes the given image.
[ 30522, 2270, 10763, 5164, 30524, 3401, 3120, 1027, 2047, 17698, 2098, 9581, 12439, 12717, 7229, 9623, 8162, 3401, 1006, 10047, 27920, 4014, 1012, 2000, 8569, 12494, 2098, 9581, 3351, 1006, 3746, 1007, 1007, 1025, 2345, 8026, 8486, 6290, 802...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
resolver-dns/src/main/java/io/netty/resolver/dns/Cache.java
Cache.get
final List<? extends E> get(String hostname) { Entries entries = resolveCache.get(hostname); return entries == null ? null : entries.get(); }
java
final List<? extends E> get(String hostname) { Entries entries = resolveCache.get(hostname); return entries == null ? null : entries.get(); }
[ "final", "List", "<", "?", "extends", "E", ">", "get", "(", "String", "hostname", ")", "{", "Entries", "entries", "=", "resolveCache", ".", "get", "(", "hostname", ")", ";", "return", "entries", "==", "null", "?", "null", ":", "entries", ".", "get", ...
Returns all caches entries for the given hostname.
[ "Returns", "all", "caches", "entries", "for", "the", "given", "hostname", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver-dns/src/main/java/io/netty/resolver/dns/Cache.java#L116-L119
train
Get the domain information for the given hostname.
[ 30522, 2345, 2862, 1026, 1029, 8908, 1041, 1028, 2131, 1006, 5164, 3677, 18442, 1007, 1063, 10445, 10445, 1027, 10663, 3540, 5403, 1012, 2131, 1006, 3677, 18442, 1007, 1025, 2709, 10445, 1027, 1027, 19701, 1029, 19701, 1024, 10445, 1012, 21...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
UTF8String.getBytes
public byte[] getBytes() { // avoid copy if `base` is `byte[]` if (offset == BYTE_ARRAY_OFFSET && base instanceof byte[] && ((byte[]) base).length == numBytes) { return (byte[]) base; } else { byte[] bytes = new byte[numBytes]; copyMemory(base, offset, bytes, BYTE_ARRAY_OFFSET, numBytes); return bytes; } }
java
public byte[] getBytes() { // avoid copy if `base` is `byte[]` if (offset == BYTE_ARRAY_OFFSET && base instanceof byte[] && ((byte[]) base).length == numBytes) { return (byte[]) base; } else { byte[] bytes = new byte[numBytes]; copyMemory(base, offset, bytes, BYTE_ARRAY_OFFSET, numBytes); return bytes; } }
[ "public", "byte", "[", "]", "getBytes", "(", ")", "{", "// avoid copy if `base` is `byte[]`", "if", "(", "offset", "==", "BYTE_ARRAY_OFFSET", "&&", "base", "instanceof", "byte", "[", "]", "&&", "(", "(", "byte", "[", "]", ")", "base", ")", ".", "length", ...
Returns the underline bytes, will be a copy of it if it's part of another array.
[ "Returns", "the", "underline", "bytes", "will", "be", "a", "copy", "of", "it", "if", "it", "s", "part", "of", "another", "array", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L291-L301
train
Gets the bytes.
[ 30522, 2270, 24880, 1031, 1033, 2131, 3762, 4570, 1006, 1007, 1063, 1013, 1013, 4468, 6100, 2065, 1036, 2918, 1036, 2003, 1036, 24880, 1031, 1033, 1036, 2065, 1006, 16396, 1027, 1027, 24880, 1035, 9140, 1035, 16396, 1004, 1004, 2918, 6013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/IOManagerAsync.java
IOManagerAsync.createBlockChannelWriter
@Override public BlockChannelWriter<MemorySegment> createBlockChannelWriter(FileIOChannel.ID channelID, LinkedBlockingQueue<MemorySegment> returnQueue) throws IOException { checkState(!isShutdown.get(), "I/O-Manager is shut down."); return new AsynchronousBlockWriter(channelID, this.writers[channelID.getThreadNum()].requestQueue, returnQueue); }
java
@Override public BlockChannelWriter<MemorySegment> createBlockChannelWriter(FileIOChannel.ID channelID, LinkedBlockingQueue<MemorySegment> returnQueue) throws IOException { checkState(!isShutdown.get(), "I/O-Manager is shut down."); return new AsynchronousBlockWriter(channelID, this.writers[channelID.getThreadNum()].requestQueue, returnQueue); }
[ "@", "Override", "public", "BlockChannelWriter", "<", "MemorySegment", ">", "createBlockChannelWriter", "(", "FileIOChannel", ".", "ID", "channelID", ",", "LinkedBlockingQueue", "<", "MemorySegment", ">", "returnQueue", ")", "throws", "IOException", "{", "checkState", ...
------------------------------------------------------------------------
[ "------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/IOManagerAsync.java#L196-L202
train
Create a block channel writer.
[ 30522, 1030, 2058, 15637, 2270, 3796, 26058, 15994, 1026, 3638, 3366, 21693, 4765, 1028, 3443, 23467, 26058, 15994, 1006, 5371, 3695, 26058, 1012, 8909, 3149, 3593, 1010, 5799, 23467, 2075, 4226, 5657, 1026, 3638, 3366, 21693, 4765, 1028, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
java/client/src/org/openqa/selenium/interactions/Actions.java
Actions.contextClick
public Actions contextClick() { if (isBuildingActions()) { action.addAction(new ContextClickAction(jsonMouse, null)); } return clickInTicks(RIGHT); }
java
public Actions contextClick() { if (isBuildingActions()) { action.addAction(new ContextClickAction(jsonMouse, null)); } return clickInTicks(RIGHT); }
[ "public", "Actions", "contextClick", "(", ")", "{", "if", "(", "isBuildingActions", "(", ")", ")", "{", "action", ".", "addAction", "(", "new", "ContextClickAction", "(", "jsonMouse", ",", "null", ")", ")", ";", "}", "return", "clickInTicks", "(", "RIGHT",...
Performs a context-click at the current mouse location. @return A self reference.
[ "Performs", "a", "context", "-", "click", "at", "the", "current", "mouse", "location", "." ]
7af172729f17b20269c8ca4ea6f788db48616535
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/Actions.java#L432-L438
train
Clicks the context of the current element.
[ 30522, 2270, 4506, 6123, 20464, 6799, 1006, 1007, 1063, 2065, 1006, 2003, 25820, 18908, 8496, 1006, 1007, 1007, 1063, 2895, 1012, 5587, 18908, 3258, 1006, 2047, 30524, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/graph/StreamGraphGenerator.java
StreamGraphGenerator.transformSplit
private <T> Collection<Integer> transformSplit(SplitTransformation<T> split) { StreamTransformation<T> input = split.getInput(); Collection<Integer> resultIds = transform(input); validateSplitTransformation(input); // the recursive transform call might have transformed this already if (alreadyTransformed.containsKey(split)) { return alreadyTransformed.get(split); } for (int inputId : resultIds) { streamGraph.addOutputSelector(inputId, split.getOutputSelector()); } return resultIds; }
java
private <T> Collection<Integer> transformSplit(SplitTransformation<T> split) { StreamTransformation<T> input = split.getInput(); Collection<Integer> resultIds = transform(input); validateSplitTransformation(input); // the recursive transform call might have transformed this already if (alreadyTransformed.containsKey(split)) { return alreadyTransformed.get(split); } for (int inputId : resultIds) { streamGraph.addOutputSelector(inputId, split.getOutputSelector()); } return resultIds; }
[ "private", "<", "T", ">", "Collection", "<", "Integer", ">", "transformSplit", "(", "SplitTransformation", "<", "T", ">", "split", ")", "{", "StreamTransformation", "<", "T", ">", "input", "=", "split", ".", "getInput", "(", ")", ";", "Collection", "<", ...
Transforms a {@code SplitTransformation}. <p>We add the output selector to previously transformed nodes.
[ "Transforms", "a", "{", "@code", "SplitTransformation", "}", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphGenerator.java#L263-L280
train
Transform a split transformation.
[ 30522, 2797, 1026, 1056, 1028, 3074, 1026, 16109, 1028, 21743, 24759, 4183, 1006, 3975, 6494, 3619, 14192, 3370, 1026, 1056, 1028, 3975, 1007, 1063, 5460, 6494, 3619, 14192, 3370, 1026, 1056, 1028, 7953, 1027, 3975, 1012, 2131, 2378, 18780,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-db/src/main/java/cn/hutool/db/nosql/mongo/MongoFactory.java
MongoFactory.getDS
public static MongoDS getDS(Collection<String> groups) { return getDS(groups.toArray(new String[groups.size()])); }
java
public static MongoDS getDS(Collection<String> groups) { return getDS(groups.toArray(new String[groups.size()])); }
[ "public", "static", "MongoDS", "getDS", "(", "Collection", "<", "String", ">", "groups", ")", "{", "return", "getDS", "(", "groups", ".", "toArray", "(", "new", "String", "[", "groups", ".", "size", "(", ")", "]", ")", ")", ";", "}" ]
获取MongoDB数据源<br> @param groups 分组列表 @return MongoDB连接
[ "获取MongoDB数据源<br", ">" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/nosql/mongo/MongoFactory.java#L79-L81
train
Gets the DS object for the given collection of groups.
[ 30522, 2270, 10763, 12256, 3995, 5104, 2131, 5104, 1006, 3074, 1026, 5164, 1028, 2967, 1007, 1063, 2709, 2131, 5104, 1006, 2967, 1012, 2000, 2906, 9447, 1006, 2047, 5164, 1031, 2967, 1012, 2946, 1006, 1007, 1033, 1007, 1007, 1025, 1065, 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...
alibaba/canal
client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/support/ESTemplate.java
ESTemplate.getESDataFromDmlData
public Object getESDataFromDmlData(ESMapping mapping, Map<String, Object> dmlData, Map<String, Object> esFieldData) { SchemaItem schemaItem = mapping.getSchemaItem(); String idFieldName = mapping.get_id() == null ? mapping.getPk() : mapping.get_id(); Object resultIdVal = null; for (FieldItem fieldItem : schemaItem.getSelectFields().values()) { String columnName = fieldItem.getColumnItems().iterator().next().getColumnName(); Object value = getValFromData(mapping, dmlData, fieldItem.getFieldName(), columnName); if (fieldItem.getFieldName().equals(idFieldName)) { resultIdVal = value; } if (!fieldItem.getFieldName().equals(mapping.get_id()) && !mapping.getSkips().contains(fieldItem.getFieldName())) { esFieldData.put(Util.cleanColumn(fieldItem.getFieldName()), value); } } // 添加父子文档关联信息 putRelationData(mapping, schemaItem, dmlData, esFieldData); return resultIdVal; }
java
public Object getESDataFromDmlData(ESMapping mapping, Map<String, Object> dmlData, Map<String, Object> esFieldData) { SchemaItem schemaItem = mapping.getSchemaItem(); String idFieldName = mapping.get_id() == null ? mapping.getPk() : mapping.get_id(); Object resultIdVal = null; for (FieldItem fieldItem : schemaItem.getSelectFields().values()) { String columnName = fieldItem.getColumnItems().iterator().next().getColumnName(); Object value = getValFromData(mapping, dmlData, fieldItem.getFieldName(), columnName); if (fieldItem.getFieldName().equals(idFieldName)) { resultIdVal = value; } if (!fieldItem.getFieldName().equals(mapping.get_id()) && !mapping.getSkips().contains(fieldItem.getFieldName())) { esFieldData.put(Util.cleanColumn(fieldItem.getFieldName()), value); } } // 添加父子文档关联信息 putRelationData(mapping, schemaItem, dmlData, esFieldData); return resultIdVal; }
[ "public", "Object", "getESDataFromDmlData", "(", "ESMapping", "mapping", ",", "Map", "<", "String", ",", "Object", ">", "dmlData", ",", "Map", "<", "String", ",", "Object", ">", "esFieldData", ")", "{", "SchemaItem", "schemaItem", "=", "mapping", ".", "getSc...
将dml的data转换为es的data @param mapping 配置mapping @param dmlData dml data @param esFieldData es data @return 返回 id 值
[ "将dml的data转换为es的data" ]
8f088cddc0755f4350c5aaae95c6e4002d90a40f
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/support/ESTemplate.java#L371-L393
train
Get ES data from DML data.
[ 30522, 2270, 4874, 2131, 2229, 2850, 2696, 19699, 5358, 22117, 15150, 2696, 1006, 9686, 2863, 14853, 12375, 1010, 4949, 1026, 5164, 1010, 4874, 1028, 1040, 19968, 2850, 2696, 1010, 4949, 1026, 5164, 1010, 4874, 1028, 9686, 3790, 2850, 2696,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/ClassScaner.java
ClassScaner.loadClass
private Class<?> loadClass(String className) { Class<?> clazz = null; try { clazz = Class.forName(className, this.initialize, ClassUtil.getClassLoader()); } catch (NoClassDefFoundError e) { // 由于依赖库导致的类无法加载,直接跳过此类 } catch (UnsupportedClassVersionError e) { // 版本导致的不兼容的类,跳过 } catch (Exception e) { throw new RuntimeException(e); // Console.error(e); } return clazz; }
java
private Class<?> loadClass(String className) { Class<?> clazz = null; try { clazz = Class.forName(className, this.initialize, ClassUtil.getClassLoader()); } catch (NoClassDefFoundError e) { // 由于依赖库导致的类无法加载,直接跳过此类 } catch (UnsupportedClassVersionError e) { // 版本导致的不兼容的类,跳过 } catch (Exception e) { throw new RuntimeException(e); // Console.error(e); } return clazz; }
[ "private", "Class", "<", "?", ">", "loadClass", "(", "String", "className", ")", "{", "Class", "<", "?", ">", "clazz", "=", "null", ";", "try", "{", "clazz", "=", "Class", ".", "forName", "(", "className", ",", "this", ".", "initialize", ",", "ClassU...
加载类 @param className 类名 @return 加载的类
[ "加载类" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/ClassScaner.java#L263-L276
train
Load a class from the classpath.
[ 30522, 2797, 2465, 1026, 1029, 1028, 7170, 26266, 1006, 5164, 2465, 18442, 1007, 1063, 2465, 1026, 1029, 1028, 18856, 10936, 2480, 1027, 19701, 1025, 3046, 1063, 18856, 10936, 2480, 1027, 2465, 1012, 2005, 18442, 1006, 2465, 18442, 1010, 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-libraries/flink-gelly/src/main/java/org/apache/flink/graph/spargel/ScatterGatherIteration.java
ScatterGatherIteration.createResult
@Override public DataSet<Vertex<K, VV>> createResult() { if (this.initialVertices == null) { throw new IllegalStateException("The input data set has not been set."); } // prepare some type information TypeInformation<K> keyType = ((TupleTypeInfo<?>) initialVertices.getType()).getTypeAt(0); TypeInformation<Tuple2<K, Message>> messageTypeInfo = new TupleTypeInfo<>(keyType, messageType); // create a graph Graph<K, VV, EV> graph = Graph.fromDataSet(initialVertices, edgesWithValue, initialVertices.getExecutionEnvironment()); // check whether the numVertices option is set and, if so, compute the total number of vertices // and set it within the scatter and gather functions DataSet<LongValue> numberOfVertices = null; if (this.configuration != null && this.configuration.isOptNumVertices()) { try { numberOfVertices = GraphUtils.count(this.initialVertices); } catch (Exception e) { e.printStackTrace(); } } if (this.configuration != null) { scatterFunction.setDirection(this.configuration.getDirection()); } else { scatterFunction.setDirection(EdgeDirection.OUT); } // retrieve the direction in which the updates are made and in which the messages are sent EdgeDirection messagingDirection = scatterFunction.getDirection(); // check whether the degrees option is set and, if so, compute the in and the out degrees and // add them to the vertex value if (this.configuration != null && this.configuration.isOptDegrees()) { return createResultVerticesWithDegrees(graph, messagingDirection, messageTypeInfo, numberOfVertices); } else { return createResultSimpleVertex(messagingDirection, messageTypeInfo, numberOfVertices); } }
java
@Override public DataSet<Vertex<K, VV>> createResult() { if (this.initialVertices == null) { throw new IllegalStateException("The input data set has not been set."); } // prepare some type information TypeInformation<K> keyType = ((TupleTypeInfo<?>) initialVertices.getType()).getTypeAt(0); TypeInformation<Tuple2<K, Message>> messageTypeInfo = new TupleTypeInfo<>(keyType, messageType); // create a graph Graph<K, VV, EV> graph = Graph.fromDataSet(initialVertices, edgesWithValue, initialVertices.getExecutionEnvironment()); // check whether the numVertices option is set and, if so, compute the total number of vertices // and set it within the scatter and gather functions DataSet<LongValue> numberOfVertices = null; if (this.configuration != null && this.configuration.isOptNumVertices()) { try { numberOfVertices = GraphUtils.count(this.initialVertices); } catch (Exception e) { e.printStackTrace(); } } if (this.configuration != null) { scatterFunction.setDirection(this.configuration.getDirection()); } else { scatterFunction.setDirection(EdgeDirection.OUT); } // retrieve the direction in which the updates are made and in which the messages are sent EdgeDirection messagingDirection = scatterFunction.getDirection(); // check whether the degrees option is set and, if so, compute the in and the out degrees and // add them to the vertex value if (this.configuration != null && this.configuration.isOptDegrees()) { return createResultVerticesWithDegrees(graph, messagingDirection, messageTypeInfo, numberOfVertices); } else { return createResultSimpleVertex(messagingDirection, messageTypeInfo, numberOfVertices); } }
[ "@", "Override", "public", "DataSet", "<", "Vertex", "<", "K", ",", "VV", ">", ">", "createResult", "(", ")", "{", "if", "(", "this", ".", "initialVertices", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"The input data set has not ...
Creates the operator that represents this scatter-gather graph computation. @return The operator that represents this scatter-gather graph computation.
[ "Creates", "the", "operator", "that", "represents", "this", "scatter", "-", "gather", "graph", "computation", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/spargel/ScatterGatherIteration.java#L137-L179
train
Creates the result data set.
[ 30522, 1030, 2058, 15637, 2270, 2951, 13462, 1026, 19449, 1026, 1047, 1010, 1058, 2615, 1028, 1028, 3443, 6072, 11314, 1006, 1007, 1063, 2065, 1006, 2023, 1012, 3988, 16874, 23522, 1027, 1027, 19701, 1007, 1063, 5466, 2047, 6206, 9153, 1738...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.getReader
public static ImageReader getReader(String type) { final Iterator<ImageReader> iterator = ImageIO.getImageReadersByFormatName(type); if (iterator.hasNext()) { return iterator.next(); } return null; }
java
public static ImageReader getReader(String type) { final Iterator<ImageReader> iterator = ImageIO.getImageReadersByFormatName(type); if (iterator.hasNext()) { return iterator.next(); } return null; }
[ "public", "static", "ImageReader", "getReader", "(", "String", "type", ")", "{", "final", "Iterator", "<", "ImageReader", ">", "iterator", "=", "ImageIO", ".", "getImageReadersByFormatName", "(", "type", ")", ";", "if", "(", "iterator", ".", "hasNext", "(", ...
获得{@link ImageReader} @param type 图片文件类型,例如 "jpeg" 或 "tiff" @return {@link ImageReader}
[ "获得", "{", "@link", "ImageReader", "}" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1508-L1514
train
Gets the ImageReader for the specified format name.
[ 30522, 2270, 10763, 3746, 16416, 4063, 2131, 16416, 4063, 1006, 5164, 2828, 1007, 1063, 2345, 2009, 6906, 4263, 1026, 3746, 16416, 4063, 1028, 2009, 6906, 4263, 1027, 3746, 3695, 1012, 2131, 9581, 4590, 13775, 2545, 3762, 14192, 4017, 18442...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java
ClassUtil.getPublicMethod
public static Method getPublicMethod(Class<?> clazz, String methodName, Class<?>... paramTypes) throws SecurityException { return ReflectUtil.getPublicMethod(clazz, methodName, paramTypes); }
java
public static Method getPublicMethod(Class<?> clazz, String methodName, Class<?>... paramTypes) throws SecurityException { return ReflectUtil.getPublicMethod(clazz, methodName, paramTypes); }
[ "public", "static", "Method", "getPublicMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "methodName", ",", "Class", "<", "?", ">", "...", "paramTypes", ")", "throws", "SecurityException", "{", "return", "ReflectUtil", ".", "getPublicMethod", "(",...
查找指定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/ClassUtil.java#L294-L296
train
Get a public method from a 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...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlot.java
TaskSlot.markFree
public boolean markFree() { if (isEmpty()) { state = TaskSlotState.FREE; this.jobId = null; this.allocationId = null; return true; } else { return false; } }
java
public boolean markFree() { if (isEmpty()) { state = TaskSlotState.FREE; this.jobId = null; this.allocationId = null; return true; } else { return false; } }
[ "public", "boolean", "markFree", "(", ")", "{", "if", "(", "isEmpty", "(", ")", ")", "{", "state", "=", "TaskSlotState", ".", "FREE", ";", "this", ".", "jobId", "=", "null", ";", "this", ".", "allocationId", "=", "null", ";", "return", "true", ";", ...
Mark the slot as free. A slot can only be marked as free if it's empty. @return True if the new state is free; otherwise false
[ "Mark", "the", "slot", "as", "free", ".", "A", "slot", "can", "only", "be", "marked", "as", "free", "if", "it", "s", "empty", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlot.java#L268-L278
train
Mark this slot as free.
[ 30522, 2270, 22017, 20898, 2928, 23301, 1006, 1007, 1063, 2065, 1006, 2003, 6633, 13876, 2100, 1006, 1007, 1007, 1063, 2110, 1027, 8518, 10994, 9153, 2618, 1012, 2489, 1025, 2023, 1012, 3105, 3593, 1027, 19701, 1025, 2023, 1012, 16169, 3593...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/savepoint/SavepointSerializers.java
SavepointSerializers.getSerializer
@SuppressWarnings("unchecked") public static <T extends Savepoint> SavepointSerializer<T> getSerializer(T savepoint) { Preconditions.checkNotNull(savepoint, "Savepoint"); SavepointSerializer<T> serializer = (SavepointSerializer<T>) SERIALIZERS.get(savepoint.getVersion()); if (serializer != null) { return serializer; } else { throw new IllegalArgumentException("Unknown savepoint version " + savepoint.getVersion() + "."); } }
java
@SuppressWarnings("unchecked") public static <T extends Savepoint> SavepointSerializer<T> getSerializer(T savepoint) { Preconditions.checkNotNull(savepoint, "Savepoint"); SavepointSerializer<T> serializer = (SavepointSerializer<T>) SERIALIZERS.get(savepoint.getVersion()); if (serializer != null) { return serializer; } else { throw new IllegalArgumentException("Unknown savepoint version " + savepoint.getVersion() + "."); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", "extends", "Savepoint", ">", "SavepointSerializer", "<", "T", ">", "getSerializer", "(", "T", "savepoint", ")", "{", "Preconditions", ".", "checkNotNull", "(", "savepoint", ",", ...
Returns the {@link SavepointSerializer} for the given savepoint. @param savepoint Savepoint to get serializer for @param <T> Type of savepoint @return Savepoint serializer for the savepoint @throws IllegalArgumentException If unknown savepoint version
[ "Returns", "the", "{", "@link", "SavepointSerializer", "}", "for", "the", "given", "savepoint", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/savepoint/SavepointSerializers.java#L56-L65
train
Gets the serializer for the given savepoint.
[ 30522, 1030, 16081, 9028, 5582, 2015, 1006, 1000, 4895, 5403, 18141, 1000, 1007, 2270, 10763, 1026, 1056, 8908, 3828, 8400, 1028, 3828, 26521, 11610, 28863, 1026, 1056, 1028, 4152, 11610, 28863, 1006, 1056, 3828, 8400, 1007, 1063, 3653, 866...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java
HttpHeaders.setDateHeader
@Deprecated public static void setDateHeader(HttpMessage message, String name, Iterable<Date> values) { message.headers().set(name, values); }
java
@Deprecated public static void setDateHeader(HttpMessage message, String name, Iterable<Date> values) { message.headers().set(name, values); }
[ "@", "Deprecated", "public", "static", "void", "setDateHeader", "(", "HttpMessage", "message", ",", "String", "name", ",", "Iterable", "<", "Date", ">", "values", ")", "{", "message", ".", "headers", "(", ")", ".", "set", "(", "name", ",", "values", ")",...
@deprecated Use {@link #set(CharSequence, Iterable)} instead. @see #setDateHeader(HttpMessage, CharSequence, Iterable)
[ "@deprecated", "Use", "{", "@link", "#set", "(", "CharSequence", "Iterable", ")", "}", "instead", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L914-L917
train
Sets a date header.
[ 30522, 1030, 2139, 28139, 12921, 2270, 10763, 11675, 2275, 13701, 4974, 2121, 1006, 8299, 7834, 3736, 3351, 4471, 1010, 5164, 2171, 1010, 2009, 6906, 3468, 1026, 3058, 1028, 5300, 1007, 1063, 4471, 1012, 20346, 2015, 1006, 1007, 1012, 2275,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.filter
public static <T> List<T> filter(List<T> list, Filter<T> filter) { if (null == list || null == filter) { return list; } final List<T> list2 = (list instanceof LinkedList) ? new LinkedList<T>() : new ArrayList<T>(list.size()); for (T t : list) { if (filter.accept(t)) { list2.add(t); } } return list2; }
java
public static <T> List<T> filter(List<T> list, Filter<T> filter) { if (null == list || null == filter) { return list; } final List<T> list2 = (list instanceof LinkedList) ? new LinkedList<T>() : new ArrayList<T>(list.size()); for (T t : list) { if (filter.accept(t)) { list2.add(t); } } return list2; }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "filter", "(", "List", "<", "T", ">", "list", ",", "Filter", "<", "T", ">", "filter", ")", "{", "if", "(", "null", "==", "list", "||", "null", "==", "filter", ")", "{", "return", "list",...
过滤<br> 过滤过程通过传入的Filter实现来过滤返回需要的元素内容,这个Filter实现可以实现以下功能: <pre> 1、过滤出需要的对象,{@link Filter#accept(Object)}方法返回true的对象将被加入结果集合中 </pre> @param <T> 集合元素类型 @param list 集合 @param filter 过滤器 @return 过滤后的数组 @since 4.1.8
[ "过滤<br", ">", "过滤过程通过传入的Filter实现来过滤返回需要的元素内容,这个Filter实现可以实现以下功能:" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1039-L1050
train
Returns a new list that contains only those objects that match the given filter.
[ 30522, 2270, 10763, 1026, 1056, 1028, 2862, 1026, 1056, 1028, 11307, 1006, 2862, 1026, 1056, 1028, 2862, 1010, 11307, 1026, 1056, 1028, 11307, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 2862, 1064, 1064, 19701, 1027, 1027, 11307, 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/spark
sql/hive-thriftserver/src/gen/java/org/apache/hive/service/cli/thrift/TOpenSessionReq.java
TOpenSessionReq.isSet
public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case CLIENT_PROTOCOL: return isSetClient_protocol(); case USERNAME: return isSetUsername(); case PASSWORD: return isSetPassword(); case CONFIGURATION: return isSetConfiguration(); } throw new IllegalStateException(); }
java
public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case CLIENT_PROTOCOL: return isSetClient_protocol(); case USERNAME: return isSetUsername(); case PASSWORD: return isSetPassword(); case CONFIGURATION: return isSetConfiguration(); } throw new IllegalStateException(); }
[ "public", "boolean", "isSet", "(", "_Fields", "field", ")", "{", "if", "(", "field", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "switch", "(", "field", ")", "{", "case", "CLIENT_PROTOCOL", ":", "return", "isSe...
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/TOpenSessionReq.java#L365-L381
train
Checks if field is set to a value of a CRAsCTYPE
[ 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, 7396...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/mail/InternalMailUtil.java
InternalMailUtil.parseAddressFromStrs
public static InternetAddress[] parseAddressFromStrs(String[] addrStrs, Charset charset) { final List<InternetAddress> resultList = new ArrayList<>(addrStrs.length); InternetAddress[] addrs; for (int i = 0; i < addrStrs.length; i++) { addrs = parseAddress(addrStrs[i], charset); if(ArrayUtil.isNotEmpty(addrs)) { for(int j = 0 ; j < addrs.length; j++) { resultList.add(addrs[j]); } } } return resultList.toArray(new InternetAddress[resultList.size()]); }
java
public static InternetAddress[] parseAddressFromStrs(String[] addrStrs, Charset charset) { final List<InternetAddress> resultList = new ArrayList<>(addrStrs.length); InternetAddress[] addrs; for (int i = 0; i < addrStrs.length; i++) { addrs = parseAddress(addrStrs[i], charset); if(ArrayUtil.isNotEmpty(addrs)) { for(int j = 0 ; j < addrs.length; j++) { resultList.add(addrs[j]); } } } return resultList.toArray(new InternetAddress[resultList.size()]); }
[ "public", "static", "InternetAddress", "[", "]", "parseAddressFromStrs", "(", "String", "[", "]", "addrStrs", ",", "Charset", "charset", ")", "{", "final", "List", "<", "InternetAddress", ">", "resultList", "=", "new", "ArrayList", "<>", "(", "addrStrs", ".", ...
将多个字符串邮件地址转为{@link InternetAddress}列表<br> 单个字符串地址可以是多个地址合并的字符串 @param addrStrs 地址数组 @param charset 编码(主要用于中文用户名的编码) @return 地址数组 @since 4.0.3
[ "将多个字符串邮件地址转为", "{", "@link", "InternetAddress", "}", "列表<br", ">", "单个字符串地址可以是多个地址合并的字符串" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/mail/InternalMailUtil.java#L30-L42
train
Parses an array of strings containing a list of IPv4 addresses.
[ 30522, 2270, 10763, 4274, 4215, 16200, 4757, 1031, 1033, 11968, 17310, 14141, 8303, 19699, 22225, 16344, 2015, 1006, 5164, 1031, 1033, 5587, 12096, 2869, 1010, 25869, 13462, 25869, 13462, 1007, 1063, 2345, 2862, 1026, 4274, 4215, 16200, 4757,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/query/QueryableStateUtils.java
QueryableStateUtils.createKvStateClientProxy
public static KvStateClientProxy createKvStateClientProxy( final InetAddress address, final Iterator<Integer> ports, final int eventLoopThreads, final int queryThreads, final KvStateRequestStats stats) { Preconditions.checkNotNull(address, "address"); Preconditions.checkNotNull(stats, "stats"); Preconditions.checkArgument(eventLoopThreads >= 1); Preconditions.checkArgument(queryThreads >= 1); try { String classname = "org.apache.flink.queryablestate.client.proxy.KvStateClientProxyImpl"; Class<? extends KvStateClientProxy> clazz = Class.forName(classname).asSubclass(KvStateClientProxy.class); Constructor<? extends KvStateClientProxy> constructor = clazz.getConstructor( InetAddress.class, Iterator.class, Integer.class, Integer.class, KvStateRequestStats.class); return constructor.newInstance(address, ports, eventLoopThreads, queryThreads, stats); } catch (ClassNotFoundException e) { final String msg = "Could not load Queryable State Client Proxy. " + ERROR_MESSAGE_ON_LOAD_FAILURE; if (LOG.isDebugEnabled()) { LOG.debug(msg + " Cause: " + e.getMessage()); } else { LOG.info(msg); } return null; } catch (InvocationTargetException e) { LOG.error("Queryable State Client Proxy could not be created: ", e.getTargetException()); return null; } catch (Throwable t) { LOG.error("Failed to instantiate the Queryable State Client Proxy.", t); return null; } }
java
public static KvStateClientProxy createKvStateClientProxy( final InetAddress address, final Iterator<Integer> ports, final int eventLoopThreads, final int queryThreads, final KvStateRequestStats stats) { Preconditions.checkNotNull(address, "address"); Preconditions.checkNotNull(stats, "stats"); Preconditions.checkArgument(eventLoopThreads >= 1); Preconditions.checkArgument(queryThreads >= 1); try { String classname = "org.apache.flink.queryablestate.client.proxy.KvStateClientProxyImpl"; Class<? extends KvStateClientProxy> clazz = Class.forName(classname).asSubclass(KvStateClientProxy.class); Constructor<? extends KvStateClientProxy> constructor = clazz.getConstructor( InetAddress.class, Iterator.class, Integer.class, Integer.class, KvStateRequestStats.class); return constructor.newInstance(address, ports, eventLoopThreads, queryThreads, stats); } catch (ClassNotFoundException e) { final String msg = "Could not load Queryable State Client Proxy. " + ERROR_MESSAGE_ON_LOAD_FAILURE; if (LOG.isDebugEnabled()) { LOG.debug(msg + " Cause: " + e.getMessage()); } else { LOG.info(msg); } return null; } catch (InvocationTargetException e) { LOG.error("Queryable State Client Proxy could not be created: ", e.getTargetException()); return null; } catch (Throwable t) { LOG.error("Failed to instantiate the Queryable State Client Proxy.", t); return null; } }
[ "public", "static", "KvStateClientProxy", "createKvStateClientProxy", "(", "final", "InetAddress", "address", ",", "final", "Iterator", "<", "Integer", ">", "ports", ",", "final", "int", "eventLoopThreads", ",", "final", "int", "queryThreads", ",", "final", "KvState...
Initializes the {@link KvStateClientProxy client proxy} responsible for receiving requests from the external (to the cluster) client and forwarding them internally. @param address the address to bind to. @param ports the range of ports the proxy will attempt to listen to (see {@link org.apache.flink.configuration.QueryableStateOptions#PROXY_PORT_RANGE QueryableStateOptions.PROXY_PORT_RANGE}). @param eventLoopThreads the number of threads to be used to process incoming requests. @param queryThreads the number of threads to be used to send the actual state. @param stats statistics to be gathered about the incoming requests. @return the {@link KvStateClientProxy client proxy}.
[ "Initializes", "the", "{", "@link", "KvStateClientProxy", "client", "proxy", "}", "responsible", "for", "receiving", "requests", "from", "the", "external", "(", "to", "the", "cluster", ")", "client", "and", "forwarding", "them", "internally", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/query/QueryableStateUtils.java#L56-L94
train
Creates a new Queryable State Client Proxy.
[ 30522, 2270, 10763, 24888, 9153, 26557, 8751, 3372, 21572, 18037, 3443, 2243, 15088, 12259, 20464, 11638, 21572, 18037, 1006, 2345, 1999, 12928, 14141, 8303, 4769, 1010, 2345, 2009, 6906, 4263, 1026, 16109, 1028, 8831, 1010, 2345, 20014, 2724...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
common/network-common/src/main/java/org/apache/spark/network/server/OneForOneStreamManager.java
OneForOneStreamManager.parseStreamChunkId
public static Pair<Long, Integer> parseStreamChunkId(String streamChunkId) { String[] array = streamChunkId.split("_"); assert array.length == 2: "Stream id and chunk index should be specified."; long streamId = Long.valueOf(array[0]); int chunkIndex = Integer.valueOf(array[1]); return ImmutablePair.of(streamId, chunkIndex); }
java
public static Pair<Long, Integer> parseStreamChunkId(String streamChunkId) { String[] array = streamChunkId.split("_"); assert array.length == 2: "Stream id and chunk index should be specified."; long streamId = Long.valueOf(array[0]); int chunkIndex = Integer.valueOf(array[1]); return ImmutablePair.of(streamId, chunkIndex); }
[ "public", "static", "Pair", "<", "Long", ",", "Integer", ">", "parseStreamChunkId", "(", "String", "streamChunkId", ")", "{", "String", "[", "]", "array", "=", "streamChunkId", ".", "split", "(", "\"_\"", ")", ";", "assert", "array", ".", "length", "==", ...
stream.
[ "stream", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/server/OneForOneStreamManager.java#L109-L116
train
Parses a chunk id.
[ 30522, 2270, 10763, 3940, 1026, 2146, 1010, 16109, 1028, 11968, 8583, 25379, 20760, 8950, 3593, 1006, 5164, 5460, 20760, 8950, 3593, 1007, 1063, 5164, 1031, 1033, 9140, 1027, 5460, 20760, 8950, 3593, 1012, 3975, 1006, 1000, 1035, 1000, 1007...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java
CommandBuilderUtils.firstNonEmptyValue
static String firstNonEmptyValue(String key, Map<?, ?>... maps) { for (Map<?, ?> map : maps) { String value = (String) map.get(key); if (!isEmpty(value)) { return value; } } return null; }
java
static String firstNonEmptyValue(String key, Map<?, ?>... maps) { for (Map<?, ?> map : maps) { String value = (String) map.get(key); if (!isEmpty(value)) { return value; } } return null; }
[ "static", "String", "firstNonEmptyValue", "(", "String", "key", ",", "Map", "<", "?", ",", "?", ">", "...", "maps", ")", "{", "for", "(", "Map", "<", "?", ",", "?", ">", "map", ":", "maps", ")", "{", "String", "value", "=", "(", "String", ")", ...
Returns the first non-empty value mapped to the given key in the given maps, or null otherwise.
[ "Returns", "the", "first", "non", "-", "empty", "value", "mapped", "to", "the", "given", "key", "in", "the", "given", "maps", "or", "null", "otherwise", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java#L70-L78
train
Get the first non - empty value from the map.
[ 30522, 10763, 5164, 2034, 8540, 6633, 13876, 2100, 10175, 5657, 1006, 5164, 3145, 1010, 4949, 1026, 1029, 1010, 1029, 1028, 1012, 1012, 1012, 7341, 1007, 1063, 2005, 1006, 4949, 1026, 1029, 1010, 1029, 1028, 4949, 1024, 7341, 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
handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslContext.java
ReferenceCountedOpenSslContext.providerFor
static OpenSslKeyMaterialProvider providerFor(KeyManagerFactory factory, String password) { if (factory instanceof OpenSslX509KeyManagerFactory) { return ((OpenSslX509KeyManagerFactory) factory).newProvider(); } X509KeyManager keyManager = chooseX509KeyManager(factory.getKeyManagers()); if (factory instanceof OpenSslCachingX509KeyManagerFactory) { // The user explicit used OpenSslCachingX509KeyManagerFactory which signals us that its fine to cache. return new OpenSslCachingKeyMaterialProvider(keyManager, password); } // We can not be sure if the material may change at runtime so we will not cache it. return new OpenSslKeyMaterialProvider(keyManager, password); }
java
static OpenSslKeyMaterialProvider providerFor(KeyManagerFactory factory, String password) { if (factory instanceof OpenSslX509KeyManagerFactory) { return ((OpenSslX509KeyManagerFactory) factory).newProvider(); } X509KeyManager keyManager = chooseX509KeyManager(factory.getKeyManagers()); if (factory instanceof OpenSslCachingX509KeyManagerFactory) { // The user explicit used OpenSslCachingX509KeyManagerFactory which signals us that its fine to cache. return new OpenSslCachingKeyMaterialProvider(keyManager, password); } // We can not be sure if the material may change at runtime so we will not cache it. return new OpenSslKeyMaterialProvider(keyManager, password); }
[ "static", "OpenSslKeyMaterialProvider", "providerFor", "(", "KeyManagerFactory", "factory", ",", "String", "password", ")", "{", "if", "(", "factory", "instanceof", "OpenSslX509KeyManagerFactory", ")", "{", "return", "(", "(", "OpenSslX509KeyManagerFactory", ")", "facto...
Returns the {@link OpenSslKeyMaterialProvider} that should be used for OpenSSL. Depending on the given {@link KeyManagerFactory} this may cache the {@link OpenSslKeyMaterial} for better performance if it can ensure that the same material is always returned for the same alias.
[ "Returns", "the", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslContext.java#L899-L911
train
Returns a new OpenSslKeyMaterialProvider based on the key manager factory.
[ 30522, 10763, 7480, 14540, 14839, 8585, 14482, 21572, 17258, 2121, 10802, 29278, 1006, 3145, 24805, 4590, 21450, 4713, 1010, 5164, 20786, 1007, 1063, 2065, 1006, 4713, 6013, 11253, 7480, 14540, 2595, 12376, 2683, 14839, 24805, 4590, 21450, 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-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java
JarWriter.writeEntry
@Override public void writeEntry(String entryName, InputStream inputStream) throws IOException { JarArchiveEntry entry = new JarArchiveEntry(entryName); writeEntry(entry, new InputStreamEntryWriter(inputStream, true)); }
java
@Override public void writeEntry(String entryName, InputStream inputStream) throws IOException { JarArchiveEntry entry = new JarArchiveEntry(entryName); writeEntry(entry, new InputStreamEntryWriter(inputStream, true)); }
[ "@", "Override", "public", "void", "writeEntry", "(", "String", "entryName", ",", "InputStream", "inputStream", ")", "throws", "IOException", "{", "JarArchiveEntry", "entry", "=", "new", "JarArchiveEntry", "(", "entryName", ")", ";", "writeEntry", "(", "entry", ...
Writes an entry. The {@code inputStream} is closed once the entry has been written @param entryName the name of the entry @param inputStream the stream from which the entry's data can be read @throws IOException if the write fails
[ "Writes", "an", "entry", ".", "The", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java#L167-L171
train
Write an entry to the jar archive.
[ 30522, 1030, 2058, 15637, 2270, 11675, 4339, 4765, 2854, 1006, 5164, 4443, 18442, 1010, 20407, 25379, 20407, 25379, 1007, 11618, 22834, 10288, 24422, 1063, 15723, 2906, 5428, 3726, 4765, 2854, 4443, 1027, 2047, 15723, 2906, 5428, 3726, 4765, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.fetch
private int fetch(Node parent, List<Node> siblings) { if (error_ < 0) return 0; int prev = 0; for (int i = parent.left; i < parent.right; i++) { if ((length != null ? length[i] : key.get(i).length()) < parent.depth) continue; String tmp = key.get(i); int cur = 0; if ((length != null ? length[i] : tmp.length()) != parent.depth) cur = (int) tmp.charAt(parent.depth) + 1; if (prev > cur) { error_ = -3; return 0; } if (cur != prev || siblings.size() == 0) { Node tmp_node = new Node(); tmp_node.depth = parent.depth + 1; tmp_node.code = cur; tmp_node.left = i; if (siblings.size() != 0) siblings.get(siblings.size() - 1).right = i; siblings.add(tmp_node); } prev = cur; } if (siblings.size() != 0) siblings.get(siblings.size() - 1).right = parent.right; return siblings.size(); }
java
private int fetch(Node parent, List<Node> siblings) { if (error_ < 0) return 0; int prev = 0; for (int i = parent.left; i < parent.right; i++) { if ((length != null ? length[i] : key.get(i).length()) < parent.depth) continue; String tmp = key.get(i); int cur = 0; if ((length != null ? length[i] : tmp.length()) != parent.depth) cur = (int) tmp.charAt(parent.depth) + 1; if (prev > cur) { error_ = -3; return 0; } if (cur != prev || siblings.size() == 0) { Node tmp_node = new Node(); tmp_node.depth = parent.depth + 1; tmp_node.code = cur; tmp_node.left = i; if (siblings.size() != 0) siblings.get(siblings.size() - 1).right = i; siblings.add(tmp_node); } prev = cur; } if (siblings.size() != 0) siblings.get(siblings.size() - 1).right = parent.right; return siblings.size(); }
[ "private", "int", "fetch", "(", "Node", "parent", ",", "List", "<", "Node", ">", "siblings", ")", "{", "if", "(", "error_", "<", "0", ")", "return", "0", ";", "int", "prev", "=", "0", ";", "for", "(", "int", "i", "=", "parent", ".", "left", ";"...
获取直接相连的子节点 @param parent 父节点 @param siblings (子)兄弟节点 @return 兄弟节点个数
[ "获取直接相连的子节点" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java#L110-L153
train
Fetch the count of nodes from a node.
[ 30522, 2797, 20014, 18584, 1006, 13045, 6687, 1010, 2862, 1026, 13045, 1028, 9504, 1007, 1063, 2065, 1006, 7561, 1035, 1026, 1014, 1007, 2709, 1014, 1025, 20014, 3653, 2615, 1027, 1014, 1025, 2005, 1006, 20014, 1045, 1027, 6687, 1012, 2187,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.getInt
public int getInt(String name, int defaultValue) { String valueString = getTrimmed(name); if (valueString == null) return defaultValue; String hexString = getHexDigits(valueString); if (hexString != null) { return Integer.parseInt(hexString, 16); } return Integer.parseInt(valueString); }
java
public int getInt(String name, int defaultValue) { String valueString = getTrimmed(name); if (valueString == null) return defaultValue; String hexString = getHexDigits(valueString); if (hexString != null) { return Integer.parseInt(hexString, 16); } return Integer.parseInt(valueString); }
[ "public", "int", "getInt", "(", "String", "name", ",", "int", "defaultValue", ")", "{", "String", "valueString", "=", "getTrimmed", "(", "name", ")", ";", "if", "(", "valueString", "==", "null", ")", "return", "defaultValue", ";", "String", "hexString", "=...
Get the value of the <code>name</code> property as an <code>int</code>. If no such property exists, the provided default value is returned, or if the specified value is not a valid <code>int</code>, then an error is thrown. @param name property name. @param defaultValue default value. @throws NumberFormatException when the value is invalid @return property value as an <code>int</code>, or <code>defaultValue</code>.
[ "Get", "the", "value", "of", "the", "<code", ">", "name<", "/", "code", ">", "property", "as", "an", "<code", ">", "int<", "/", "code", ">", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L1353-L1362
train
Returns the value of the specified attribute as an int.
[ 30522, 2270, 20014, 2131, 18447, 1006, 5164, 2171, 1010, 20014, 12398, 10175, 5657, 1007, 1063, 5164, 5300, 18886, 3070, 1027, 2131, 18886, 20058, 2094, 1006, 2171, 1007, 1025, 2065, 1006, 5300, 18886, 3070, 1027, 1027, 19701, 1007, 2709, 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...
alibaba/canal
driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/client/BinlogDumpCommandPacket.java
BinlogDumpCommandPacket.toBytes
public byte[] toBytes() throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); // 0. write command number out.write(getCommand()); // 1. write 4 bytes bin-log position to start at ByteHelper.writeUnsignedIntLittleEndian(binlogPosition, out); // 2. write 2 bytes bin-log flags int binlog_flags = 0; binlog_flags |= BINLOG_SEND_ANNOTATE_ROWS_EVENT; out.write(binlog_flags); out.write(0x00); // 3. write 4 bytes server id of the slave ByteHelper.writeUnsignedIntLittleEndian(this.slaveServerId, out); // 4. write bin-log file name if necessary if (StringUtils.isNotEmpty(this.binlogFileName)) { out.write(this.binlogFileName.getBytes()); } return out.toByteArray(); }
java
public byte[] toBytes() throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); // 0. write command number out.write(getCommand()); // 1. write 4 bytes bin-log position to start at ByteHelper.writeUnsignedIntLittleEndian(binlogPosition, out); // 2. write 2 bytes bin-log flags int binlog_flags = 0; binlog_flags |= BINLOG_SEND_ANNOTATE_ROWS_EVENT; out.write(binlog_flags); out.write(0x00); // 3. write 4 bytes server id of the slave ByteHelper.writeUnsignedIntLittleEndian(this.slaveServerId, out); // 4. write bin-log file name if necessary if (StringUtils.isNotEmpty(this.binlogFileName)) { out.write(this.binlogFileName.getBytes()); } return out.toByteArray(); }
[ "public", "byte", "[", "]", "toBytes", "(", ")", "throws", "IOException", "{", "ByteArrayOutputStream", "out", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "// 0. write command number", "out", ".", "write", "(", "getCommand", "(", ")", ")", ";", "// 1. ...
<pre> Bytes Name ----- ---- 1 command n arg -------------------------------------------------------- Bytes Name ----- ---- 4 binlog position to start at (little endian) 2 binlog flags (currently not used; always 0) 4 server_id of the slave (little endian) n binlog file name (optional) </pre>
[ "<pre", ">", "Bytes", "Name", "-----", "----", "1", "command", "n", "arg", "--------------------------------------------------------", "Bytes", "Name", "-----", "----", "4", "binlog", "position", "to", "start", "at", "(", "little", "endian", ")", "2", "binlog", ...
8f088cddc0755f4350c5aaae95c6e4002d90a40f
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/client/BinlogDumpCommandPacket.java#L50-L68
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, 1012, 4339, 3094, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/util/SegmentsUtil.java
SegmentsUtil.setLong
public static void setLong(MemorySegment[] segments, int offset, long value) { if (inFirstSegment(segments, offset, 8)) { segments[0].putLong(offset, value); } else { setLongMultiSegments(segments, offset, value); } }
java
public static void setLong(MemorySegment[] segments, int offset, long value) { if (inFirstSegment(segments, offset, 8)) { segments[0].putLong(offset, value); } else { setLongMultiSegments(segments, offset, value); } }
[ "public", "static", "void", "setLong", "(", "MemorySegment", "[", "]", "segments", ",", "int", "offset", ",", "long", "value", ")", "{", "if", "(", "inFirstSegment", "(", "segments", ",", "offset", ",", "8", ")", ")", "{", "segments", "[", "0", "]", ...
set long from segments. @param segments target segments. @param offset value offset.
[ "set", "long", "from", "segments", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L755-L761
train
set long from segments.
[ 30522, 2270, 10763, 11675, 2275, 10052, 1006, 3638, 3366, 21693, 4765, 1031, 1033, 9214, 1010, 20014, 16396, 1010, 2146, 3643, 1007, 1063, 2065, 1006, 1999, 8873, 12096, 3366, 21693, 4765, 1006, 9214, 1010, 16396, 1010, 1022, 1007, 1007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java
Graph.reduceOnNeighbors
public DataSet<Tuple2<K, VV>> reduceOnNeighbors(ReduceNeighborsFunction<VV> reduceNeighborsFunction, EdgeDirection direction) throws IllegalArgumentException { switch (direction) { case IN: // create <vertex-source value> pairs final DataSet<Tuple2<K, VV>> verticesWithSourceNeighborValues = edges .join(this.vertices).where(0).equalTo(0) .with(new ProjectVertexWithNeighborValueJoin<>(1)) .withForwardedFieldsFirst("f1->f0").name("Vertex with in-neighbor value"); return verticesWithSourceNeighborValues.groupBy(0).reduce(new ApplyNeighborReduceFunction<>( reduceNeighborsFunction)).name("Neighbors function"); case OUT: // create <vertex-target value> pairs DataSet<Tuple2<K, VV>> verticesWithTargetNeighborValues = edges .join(this.vertices).where(1).equalTo(0) .with(new ProjectVertexWithNeighborValueJoin<>(0)) .withForwardedFieldsFirst("f0").name("Vertex with out-neighbor value"); return verticesWithTargetNeighborValues.groupBy(0).reduce(new ApplyNeighborReduceFunction<>( reduceNeighborsFunction)).name("Neighbors function"); case ALL: // create <vertex-neighbor value> pairs DataSet<Tuple2<K, VV>> verticesWithNeighborValues = edges .flatMap(new EmitOneEdgeWithNeighborPerNode<>()) .join(this.vertices).where(1).equalTo(0) .with(new ProjectNeighborValue<>()).name("Vertex with neighbor value"); return verticesWithNeighborValues.groupBy(0).reduce(new ApplyNeighborReduceFunction<>( reduceNeighborsFunction)).name("Neighbors function"); default: throw new IllegalArgumentException("Illegal edge direction"); } }
java
public DataSet<Tuple2<K, VV>> reduceOnNeighbors(ReduceNeighborsFunction<VV> reduceNeighborsFunction, EdgeDirection direction) throws IllegalArgumentException { switch (direction) { case IN: // create <vertex-source value> pairs final DataSet<Tuple2<K, VV>> verticesWithSourceNeighborValues = edges .join(this.vertices).where(0).equalTo(0) .with(new ProjectVertexWithNeighborValueJoin<>(1)) .withForwardedFieldsFirst("f1->f0").name("Vertex with in-neighbor value"); return verticesWithSourceNeighborValues.groupBy(0).reduce(new ApplyNeighborReduceFunction<>( reduceNeighborsFunction)).name("Neighbors function"); case OUT: // create <vertex-target value> pairs DataSet<Tuple2<K, VV>> verticesWithTargetNeighborValues = edges .join(this.vertices).where(1).equalTo(0) .with(new ProjectVertexWithNeighborValueJoin<>(0)) .withForwardedFieldsFirst("f0").name("Vertex with out-neighbor value"); return verticesWithTargetNeighborValues.groupBy(0).reduce(new ApplyNeighborReduceFunction<>( reduceNeighborsFunction)).name("Neighbors function"); case ALL: // create <vertex-neighbor value> pairs DataSet<Tuple2<K, VV>> verticesWithNeighborValues = edges .flatMap(new EmitOneEdgeWithNeighborPerNode<>()) .join(this.vertices).where(1).equalTo(0) .with(new ProjectNeighborValue<>()).name("Vertex with neighbor value"); return verticesWithNeighborValues.groupBy(0).reduce(new ApplyNeighborReduceFunction<>( reduceNeighborsFunction)).name("Neighbors function"); default: throw new IllegalArgumentException("Illegal edge direction"); } }
[ "public", "DataSet", "<", "Tuple2", "<", "K", ",", "VV", ">", ">", "reduceOnNeighbors", "(", "ReduceNeighborsFunction", "<", "VV", ">", "reduceNeighborsFunction", ",", "EdgeDirection", "direction", ")", "throws", "IllegalArgumentException", "{", "switch", "(", "di...
Compute a reduce transformation over the neighbors' vertex values of each vertex. For each vertex, the transformation consecutively calls a {@link ReduceNeighborsFunction} until only a single value for each vertex remains. The {@link ReduceNeighborsFunction} combines a pair of neighbor vertex values into one new value of the same type. @param reduceNeighborsFunction the reduce function to apply to the neighbors of each vertex. @param direction the edge direction (in-, out-, all-) @return a Dataset of Tuple2, with one tuple per vertex. The first field of the Tuple2 is the vertex ID and the second field is the aggregate value computed by the provided {@link ReduceNeighborsFunction}. @throws IllegalArgumentException
[ "Compute", "a", "reduce", "transformation", "over", "the", "neighbors", "vertex", "values", "of", "each", "vertex", ".", "For", "each", "vertex", "the", "transformation", "consecutively", "calls", "a", "{", "@link", "ReduceNeighborsFunction", "}", "until", "only",...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L2242-L2273
train
Reduce the data set on neighbors of this graph.
[ 30522, 2270, 2951, 13462, 1026, 10722, 10814, 2475, 1026, 1047, 1010, 1058, 2615, 1028, 1028, 5547, 18256, 18377, 12821, 2015, 1006, 5547, 2638, 18377, 12821, 22747, 4609, 7542, 1026, 1058, 2615, 1028, 5547, 2638, 18377, 12821, 22747, 4609, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java
SecureUtil.signParams
public static String signParams(DigestAlgorithm digestAlgorithm, Map<?, ?> params) { return signParams(digestAlgorithm, params, StrUtil.EMPTY, StrUtil.EMPTY, true); }
java
public static String signParams(DigestAlgorithm digestAlgorithm, Map<?, ?> params) { return signParams(digestAlgorithm, params, StrUtil.EMPTY, StrUtil.EMPTY, true); }
[ "public", "static", "String", "signParams", "(", "DigestAlgorithm", "digestAlgorithm", ",", "Map", "<", "?", ",", "?", ">", "params", ")", "{", "return", "signParams", "(", "digestAlgorithm", ",", "params", ",", "StrUtil", ".", "EMPTY", ",", "StrUtil", ".", ...
对参数做签名<br> 参数签名为对Map参数按照key的顺序排序后拼接为字符串,然后根据提供的签名算法生成签名字符串<br> 拼接后的字符串键值对之间无符号,键值对之间无符号,忽略null值 @param digestAlgorithm 摘要算法 @param params 参数 @return 签名 @since 4.0.1
[ "对参数做签名<br", ">", "参数签名为对Map参数按照key的顺序排序后拼接为字符串,然后根据提供的签名算法生成签名字符串<br", ">", "拼接后的字符串键值对之间无符号,键值对之间无符号,忽略null值" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L904-L906
train
Creates a signature string from the given parameters.
[ 30522, 2270, 10763, 5164, 3696, 28689, 5244, 1006, 17886, 2389, 20255, 8939, 2213, 17886, 2389, 20255, 8939, 2213, 1010, 4949, 1026, 1029, 1010, 1029, 1028, 11498, 5244, 1007, 1063, 2709, 3696, 28689, 5244, 1006, 17886, 2389, 20255, 8939, 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...
apache/flink
flink-core/src/main/java/org/apache/flink/core/fs/FileSystemSafetyNet.java
FileSystemSafetyNet.wrapWithSafetyNetWhenActivated
static FileSystem wrapWithSafetyNetWhenActivated(FileSystem fs) { SafetyNetCloseableRegistry reg = REGISTRIES.get(); return reg != null ? new SafetyNetWrapperFileSystem(fs, reg) : fs; }
java
static FileSystem wrapWithSafetyNetWhenActivated(FileSystem fs) { SafetyNetCloseableRegistry reg = REGISTRIES.get(); return reg != null ? new SafetyNetWrapperFileSystem(fs, reg) : fs; }
[ "static", "FileSystem", "wrapWithSafetyNetWhenActivated", "(", "FileSystem", "fs", ")", "{", "SafetyNetCloseableRegistry", "reg", "=", "REGISTRIES", ".", "get", "(", ")", ";", "return", "reg", "!=", "null", "?", "new", "SafetyNetWrapperFileSystem", "(", "fs", ",",...
------------------------------------------------------------------------
[ "------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/fs/FileSystemSafetyNet.java#L131-L134
train
Wrap a FileSystem with a SafetyNetFileSystem when the system is activated.
[ 30522, 10763, 6764, 27268, 6633, 10236, 24415, 3736, 7959, 25680, 3388, 2860, 10222, 18908, 21967, 1006, 6764, 27268, 6633, 1042, 2015, 1007, 1063, 3808, 7159, 20464, 9232, 3085, 2890, 24063, 2854, 19723, 1027, 20588, 21011, 1012, 2131, 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-cron/src/main/java/cn/hutool/cron/pattern/CronPatternUtil.java
CronPatternUtil.matchedDates
public static List<Date> matchedDates(CronPattern pattern, long start, long end, int count, boolean isMatchSecond) { Assert.isTrue(start < end, "Start date is later than end !"); final List<Date> result = new ArrayList<>(count); long step = isMatchSecond ? DateUnit.SECOND.getMillis() : DateUnit.MINUTE.getMillis(); for (long i = start; i < end; i += step) { if (pattern.match(i, isMatchSecond)) { result.add(DateUtil.date(i)); if (result.size() >= count) { break; } } } return result; }
java
public static List<Date> matchedDates(CronPattern pattern, long start, long end, int count, boolean isMatchSecond) { Assert.isTrue(start < end, "Start date is later than end !"); final List<Date> result = new ArrayList<>(count); long step = isMatchSecond ? DateUnit.SECOND.getMillis() : DateUnit.MINUTE.getMillis(); for (long i = start; i < end; i += step) { if (pattern.match(i, isMatchSecond)) { result.add(DateUtil.date(i)); if (result.size() >= count) { break; } } } return result; }
[ "public", "static", "List", "<", "Date", ">", "matchedDates", "(", "CronPattern", "pattern", ",", "long", "start", ",", "long", "end", ",", "int", "count", ",", "boolean", "isMatchSecond", ")", "{", "Assert", ".", "isTrue", "(", "start", "<", "end", ",",...
列举指定日期范围内所有匹配表达式的日期 @param pattern 表达式 @param start 起始时间 @param end 结束时间 @param count 列举数量 @param isMatchSecond 是否匹配秒 @return 日期列表
[ "列举指定日期范围内所有匹配表达式的日期" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/pattern/CronPatternUtil.java#L70-L84
train
Returns a list of dates that match the specified cron pattern.
[ 30522, 2270, 10763, 2862, 1026, 3058, 1028, 10349, 27122, 1006, 13675, 2239, 4502, 12079, 2078, 5418, 1010, 2146, 2707, 1010, 2146, 2203, 1010, 20014, 4175, 1010, 22017, 20898, 2003, 18900, 18069, 8586, 15422, 1007, 1063, 20865, 1012, 21541, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/TypeDescriptor.java
TypeDescriptor.getColumnSize
public Integer getColumnSize() { if (type.isNumericType()) { return getPrecision(); } switch (type) { case STRING_TYPE: case BINARY_TYPE: return Integer.MAX_VALUE; case CHAR_TYPE: case VARCHAR_TYPE: return typeQualifiers.getCharacterMaximumLength(); case DATE_TYPE: return 10; case TIMESTAMP_TYPE: return 29; default: return null; } }
java
public Integer getColumnSize() { if (type.isNumericType()) { return getPrecision(); } switch (type) { case STRING_TYPE: case BINARY_TYPE: return Integer.MAX_VALUE; case CHAR_TYPE: case VARCHAR_TYPE: return typeQualifiers.getCharacterMaximumLength(); case DATE_TYPE: return 10; case TIMESTAMP_TYPE: return 29; default: return null; } }
[ "public", "Integer", "getColumnSize", "(", ")", "{", "if", "(", "type", ".", "isNumericType", "(", ")", ")", "{", "return", "getPrecision", "(", ")", ";", "}", "switch", "(", "type", ")", "{", "case", "STRING_TYPE", ":", "case", "BINARY_TYPE", ":", "re...
The column size for this type. For numeric data this is the maximum precision. For character data this is the length in characters. For datetime types this is the length in characters of the String representation (assuming the maximum allowed precision of the fractional seconds component). For binary data this is the length in bytes. Null is returned for data types where the column size is not applicable.
[ "The", "column", "size", "for", "this", "type", ".", "For", "numeric", "data", "this", "is", "the", "maximum", "precision", ".", "For", "character", "data", "this", "is", "the", "length", "in", "characters", ".", "For", "datetime", "types", "this", "is", ...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/TypeDescriptor.java#L103-L121
train
Get the column size of the column.
[ 30522, 2270, 16109, 2131, 25778, 2819, 3619, 4697, 1006, 1007, 1063, 2065, 1006, 2828, 1012, 3475, 17897, 7277, 13874, 1006, 1007, 1007, 1063, 2709, 2131, 28139, 28472, 1006, 1007, 1025, 1065, 6942, 1006, 2828, 1007, 1063, 2553, 5164, 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-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/RowComparator.java
RowComparator.getFlatComparator
@Override public void getFlatComparator(List<TypeComparator> flatComparators) { for (NullAwareComparator<Object> c : comparators) { Collections.addAll(flatComparators, c.getFlatComparators()); } }
java
@Override public void getFlatComparator(List<TypeComparator> flatComparators) { for (NullAwareComparator<Object> c : comparators) { Collections.addAll(flatComparators, c.getFlatComparators()); } }
[ "@", "Override", "public", "void", "getFlatComparator", "(", "List", "<", "TypeComparator", ">", "flatComparators", ")", "{", "for", "(", "NullAwareComparator", "<", "Object", ">", "c", ":", "comparators", ")", "{", "Collections", ".", "addAll", "(", "flatComp...
--------------------------------------------------------------------------------------------
[ "--------------------------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/RowComparator.java#L157-L162
train
Gets the flat comparators.
[ 30522, 1030, 2058, 15637, 2270, 11675, 2131, 10258, 4017, 9006, 28689, 4263, 1006, 2862, 1026, 2828, 9006, 28689, 4263, 1028, 4257, 9006, 28689, 6591, 1007, 1063, 2005, 1006, 19701, 10830, 2890, 9006, 28689, 4263, 1026, 4874, 1028, 1039, 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-captcha/src/main/java/cn/hutool/captcha/CaptchaUtil.java
CaptchaUtil.createShearCaptcha
public static ShearCaptcha createShearCaptcha(int width, int height, int codeCount, int thickness) { return new ShearCaptcha(width, height, codeCount, thickness); }
java
public static ShearCaptcha createShearCaptcha(int width, int height, int codeCount, int thickness) { return new ShearCaptcha(width, height, codeCount, thickness); }
[ "public", "static", "ShearCaptcha", "createShearCaptcha", "(", "int", "width", ",", "int", "height", ",", "int", "codeCount", ",", "int", "thickness", ")", "{", "return", "new", "ShearCaptcha", "(", "width", ",", "height", ",", "codeCount", ",", "thickness", ...
创建扭曲干扰的验证码,默认5位验证码 @param width 图片宽 @param height 图片高 @param codeCount 字符个数 @param thickness 干扰线宽度 @return {@link ShearCaptcha} @since 3.3.0
[ "创建扭曲干扰的验证码,默认5位验证码" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-captcha/src/main/java/cn/hutool/captcha/CaptchaUtil.java#L83-L85
train
Create a ShearCaptcha object.
[ 30522, 2270, 10763, 18330, 17695, 10649, 2050, 9005, 26560, 17695, 10649, 2050, 1006, 20014, 9381, 1010, 20014, 4578, 1010, 20014, 3642, 3597, 16671, 1010, 20014, 14983, 1007, 1063, 2709, 2047, 18330, 17695, 10649, 2050, 1006, 9381, 1010, 457...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/IOManager.java
IOManager.shutdown
public void shutdown() { // remove all of our temp directories for (File path : paths) { try { if (path != null) { if (path.exists()) { FileUtils.deleteDirectory(path); LOG.info("I/O manager removed spill file directory {}", path.getAbsolutePath()); } } } catch (Throwable t) { LOG.error("IOManager failed to properly clean up temp file directory: " + path, t); } } }
java
public void shutdown() { // remove all of our temp directories for (File path : paths) { try { if (path != null) { if (path.exists()) { FileUtils.deleteDirectory(path); LOG.info("I/O manager removed spill file directory {}", path.getAbsolutePath()); } } } catch (Throwable t) { LOG.error("IOManager failed to properly clean up temp file directory: " + path, t); } } }
[ "public", "void", "shutdown", "(", ")", "{", "// remove all of our temp directories", "for", "(", "File", "path", ":", "paths", ")", "{", "try", "{", "if", "(", "path", "!=", "null", ")", "{", "if", "(", "path", ".", "exists", "(", ")", ")", "{", "Fi...
Close method, marks the I/O manager as closed and removed all temporary files.
[ "Close", "method", "marks", "the", "I", "/", "O", "manager", "as", "closed", "and", "removed", "all", "temporary", "files", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/IOManager.java#L87-L101
train
Shutdown the IO manager.
[ 30522, 2270, 30524, 1007, 1063, 1013, 1013, 6366, 2035, 1997, 2256, 8915, 8737, 2472, 3111, 2005, 1006, 5371, 4130, 1024, 10425, 1007, 1063, 3046, 1063, 2065, 1006, 4130, 999, 1027, 19701, 1007, 1063, 2065, 1006, 4130, 1012, 6526, 1006, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec-dns/src/main/java/io/netty/handler/codec/dns/DnsOpCode.java
DnsOpCode.valueOf
public static DnsOpCode valueOf(int b) { switch (b) { case 0x00: return QUERY; case 0x01: return IQUERY; case 0x02: return STATUS; case 0x04: return NOTIFY; case 0x05: return UPDATE; } return new DnsOpCode(b); }
java
public static DnsOpCode valueOf(int b) { switch (b) { case 0x00: return QUERY; case 0x01: return IQUERY; case 0x02: return STATUS; case 0x04: return NOTIFY; case 0x05: return UPDATE; } return new DnsOpCode(b); }
[ "public", "static", "DnsOpCode", "valueOf", "(", "int", "b", ")", "{", "switch", "(", "b", ")", "{", "case", "0x00", ":", "return", "QUERY", ";", "case", "0x01", ":", "return", "IQUERY", ";", "case", "0x02", ":", "return", "STATUS", ";", "case", "0x0...
Returns the {@link DnsOpCode} instance of the specified byte value.
[ "Returns", "the", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-dns/src/main/java/io/netty/handler/codec/dns/DnsOpCode.java#L56-L71
train
Gets the DnsOpCode from the given integer.
[ 30522, 2270, 10763, 1040, 3619, 7361, 16044, 3643, 11253, 1006, 20014, 1038, 1007, 1063, 6942, 1006, 1038, 1007, 1063, 2553, 1014, 2595, 8889, 1024, 2709, 23032, 1025, 2553, 1014, 2595, 24096, 1024, 2709, 26264, 13094, 2100, 1025, 2553, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...