repo
stringclasses
11 values
path
stringlengths
41
234
func_name
stringlengths
5
78
original_string
stringlengths
71
14.1k
language
stringclasses
1 value
code
stringlengths
71
14.1k
code_tokens
listlengths
22
2.65k
docstring
stringlengths
2
5.35k
docstring_tokens
listlengths
1
369
sha
stringclasses
11 values
url
stringlengths
129
339
partition
stringclasses
1 value
summary
stringlengths
7
175
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/instance/InstanceManager.java
InstanceManager.unregisterTaskManager
public void unregisterTaskManager(InstanceID instanceId, boolean terminated){ Instance instance = registeredHostsById.get(instanceId); if (instance != null){ registeredHostsById.remove(instance.getId()); registeredHostsByResource.remove(instance.getTaskManagerID()); if (terminated) { deadHosts.add(instance.getTaskManagerID()); } instance.markDead(); totalNumberOfAliveTaskSlots -= instance.getTotalNumberOfSlots(); notifyDeadInstance(instance); LOG.info( "Unregistered task manager " + instance.getTaskManagerLocation().addressString() + ". Number of registered task managers " + getNumberOfRegisteredTaskManagers() + ". Number of available slots " + getTotalNumberOfSlots() + "."); } else { LOG.warn("Tried to unregister instance {} but it is not registered.", instanceId); } }
java
public void unregisterTaskManager(InstanceID instanceId, boolean terminated){ Instance instance = registeredHostsById.get(instanceId); if (instance != null){ registeredHostsById.remove(instance.getId()); registeredHostsByResource.remove(instance.getTaskManagerID()); if (terminated) { deadHosts.add(instance.getTaskManagerID()); } instance.markDead(); totalNumberOfAliveTaskSlots -= instance.getTotalNumberOfSlots(); notifyDeadInstance(instance); LOG.info( "Unregistered task manager " + instance.getTaskManagerLocation().addressString() + ". Number of registered task managers " + getNumberOfRegisteredTaskManagers() + ". Number of available slots " + getTotalNumberOfSlots() + "."); } else { LOG.warn("Tried to unregister instance {} but it is not registered.", instanceId); } }
[ "public", "void", "unregisterTaskManager", "(", "InstanceID", "instanceId", ",", "boolean", "terminated", ")", "{", "Instance", "instance", "=", "registeredHostsById", ".", "get", "(", "instanceId", ")", ";", "if", "(", "instance", "!=", "null", ")", "{", "reg...
Unregisters the TaskManager with the given instance id. Unregistering means to mark the given instance as dead and notify {@link InstanceListener} about the dead instance. @param instanceId TaskManager which is about to be marked dead.
[ "Unregisters", "the", "TaskManager", "with", "the", "given", "instance", "id", ".", "Unregistering", "means", "to", "mark", "the", "given", "instance", "as", "dead", "and", "notify", "{", "@link", "InstanceListener", "}", "about", "the", "dead", "instance", "....
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/instance/InstanceManager.java#L201-L225
train
Unregister a task manager instance.
[ 30522, 2270, 11675, 4895, 2890, 24063, 8743, 19895, 24805, 4590, 1006, 6013, 3593, 6013, 3593, 1010, 22017, 20898, 12527, 1007, 1063, 6013, 6013, 1027, 5068, 15006, 3215, 3762, 3593, 1012, 2131, 1006, 6013, 3593, 1007, 1025, 2065, 1006, 601...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPid.java
ApplicationPid.write
public void write(File file) throws IOException { Assert.state(this.pid != null, "No PID available"); createParentFolder(file); if (file.exists()) { assertCanOverwrite(file); } try (FileWriter writer = new FileWriter(file)) { writer.append(this.pid); } }
java
public void write(File file) throws IOException { Assert.state(this.pid != null, "No PID available"); createParentFolder(file); if (file.exists()) { assertCanOverwrite(file); } try (FileWriter writer = new FileWriter(file)) { writer.append(this.pid); } }
[ "public", "void", "write", "(", "File", "file", ")", "throws", "IOException", "{", "Assert", ".", "state", "(", "this", ".", "pid", "!=", "null", ",", "\"No PID available\"", ")", ";", "createParentFolder", "(", "file", ")", ";", "if", "(", "file", ".", ...
Write the PID to the specified file. @param file the PID file @throws IllegalStateException if no PID is available. @throws IOException if the file cannot be written
[ "Write", "the", "PID", "to", "the", "specified", "file", "." ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPid.java#L90-L99
train
Write the PID to the specified file.
[ 30522, 2270, 11675, 4339, 1006, 5371, 5371, 1007, 11618, 22834, 10288, 24422, 1063, 20865, 1012, 2110, 1006, 2023, 1012, 14255, 2094, 999, 1027, 19701, 1010, 1000, 2053, 14255, 2094, 2800, 1000, 1007, 1025, 3443, 19362, 4765, 10371, 2121, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
networknt/light-4j
metrics/src/main/java/io/dropwizard/metrics/InstrumentedExecutorService.java
InstrumentedExecutorService.submit
@Nonnull @Override public <T> Future<T> submit(@Nonnull Callable<T> task) { submitted.mark(); try { return delegate.submit(new InstrumentedCallable<>(task)); } catch (RejectedExecutionException e) { rejected.mark(); throw e; } }
java
@Nonnull @Override public <T> Future<T> submit(@Nonnull Callable<T> task) { submitted.mark(); try { return delegate.submit(new InstrumentedCallable<>(task)); } catch (RejectedExecutionException e) { rejected.mark(); throw e; } }
[ "@", "Nonnull", "@", "Override", "public", "<", "T", ">", "Future", "<", "T", ">", "submit", "(", "@", "Nonnull", "Callable", "<", "T", ">", "task", ")", "{", "submitted", ".", "mark", "(", ")", ";", "try", "{", "return", "delegate", ".", "submit",...
{@inheritDoc}
[ "{" ]
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/InstrumentedExecutorService.java#L118-L128
train
Submits a Callable to the delegate thread.
[ 30522, 1030, 2512, 11231, 3363, 1030, 2058, 15637, 2270, 1026, 1056, 1028, 2925, 1026, 1056, 1028, 12040, 1006, 1030, 2512, 11231, 3363, 2655, 3085, 1026, 1056, 1028, 4708, 1007, 1063, 7864, 1012, 2928, 1006, 1007, 1025, 3046, 1063, 2709, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
java/client/src/org/openqa/selenium/Proxy.java
Proxy.setFtpProxy
public Proxy setFtpProxy(String ftpProxy) { verifyProxyTypeCompatibility(ProxyType.MANUAL); this.proxyType = ProxyType.MANUAL; this.ftpProxy = ftpProxy; return this; }
java
public Proxy setFtpProxy(String ftpProxy) { verifyProxyTypeCompatibility(ProxyType.MANUAL); this.proxyType = ProxyType.MANUAL; this.ftpProxy = ftpProxy; return this; }
[ "public", "Proxy", "setFtpProxy", "(", "String", "ftpProxy", ")", "{", "verifyProxyTypeCompatibility", "(", "ProxyType", ".", "MANUAL", ")", ";", "this", ".", "proxyType", "=", "ProxyType", ".", "MANUAL", ";", "this", ".", "ftpProxy", "=", "ftpProxy", ";", "...
Specify which proxy to use for FTP connections. @param ftpProxy the proxy host, expected format is <code>hostname.com:1234</code> @return reference to self
[ "Specify", "which", "proxy", "to", "use", "for", "FTP", "connections", "." ]
7af172729f17b20269c8ca4ea6f788db48616535
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/Proxy.java#L217-L222
train
Sets the FTP proxy.
[ 30522, 2270, 24540, 2275, 6199, 9397, 3217, 18037, 1006, 5164, 3027, 9397, 3217, 18037, 1007, 1063, 20410, 21572, 18037, 13874, 9006, 24952, 8553, 1006, 24540, 13874, 1012, 6410, 1007, 1025, 2023, 1012, 24540, 13874, 1027, 24540, 13874, 1012,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannel.java
EpollSocketChannel.tcpInfo
public EpollTcpInfo tcpInfo(EpollTcpInfo info) { try { socket.getTcpInfo(info); return info; } catch (IOException e) { throw new ChannelException(e); } }
java
public EpollTcpInfo tcpInfo(EpollTcpInfo info) { try { socket.getTcpInfo(info); return info; } catch (IOException e) { throw new ChannelException(e); } }
[ "public", "EpollTcpInfo", "tcpInfo", "(", "EpollTcpInfo", "info", ")", "{", "try", "{", "socket", ".", "getTcpInfo", "(", "info", ")", ";", "return", "info", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "ChannelException", "(", "...
Updates and returns the {@code TCP_INFO} for the current socket. See <a href="http://linux.die.net/man/7/tcp">man 7 tcp</a>.
[ "Updates", "and", "returns", "the", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannel.java#L79-L86
train
Get the tcp info.
[ 30522, 2270, 4958, 14511, 13535, 8091, 14876, 22975, 8091, 14876, 1006, 4958, 14511, 13535, 8091, 14876, 18558, 1007, 1063, 3046, 1063, 22278, 1012, 2131, 13535, 8091, 14876, 1006, 18558, 1007, 1025, 2709, 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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-filesystems/flink-hadoop-fs/src/main/java/org/apache/flink/runtime/util/HadoopUtils.java
HadoopUtils.hasHDFSDelegationToken
public static boolean hasHDFSDelegationToken() throws Exception { UserGroupInformation loginUser = UserGroupInformation.getCurrentUser(); Collection<Token<? extends TokenIdentifier>> usrTok = loginUser.getTokens(); for (Token<? extends TokenIdentifier> token : usrTok) { if (token.getKind().equals(HDFS_DELEGATION_TOKEN_KIND)) { return true; } } return false; }
java
public static boolean hasHDFSDelegationToken() throws Exception { UserGroupInformation loginUser = UserGroupInformation.getCurrentUser(); Collection<Token<? extends TokenIdentifier>> usrTok = loginUser.getTokens(); for (Token<? extends TokenIdentifier> token : usrTok) { if (token.getKind().equals(HDFS_DELEGATION_TOKEN_KIND)) { return true; } } return false; }
[ "public", "static", "boolean", "hasHDFSDelegationToken", "(", ")", "throws", "Exception", "{", "UserGroupInformation", "loginUser", "=", "UserGroupInformation", ".", "getCurrentUser", "(", ")", ";", "Collection", "<", "Token", "<", "?", "extends", "TokenIdentifier", ...
Indicates whether the current user has an HDFS delegation token.
[ "Indicates", "whether", "the", "current", "user", "has", "an", "HDFS", "delegation", "token", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-hadoop-fs/src/main/java/org/apache/flink/runtime/util/HadoopUtils.java#L118-L127
train
Checks if the current user has a delegation token.
[ 30522, 2270, 10763, 22017, 20898, 23325, 20952, 16150, 12260, 12540, 18715, 2368, 1006, 1007, 11618, 6453, 1063, 5310, 17058, 2378, 14192, 3370, 8833, 13429, 2121, 1027, 5310, 17058, 2378, 14192, 3370, 1012, 2131, 10841, 14343, 3372, 20330, 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-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java
TaskSlotTable.allocateSlot
public boolean allocateSlot(int index, JobID jobId, AllocationID allocationId, Time slotTimeout) { checkInit(); TaskSlot taskSlot = taskSlots.get(index); boolean result = taskSlot.allocate(jobId, allocationId); if (result) { // update the allocation id to task slot map allocationIDTaskSlotMap.put(allocationId, taskSlot); // register a timeout for this slot since it's in state allocated timerService.registerTimeout(allocationId, slotTimeout.getSize(), slotTimeout.getUnit()); // add this slot to the set of job slots Set<AllocationID> slots = slotsPerJob.get(jobId); if (slots == null) { slots = new HashSet<>(4); slotsPerJob.put(jobId, slots); } slots.add(allocationId); } return result; }
java
public boolean allocateSlot(int index, JobID jobId, AllocationID allocationId, Time slotTimeout) { checkInit(); TaskSlot taskSlot = taskSlots.get(index); boolean result = taskSlot.allocate(jobId, allocationId); if (result) { // update the allocation id to task slot map allocationIDTaskSlotMap.put(allocationId, taskSlot); // register a timeout for this slot since it's in state allocated timerService.registerTimeout(allocationId, slotTimeout.getSize(), slotTimeout.getUnit()); // add this slot to the set of job slots Set<AllocationID> slots = slotsPerJob.get(jobId); if (slots == null) { slots = new HashSet<>(4); slotsPerJob.put(jobId, slots); } slots.add(allocationId); } return result; }
[ "public", "boolean", "allocateSlot", "(", "int", "index", ",", "JobID", "jobId", ",", "AllocationID", "allocationId", ",", "Time", "slotTimeout", ")", "{", "checkInit", "(", ")", ";", "TaskSlot", "taskSlot", "=", "taskSlots", ".", "get", "(", "index", ")", ...
Allocate the slot with the given index for the given job and allocation id. Returns true if the slot could be allocated. Otherwise it returns false. @param index of the task slot to allocate @param jobId to allocate the task slot for @param allocationId identifying the allocation @param slotTimeout until the slot times out @return True if the task slot could be allocated; otherwise false
[ "Allocate", "the", "slot", "with", "the", "given", "index", "for", "the", "given", "job", "and", "allocation", "id", ".", "Returns", "true", "if", "the", "slot", "could", "be", "allocated", ".", "Otherwise", "it", "returns", "false", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java#L193-L219
train
Allocate a slot.
[ 30522, 2270, 22017, 20898, 2035, 24755, 4570, 10994, 1006, 20014, 5950, 1010, 3105, 3593, 3105, 3593, 1010, 16169, 3593, 16169, 3593, 1010, 2051, 10453, 7292, 5833, 1007, 1063, 4638, 5498, 2102, 1006, 1007, 1025, 8518, 10994, 8518, 10994, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java
SoapClient.create
public static SoapClient create(String url, SoapProtocol protocol, String namespaceURI) { return new SoapClient(url, protocol, namespaceURI); }
java
public static SoapClient create(String url, SoapProtocol protocol, String namespaceURI) { return new SoapClient(url, protocol, namespaceURI); }
[ "public", "static", "SoapClient", "create", "(", "String", "url", ",", "SoapProtocol", "protocol", ",", "String", "namespaceURI", ")", "{", "return", "new", "SoapClient", "(", "url", ",", "protocol", ",", "namespaceURI", ")", ";", "}" ]
创建SOAP客户端 @param url WS的URL地址 @param protocol 协议,见{@link SoapProtocol} @param namespaceURI 方法上的命名空间URI @return {@link SoapClient} @since 4.5.6
[ "创建SOAP客户端" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java#L85-L87
train
Create a new instance of the class.
[ 30522, 2270, 10763, 7815, 20464, 11638, 3443, 1006, 5164, 24471, 2140, 1010, 7815, 21572, 3406, 25778, 8778, 1010, 5164, 3415, 15327, 9496, 1007, 1063, 2709, 2047, 7815, 20464, 11638, 1006, 24471, 2140, 1010, 8778, 1010, 3415, 15327, 9496, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-filesystems/flink-hadoop-fs/src/main/java/org/apache/flink/runtime/fs/hdfs/HadoopFileSystem.java
HadoopFileSystem.getKindForScheme
static FileSystemKind getKindForScheme(String scheme) { scheme = scheme.toLowerCase(Locale.US); if (scheme.startsWith("s3") || scheme.startsWith("emr") || scheme.startsWith("oss")) { // the Amazon S3 storage or Aliyun OSS storage return FileSystemKind.OBJECT_STORE; } else if (scheme.startsWith("http") || scheme.startsWith("ftp")) { // file servers instead of file systems // they might actually be consistent, but we have no hard guarantees // currently to rely on that return FileSystemKind.OBJECT_STORE; } else { // the remainder should include hdfs, kosmos, ceph, ... // this also includes federated HDFS (viewfs). return FileSystemKind.FILE_SYSTEM; } }
java
static FileSystemKind getKindForScheme(String scheme) { scheme = scheme.toLowerCase(Locale.US); if (scheme.startsWith("s3") || scheme.startsWith("emr") || scheme.startsWith("oss")) { // the Amazon S3 storage or Aliyun OSS storage return FileSystemKind.OBJECT_STORE; } else if (scheme.startsWith("http") || scheme.startsWith("ftp")) { // file servers instead of file systems // they might actually be consistent, but we have no hard guarantees // currently to rely on that return FileSystemKind.OBJECT_STORE; } else { // the remainder should include hdfs, kosmos, ceph, ... // this also includes federated HDFS (viewfs). return FileSystemKind.FILE_SYSTEM; } }
[ "static", "FileSystemKind", "getKindForScheme", "(", "String", "scheme", ")", "{", "scheme", "=", "scheme", ".", "toLowerCase", "(", "Locale", ".", "US", ")", ";", "if", "(", "scheme", ".", "startsWith", "(", "\"s3\"", ")", "||", "scheme", ".", "startsWith...
Gets the kind of the file system from its scheme. <p>Implementation note: Initially, especially within the Flink 1.3.x line (in order to not break backwards compatibility), we must only label file systems as 'inconsistent' or as 'not proper filesystems' if we are sure about it. Otherwise, we cause regression for example in the performance and cleanup handling of checkpoints. For that reason, we initially mark some filesystems as 'eventually consistent' or as 'object stores', and leave the others as 'consistent file systems'.
[ "Gets", "the", "kind", "of", "the", "file", "system", "from", "its", "scheme", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-hadoop-fs/src/main/java/org/apache/flink/runtime/fs/hdfs/HadoopFileSystem.java#L224-L242
train
Returns the kind of the file system based on the scheme.
[ 30522, 10763, 6764, 27268, 6633, 18824, 2131, 18824, 29278, 22842, 4168, 1006, 5164, 5679, 1007, 1063, 5679, 1027, 5679, 1012, 2000, 27663, 18992, 3366, 1006, 2334, 2063, 1012, 2149, 1007, 1025, 2065, 1006, 5679, 1012, 4627, 24415, 1006, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/resource/ResourceUtil.java
ResourceUtil.getResourceIter
public static EnumerationIter<URL> getResourceIter(String resource) { final Enumeration<URL> resources; try { resources = ClassLoaderUtil.getClassLoader().getResources(resource); } catch (IOException e) { throw new IORuntimeException(e); } return new EnumerationIter<>(resources); }
java
public static EnumerationIter<URL> getResourceIter(String resource) { final Enumeration<URL> resources; try { resources = ClassLoaderUtil.getClassLoader().getResources(resource); } catch (IOException e) { throw new IORuntimeException(e); } return new EnumerationIter<>(resources); }
[ "public", "static", "EnumerationIter", "<", "URL", ">", "getResourceIter", "(", "String", "resource", ")", "{", "final", "Enumeration", "<", "URL", ">", "resources", ";", "try", "{", "resources", "=", "ClassLoaderUtil", ".", "getClassLoader", "(", ")", ".", ...
获取指定路径下的资源Iterator<br> 路径格式必须为目录格式,用/分隔,例如: <pre> config/a spring/xml </pre> @param resource 资源路径 @return 资源列表 @since 4.1.5
[ "获取指定路径下的资源Iterator<br", ">", "路径格式必须为目录格式", "用", "/", "分隔,例如", ":" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/resource/ResourceUtil.java#L142-L150
train
Gets the resource iterator.
[ 30522, 2270, 10763, 4372, 17897, 8156, 21646, 1026, 24471, 2140, 1028, 2131, 6072, 8162, 3401, 21646, 1006, 5164, 7692, 1007, 1063, 2345, 4372, 17897, 8156, 1026, 24471, 2140, 1028, 4219, 1025, 3046, 1063, 4219, 1027, 2465, 11066, 2121, 218...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java
Configuration.getPropsWithPrefix
public Map<String, String> getPropsWithPrefix(String confPrefix) { Properties props = getProps(); Enumeration e = props.propertyNames(); Map<String, String> configMap = new HashMap<>(); String name = null; while (e.hasMoreElements()) { name = (String) e.nextElement(); if (name.startsWith(confPrefix)) { String value = props.getProperty(name); name = name.substring(confPrefix.length()); configMap.put(name, value); } } return configMap; }
java
public Map<String, String> getPropsWithPrefix(String confPrefix) { Properties props = getProps(); Enumeration e = props.propertyNames(); Map<String, String> configMap = new HashMap<>(); String name = null; while (e.hasMoreElements()) { name = (String) e.nextElement(); if (name.startsWith(confPrefix)) { String value = props.getProperty(name); name = name.substring(confPrefix.length()); configMap.put(name, value); } } return configMap; }
[ "public", "Map", "<", "String", ",", "String", ">", "getPropsWithPrefix", "(", "String", "confPrefix", ")", "{", "Properties", "props", "=", "getProps", "(", ")", ";", "Enumeration", "e", "=", "props", ".", "propertyNames", "(", ")", ";", "Map", "<", "St...
Constructs a mapping of configuration and includes all properties that start with the specified configuration prefix. Property names in the mapping are trimmed to remove the configuration prefix. @param confPrefix configuration prefix @return mapping of configuration properties with prefix stripped
[ "Constructs", "a", "mapping", "of", "configuration", "and", "includes", "all", "properties", "that", "start", "with", "the", "specified", "configuration", "prefix", ".", "Property", "names", "in", "the", "mapping", "are", "trimmed", "to", "remove", "the", "confi...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L2746-L2760
train
Get the properties with the specified prefix.
[ 30522, 2270, 4949, 1026, 5164, 1010, 5164, 1028, 2131, 21572, 4523, 24415, 28139, 8873, 2595, 1006, 5164, 9530, 22540, 2890, 8873, 2595, 1007, 1063, 5144, 24387, 1027, 2131, 21572, 4523, 1006, 1007, 1025, 4372, 17897, 8156, 1041, 1027, 2438...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.lastIndexOfSeparator
public static int lastIndexOfSeparator(String filePath) { if (StrUtil.isNotEmpty(filePath)) { int i = filePath.length(); char c; while (--i >= 0) { c = filePath.charAt(i); if (CharUtil.isFileSeparator(c)) { return i; } } } return -1; }
java
public static int lastIndexOfSeparator(String filePath) { if (StrUtil.isNotEmpty(filePath)) { int i = filePath.length(); char c; while (--i >= 0) { c = filePath.charAt(i); if (CharUtil.isFileSeparator(c)) { return i; } } } return -1; }
[ "public", "static", "int", "lastIndexOfSeparator", "(", "String", "filePath", ")", "{", "if", "(", "StrUtil", ".", "isNotEmpty", "(", "filePath", ")", ")", "{", "int", "i", "=", "filePath", ".", "length", "(", ")", ";", "char", "c", ";", "while", "(", ...
获得最后一个文件路径分隔符的位置 @param filePath 文件路径 @return 最后一个文件路径分隔符的位置
[ "获得最后一个文件路径分隔符的位置" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L1465-L1477
train
Returns the index of the last file separator in the given path.
[ 30522, 2270, 10763, 20014, 2197, 22254, 10288, 11253, 3366, 28689, 4263, 1006, 5164, 5371, 15069, 1007, 1063, 2065, 1006, 2358, 22134, 4014, 1012, 3475, 12184, 27718, 2100, 1006, 5371, 15069, 1007, 1007, 1063, 20014, 1045, 1027, 5371, 15069, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/highavailability/nonha/embedded/EmbeddedHaServices.java
EmbeddedHaServices.close
@Override public void close() throws Exception { synchronized (lock) { if (!isShutDown()) { // stop all job manager leader services for (EmbeddedLeaderService service : jobManagerLeaderServices.values()) { service.shutdown(); } jobManagerLeaderServices.clear(); resourceManagerLeaderService.shutdown(); webMonitorLeaderService.shutdown(); } super.close(); } }
java
@Override public void close() throws Exception { synchronized (lock) { if (!isShutDown()) { // stop all job manager leader services for (EmbeddedLeaderService service : jobManagerLeaderServices.values()) { service.shutdown(); } jobManagerLeaderServices.clear(); resourceManagerLeaderService.shutdown(); webMonitorLeaderService.shutdown(); } super.close(); } }
[ "@", "Override", "public", "void", "close", "(", ")", "throws", "Exception", "{", "synchronized", "(", "lock", ")", "{", "if", "(", "!", "isShutDown", "(", ")", ")", "{", "// stop all job manager leader services", "for", "(", "EmbeddedLeaderService", "service", ...
------------------------------------------------------------------------
[ "------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/nonha/embedded/EmbeddedHaServices.java#L160-L177
train
Closes the cluster.
[ 30522, 1030, 2058, 15637, 2270, 11675, 2485, 1006, 1007, 11618, 6453, 1063, 25549, 1006, 5843, 1007, 1063, 2065, 1006, 999, 26354, 6979, 2102, 7698, 1006, 1007, 1007, 1063, 1013, 1013, 2644, 2035, 3105, 3208, 3003, 2578, 2005, 1006, 11157, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
HiveSessionImpl.release
protected synchronized void release(boolean userAccess) { SessionState.detachSession(); if (ThreadWithGarbageCleanup.currentThread() instanceof ThreadWithGarbageCleanup) { ThreadWithGarbageCleanup currentThread = (ThreadWithGarbageCleanup) ThreadWithGarbageCleanup.currentThread(); currentThread.cacheThreadLocalRawStore(); } if (userAccess) { lastAccessTime = System.currentTimeMillis(); } if (opHandleSet.isEmpty()) { lastIdleTime = System.currentTimeMillis(); } else { lastIdleTime = 0; } }
java
protected synchronized void release(boolean userAccess) { SessionState.detachSession(); if (ThreadWithGarbageCleanup.currentThread() instanceof ThreadWithGarbageCleanup) { ThreadWithGarbageCleanup currentThread = (ThreadWithGarbageCleanup) ThreadWithGarbageCleanup.currentThread(); currentThread.cacheThreadLocalRawStore(); } if (userAccess) { lastAccessTime = System.currentTimeMillis(); } if (opHandleSet.isEmpty()) { lastIdleTime = System.currentTimeMillis(); } else { lastIdleTime = 0; } }
[ "protected", "synchronized", "void", "release", "(", "boolean", "userAccess", ")", "{", "SessionState", ".", "detachSession", "(", ")", ";", "if", "(", "ThreadWithGarbageCleanup", ".", "currentThread", "(", ")", "instanceof", "ThreadWithGarbageCleanup", ")", "{", ...
1. We'll remove the ThreadLocal SessionState as this thread might now serve other requests. 2. We'll cache the ThreadLocal RawStore object for this background thread for an orderly cleanup when this thread is garbage collected later. @see org.apache.hive.service.server.ThreadWithGarbageCleanup#finalize()
[ "1", ".", "We", "ll", "remove", "the", "ThreadLocal", "SessionState", "as", "this", "thread", "might", "now", "serve", "other", "requests", ".", "2", ".", "We", "ll", "cache", "the", "ThreadLocal", "RawStore", "object", "for", "this", "background", "thread",...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImpl.java#L372-L387
train
Release the session.
[ 30522, 5123, 25549, 11675, 2713, 1006, 22017, 20898, 5310, 6305, 9623, 2015, 1007, 1063, 6521, 12259, 1012, 20010, 6776, 8583, 10992, 1006, 1007, 1025, 2065, 1006, 11689, 24415, 6843, 16078, 8586, 20898, 6279, 1012, 2783, 2705, 16416, 2094, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java
WindowedStream.aggregate
@PublicEvolving public <ACC, V, R> SingleOutputStreamOperator<R> aggregate( AggregateFunction<T, ACC, V> aggregateFunction, WindowFunction<V, R, K, W> windowFunction, TypeInformation<ACC> accumulatorType, TypeInformation<R> resultType) { checkNotNull(aggregateFunction, "aggregateFunction"); checkNotNull(windowFunction, "windowFunction"); checkNotNull(accumulatorType, "accumulatorType"); checkNotNull(resultType, "resultType"); if (aggregateFunction instanceof RichFunction) { throw new UnsupportedOperationException("This aggregate function cannot be a RichFunction."); } //clean the closures windowFunction = input.getExecutionEnvironment().clean(windowFunction); aggregateFunction = input.getExecutionEnvironment().clean(aggregateFunction); final String opName = generateOperatorName(windowAssigner, trigger, evictor, aggregateFunction, windowFunction); KeySelector<T, K> keySel = input.getKeySelector(); OneInputStreamOperator<T, R> operator; if (evictor != null) { @SuppressWarnings({"unchecked", "rawtypes"}) TypeSerializer<StreamRecord<T>> streamRecordSerializer = (TypeSerializer<StreamRecord<T>>) new StreamElementSerializer(input.getType().createSerializer(getExecutionEnvironment().getConfig())); ListStateDescriptor<StreamRecord<T>> stateDesc = new ListStateDescriptor<>("window-contents", streamRecordSerializer); operator = new EvictingWindowOperator<>(windowAssigner, windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()), keySel, input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()), stateDesc, new InternalIterableWindowFunction<>(new AggregateApplyWindowFunction<>(aggregateFunction, windowFunction)), trigger, evictor, allowedLateness, lateDataOutputTag); } else { AggregatingStateDescriptor<T, ACC, V> stateDesc = new AggregatingStateDescriptor<>("window-contents", aggregateFunction, accumulatorType.createSerializer(getExecutionEnvironment().getConfig())); operator = new WindowOperator<>(windowAssigner, windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()), keySel, input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()), stateDesc, new InternalSingleValueWindowFunction<>(windowFunction), trigger, allowedLateness, lateDataOutputTag); } return input.transform(opName, resultType, operator); }
java
@PublicEvolving public <ACC, V, R> SingleOutputStreamOperator<R> aggregate( AggregateFunction<T, ACC, V> aggregateFunction, WindowFunction<V, R, K, W> windowFunction, TypeInformation<ACC> accumulatorType, TypeInformation<R> resultType) { checkNotNull(aggregateFunction, "aggregateFunction"); checkNotNull(windowFunction, "windowFunction"); checkNotNull(accumulatorType, "accumulatorType"); checkNotNull(resultType, "resultType"); if (aggregateFunction instanceof RichFunction) { throw new UnsupportedOperationException("This aggregate function cannot be a RichFunction."); } //clean the closures windowFunction = input.getExecutionEnvironment().clean(windowFunction); aggregateFunction = input.getExecutionEnvironment().clean(aggregateFunction); final String opName = generateOperatorName(windowAssigner, trigger, evictor, aggregateFunction, windowFunction); KeySelector<T, K> keySel = input.getKeySelector(); OneInputStreamOperator<T, R> operator; if (evictor != null) { @SuppressWarnings({"unchecked", "rawtypes"}) TypeSerializer<StreamRecord<T>> streamRecordSerializer = (TypeSerializer<StreamRecord<T>>) new StreamElementSerializer(input.getType().createSerializer(getExecutionEnvironment().getConfig())); ListStateDescriptor<StreamRecord<T>> stateDesc = new ListStateDescriptor<>("window-contents", streamRecordSerializer); operator = new EvictingWindowOperator<>(windowAssigner, windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()), keySel, input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()), stateDesc, new InternalIterableWindowFunction<>(new AggregateApplyWindowFunction<>(aggregateFunction, windowFunction)), trigger, evictor, allowedLateness, lateDataOutputTag); } else { AggregatingStateDescriptor<T, ACC, V> stateDesc = new AggregatingStateDescriptor<>("window-contents", aggregateFunction, accumulatorType.createSerializer(getExecutionEnvironment().getConfig())); operator = new WindowOperator<>(windowAssigner, windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()), keySel, input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()), stateDesc, new InternalSingleValueWindowFunction<>(windowFunction), trigger, allowedLateness, lateDataOutputTag); } return input.transform(opName, resultType, operator); }
[ "@", "PublicEvolving", "public", "<", "ACC", ",", "V", ",", "R", ">", "SingleOutputStreamOperator", "<", "R", ">", "aggregate", "(", "AggregateFunction", "<", "T", ",", "ACC", ",", "V", ">", "aggregateFunction", ",", "WindowFunction", "<", "V", ",", "R", ...
Applies the given window function to each window. The window function is called for each evaluation of the window for each key individually. The output of the window function is interpreted as a regular non-windowed stream. <p>Arriving data is incrementally aggregated using the given aggregate function. This means that the window function typically has only a single value to process when called. @param aggregateFunction The aggregation function that is used for incremental aggregation. @param windowFunction The window function. @param accumulatorType Type information for the internal accumulator type of the aggregation function @param resultType Type information for the result type of the window function @return The data stream that is the result of applying the window function to the window. @param <ACC> The type of the AggregateFunction's accumulator @param <V> The type of AggregateFunction's result, and the WindowFunction's input @param <R> The type of the elements in the resulting stream, equal to the WindowFunction's result type
[ "Applies", "the", "given", "window", "function", "to", "each", "window", ".", "The", "window", "function", "is", "called", "for", "each", "evaluation", "of", "the", "window", "for", "each", "key", "individually", ".", "The", "output", "of", "the", "window", ...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java#L791-L851
train
Creates an operator that aggregates the contents of the input stream using the given window function and accumulator type.
[ 30522, 1030, 2270, 6777, 4747, 6455, 2270, 1026, 16222, 1010, 1058, 1010, 1054, 1028, 2309, 5833, 18780, 21422, 25918, 8844, 1026, 1054, 1028, 9572, 1006, 9572, 11263, 27989, 1026, 1056, 1010, 16222, 1010, 1058, 1028, 9572, 11263, 27989, 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-table/flink-table-planner-blink/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java
DateTimeUtils.firstMondayOfFirstWeek
private static long firstMondayOfFirstWeek(int year) { final long janFirst = ymdToJulian(year, 1, 1); final long janFirstDow = floorMod(janFirst + 1, 7); // sun=0, sat=6 return janFirst + (11 - janFirstDow) % 7 - 3; }
java
private static long firstMondayOfFirstWeek(int year) { final long janFirst = ymdToJulian(year, 1, 1); final long janFirstDow = floorMod(janFirst + 1, 7); // sun=0, sat=6 return janFirst + (11 - janFirstDow) % 7 - 3; }
[ "private", "static", "long", "firstMondayOfFirstWeek", "(", "int", "year", ")", "{", "final", "long", "janFirst", "=", "ymdToJulian", "(", "year", ",", "1", ",", "1", ")", ";", "final", "long", "janFirstDow", "=", "floorMod", "(", "janFirst", "+", "1", "...
Returns the first day of the first week of a year. Per ISO-8601 it is the Monday of the week that contains Jan 4, or equivalently, it is a Monday between Dec 29 and Jan 4. Sometimes it is in the year before the given year.
[ "Returns", "the", "first", "day", "of", "the", "first", "week", "of", "a", "year", ".", "Per", "ISO", "-", "8601", "it", "is", "the", "Monday", "of", "the", "week", "that", "contains", "Jan", "4", "or", "equivalently", "it", "is", "a", "Monday", "bet...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner-blink/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java#L931-L935
train
Get the first Monday of the first week of the given year.
[ 30522, 2797, 10763, 2146, 2034, 11442, 28852, 26989, 12096, 28075, 1006, 20014, 2095, 1007, 1063, 2345, 2146, 5553, 8873, 12096, 1027, 1061, 26876, 3406, 9103, 15204, 1006, 2095, 1010, 1015, 1010, 1015, 1007, 1025, 2345, 2146, 5553, 8873, 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-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java
TypeExtractor.createHadoopWritableTypeInfo
public static <T> TypeInformation<T> createHadoopWritableTypeInfo(Class<T> clazz) { checkNotNull(clazz); Class<?> typeInfoClass; try { typeInfoClass = Class.forName(HADOOP_WRITABLE_TYPEINFO_CLASS, false, TypeExtractor.class.getClassLoader()); } catch (ClassNotFoundException e) { throw new RuntimeException("Could not load the TypeInformation for the class '" + HADOOP_WRITABLE_CLASS + "'. You may be missing the 'flink-hadoop-compatibility' dependency."); } try { Constructor<?> constr = typeInfoClass.getConstructor(Class.class); @SuppressWarnings("unchecked") TypeInformation<T> typeInfo = (TypeInformation<T>) constr.newInstance(clazz); return typeInfo; } catch (NoSuchMethodException | IllegalAccessException | InstantiationException e) { throw new RuntimeException("Incompatible versions of the Hadoop Compatibility classes found."); } catch (InvocationTargetException e) { throw new RuntimeException("Cannot create Hadoop WritableTypeInfo.", e.getTargetException()); } }
java
public static <T> TypeInformation<T> createHadoopWritableTypeInfo(Class<T> clazz) { checkNotNull(clazz); Class<?> typeInfoClass; try { typeInfoClass = Class.forName(HADOOP_WRITABLE_TYPEINFO_CLASS, false, TypeExtractor.class.getClassLoader()); } catch (ClassNotFoundException e) { throw new RuntimeException("Could not load the TypeInformation for the class '" + HADOOP_WRITABLE_CLASS + "'. You may be missing the 'flink-hadoop-compatibility' dependency."); } try { Constructor<?> constr = typeInfoClass.getConstructor(Class.class); @SuppressWarnings("unchecked") TypeInformation<T> typeInfo = (TypeInformation<T>) constr.newInstance(clazz); return typeInfo; } catch (NoSuchMethodException | IllegalAccessException | InstantiationException e) { throw new RuntimeException("Incompatible versions of the Hadoop Compatibility classes found."); } catch (InvocationTargetException e) { throw new RuntimeException("Cannot create Hadoop WritableTypeInfo.", e.getTargetException()); } }
[ "public", "static", "<", "T", ">", "TypeInformation", "<", "T", ">", "createHadoopWritableTypeInfo", "(", "Class", "<", "T", ">", "clazz", ")", "{", "checkNotNull", "(", "clazz", ")", ";", "Class", "<", "?", ">", "typeInfoClass", ";", "try", "{", "typeIn...
visible for testing
[ "visible", "for", "testing" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java#L2074-L2099
train
Creates a Hadoop Writable TypeInformation for the given class.
[ 30522, 2270, 10763, 1026, 1056, 1028, 2828, 2378, 14192, 3370, 1026, 1056, 1028, 3443, 16102, 18589, 13088, 6590, 3468, 13874, 2378, 14876, 1006, 2465, 1026, 1056, 1028, 18856, 10936, 2480, 1007, 1063, 4638, 17048, 11231, 3363, 1006, 18856, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/sql/SqlExecutor.java
SqlExecutor.execute
public static int execute(Connection conn, String sql, Object... params) throws SQLException { PreparedStatement ps = null; try { ps = StatementUtil.prepareStatement(conn, sql, params); return ps.executeUpdate(); } finally { DbUtil.close(ps); } }
java
public static int execute(Connection conn, String sql, Object... params) throws SQLException { PreparedStatement ps = null; try { ps = StatementUtil.prepareStatement(conn, sql, params); return ps.executeUpdate(); } finally { DbUtil.close(ps); } }
[ "public", "static", "int", "execute", "(", "Connection", "conn", ",", "String", "sql", ",", "Object", "...", "params", ")", "throws", "SQLException", "{", "PreparedStatement", "ps", "=", "null", ";", "try", "{", "ps", "=", "StatementUtil", ".", "prepareState...
执行非查询语句<br> 语句包括 插入、更新、删除<br> 此方法不会关闭Connection @param conn 数据库连接对象 @param sql SQL @param params 参数 @return 影响的行数 @throws SQLException SQL执行异常
[ "执行非查询语句<br", ">", "语句包括", "插入、更新、删除<br", ">", "此方法不会关闭Connection" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java#L53-L61
train
Execute a SQL statement.
[ 30522, 2270, 10763, 20014, 15389, 1006, 4434, 9530, 2078, 1010, 5164, 29296, 1010, 4874, 1012, 1012, 1012, 11498, 5244, 1007, 11618, 29296, 10288, 24422, 1063, 4810, 9153, 18532, 4765, 8827, 1027, 19701, 1025, 3046, 1063, 8827, 1027, 4861, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/template/engine/enjoy/EnjoyEngine.java
EnjoyEngine.getTemplate
@Override public Template getTemplate(String resource) { if(ObjectUtil.equal(ResourceMode.STRING, this.resourceMode)) { return EnjoyTemplate.wrap(this.engine.getTemplateByString(resource)); } return EnjoyTemplate.wrap(this.engine.getTemplate(resource)); }
java
@Override public Template getTemplate(String resource) { if(ObjectUtil.equal(ResourceMode.STRING, this.resourceMode)) { return EnjoyTemplate.wrap(this.engine.getTemplateByString(resource)); } return EnjoyTemplate.wrap(this.engine.getTemplate(resource)); }
[ "@", "Override", "public", "Template", "getTemplate", "(", "String", "resource", ")", "{", "if", "(", "ObjectUtil", ".", "equal", "(", "ResourceMode", ".", "STRING", ",", "this", ".", "resourceMode", ")", ")", "{", "return", "EnjoyTemplate", ".", "wrap", "...
--------------------------------------------------------------------------------- Constructor end
[ "---------------------------------------------------------------------------------", "Constructor", "end" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/enjoy/EnjoyEngine.java#L54-L60
train
Override the method to get the Template object for the given resource.
[ 30522, 1030, 2058, 15637, 2270, 23561, 2131, 18532, 15725, 1006, 5164, 7692, 1007, 1063, 2065, 1006, 4874, 21823, 2140, 1012, 5020, 1006, 7692, 5302, 3207, 1012, 5164, 1010, 2023, 1012, 7692, 5302, 3207, 1007, 1007, 1063, 2709, 5959, 18532,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java
ExecutionEnvironment.fromParallelCollection
public <X> DataSource<X> fromParallelCollection(SplittableIterator<X> iterator, Class<X> type) { return fromParallelCollection(iterator, TypeExtractor.getForClass(type)); }
java
public <X> DataSource<X> fromParallelCollection(SplittableIterator<X> iterator, Class<X> type) { return fromParallelCollection(iterator, TypeExtractor.getForClass(type)); }
[ "public", "<", "X", ">", "DataSource", "<", "X", ">", "fromParallelCollection", "(", "SplittableIterator", "<", "X", ">", "iterator", ",", "Class", "<", "X", ">", "type", ")", "{", "return", "fromParallelCollection", "(", "iterator", ",", "TypeExtractor", "....
Creates a new data set that contains elements in the iterator. The iterator is splittable, allowing the framework to create a parallel data source that returns the elements in the iterator. <p>Because the iterator will remain unmodified until the actual execution happens, the type of data returned by the iterator must be given explicitly in the form of the type class (this is due to the fact that the Java compiler erases the generic type information). @param iterator The iterator that produces the elements of the data set. @param type The class of the data produced by the iterator. Must not be a generic class. @return A DataSet representing the elements in the iterator. @see #fromParallelCollection(SplittableIterator, TypeInformation)
[ "Creates", "a", "new", "data", "set", "that", "contains", "elements", "in", "the", "iterator", ".", "The", "iterator", "is", "splittable", "allowing", "the", "framework", "to", "create", "a", "parallel", "data", "source", "that", "returns", "the", "elements", ...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java#L760-L762
train
Creates a DataSource from a parallel collection of data sources.
[ 30522, 2270, 1026, 1060, 1028, 2951, 6499, 3126, 3401, 1026, 1060, 1028, 2013, 28689, 6216, 22499, 6216, 7542, 1006, 3975, 10880, 21646, 8844, 1026, 1060, 1028, 2009, 6906, 4263, 1010, 2465, 1026, 1060, 1028, 2828, 1007, 1063, 2709, 2013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java
SoapClient.setCharset
public SoapClient setCharset(Charset charset) { this.charset = charset; try { this.message.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, this.charset.toString()); this.message.setProperty(SOAPMessage.WRITE_XML_DECLARATION, "true"); } catch (SOAPException e) { // ignore } return this; }
java
public SoapClient setCharset(Charset charset) { this.charset = charset; try { this.message.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, this.charset.toString()); this.message.setProperty(SOAPMessage.WRITE_XML_DECLARATION, "true"); } catch (SOAPException e) { // ignore } return this; }
[ "public", "SoapClient", "setCharset", "(", "Charset", "charset", ")", "{", "this", ".", "charset", "=", "charset", ";", "try", "{", "this", ".", "message", ".", "setProperty", "(", "SOAPMessage", ".", "CHARACTER_SET_ENCODING", ",", "this", ".", "charset", "....
设置编码 @param charset 编码 @return this
[ "设置编码" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java#L147-L157
train
Sets the character set encoding for the SOAP message.
[ 30522, 2270, 7815, 20464, 11638, 2275, 7507, 22573, 2102, 1006, 25869, 13462, 25869, 13462, 1007, 1063, 30524, 1006, 7815, 7834, 3736, 3351, 1012, 2839, 1035, 2275, 1035, 17181, 1010, 2023, 1012, 25869, 13462, 1012, 2000, 3367, 4892, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java
SlotManager.registerSlot
private void registerSlot( SlotID slotId, AllocationID allocationId, JobID jobId, ResourceProfile resourceProfile, TaskExecutorConnection taskManagerConnection) { if (slots.containsKey(slotId)) { // remove the old slot first removeSlot(slotId); } final TaskManagerSlot slot = createAndRegisterTaskManagerSlot(slotId, resourceProfile, taskManagerConnection); final PendingTaskManagerSlot pendingTaskManagerSlot; if (allocationId == null) { pendingTaskManagerSlot = findExactlyMatchingPendingTaskManagerSlot(resourceProfile); } else { pendingTaskManagerSlot = null; } if (pendingTaskManagerSlot == null) { updateSlot(slotId, allocationId, jobId); } else { pendingSlots.remove(pendingTaskManagerSlot.getTaskManagerSlotId()); final PendingSlotRequest assignedPendingSlotRequest = pendingTaskManagerSlot.getAssignedPendingSlotRequest(); if (assignedPendingSlotRequest == null) { handleFreeSlot(slot); } else { assignedPendingSlotRequest.unassignPendingTaskManagerSlot(); allocateSlot(slot, assignedPendingSlotRequest); } } }
java
private void registerSlot( SlotID slotId, AllocationID allocationId, JobID jobId, ResourceProfile resourceProfile, TaskExecutorConnection taskManagerConnection) { if (slots.containsKey(slotId)) { // remove the old slot first removeSlot(slotId); } final TaskManagerSlot slot = createAndRegisterTaskManagerSlot(slotId, resourceProfile, taskManagerConnection); final PendingTaskManagerSlot pendingTaskManagerSlot; if (allocationId == null) { pendingTaskManagerSlot = findExactlyMatchingPendingTaskManagerSlot(resourceProfile); } else { pendingTaskManagerSlot = null; } if (pendingTaskManagerSlot == null) { updateSlot(slotId, allocationId, jobId); } else { pendingSlots.remove(pendingTaskManagerSlot.getTaskManagerSlotId()); final PendingSlotRequest assignedPendingSlotRequest = pendingTaskManagerSlot.getAssignedPendingSlotRequest(); if (assignedPendingSlotRequest == null) { handleFreeSlot(slot); } else { assignedPendingSlotRequest.unassignPendingTaskManagerSlot(); allocateSlot(slot, assignedPendingSlotRequest); } } }
[ "private", "void", "registerSlot", "(", "SlotID", "slotId", ",", "AllocationID", "allocationId", ",", "JobID", "jobId", ",", "ResourceProfile", "resourceProfile", ",", "TaskExecutorConnection", "taskManagerConnection", ")", "{", "if", "(", "slots", ".", "containsKey",...
Registers a slot for the given task manager at the slot manager. The slot is identified by the given slot id. The given resource profile defines the available resources for the slot. The task manager connection can be used to communicate with the task manager. @param slotId identifying the slot on the task manager @param allocationId which is currently deployed in the slot @param resourceProfile of the slot @param taskManagerConnection to communicate with the remote task manager
[ "Registers", "a", "slot", "for", "the", "given", "task", "manager", "at", "the", "slot", "manager", ".", "The", "slot", "is", "identified", "by", "the", "given", "slot", "id", ".", "The", "given", "resource", "profile", "defines", "the", "available", "reso...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java#L538-L573
train
Registers a slot with the TaskManager.
[ 30522, 2797, 11675, 18687, 10994, 1006, 10453, 3593, 10453, 3593, 1010, 16169, 3593, 16169, 3593, 1010, 3105, 3593, 3105, 3593, 1010, 7692, 21572, 8873, 2571, 7692, 21572, 8873, 2571, 1010, 4708, 10288, 8586, 16161, 29566, 10087, 7542, 4708, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java
BinaryString.contains
public boolean contains(final BinaryString substring) { ensureMaterialized(); substring.ensureMaterialized(); if (substring.sizeInBytes == 0) { return true; } int find = SegmentsUtil.find( segments, offset, sizeInBytes, substring.segments, substring.offset, substring.sizeInBytes); return find != -1; }
java
public boolean contains(final BinaryString substring) { ensureMaterialized(); substring.ensureMaterialized(); if (substring.sizeInBytes == 0) { return true; } int find = SegmentsUtil.find( segments, offset, sizeInBytes, substring.segments, substring.offset, substring.sizeInBytes); return find != -1; }
[ "public", "boolean", "contains", "(", "final", "BinaryString", "substring", ")", "{", "ensureMaterialized", "(", ")", ";", "substring", ".", "ensureMaterialized", "(", ")", ";", "if", "(", "substring", ".", "sizeInBytes", "==", "0", ")", "{", "return", "true...
Returns whether this contains `substring` or not. Same to like '%substring%'.
[ "Returns", "whether", "this", "contains", "substring", "or", "not", ".", "Same", "to", "like", "%substring%", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java#L550-L560
train
Checks if this string contains the substring.
[ 30522, 2270, 22017, 20898, 3397, 1006, 2345, 12441, 3367, 4892, 4942, 3367, 4892, 1007, 1063, 5676, 8585, 14482, 3550, 1006, 1007, 1025, 4942, 3367, 4892, 1012, 5676, 8585, 14482, 3550, 1006, 1007, 1025, 2065, 1006, 4942, 3367, 4892, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Assert.java
Assert.isNull
public static void isNull(Object object, String errorMsgTemplate, Object... params) throws IllegalArgumentException { if (object != null) { throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params)); } }
java
public static void isNull(Object object, String errorMsgTemplate, Object... params) throws IllegalArgumentException { if (object != null) { throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params)); } }
[ "public", "static", "void", "isNull", "(", "Object", "object", ",", "String", "errorMsgTemplate", ",", "Object", "...", "params", ")", "throws", "IllegalArgumentException", "{", "if", "(", "object", "!=", "null", ")", "{", "throw", "new", "IllegalArgumentExcepti...
断言对象是否为{@code null} ,如果不为{@code null} 抛出{@link IllegalArgumentException} 异常 <pre class="code"> Assert.isNull(value, "The value must be null"); </pre> @param object 被检查的对象 @param errorMsgTemplate 消息模板,变量使用{}表示 @param params 参数列表 @throws IllegalArgumentException if the object is not {@code null}
[ "断言对象是否为", "{", "@code", "null", "}", ",如果不为", "{", "@code", "null", "}", "抛出", "{", "@link", "IllegalArgumentException", "}", "异常" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L95-L99
train
Checks if object is null.
[ 30522, 2270, 10763, 11675, 3475, 18083, 1006, 4874, 4874, 1010, 5164, 7561, 5244, 13512, 6633, 15725, 1010, 4874, 1012, 1012, 1012, 11498, 5244, 1007, 11618, 6206, 2906, 22850, 15781, 2595, 24422, 1063, 2065, 1006, 4874, 999, 1027, 19701, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-db/src/main/java/cn/hutool/db/DaoTemplate.java
DaoTemplate.del
public <T> int del(Entity where) throws SQLException { if (CollectionUtil.isEmpty(where)) { return 0; } return db.del(fixEntity(where)); }
java
public <T> int del(Entity where) throws SQLException { if (CollectionUtil.isEmpty(where)) { return 0; } return db.del(fixEntity(where)); }
[ "public", "<", "T", ">", "int", "del", "(", "Entity", "where", ")", "throws", "SQLException", "{", "if", "(", "CollectionUtil", ".", "isEmpty", "(", "where", ")", ")", "{", "return", "0", ";", "}", "return", "db", ".", "del", "(", "fixEntity", "(", ...
删除 @param <T> 主键类型 @param where 删除条件,当条件为空时,返回0(防止误删全表) @return 删除行数 @throws SQLException SQL执行异常
[ "删除" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/DaoTemplate.java#L152-L157
train
Delete an entity from the database.
[ 30522, 2270, 1026, 1056, 1028, 20014, 3972, 1006, 9178, 2073, 1007, 11618, 29296, 30524, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Http2ConnectionHandler.java
Http2ConnectionHandler.onHttpClientUpgrade
public void onHttpClientUpgrade() throws Http2Exception { if (connection().isServer()) { throw connectionError(PROTOCOL_ERROR, "Client-side HTTP upgrade requested for a server"); } if (!prefaceSent()) { // If the preface was not sent yet it most likely means the handler was not added to the pipeline before // calling this method. throw connectionError(INTERNAL_ERROR, "HTTP upgrade must occur after preface was sent"); } if (decoder.prefaceReceived()) { throw connectionError(PROTOCOL_ERROR, "HTTP upgrade must occur before HTTP/2 preface is received"); } // Create a local stream used for the HTTP cleartext upgrade. connection().local().createStream(HTTP_UPGRADE_STREAM_ID, true); }
java
public void onHttpClientUpgrade() throws Http2Exception { if (connection().isServer()) { throw connectionError(PROTOCOL_ERROR, "Client-side HTTP upgrade requested for a server"); } if (!prefaceSent()) { // If the preface was not sent yet it most likely means the handler was not added to the pipeline before // calling this method. throw connectionError(INTERNAL_ERROR, "HTTP upgrade must occur after preface was sent"); } if (decoder.prefaceReceived()) { throw connectionError(PROTOCOL_ERROR, "HTTP upgrade must occur before HTTP/2 preface is received"); } // Create a local stream used for the HTTP cleartext upgrade. connection().local().createStream(HTTP_UPGRADE_STREAM_ID, true); }
[ "public", "void", "onHttpClientUpgrade", "(", ")", "throws", "Http2Exception", "{", "if", "(", "connection", "(", ")", ".", "isServer", "(", ")", ")", "{", "throw", "connectionError", "(", "PROTOCOL_ERROR", ",", "\"Client-side HTTP upgrade requested for a server\"", ...
Handles the client-side (cleartext) upgrade from HTTP to HTTP/2. Reserves local stream 1 for the HTTP/2 response.
[ "Handles", "the", "client", "-", "side", "(", "cleartext", ")", "upgrade", "from", "HTTP", "to", "HTTP", "/", "2", ".", "Reserves", "local", "stream", "1", "for", "the", "HTTP", "/", "2", "response", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java#L143-L158
train
Called when an HTTP upgrade is received.
[ 30522, 2270, 11675, 2006, 11039, 25856, 20464, 11638, 6279, 24170, 1006, 1007, 11618, 8299, 2475, 10288, 24422, 1063, 2065, 1006, 4434, 1006, 1007, 1012, 26354, 2121, 6299, 1006, 1007, 1007, 1063, 5466, 4434, 2121, 29165, 1006, 8778, 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-runtime/src/main/java/org/apache/flink/runtime/state/SharedStateRegistry.java
SharedStateRegistry.registerReference
public Result registerReference(SharedStateRegistryKey registrationKey, StreamStateHandle state) { Preconditions.checkNotNull(state); StreamStateHandle scheduledStateDeletion = null; SharedStateRegistry.SharedStateEntry entry; synchronized (registeredStates) { Preconditions.checkState(open, "Attempt to register state to closed SharedStateRegistry."); entry = registeredStates.get(registrationKey); if (entry == null) { // Additional check that should never fail, because only state handles that are not placeholders should // ever be inserted to the registry. Preconditions.checkState(!isPlaceholder(state), "Attempt to reference unknown state: " + registrationKey); entry = new SharedStateRegistry.SharedStateEntry(state); registeredStates.put(registrationKey, entry); } else { // delete if this is a real duplicate if (!Objects.equals(state, entry.stateHandle)) { scheduledStateDeletion = state; LOG.trace("Identified duplicate state registration under key {}. New state {} was determined to " + "be an unnecessary copy of existing state {} and will be dropped.", registrationKey, state, entry.stateHandle); } entry.increaseReferenceCount(); } } scheduleAsyncDelete(scheduledStateDeletion); LOG.trace("Registered shared state {} under key {}.", entry, registrationKey); return new Result(entry); }
java
public Result registerReference(SharedStateRegistryKey registrationKey, StreamStateHandle state) { Preconditions.checkNotNull(state); StreamStateHandle scheduledStateDeletion = null; SharedStateRegistry.SharedStateEntry entry; synchronized (registeredStates) { Preconditions.checkState(open, "Attempt to register state to closed SharedStateRegistry."); entry = registeredStates.get(registrationKey); if (entry == null) { // Additional check that should never fail, because only state handles that are not placeholders should // ever be inserted to the registry. Preconditions.checkState(!isPlaceholder(state), "Attempt to reference unknown state: " + registrationKey); entry = new SharedStateRegistry.SharedStateEntry(state); registeredStates.put(registrationKey, entry); } else { // delete if this is a real duplicate if (!Objects.equals(state, entry.stateHandle)) { scheduledStateDeletion = state; LOG.trace("Identified duplicate state registration under key {}. New state {} was determined to " + "be an unnecessary copy of existing state {} and will be dropped.", registrationKey, state, entry.stateHandle); } entry.increaseReferenceCount(); } } scheduleAsyncDelete(scheduledStateDeletion); LOG.trace("Registered shared state {} under key {}.", entry, registrationKey); return new Result(entry); }
[ "public", "Result", "registerReference", "(", "SharedStateRegistryKey", "registrationKey", ",", "StreamStateHandle", "state", ")", "{", "Preconditions", ".", "checkNotNull", "(", "state", ")", ";", "StreamStateHandle", "scheduledStateDeletion", "=", "null", ";", "Shared...
Register a reference to the given shared state in the registry. This does the following: We check if the state handle is actually new by the registrationKey. If it is new, we register it with a reference count of 1. If there is already a state handle registered under the given key, we dispose the given "new" state handle, uptick the reference count of the previously existing state handle and return it as a replacement with the result. <p>IMPORTANT: caller should check the state handle returned by the result, because the registry is performing de-duplication and could potentially return a handle that is supposed to replace the one from the registration request. @param state the shared state for which we register a reference. @return the result of this registration request, consisting of the state handle that is registered under the key by the end of the operation and its current reference count.
[ "Register", "a", "reference", "to", "the", "given", "shared", "state", "in", "the", "registry", ".", "This", "does", "the", "following", ":", "We", "check", "if", "the", "state", "handle", "is", "actually", "new", "by", "the", "registrationKey", ".", "If",...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/SharedStateRegistry.java#L85-L123
train
Registers a reference to a shared state.
[ 30522, 2270, 2765, 4236, 2890, 25523, 1006, 4207, 9153, 3334, 13910, 2923, 2854, 14839, 8819, 14839, 1010, 9199, 12259, 11774, 2571, 2110, 1007, 1063, 3653, 8663, 20562, 30524, 4443, 1025, 25549, 1006, 5068, 9153, 4570, 1007, 1063, 3653, 86...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.doResolveAll
protected void doResolveAll(String inetHost, DnsRecord[] additionals, Promise<List<InetAddress>> promise, DnsCache resolveCache) throws Exception { if (inetHost == null || inetHost.isEmpty()) { // If an empty hostname is used we should use "localhost", just like InetAddress.getAllByName(...) does. promise.setSuccess(Collections.singletonList(loopbackAddress())); return; } final byte[] bytes = NetUtil.createByteArrayFromIpAddressString(inetHost); if (bytes != null) { // The unresolvedAddress was created via a String that contains an ipaddress. promise.setSuccess(Collections.singletonList(InetAddress.getByAddress(bytes))); return; } final String hostname = hostname(inetHost); InetAddress hostsFileEntry = resolveHostsFileEntry(hostname); if (hostsFileEntry != null) { promise.setSuccess(Collections.singletonList(hostsFileEntry)); return; } if (!doResolveAllCached(hostname, additionals, promise, resolveCache, resolvedInternetProtocolFamilies)) { doResolveAllUncached(hostname, additionals, promise, resolveCache, false); } }
java
protected void doResolveAll(String inetHost, DnsRecord[] additionals, Promise<List<InetAddress>> promise, DnsCache resolveCache) throws Exception { if (inetHost == null || inetHost.isEmpty()) { // If an empty hostname is used we should use "localhost", just like InetAddress.getAllByName(...) does. promise.setSuccess(Collections.singletonList(loopbackAddress())); return; } final byte[] bytes = NetUtil.createByteArrayFromIpAddressString(inetHost); if (bytes != null) { // The unresolvedAddress was created via a String that contains an ipaddress. promise.setSuccess(Collections.singletonList(InetAddress.getByAddress(bytes))); return; } final String hostname = hostname(inetHost); InetAddress hostsFileEntry = resolveHostsFileEntry(hostname); if (hostsFileEntry != null) { promise.setSuccess(Collections.singletonList(hostsFileEntry)); return; } if (!doResolveAllCached(hostname, additionals, promise, resolveCache, resolvedInternetProtocolFamilies)) { doResolveAllUncached(hostname, additionals, promise, resolveCache, false); } }
[ "protected", "void", "doResolveAll", "(", "String", "inetHost", ",", "DnsRecord", "[", "]", "additionals", ",", "Promise", "<", "List", "<", "InetAddress", ">", ">", "promise", ",", "DnsCache", "resolveCache", ")", "throws", "Exception", "{", "if", "(", "ine...
Hook designed for extensibility so one can pass a different cache on each resolution attempt instead of using the global one.
[ "Hook", "designed", "for", "extensibility", "so", "one", "can", "pass", "a", "different", "cache", "on", "each", "resolution", "attempt", "instead", "of", "using", "the", "global", "one", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolver.java#L932-L959
train
Resolve all the dns records.
[ 30522, 5123, 11675, 2079, 6072, 4747, 3726, 8095, 1006, 5164, 1999, 11031, 14122, 1010, 1040, 3619, 2890, 27108, 2094, 1031, 1033, 3176, 2015, 1010, 4872, 1026, 2862, 1026, 1999, 12928, 14141, 8303, 1028, 1028, 4872, 1010, 1040, 3619, 3540,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/TByteColumn.java
TByteColumn.isSet
public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case VALUES: return isSetValues(); case NULLS: return isSetNulls(); } throw new IllegalStateException(); }
java
public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case VALUES: return isSetValues(); case NULLS: return isSetNulls(); } throw new IllegalStateException(); }
[ "public", "boolean", "isSet", "(", "_Fields", "field", ")", "{", "if", "(", "field", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "switch", "(", "field", ")", "{", "case", "VALUES", ":", "return", "isSetValues",...
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/TByteColumn.java#L266-L278
train
Checks if field is set to a value of a CRA S Grammar.
[ 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, 5300...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.getBytes
public static byte[] getBytes(MemorySegment[] segments, int baseOffset, int sizeInBytes) { // avoid copy if `base` is `byte[]` if (segments.length == 1) { byte[] heapMemory = segments[0].getHeapMemory(); if (baseOffset == 0 && heapMemory != null && heapMemory.length == sizeInBytes) { return heapMemory; } else { byte[] bytes = new byte[sizeInBytes]; segments[0].get(baseOffset, bytes, 0, sizeInBytes); return bytes; } } else { byte[] bytes = new byte[sizeInBytes]; copyMultiSegmentsToBytes(segments, baseOffset, bytes, 0, sizeInBytes); return bytes; } }
java
public static byte[] getBytes(MemorySegment[] segments, int baseOffset, int sizeInBytes) { // avoid copy if `base` is `byte[]` if (segments.length == 1) { byte[] heapMemory = segments[0].getHeapMemory(); if (baseOffset == 0 && heapMemory != null && heapMemory.length == sizeInBytes) { return heapMemory; } else { byte[] bytes = new byte[sizeInBytes]; segments[0].get(baseOffset, bytes, 0, sizeInBytes); return bytes; } } else { byte[] bytes = new byte[sizeInBytes]; copyMultiSegmentsToBytes(segments, baseOffset, bytes, 0, sizeInBytes); return bytes; } }
[ "public", "static", "byte", "[", "]", "getBytes", "(", "MemorySegment", "[", "]", "segments", ",", "int", "baseOffset", ",", "int", "sizeInBytes", ")", "{", "// avoid copy if `base` is `byte[]`", "if", "(", "segments", ".", "length", "==", "1", ")", "{", "by...
Maybe not copied, if want copy, please use copyTo.
[ "Maybe", "not", "copied", "if", "want", "copy", "please", "use", "copyTo", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L284-L302
train
Get the bytes from the given segments.
[ 30522, 2270, 10763, 24880, 1031, 1033, 2131, 3762, 4570, 1006, 3638, 3366, 21693, 4765, 1031, 1033, 9214, 1010, 20014, 2918, 27475, 3388, 1010, 20014, 2946, 2378, 3762, 4570, 1007, 1063, 1013, 1013, 4468, 6100, 2065, 1036, 2918, 1036, 2003,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/util/TransportFrameDecoder.java
TransportFrameDecoder.nextBufferForFrame
private ByteBuf nextBufferForFrame(int bytesToRead) { ByteBuf buf = buffers.getFirst(); ByteBuf frame; if (buf.readableBytes() > bytesToRead) { frame = buf.retain().readSlice(bytesToRead); totalSize -= bytesToRead; } else { frame = buf; buffers.removeFirst(); totalSize -= frame.readableBytes(); } return frame; }
java
private ByteBuf nextBufferForFrame(int bytesToRead) { ByteBuf buf = buffers.getFirst(); ByteBuf frame; if (buf.readableBytes() > bytesToRead) { frame = buf.retain().readSlice(bytesToRead); totalSize -= bytesToRead; } else { frame = buf; buffers.removeFirst(); totalSize -= frame.readableBytes(); } return frame; }
[ "private", "ByteBuf", "nextBufferForFrame", "(", "int", "bytesToRead", ")", "{", "ByteBuf", "buf", "=", "buffers", ".", "getFirst", "(", ")", ";", "ByteBuf", "frame", ";", "if", "(", "buf", ".", "readableBytes", "(", ")", ">", "bytesToRead", ")", "{", "f...
Takes the first buffer in the internal list, and either adjust it to fit in the frame (by taking a slice out of it) or remove it from the internal list.
[ "Takes", "the", "first", "buffer", "in", "the", "internal", "list", "and", "either", "adjust", "it", "to", "fit", "in", "the", "frame", "(", "by", "taking", "a", "slice", "out", "of", "it", ")", "or", "remove", "it", "from", "the", "internal", "list", ...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/TransportFrameDecoder.java#L200-L214
train
Returns the next frame of the buffer that contains the specified number of bytes.
[ 30522, 2797, 24880, 8569, 2546, 2279, 8569, 12494, 29278, 15643, 1006, 20014, 27507, 19277, 4215, 1007, 1063, 24880, 8569, 30524, 1012, 9631, 13231, 1006, 27507, 19277, 4215, 1007, 1025, 21948, 4697, 1011, 1027, 27507, 19277, 4215, 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...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/collection/dartsclone/DoubleArray.java
DoubleArray.build
public void build(byte[][] keys, int[] values) { Keyset keyset = new Keyset(keys, values); DoubleArrayBuilder builder = new DoubleArrayBuilder(); builder.build(keyset); _array = builder.copy(); }
java
public void build(byte[][] keys, int[] values) { Keyset keyset = new Keyset(keys, values); DoubleArrayBuilder builder = new DoubleArrayBuilder(); builder.build(keyset); _array = builder.copy(); }
[ "public", "void", "build", "(", "byte", "[", "]", "[", "]", "keys", ",", "int", "[", "]", "values", ")", "{", "Keyset", "keyset", "=", "new", "Keyset", "(", "keys", ",", "values", ")", ";", "DoubleArrayBuilder", "builder", "=", "new", "DoubleArrayBuild...
构建 @param keys 字节形式的键 @param values 值
[ "构建" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/dartsclone/DoubleArray.java#L32-L39
train
Build a single record set from the given keys and values.
[ 30522, 2270, 11675, 3857, 1006, 24880, 1031, 1033, 1031, 1033, 6309, 1010, 20014, 1031, 1033, 5300, 1007, 1063, 6309, 30524, 1007, 1025, 3313, 2906, 9447, 8569, 23891, 2099, 12508, 1027, 2047, 3313, 2906, 9447, 8569, 23891, 2099, 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...
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelBase.java
ExcelBase.getOrCreateCellStyle
public CellStyle getOrCreateCellStyle(int x, int y) { final Cell cell = getOrCreateCell(x, y); CellStyle cellStyle = cell.getCellStyle(); if (null == cellStyle) { cellStyle = this.workbook.createCellStyle(); cell.setCellStyle(cellStyle); } return cellStyle; }
java
public CellStyle getOrCreateCellStyle(int x, int y) { final Cell cell = getOrCreateCell(x, y); CellStyle cellStyle = cell.getCellStyle(); if (null == cellStyle) { cellStyle = this.workbook.createCellStyle(); cell.setCellStyle(cellStyle); } return cellStyle; }
[ "public", "CellStyle", "getOrCreateCellStyle", "(", "int", "x", ",", "int", "y", ")", "{", "final", "Cell", "cell", "=", "getOrCreateCell", "(", "x", ",", "y", ")", ";", "CellStyle", "cellStyle", "=", "cell", ".", "getCellStyle", "(", ")", ";", "if", "...
为指定单元格获取或者创建样式,返回样式后可以设置样式内容 @param x X坐标,从0计数,既列号 @param y Y坐标,从0计数,既行号 @return {@link CellStyle} @since 4.1.4
[ "为指定单元格获取或者创建样式,返回样式后可以设置样式内容" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelBase.java#L199-L207
train
Gets the cell style of the specified coordinates.
[ 30522, 2270, 4442, 27983, 2131, 2953, 16748, 3686, 29109, 4877, 27983, 1006, 20014, 1060, 1010, 20014, 1061, 1007, 1063, 2345, 3526, 3526, 1027, 2131, 2953, 16748, 3686, 29109, 2140, 1006, 1060, 1010, 1061, 1007, 1025, 4442, 27983, 4442, 27...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java
AllWindowedStream.min
public SingleOutputStreamOperator<T> min(String field) { return aggregate(new ComparableAggregator<>(field, input.getType(), AggregationFunction.AggregationType.MIN, false, input.getExecutionConfig())); }
java
public SingleOutputStreamOperator<T> min(String field) { return aggregate(new ComparableAggregator<>(field, input.getType(), AggregationFunction.AggregationType.MIN, false, input.getExecutionConfig())); }
[ "public", "SingleOutputStreamOperator", "<", "T", ">", "min", "(", "String", "field", ")", "{", "return", "aggregate", "(", "new", "ComparableAggregator", "<>", "(", "field", ",", "input", ".", "getType", "(", ")", ",", "AggregationFunction", ".", "Aggregation...
Applies an aggregation that that gives the minimum value of the pojo data stream at the given field expression for every window. <p>A field expression is either the name of a public field or a getter method with parentheses of the {@link DataStream}S underlying type. A dot can be used to drill down into objects, as in {@code "field1.getInnerField2()" }. @param field The field expression based on which the aggregation will be applied. @return The transformed DataStream.
[ "Applies", "an", "aggregation", "that", "that", "gives", "the", "minimum", "value", "of", "the", "pojo", "data", "stream", "at", "the", "given", "field", "expression", "for", "every", "window", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java#L1419-L1421
train
Applies an aggregation that aggregates values by comparing their field values to the minimum value of the stream.
[ 30522, 2270, 2309, 5833, 18780, 21422, 25918, 8844, 1026, 1056, 1028, 8117, 1006, 5164, 2492, 1007, 1063, 2709, 9572, 1006, 2047, 12435, 8490, 17603, 20697, 2953, 1026, 1028, 1006, 2492, 1010, 7953, 1012, 2131, 13874, 1006, 1007, 1010, 2804...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java
IoUtil.readUtf8Lines
public static void readUtf8Lines(InputStream in, LineHandler lineHandler) throws IORuntimeException { readLines(in, CharsetUtil.CHARSET_UTF_8, lineHandler); }
java
public static void readUtf8Lines(InputStream in, LineHandler lineHandler) throws IORuntimeException { readLines(in, CharsetUtil.CHARSET_UTF_8, lineHandler); }
[ "public", "static", "void", "readUtf8Lines", "(", "InputStream", "in", ",", "LineHandler", "lineHandler", ")", "throws", "IORuntimeException", "{", "readLines", "(", "in", ",", "CharsetUtil", ".", "CHARSET_UTF_8", ",", "lineHandler", ")", ";", "}" ]
按行读取UTF-8编码数据,针对每行的数据做处理 @param in {@link InputStream} @param lineHandler 行处理接口,实现handle方法用于编辑一行的数据后入到指定地方 @throws IORuntimeException IO异常 @since 3.1.1
[ "按行读取UTF", "-", "8编码数据,针对每行的数据做处理" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L689-L691
train
Reads the UTF - 8 lines from the given input stream.
[ 30522, 2270, 10763, 11675, 3191, 4904, 2546, 2620, 12735, 1006, 20407, 25379, 1999, 1010, 2240, 11774, 3917, 2240, 11774, 3917, 1007, 11618, 22834, 15532, 7292, 10288, 24422, 1063, 3191, 12735, 1006, 1999, 1010, 25869, 13462, 21823, 2140, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/incubator-shardingsphere
sharding-transaction/sharding-transaction-core/src/main/java/org/apache/shardingsphere/transaction/ShardingTransactionManagerEngine.java
ShardingTransactionManagerEngine.close
public void close() throws Exception { for (Entry<TransactionType, ShardingTransactionManager> entry : transactionManagerMap.entrySet()) { entry.getValue().close(); } }
java
public void close() throws Exception { for (Entry<TransactionType, ShardingTransactionManager> entry : transactionManagerMap.entrySet()) { entry.getValue().close(); } }
[ "public", "void", "close", "(", ")", "throws", "Exception", "{", "for", "(", "Entry", "<", "TransactionType", ",", "ShardingTransactionManager", ">", "entry", ":", "transactionManagerMap", ".", "entrySet", "(", ")", ")", "{", "entry", ".", "getValue", "(", "...
Close sharding transaction managers. @throws Exception exception
[ "Close", "sharding", "transaction", "managers", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-transaction/sharding-transaction-core/src/main/java/org/apache/shardingsphere/transaction/ShardingTransactionManagerEngine.java#L103-L107
train
Close all sharding transaction managers.
[ 30522, 2270, 11675, 2485, 1006, 1007, 11618, 6453, 1063, 2005, 1006, 4443, 1026, 12598, 13874, 1010, 21146, 17080, 3070, 6494, 3619, 18908, 3258, 24805, 4590, 1028, 4443, 1024, 12598, 24805, 4590, 2863, 2361, 1012, 4443, 13462, 1006, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/DataSet.java
DataSet.rightOuterJoin
public <R> JoinOperatorSetsBase<T, R> rightOuterJoin(DataSet<R> other) { return new JoinOperatorSetsBase<>(this, other, JoinHint.OPTIMIZER_CHOOSES, JoinType.RIGHT_OUTER); }
java
public <R> JoinOperatorSetsBase<T, R> rightOuterJoin(DataSet<R> other) { return new JoinOperatorSetsBase<>(this, other, JoinHint.OPTIMIZER_CHOOSES, JoinType.RIGHT_OUTER); }
[ "public", "<", "R", ">", "JoinOperatorSetsBase", "<", "T", ",", "R", ">", "rightOuterJoin", "(", "DataSet", "<", "R", ">", "other", ")", "{", "return", "new", "JoinOperatorSetsBase", "<>", "(", "this", ",", "other", ",", "JoinHint", ".", "OPTIMIZER_CHOOSES...
Initiates a Right Outer Join transformation. <p>An Outer Join transformation joins two elements of two {@link DataSet DataSets} on key equality and provides multiple ways to combine joining elements into one DataSet. <p>Elements of the <b>right</b> DataSet (i.e. {@code other}) that do not have a matching element on {@code this} side are joined with {@code null} and emitted to the resulting DataSet. @param other The other DataSet with which this DataSet is joined. @return A JoinOperatorSet to continue the definition of the Join transformation. @see org.apache.flink.api.java.operators.join.JoinOperatorSetsBase @see DataSet
[ "Initiates", "a", "Right", "Outer", "Join", "transformation", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L895-L897
train
Create a JoinOperatorSetsBase for the right outer join of this DataSet and other DataSet.
[ 30522, 2270, 1026, 1054, 1028, 3693, 25918, 18926, 8454, 15058, 1026, 1056, 1010, 1054, 1028, 2157, 5833, 2121, 5558, 2378, 1006, 2951, 13462, 1026, 1054, 1028, 2060, 1007, 1063, 2709, 2047, 3693, 25918, 18926, 8454, 15058, 1026, 1028, 1006...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java
BeanUtil.getBeanDesc
public static BeanDesc getBeanDesc(Class<?> clazz) { BeanDesc beanDesc = BeanDescCache.INSTANCE.getBeanDesc(clazz); if (null == beanDesc) { beanDesc = new BeanDesc(clazz); BeanDescCache.INSTANCE.putBeanDesc(clazz, beanDesc); } return beanDesc; }
java
public static BeanDesc getBeanDesc(Class<?> clazz) { BeanDesc beanDesc = BeanDescCache.INSTANCE.getBeanDesc(clazz); if (null == beanDesc) { beanDesc = new BeanDesc(clazz); BeanDescCache.INSTANCE.putBeanDesc(clazz, beanDesc); } return beanDesc; }
[ "public", "static", "BeanDesc", "getBeanDesc", "(", "Class", "<", "?", ">", "clazz", ")", "{", "BeanDesc", "beanDesc", "=", "BeanDescCache", ".", "INSTANCE", ".", "getBeanDesc", "(", "clazz", ")", ";", "if", "(", "null", "==", "beanDesc", ")", "{", "bean...
获取{@link BeanDesc} Bean描述信息 @param clazz Bean类 @return {@link BeanDesc} @since 3.1.2
[ "获取", "{", "@link", "BeanDesc", "}", "Bean描述信息" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L151-L158
train
Gets the BeanDesc for the given class.
[ 30522, 2270, 10763, 14068, 6155, 2278, 2131, 4783, 5685, 2229, 2278, 1006, 2465, 1026, 1029, 30524, 1063, 14068, 6155, 2278, 14068, 6155, 2278, 1027, 14068, 6155, 16665, 5403, 1012, 6013, 1012, 2131, 4783, 5685, 2229, 2278, 1006, 18856, 109...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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) { return resolveAll(inetHost, additionals, executor().<List<InetAddress>>newPromise()); }
java
public final Future<List<InetAddress>> resolveAll(String inetHost, Iterable<DnsRecord> additionals) { return resolveAll(inetHost, additionals, executor().<List<InetAddress>>newPromise()); }
[ "public", "final", "Future", "<", "List", "<", "InetAddress", ">", ">", "resolveAll", "(", "String", "inetHost", ",", "Iterable", "<", "DnsRecord", ">", "additionals", ")", "{", "return", "resolveAll", "(", "inetHost", ",", "additionals", ",", "executor", "(...
Resolves the specified host name and port into a list of address. @param inetHost the name to resolve @param additionals additional records ({@code OPT}) @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#L670-L672
train
Resolves all dns records from the given IP address.
[ 30522, 2270, 2345, 2925, 1026, 2862, 1026, 1999, 12928, 14141, 8303, 1028, 1028, 10663, 8095, 1006, 5164, 1999, 11031, 14122, 1010, 2009, 6906, 3468, 1026, 1040, 3619, 2890, 27108, 2094, 1028, 3176, 2015, 1007, 1063, 30524, 1010, 4654, 8586...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/TRowSet.java
TRowSet.isSet
public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case START_ROW_OFFSET: return isSetStartRowOffset(); case ROWS: return isSetRows(); case COLUMNS: return isSetColumns(); } throw new IllegalStateException(); }
java
public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case START_ROW_OFFSET: return isSetStartRowOffset(); case ROWS: return isSetRows(); case COLUMNS: return isSetColumns(); } throw new IllegalStateException(); }
[ "public", "boolean", "isSet", "(", "_Fields", "field", ")", "{", "if", "(", "field", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "switch", "(", "field", ")", "{", "case", "START_ROW_OFFSET", ":", "return", "isS...
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/TRowSet.java#L324-L338
train
Checks if the specified field is set to a value of a CRA S Grammar.
[ 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, 2707...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/dictionary/CoreSynonymDictionary.java
CoreSynonymDictionary.similarity
public static double similarity(String A, String B) { long distance = distance(A, B); if (distance > dictionary.getMaxSynonymItemIdDistance()) return 0.0; return (dictionary.getMaxSynonymItemIdDistance() - distance) / (double) dictionary.getMaxSynonymItemIdDistance(); }
java
public static double similarity(String A, String B) { long distance = distance(A, B); if (distance > dictionary.getMaxSynonymItemIdDistance()) return 0.0; return (dictionary.getMaxSynonymItemIdDistance() - distance) / (double) dictionary.getMaxSynonymItemIdDistance(); }
[ "public", "static", "double", "similarity", "(", "String", "A", ",", "String", "B", ")", "{", "long", "distance", "=", "distance", "(", "A", ",", "B", ")", ";", "if", "(", "distance", ">", "dictionary", ".", "getMaxSynonymItemIdDistance", "(", ")", ")", ...
计算两个单词之间的相似度,0表示不相似,1表示完全相似 @param A @param B @return
[ "计算两个单词之间的相似度,0表示不相似,1表示完全相似" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/CoreSynonymDictionary.java#L104-L110
train
Returns the similarity of two words.
[ 30522, 2270, 10763, 3313, 14402, 1006, 5164, 1037, 1010, 5164, 1038, 1007, 1063, 2146, 3292, 1027, 3292, 1006, 1037, 1010, 1038, 1007, 1025, 2065, 1006, 3292, 1028, 9206, 1012, 2131, 17848, 6508, 8540, 24335, 4221, 4328, 14141, 23137, 3401,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
networknt/light-4j
security/src/main/java/com/networknt/security/JwtIssuer.java
JwtIssuer.getJwt
public static String getJwt(JwtClaims claims) throws JoseException { String jwt; RSAPrivateKey privateKey = (RSAPrivateKey) getPrivateKey( jwtConfig.getKey().getFilename(), (String)secretConfig.get(JWT_PRIVATE_KEY_PASSWORD), jwtConfig.getKey().getKeyName()); // A JWT is a JWS and/or a JWE with JSON claims as the payload. // In this example it is a JWS nested inside a JWE // So we first create a JsonWebSignature object. JsonWebSignature jws = new JsonWebSignature(); // The payload of the JWS is JSON content of the JWT Claims jws.setPayload(claims.toJson()); // The JWT is signed using the sender's private key jws.setKey(privateKey); // Get provider from security config file, it should be two digit // And the provider id will set as prefix for keyid in the token header, for example: 05100 // if there is no provider id, we use "00" for the default value String provider_id = ""; if (jwtConfig.getProviderId() != null) { provider_id = jwtConfig.getProviderId(); if (provider_id.length() == 1) { provider_id = "0" + provider_id; } else if (provider_id.length() > 2) { logger.error("provider_id defined in the security.yml file is invalid; the length should be 2"); provider_id = provider_id.substring(0, 2); } } jws.setKeyIdHeaderValue(provider_id + jwtConfig.getKey().getKid()); // Set the signature algorithm on the JWT/JWS that will integrity protect the claims jws.setAlgorithmHeaderValue(AlgorithmIdentifiers.RSA_USING_SHA256); // Sign the JWS and produce the compact serialization, which will be the inner JWT/JWS // representation, which is a string consisting of three dot ('.') separated // base64url-encoded parts in the form Header.Payload.Signature jwt = jws.getCompactSerialization(); return jwt; }
java
public static String getJwt(JwtClaims claims) throws JoseException { String jwt; RSAPrivateKey privateKey = (RSAPrivateKey) getPrivateKey( jwtConfig.getKey().getFilename(), (String)secretConfig.get(JWT_PRIVATE_KEY_PASSWORD), jwtConfig.getKey().getKeyName()); // A JWT is a JWS and/or a JWE with JSON claims as the payload. // In this example it is a JWS nested inside a JWE // So we first create a JsonWebSignature object. JsonWebSignature jws = new JsonWebSignature(); // The payload of the JWS is JSON content of the JWT Claims jws.setPayload(claims.toJson()); // The JWT is signed using the sender's private key jws.setKey(privateKey); // Get provider from security config file, it should be two digit // And the provider id will set as prefix for keyid in the token header, for example: 05100 // if there is no provider id, we use "00" for the default value String provider_id = ""; if (jwtConfig.getProviderId() != null) { provider_id = jwtConfig.getProviderId(); if (provider_id.length() == 1) { provider_id = "0" + provider_id; } else if (provider_id.length() > 2) { logger.error("provider_id defined in the security.yml file is invalid; the length should be 2"); provider_id = provider_id.substring(0, 2); } } jws.setKeyIdHeaderValue(provider_id + jwtConfig.getKey().getKid()); // Set the signature algorithm on the JWT/JWS that will integrity protect the claims jws.setAlgorithmHeaderValue(AlgorithmIdentifiers.RSA_USING_SHA256); // Sign the JWS and produce the compact serialization, which will be the inner JWT/JWS // representation, which is a string consisting of three dot ('.') separated // base64url-encoded parts in the form Header.Payload.Signature jwt = jws.getCompactSerialization(); return jwt; }
[ "public", "static", "String", "getJwt", "(", "JwtClaims", "claims", ")", "throws", "JoseException", "{", "String", "jwt", ";", "RSAPrivateKey", "privateKey", "=", "(", "RSAPrivateKey", ")", "getPrivateKey", "(", "jwtConfig", ".", "getKey", "(", ")", ".", "getF...
A static method that generate JWT token from JWT claims object @param claims JwtClaims object @return A string represents jwt token @throws JoseException JoseException
[ "A", "static", "method", "that", "generate", "JWT", "token", "from", "JWT", "claims", "object" ]
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/security/src/main/java/com/networknt/security/JwtIssuer.java#L53-L92
train
Returns the JWT for the given claims
[ 30522, 2270, 10763, 5164, 2131, 3501, 26677, 1006, 1046, 26677, 25154, 2015, 4447, 1007, 11618, 4560, 10288, 24422, 1063, 5164, 1046, 26677, 1025, 12667, 9331, 3089, 16952, 14839, 2797, 14839, 1027, 1006, 12667, 9331, 3089, 16952, 14839, 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...
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoder.java
HttpPostRequestEncoder.addBodyHttpData
public void addBodyHttpData(InterfaceHttpData data) throws ErrorDataEncoderException { if (headerFinalized) { throw new ErrorDataEncoderException("Cannot add value once finalized"); } bodyListDatas.add(checkNotNull(data, "data")); if (!isMultipart) { if (data instanceof Attribute) { Attribute attribute = (Attribute) data; try { // name=value& with encoded name and attribute String key = encodeAttribute(attribute.getName(), charset); String value = encodeAttribute(attribute.getValue(), charset); Attribute newattribute = factory.createAttribute(request, key, value); multipartHttpDatas.add(newattribute); globalBodySize += newattribute.getName().length() + 1 + newattribute.length() + 1; } catch (IOException e) { throw new ErrorDataEncoderException(e); } } else if (data instanceof FileUpload) { // since not Multipart, only name=filename => Attribute FileUpload fileUpload = (FileUpload) data; // name=filename& with encoded name and filename String key = encodeAttribute(fileUpload.getName(), charset); String value = encodeAttribute(fileUpload.getFilename(), charset); Attribute newattribute = factory.createAttribute(request, key, value); multipartHttpDatas.add(newattribute); globalBodySize += newattribute.getName().length() + 1 + newattribute.length() + 1; } return; } /* * Logic: * if not Attribute: * add Data to body list * if (duringMixedMode) * add endmixedmultipart delimiter * currentFileUpload = null * duringMixedMode = false; * add multipart delimiter, multipart body header and Data to multipart list * reset currentFileUpload, duringMixedMode * if FileUpload: take care of multiple file for one field => mixed mode * if (duringMixedMode) * if (currentFileUpload.name == data.name) * add mixedmultipart delimiter, mixedmultipart body header and Data to multipart list * else * add endmixedmultipart delimiter, multipart body header and Data to multipart list * currentFileUpload = data * duringMixedMode = false; * else * if (currentFileUpload.name == data.name) * change multipart body header of previous file into multipart list to * mixedmultipart start, mixedmultipart body header * add mixedmultipart delimiter, mixedmultipart body header and Data to multipart list * duringMixedMode = true * else * add multipart delimiter, multipart body header and Data to multipart list * currentFileUpload = data * duringMixedMode = false; * Do not add last delimiter! Could be: * if duringmixedmode: endmixedmultipart + endmultipart * else only endmultipart */ if (data instanceof Attribute) { if (duringMixedMode) { InternalAttribute internal = new InternalAttribute(charset); internal.addValue("\r\n--" + multipartMixedBoundary + "--"); multipartHttpDatas.add(internal); multipartMixedBoundary = null; currentFileUpload = null; duringMixedMode = false; } InternalAttribute internal = new InternalAttribute(charset); if (!multipartHttpDatas.isEmpty()) { // previously a data field so CRLF internal.addValue("\r\n"); } internal.addValue("--" + multipartDataBoundary + "\r\n"); // content-disposition: form-data; name="field1" Attribute attribute = (Attribute) data; internal.addValue(HttpHeaderNames.CONTENT_DISPOSITION + ": " + HttpHeaderValues.FORM_DATA + "; " + HttpHeaderValues.NAME + "=\"" + attribute.getName() + "\"\r\n"); // Add Content-Length: xxx internal.addValue(HttpHeaderNames.CONTENT_LENGTH + ": " + attribute.length() + "\r\n"); Charset localcharset = attribute.getCharset(); if (localcharset != null) { // Content-Type: text/plain; charset=charset internal.addValue(HttpHeaderNames.CONTENT_TYPE + ": " + HttpPostBodyUtil.DEFAULT_TEXT_CONTENT_TYPE + "; " + HttpHeaderValues.CHARSET + '=' + localcharset.name() + "\r\n"); } // CRLF between body header and data internal.addValue("\r\n"); multipartHttpDatas.add(internal); multipartHttpDatas.add(data); globalBodySize += attribute.length() + internal.size(); } else if (data instanceof FileUpload) { FileUpload fileUpload = (FileUpload) data; InternalAttribute internal = new InternalAttribute(charset); if (!multipartHttpDatas.isEmpty()) { // previously a data field so CRLF internal.addValue("\r\n"); } boolean localMixed; if (duringMixedMode) { if (currentFileUpload != null && currentFileUpload.getName().equals(fileUpload.getName())) { // continue a mixed mode localMixed = true; } else { // end a mixed mode // add endmixedmultipart delimiter, multipart body header // and // Data to multipart list internal.addValue("--" + multipartMixedBoundary + "--"); multipartHttpDatas.add(internal); multipartMixedBoundary = null; // start a new one (could be replaced if mixed start again // from here internal = new InternalAttribute(charset); internal.addValue("\r\n"); localMixed = false; // new currentFileUpload and no more in Mixed mode currentFileUpload = fileUpload; duringMixedMode = false; } } else { if (encoderMode != EncoderMode.HTML5 && currentFileUpload != null && currentFileUpload.getName().equals(fileUpload.getName())) { // create a new mixed mode (from previous file) // change multipart body header of previous file into // multipart list to // mixedmultipart start, mixedmultipart body header // change Internal (size()-2 position in multipartHttpDatas) // from (line starting with *) // --AaB03x // * Content-Disposition: form-data; name="files"; // filename="file1.txt" // Content-Type: text/plain // to (lines starting with *) // --AaB03x // * Content-Disposition: form-data; name="files" // * Content-Type: multipart/mixed; boundary=BbC04y // * // * --BbC04y // * Content-Disposition: attachment; filename="file1.txt" // Content-Type: text/plain initMixedMultipart(); InternalAttribute pastAttribute = (InternalAttribute) multipartHttpDatas.get(multipartHttpDatas .size() - 2); // remove past size globalBodySize -= pastAttribute.size(); StringBuilder replacement = new StringBuilder( 139 + multipartDataBoundary.length() + multipartMixedBoundary.length() * 2 + fileUpload.getFilename().length() + fileUpload.getName().length()) .append("--") .append(multipartDataBoundary) .append("\r\n") .append(HttpHeaderNames.CONTENT_DISPOSITION) .append(": ") .append(HttpHeaderValues.FORM_DATA) .append("; ") .append(HttpHeaderValues.NAME) .append("=\"") .append(fileUpload.getName()) .append("\"\r\n") .append(HttpHeaderNames.CONTENT_TYPE) .append(": ") .append(HttpHeaderValues.MULTIPART_MIXED) .append("; ") .append(HttpHeaderValues.BOUNDARY) .append('=') .append(multipartMixedBoundary) .append("\r\n\r\n") .append("--") .append(multipartMixedBoundary) .append("\r\n") .append(HttpHeaderNames.CONTENT_DISPOSITION) .append(": ") .append(HttpHeaderValues.ATTACHMENT); if (!fileUpload.getFilename().isEmpty()) { replacement.append("; ") .append(HttpHeaderValues.FILENAME) .append("=\"") .append(fileUpload.getFilename()) .append('"'); } replacement.append("\r\n"); pastAttribute.setValue(replacement.toString(), 1); pastAttribute.setValue("", 2); // update past size globalBodySize += pastAttribute.size(); // now continue // add mixedmultipart delimiter, mixedmultipart body header // and // Data to multipart list localMixed = true; duringMixedMode = true; } else { // a simple new multipart // add multipart delimiter, multipart body header and Data // to multipart list localMixed = false; currentFileUpload = fileUpload; duringMixedMode = false; } } if (localMixed) { // add mixedmultipart delimiter, mixedmultipart body header and // Data to multipart list internal.addValue("--" + multipartMixedBoundary + "\r\n"); if (fileUpload.getFilename().isEmpty()) { // Content-Disposition: attachment internal.addValue(HttpHeaderNames.CONTENT_DISPOSITION + ": " + HttpHeaderValues.ATTACHMENT + "\r\n"); } else { // Content-Disposition: attachment; filename="file1.txt" internal.addValue(HttpHeaderNames.CONTENT_DISPOSITION + ": " + HttpHeaderValues.ATTACHMENT + "; " + HttpHeaderValues.FILENAME + "=\"" + fileUpload.getFilename() + "\"\r\n"); } } else { internal.addValue("--" + multipartDataBoundary + "\r\n"); if (fileUpload.getFilename().isEmpty()) { // Content-Disposition: form-data; name="files"; internal.addValue(HttpHeaderNames.CONTENT_DISPOSITION + ": " + HttpHeaderValues.FORM_DATA + "; " + HttpHeaderValues.NAME + "=\"" + fileUpload.getName() + "\"\r\n"); } else { // Content-Disposition: form-data; name="files"; // filename="file1.txt" internal.addValue(HttpHeaderNames.CONTENT_DISPOSITION + ": " + HttpHeaderValues.FORM_DATA + "; " + HttpHeaderValues.NAME + "=\"" + fileUpload.getName() + "\"; " + HttpHeaderValues.FILENAME + "=\"" + fileUpload.getFilename() + "\"\r\n"); } } // Add Content-Length: xxx internal.addValue(HttpHeaderNames.CONTENT_LENGTH + ": " + fileUpload.length() + "\r\n"); // Content-Type: image/gif // Content-Type: text/plain; charset=ISO-8859-1 // Content-Transfer-Encoding: binary internal.addValue(HttpHeaderNames.CONTENT_TYPE + ": " + fileUpload.getContentType()); String contentTransferEncoding = fileUpload.getContentTransferEncoding(); if (contentTransferEncoding != null && contentTransferEncoding.equals(HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value())) { internal.addValue("\r\n" + HttpHeaderNames.CONTENT_TRANSFER_ENCODING + ": " + HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value() + "\r\n\r\n"); } else if (fileUpload.getCharset() != null) { internal.addValue("; " + HttpHeaderValues.CHARSET + '=' + fileUpload.getCharset().name() + "\r\n\r\n"); } else { internal.addValue("\r\n\r\n"); } multipartHttpDatas.add(internal); multipartHttpDatas.add(data); globalBodySize += fileUpload.length() + internal.size(); } }
java
public void addBodyHttpData(InterfaceHttpData data) throws ErrorDataEncoderException { if (headerFinalized) { throw new ErrorDataEncoderException("Cannot add value once finalized"); } bodyListDatas.add(checkNotNull(data, "data")); if (!isMultipart) { if (data instanceof Attribute) { Attribute attribute = (Attribute) data; try { // name=value& with encoded name and attribute String key = encodeAttribute(attribute.getName(), charset); String value = encodeAttribute(attribute.getValue(), charset); Attribute newattribute = factory.createAttribute(request, key, value); multipartHttpDatas.add(newattribute); globalBodySize += newattribute.getName().length() + 1 + newattribute.length() + 1; } catch (IOException e) { throw new ErrorDataEncoderException(e); } } else if (data instanceof FileUpload) { // since not Multipart, only name=filename => Attribute FileUpload fileUpload = (FileUpload) data; // name=filename& with encoded name and filename String key = encodeAttribute(fileUpload.getName(), charset); String value = encodeAttribute(fileUpload.getFilename(), charset); Attribute newattribute = factory.createAttribute(request, key, value); multipartHttpDatas.add(newattribute); globalBodySize += newattribute.getName().length() + 1 + newattribute.length() + 1; } return; } /* * Logic: * if not Attribute: * add Data to body list * if (duringMixedMode) * add endmixedmultipart delimiter * currentFileUpload = null * duringMixedMode = false; * add multipart delimiter, multipart body header and Data to multipart list * reset currentFileUpload, duringMixedMode * if FileUpload: take care of multiple file for one field => mixed mode * if (duringMixedMode) * if (currentFileUpload.name == data.name) * add mixedmultipart delimiter, mixedmultipart body header and Data to multipart list * else * add endmixedmultipart delimiter, multipart body header and Data to multipart list * currentFileUpload = data * duringMixedMode = false; * else * if (currentFileUpload.name == data.name) * change multipart body header of previous file into multipart list to * mixedmultipart start, mixedmultipart body header * add mixedmultipart delimiter, mixedmultipart body header and Data to multipart list * duringMixedMode = true * else * add multipart delimiter, multipart body header and Data to multipart list * currentFileUpload = data * duringMixedMode = false; * Do not add last delimiter! Could be: * if duringmixedmode: endmixedmultipart + endmultipart * else only endmultipart */ if (data instanceof Attribute) { if (duringMixedMode) { InternalAttribute internal = new InternalAttribute(charset); internal.addValue("\r\n--" + multipartMixedBoundary + "--"); multipartHttpDatas.add(internal); multipartMixedBoundary = null; currentFileUpload = null; duringMixedMode = false; } InternalAttribute internal = new InternalAttribute(charset); if (!multipartHttpDatas.isEmpty()) { // previously a data field so CRLF internal.addValue("\r\n"); } internal.addValue("--" + multipartDataBoundary + "\r\n"); // content-disposition: form-data; name="field1" Attribute attribute = (Attribute) data; internal.addValue(HttpHeaderNames.CONTENT_DISPOSITION + ": " + HttpHeaderValues.FORM_DATA + "; " + HttpHeaderValues.NAME + "=\"" + attribute.getName() + "\"\r\n"); // Add Content-Length: xxx internal.addValue(HttpHeaderNames.CONTENT_LENGTH + ": " + attribute.length() + "\r\n"); Charset localcharset = attribute.getCharset(); if (localcharset != null) { // Content-Type: text/plain; charset=charset internal.addValue(HttpHeaderNames.CONTENT_TYPE + ": " + HttpPostBodyUtil.DEFAULT_TEXT_CONTENT_TYPE + "; " + HttpHeaderValues.CHARSET + '=' + localcharset.name() + "\r\n"); } // CRLF between body header and data internal.addValue("\r\n"); multipartHttpDatas.add(internal); multipartHttpDatas.add(data); globalBodySize += attribute.length() + internal.size(); } else if (data instanceof FileUpload) { FileUpload fileUpload = (FileUpload) data; InternalAttribute internal = new InternalAttribute(charset); if (!multipartHttpDatas.isEmpty()) { // previously a data field so CRLF internal.addValue("\r\n"); } boolean localMixed; if (duringMixedMode) { if (currentFileUpload != null && currentFileUpload.getName().equals(fileUpload.getName())) { // continue a mixed mode localMixed = true; } else { // end a mixed mode // add endmixedmultipart delimiter, multipart body header // and // Data to multipart list internal.addValue("--" + multipartMixedBoundary + "--"); multipartHttpDatas.add(internal); multipartMixedBoundary = null; // start a new one (could be replaced if mixed start again // from here internal = new InternalAttribute(charset); internal.addValue("\r\n"); localMixed = false; // new currentFileUpload and no more in Mixed mode currentFileUpload = fileUpload; duringMixedMode = false; } } else { if (encoderMode != EncoderMode.HTML5 && currentFileUpload != null && currentFileUpload.getName().equals(fileUpload.getName())) { // create a new mixed mode (from previous file) // change multipart body header of previous file into // multipart list to // mixedmultipart start, mixedmultipart body header // change Internal (size()-2 position in multipartHttpDatas) // from (line starting with *) // --AaB03x // * Content-Disposition: form-data; name="files"; // filename="file1.txt" // Content-Type: text/plain // to (lines starting with *) // --AaB03x // * Content-Disposition: form-data; name="files" // * Content-Type: multipart/mixed; boundary=BbC04y // * // * --BbC04y // * Content-Disposition: attachment; filename="file1.txt" // Content-Type: text/plain initMixedMultipart(); InternalAttribute pastAttribute = (InternalAttribute) multipartHttpDatas.get(multipartHttpDatas .size() - 2); // remove past size globalBodySize -= pastAttribute.size(); StringBuilder replacement = new StringBuilder( 139 + multipartDataBoundary.length() + multipartMixedBoundary.length() * 2 + fileUpload.getFilename().length() + fileUpload.getName().length()) .append("--") .append(multipartDataBoundary) .append("\r\n") .append(HttpHeaderNames.CONTENT_DISPOSITION) .append(": ") .append(HttpHeaderValues.FORM_DATA) .append("; ") .append(HttpHeaderValues.NAME) .append("=\"") .append(fileUpload.getName()) .append("\"\r\n") .append(HttpHeaderNames.CONTENT_TYPE) .append(": ") .append(HttpHeaderValues.MULTIPART_MIXED) .append("; ") .append(HttpHeaderValues.BOUNDARY) .append('=') .append(multipartMixedBoundary) .append("\r\n\r\n") .append("--") .append(multipartMixedBoundary) .append("\r\n") .append(HttpHeaderNames.CONTENT_DISPOSITION) .append(": ") .append(HttpHeaderValues.ATTACHMENT); if (!fileUpload.getFilename().isEmpty()) { replacement.append("; ") .append(HttpHeaderValues.FILENAME) .append("=\"") .append(fileUpload.getFilename()) .append('"'); } replacement.append("\r\n"); pastAttribute.setValue(replacement.toString(), 1); pastAttribute.setValue("", 2); // update past size globalBodySize += pastAttribute.size(); // now continue // add mixedmultipart delimiter, mixedmultipart body header // and // Data to multipart list localMixed = true; duringMixedMode = true; } else { // a simple new multipart // add multipart delimiter, multipart body header and Data // to multipart list localMixed = false; currentFileUpload = fileUpload; duringMixedMode = false; } } if (localMixed) { // add mixedmultipart delimiter, mixedmultipart body header and // Data to multipart list internal.addValue("--" + multipartMixedBoundary + "\r\n"); if (fileUpload.getFilename().isEmpty()) { // Content-Disposition: attachment internal.addValue(HttpHeaderNames.CONTENT_DISPOSITION + ": " + HttpHeaderValues.ATTACHMENT + "\r\n"); } else { // Content-Disposition: attachment; filename="file1.txt" internal.addValue(HttpHeaderNames.CONTENT_DISPOSITION + ": " + HttpHeaderValues.ATTACHMENT + "; " + HttpHeaderValues.FILENAME + "=\"" + fileUpload.getFilename() + "\"\r\n"); } } else { internal.addValue("--" + multipartDataBoundary + "\r\n"); if (fileUpload.getFilename().isEmpty()) { // Content-Disposition: form-data; name="files"; internal.addValue(HttpHeaderNames.CONTENT_DISPOSITION + ": " + HttpHeaderValues.FORM_DATA + "; " + HttpHeaderValues.NAME + "=\"" + fileUpload.getName() + "\"\r\n"); } else { // Content-Disposition: form-data; name="files"; // filename="file1.txt" internal.addValue(HttpHeaderNames.CONTENT_DISPOSITION + ": " + HttpHeaderValues.FORM_DATA + "; " + HttpHeaderValues.NAME + "=\"" + fileUpload.getName() + "\"; " + HttpHeaderValues.FILENAME + "=\"" + fileUpload.getFilename() + "\"\r\n"); } } // Add Content-Length: xxx internal.addValue(HttpHeaderNames.CONTENT_LENGTH + ": " + fileUpload.length() + "\r\n"); // Content-Type: image/gif // Content-Type: text/plain; charset=ISO-8859-1 // Content-Transfer-Encoding: binary internal.addValue(HttpHeaderNames.CONTENT_TYPE + ": " + fileUpload.getContentType()); String contentTransferEncoding = fileUpload.getContentTransferEncoding(); if (contentTransferEncoding != null && contentTransferEncoding.equals(HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value())) { internal.addValue("\r\n" + HttpHeaderNames.CONTENT_TRANSFER_ENCODING + ": " + HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value() + "\r\n\r\n"); } else if (fileUpload.getCharset() != null) { internal.addValue("; " + HttpHeaderValues.CHARSET + '=' + fileUpload.getCharset().name() + "\r\n\r\n"); } else { internal.addValue("\r\n\r\n"); } multipartHttpDatas.add(internal); multipartHttpDatas.add(data); globalBodySize += fileUpload.length() + internal.size(); } }
[ "public", "void", "addBodyHttpData", "(", "InterfaceHttpData", "data", ")", "throws", "ErrorDataEncoderException", "{", "if", "(", "headerFinalized", ")", "{", "throw", "new", "ErrorDataEncoderException", "(", "\"Cannot add value once finalized\"", ")", ";", "}", "bodyL...
Add the InterfaceHttpData to the Body list @throws NullPointerException for data @throws ErrorDataEncoderException if the encoding is in error or if the finalize were already done
[ "Add", "the", "InterfaceHttpData", "to", "the", "Body", "list" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoder.java#L447-L720
train
Add a body data to the response.
[ 30522, 2270, 11675, 5587, 23684, 11039, 25856, 2850, 2696, 1006, 8278, 11039, 25856, 2850, 2696, 2951, 1007, 11618, 7561, 2850, 2696, 2368, 16044, 2890, 2595, 24422, 1063, 2065, 1006, 20346, 16294, 11475, 5422, 1007, 1063, 5466, 2047, 7561, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.getFloat
public static float getFloat(MemorySegment[] segments, int offset) { if (inFirstSegment(segments, offset, 4)) { return segments[0].getFloat(offset); } else { return getFloatMultiSegments(segments, offset); } }
java
public static float getFloat(MemorySegment[] segments, int offset) { if (inFirstSegment(segments, offset, 4)) { return segments[0].getFloat(offset); } else { return getFloatMultiSegments(segments, offset); } }
[ "public", "static", "float", "getFloat", "(", "MemorySegment", "[", "]", "segments", ",", "int", "offset", ")", "{", "if", "(", "inFirstSegment", "(", "segments", ",", "offset", ",", "4", ")", ")", "{", "return", "segments", "[", "0", "]", ".", "getFlo...
get float from segments. @param segments target segments. @param offset value offset.
[ "get", "float", "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#L852-L858
train
get float from segments.
[ 30522, 2270, 10763, 14257, 2131, 10258, 16503, 1006, 3638, 3366, 21693, 4765, 1031, 1033, 9214, 1010, 20014, 16396, 1007, 1063, 2065, 1006, 1999, 8873, 12096, 3366, 21693, 4765, 1006, 9214, 1010, 16396, 1010, 1018, 1007, 1007, 1063, 2709, 9...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-connectors/flink-connector-kafka-0.11/src/main/java/org/apache/flink/streaming/connectors/kafka/internal/FlinkKafkaProducer.java
FlinkKafkaProducer.flushNewPartitions
private void flushNewPartitions() { LOG.info("Flushing new partitions"); TransactionalRequestResult result = enqueueNewPartitions(); Object sender = getValue(kafkaProducer, "sender"); invoke(sender, "wakeup"); result.await(); }
java
private void flushNewPartitions() { LOG.info("Flushing new partitions"); TransactionalRequestResult result = enqueueNewPartitions(); Object sender = getValue(kafkaProducer, "sender"); invoke(sender, "wakeup"); result.await(); }
[ "private", "void", "flushNewPartitions", "(", ")", "{", "LOG", ".", "info", "(", "\"Flushing new partitions\"", ")", ";", "TransactionalRequestResult", "result", "=", "enqueueNewPartitions", "(", ")", ";", "Object", "sender", "=", "getValue", "(", "kafkaProducer", ...
Besides committing {@link org.apache.kafka.clients.producer.KafkaProducer#commitTransaction} is also adding new partitions to the transaction. flushNewPartitions method is moving this logic to pre-commit/flush, to make resumeTransaction simpler. Otherwise resumeTransaction would require to restore state of the not yet added/"in-flight" partitions.
[ "Besides", "committing", "{" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-0.11/src/main/java/org/apache/flink/streaming/connectors/kafka/internal/FlinkKafkaProducer.java#L243-L249
train
Flush all new partitions.
[ 30522, 2797, 11675, 13862, 2638, 2860, 19362, 3775, 9285, 1006, 1007, 1063, 8833, 1012, 18558, 1006, 1000, 23519, 2047, 13571, 2015, 1000, 1007, 1025, 12598, 2389, 2890, 15500, 6072, 11314, 2765, 1027, 4372, 4226, 24997, 7974, 19362, 3775, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/api/java/typeutils/ObjectArrayTypeInfo.java
ObjectArrayTypeInfo.getInfoFor
@PublicEvolving public static <T, C> ObjectArrayTypeInfo<T, C> getInfoFor(Class<T> arrayClass, TypeInformation<C> componentInfo) { checkNotNull(arrayClass); checkNotNull(componentInfo); checkArgument(arrayClass.isArray(), "Class " + arrayClass + " must be an array."); return new ObjectArrayTypeInfo<T, C>(arrayClass, componentInfo); }
java
@PublicEvolving public static <T, C> ObjectArrayTypeInfo<T, C> getInfoFor(Class<T> arrayClass, TypeInformation<C> componentInfo) { checkNotNull(arrayClass); checkNotNull(componentInfo); checkArgument(arrayClass.isArray(), "Class " + arrayClass + " must be an array."); return new ObjectArrayTypeInfo<T, C>(arrayClass, componentInfo); }
[ "@", "PublicEvolving", "public", "static", "<", "T", ",", "C", ">", "ObjectArrayTypeInfo", "<", "T", ",", "C", ">", "getInfoFor", "(", "Class", "<", "T", ">", "arrayClass", ",", "TypeInformation", "<", "C", ">", "componentInfo", ")", "{", "checkNotNull", ...
--------------------------------------------------------------------------------------------
[ "--------------------------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/ObjectArrayTypeInfo.java#L130-L137
train
Gets the type information for an object array type.
[ 30522, 1030, 2270, 6777, 4747, 6455, 2270, 10763, 1026, 1056, 1010, 1039, 1028, 4874, 2906, 9447, 13874, 2378, 14876, 1026, 1056, 1010, 1039, 1028, 2131, 2378, 14876, 29278, 1006, 2465, 1026, 1056, 1028, 9140, 26266, 1010, 2828, 2378, 14192...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannelConfig.java
EpollSocketChannelConfig.setTcpCork
public EpollSocketChannelConfig setTcpCork(boolean tcpCork) { try { ((EpollSocketChannel) channel).socket.setTcpCork(tcpCork); return this; } catch (IOException e) { throw new ChannelException(e); } }
java
public EpollSocketChannelConfig setTcpCork(boolean tcpCork) { try { ((EpollSocketChannel) channel).socket.setTcpCork(tcpCork); return this; } catch (IOException e) { throw new ChannelException(e); } }
[ "public", "EpollSocketChannelConfig", "setTcpCork", "(", "boolean", "tcpCork", ")", "{", "try", "{", "(", "(", "EpollSocketChannel", ")", "channel", ")", ".", "socket", ".", "setTcpCork", "(", "tcpCork", ")", ";", "return", "this", ";", "}", "catch", "(", ...
Set the {@code TCP_CORK} option on the socket. See {@code man 7 tcp} for more details.
[ "Set", "the", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannelConfig.java#L388-L395
train
Sets the TCP cork flag.
[ 30522, 2270, 4958, 14511, 6499, 19869, 10649, 20147, 22499, 2078, 8873, 2290, 2275, 13535, 15042, 2953, 2243, 1006, 22017, 20898, 22975, 15042, 2953, 2243, 1007, 1063, 3046, 1063, 1006, 1006, 4958, 14511, 6499, 19869, 10649, 20147, 2140, 1007...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/GenericInMemoryCatalog.java
GenericInMemoryCatalog.validatePartitionedTable
private CatalogTable validatePartitionedTable(ObjectPath tablePath) throws TableNotExistException, TableNotPartitionedException { CatalogBaseTable baseTable = getTable(tablePath); if (!(baseTable instanceof CatalogTable)) { throw new CatalogException( String.format("%s in Catalog %s is not a CatalogTable", tablePath.getFullName(), catalogName)); } CatalogTable table = (CatalogTable) baseTable; if (!table.isPartitioned()) { throw new TableNotPartitionedException(catalogName, tablePath); } return table; }
java
private CatalogTable validatePartitionedTable(ObjectPath tablePath) throws TableNotExistException, TableNotPartitionedException { CatalogBaseTable baseTable = getTable(tablePath); if (!(baseTable instanceof CatalogTable)) { throw new CatalogException( String.format("%s in Catalog %s is not a CatalogTable", tablePath.getFullName(), catalogName)); } CatalogTable table = (CatalogTable) baseTable; if (!table.isPartitioned()) { throw new TableNotPartitionedException(catalogName, tablePath); } return table; }
[ "private", "CatalogTable", "validatePartitionedTable", "(", "ObjectPath", "tablePath", ")", "throws", "TableNotExistException", ",", "TableNotPartitionedException", "{", "CatalogBaseTable", "baseTable", "=", "getTable", "(", "tablePath", ")", ";", "if", "(", "!", "(", ...
Validate the partitioned table.
[ "Validate", "the", "partitioned", "table", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/GenericInMemoryCatalog.java#L493-L510
train
Validate the partitioned table.
[ 30522, 2797, 12105, 10880, 9398, 3686, 19362, 3775, 3508, 2098, 10880, 1006, 4874, 15069, 2795, 15069, 1007, 11618, 2795, 22074, 9048, 13473, 2595, 24422, 1010, 2795, 17048, 19362, 3775, 3508, 14728, 2595, 24422, 1063, 12105, 15058, 10880, 29...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java
DateUtil.formatBetween
public static String formatBetween(Date beginDate, Date endDate) { return formatBetween(between(beginDate, endDate, DateUnit.MS)); }
java
public static String formatBetween(Date beginDate, Date endDate) { return formatBetween(between(beginDate, endDate, DateUnit.MS)); }
[ "public", "static", "String", "formatBetween", "(", "Date", "beginDate", ",", "Date", "endDate", ")", "{", "return", "formatBetween", "(", "between", "(", "beginDate", ",", "endDate", ",", "DateUnit", ".", "MS", ")", ")", ";", "}" ]
格式化日期间隔输出,精确到毫秒 @param beginDate 起始日期 @param endDate 结束日期 @return XX天XX小时XX分XX秒 @since 3.0.1
[ "格式化日期间隔输出,精确到毫秒" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L1330-L1332
train
Formats a date range in MS - notation.
[ 30522, 2270, 10763, 5164, 4289, 20915, 28394, 2078, 1006, 3058, 4088, 13701, 1010, 3058, 2203, 13701, 1007, 1063, 2709, 4289, 20915, 28394, 2078, 1006, 2090, 1006, 4088, 13701, 1010, 2203, 13701, 1010, 3058, 19496, 2102, 1012, 5796, 1007, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/operations/OperationExpressionsUtils.java
OperationExpressionsUtils.extractNames
public static List<Optional<String>> extractNames(List<Expression> expressions) { return expressions.stream().map(OperationExpressionsUtils::extractName).collect(Collectors.toList()); }
java
public static List<Optional<String>> extractNames(List<Expression> expressions) { return expressions.stream().map(OperationExpressionsUtils::extractName).collect(Collectors.toList()); }
[ "public", "static", "List", "<", "Optional", "<", "String", ">", ">", "extractNames", "(", "List", "<", "Expression", ">", "expressions", ")", "{", "return", "expressions", ".", "stream", "(", ")", ".", "map", "(", "OperationExpressionsUtils", "::", "extract...
Extracts names from given expressions if they have one. Expressions that have names are: <ul> <li>{@link FieldReferenceExpression}</li> <li>{@link TableReferenceExpression}</li> <li>{@link LocalReferenceExpression}</li> <li>{@link org.apache.flink.table.expressions.BuiltInFunctionDefinitions#AS}</li> </ul> @param expressions list of expressions to extract names from @return corresponding list of optional names
[ "Extracts", "names", "from", "given", "expressions", "if", "they", "have", "one", ".", "Expressions", "that", "have", "names", "are", ":", "<ul", ">", "<li", ">", "{", "@link", "FieldReferenceExpression", "}", "<", "/", "li", ">", "<li", ">", "{", "@link...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/operations/OperationExpressionsUtils.java#L124-L126
train
Extract names from a list of expressions.
[ 30522, 2270, 10763, 2862, 1026, 11887, 1026, 5164, 1028, 1028, 14817, 18442, 2015, 1006, 2862, 1026, 3670, 1028, 11423, 1007, 1063, 2709, 11423, 1012, 5460, 1006, 1007, 1012, 4949, 1006, 3169, 10288, 20110, 8496, 21823, 4877, 1024, 1024, 14...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java
DataStream.partitionCustom
public <K> DataStream<T> partitionCustom(Partitioner<K> partitioner, KeySelector<T, K> keySelector) { return setConnectionType(new CustomPartitionerWrapper<>(clean(partitioner), clean(keySelector))); }
java
public <K> DataStream<T> partitionCustom(Partitioner<K> partitioner, KeySelector<T, K> keySelector) { return setConnectionType(new CustomPartitionerWrapper<>(clean(partitioner), clean(keySelector))); }
[ "public", "<", "K", ">", "DataStream", "<", "T", ">", "partitionCustom", "(", "Partitioner", "<", "K", ">", "partitioner", ",", "KeySelector", "<", "T", ",", "K", ">", "keySelector", ")", "{", "return", "setConnectionType", "(", "new", "CustomPartitionerWrap...
Partitions a DataStream on the key returned by the selector, using a custom partitioner. This method takes the key selector to get the key to partition on, and a partitioner that accepts the key type. <p>Note: This method works only on single field keys, i.e. the selector cannot return tuples of fields. @param partitioner The partitioner to assign partitions to keys. @param keySelector The KeySelector with which the DataStream is partitioned. @return The partitioned DataStream. @see KeySelector
[ "Partitions", "a", "DataStream", "on", "the", "key", "returned", "by", "the", "selector", "using", "a", "custom", "partitioner", ".", "This", "method", "takes", "the", "key", "selector", "to", "get", "the", "key", "to", "partition", "on", "and", "a", "part...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java#L391-L394
train
Partition a DataStream using a custom partitioner and key selector.
[ 30522, 2270, 1026, 1047, 1028, 2951, 21422, 1026, 1056, 1028, 13571, 7874, 20389, 1006, 13571, 2121, 1026, 1047, 1028, 13571, 2121, 1010, 6309, 12260, 16761, 1026, 1056, 1010, 1047, 1028, 6309, 12260, 16761, 1007, 1063, 2709, 2275, 8663, 26...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java
ParameterTool.get
public String get(String key, String defaultValue) { addToDefaults(key, defaultValue); String value = get(key); if (value == null) { return defaultValue; } else { return value; } }
java
public String get(String key, String defaultValue) { addToDefaults(key, defaultValue); String value = get(key); if (value == null) { return defaultValue; } else { return value; } }
[ "public", "String", "get", "(", "String", "key", ",", "String", "defaultValue", ")", "{", "addToDefaults", "(", "key", ",", "defaultValue", ")", ";", "String", "value", "=", "get", "(", "key", ")", ";", "if", "(", "value", "==", "null", ")", "{", "re...
Returns the String value for the given key. If the key does not exist it will return the given default value.
[ "Returns", "the", "String", "value", "for", "the", "given", "key", ".", "If", "the", "key", "does", "not", "exist", "it", "will", "return", "the", "given", "default", "value", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java#L260-L268
train
Get the value for the given key.
[ 30522, 2270, 5164, 2131, 1006, 5164, 3145, 1010, 5164, 12398, 10175, 5657, 1007, 1063, 5587, 3406, 3207, 7011, 11314, 2015, 1006, 3145, 1010, 12398, 10175, 5657, 1007, 1025, 5164, 3643, 1027, 2131, 1006, 3145, 1007, 1025, 2065, 1006, 3643, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/BCUtil.java
BCUtil.decodeECPoint
public static PublicKey decodeECPoint(byte[] encodeByte, String curveName) { final ECNamedCurveParameterSpec namedSpec = ECNamedCurveTable.getParameterSpec(curveName); final ECCurve curve = namedSpec.getCurve(); final EllipticCurve ecCurve = new EllipticCurve(// new ECFieldFp(curve.getField().getCharacteristic()), // curve.getA().toBigInteger(), // curve.getB().toBigInteger()); // 根据X恢复点Y final ECPoint point = ECPointUtil.decodePoint(ecCurve, encodeByte); // 根据曲线恢复公钥格式 ECParameterSpec ecSpec = new ECNamedCurveSpec(curveName, curve, namedSpec.getG(), namedSpec.getN()); final KeyFactory PubKeyGen = KeyUtil.getKeyFactory("EC"); try { return PubKeyGen.generatePublic(new ECPublicKeySpec(point, ecSpec)); } catch (GeneralSecurityException e) { throw new CryptoException(e); } }
java
public static PublicKey decodeECPoint(byte[] encodeByte, String curveName) { final ECNamedCurveParameterSpec namedSpec = ECNamedCurveTable.getParameterSpec(curveName); final ECCurve curve = namedSpec.getCurve(); final EllipticCurve ecCurve = new EllipticCurve(// new ECFieldFp(curve.getField().getCharacteristic()), // curve.getA().toBigInteger(), // curve.getB().toBigInteger()); // 根据X恢复点Y final ECPoint point = ECPointUtil.decodePoint(ecCurve, encodeByte); // 根据曲线恢复公钥格式 ECParameterSpec ecSpec = new ECNamedCurveSpec(curveName, curve, namedSpec.getG(), namedSpec.getN()); final KeyFactory PubKeyGen = KeyUtil.getKeyFactory("EC"); try { return PubKeyGen.generatePublic(new ECPublicKeySpec(point, ecSpec)); } catch (GeneralSecurityException e) { throw new CryptoException(e); } }
[ "public", "static", "PublicKey", "decodeECPoint", "(", "byte", "[", "]", "encodeByte", ",", "String", "curveName", ")", "{", "final", "ECNamedCurveParameterSpec", "namedSpec", "=", "ECNamedCurveTable", ".", "getParameterSpec", "(", "curveName", ")", ";", "final", ...
解码恢复EC压缩公钥,支持Base64和Hex编码,(基于BouncyCastle)<br> 见:https://www.cnblogs.com/xinzhao/p/8963724.html @param encodeByte 压缩公钥 @param curveName EC曲线名,例如{@link KeyUtil#SM2_DEFAULT_CURVE} @since 4.4.4
[ "解码恢复EC压缩公钥", "支持Base64和Hex编码", "(基于BouncyCastle)<br", ">", "见:https", ":", "//", "www", ".", "cnblogs", ".", "com", "/", "xinzhao", "/", "p", "/", "8963724", ".", "html" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/BCUtil.java#L70-L89
train
Decodes an EC point from a byte array.
[ 30522, 2270, 10763, 2270, 14839, 21933, 26095, 21906, 25785, 1006, 24880, 1031, 1033, 4372, 16044, 3762, 2618, 1010, 5164, 7774, 18442, 1007, 1063, 2345, 14925, 18442, 16409, 3126, 3726, 28689, 22828, 13102, 8586, 2315, 13102, 8586, 1027, 149...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/concurrent/FutureUtils.java
FutureUtils.supplyAsync
public static <T> CompletableFuture<T> supplyAsync(SupplierWithException<T, ?> supplier, Executor executor) { return CompletableFuture.supplyAsync( () -> { try { return supplier.get(); } catch (Throwable e) { throw new CompletionException(e); } }, executor); }
java
public static <T> CompletableFuture<T> supplyAsync(SupplierWithException<T, ?> supplier, Executor executor) { return CompletableFuture.supplyAsync( () -> { try { return supplier.get(); } catch (Throwable e) { throw new CompletionException(e); } }, executor); }
[ "public", "static", "<", "T", ">", "CompletableFuture", "<", "T", ">", "supplyAsync", "(", "SupplierWithException", "<", "T", ",", "?", ">", "supplier", ",", "Executor", "executor", ")", "{", "return", "CompletableFuture", ".", "supplyAsync", "(", "(", ")", ...
Returns a future which is completed with the result of the {@link SupplierWithException}. @param supplier to provide the future's value @param executor to execute the supplier @param <T> type of the result @return Future which is completed with the value of the supplier
[ "Returns", "a", "future", "which", "is", "completed", "with", "the", "result", "of", "the", "{", "@link", "SupplierWithException", "}", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/FutureUtils.java#L764-L774
train
Supply a CompletableFuture that is asynchronously completed with an exception.
[ 30522, 2270, 10763, 1026, 1056, 1028, 4012, 10814, 10880, 11263, 11244, 1026, 1056, 1028, 4425, 3022, 6038, 2278, 1006, 17024, 24415, 10288, 24422, 1026, 1056, 1010, 1029, 1028, 17024, 1010, 4654, 8586, 16161, 2099, 4654, 8586, 16161, 2099, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/OneForOneBlockFetcher.java
OneForOneBlockFetcher.failRemainingBlocks
private void failRemainingBlocks(String[] failedBlockIds, Throwable e) { for (String blockId : failedBlockIds) { try { listener.onBlockFetchFailure(blockId, e); } catch (Exception e2) { logger.error("Error in block fetch failure callback", e2); } } }
java
private void failRemainingBlocks(String[] failedBlockIds, Throwable e) { for (String blockId : failedBlockIds) { try { listener.onBlockFetchFailure(blockId, e); } catch (Exception e2) { logger.error("Error in block fetch failure callback", e2); } } }
[ "private", "void", "failRemainingBlocks", "(", "String", "[", "]", "failedBlockIds", ",", "Throwable", "e", ")", "{", "for", "(", "String", "blockId", ":", "failedBlockIds", ")", "{", "try", "{", "listener", ".", "onBlockFetchFailure", "(", "blockId", ",", "...
Invokes the "onBlockFetchFailure" callback for every listed block id.
[ "Invokes", "the", "onBlockFetchFailure", "callback", "for", "every", "listed", "block", "id", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/OneForOneBlockFetcher.java#L145-L153
train
Fail remaining blocks.
[ 30522, 2797, 11675, 8246, 28578, 8113, 2075, 23467, 2015, 1006, 5164, 1031, 1033, 3478, 23467, 9821, 1010, 5466, 3085, 1041, 1007, 1063, 2005, 1006, 5164, 3796, 3593, 1024, 3478, 23467, 9821, 1007, 1063, 3046, 1063, 19373, 1012, 2006, 23467...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java
ReflectUtil.getMethodByNameIgnoreCase
public static Method getMethodByNameIgnoreCase(Class<?> clazz, String methodName) throws SecurityException { return getMethodByName(clazz, true, methodName); }
java
public static Method getMethodByNameIgnoreCase(Class<?> clazz, String methodName) throws SecurityException { return getMethodByName(clazz, true, methodName); }
[ "public", "static", "Method", "getMethodByNameIgnoreCase", "(", "Class", "<", "?", ">", "clazz", ",", "String", "methodName", ")", "throws", "SecurityException", "{", "return", "getMethodByName", "(", "clazz", ",", "true", ",", "methodName", ")", ";", "}" ]
按照方法名查找指定方法名的方法,只返回匹配到的第一个方法,如果找不到对应的方法则返回<code>null</code> <p> 此方法只检查方法名是否一致(忽略大小写),并不检查参数的一致性。 </p> @param clazz 类,如果为{@code null}返回{@code null} @param methodName 方法名,如果为空字符串返回{@code null} @return 方法 @throws SecurityException 无权访问抛出异常 @since 4.3.2
[ "按照方法名查找指定方法名的方法,只返回匹配到的第一个方法,如果找不到对应的方法则返回<code", ">", "null<", "/", "code", ">" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L498-L500
train
Get a Method object by name ignoring case.
[ 30522, 2270, 10763, 4118, 2131, 11368, 6806, 18939, 18279, 26432, 26745, 2890, 18382, 1006, 2465, 1026, 1029, 1028, 18856, 10936, 2480, 1010, 5164, 4118, 18442, 1007, 11618, 3036, 10288, 24422, 1063, 2709, 2131, 11368, 6806, 18939, 18279, 416...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/thread/ThreadUtil.java
ThreadUtil.newThread
public static Thread newThread(Runnable runnable, String name, boolean isDeamon) { final Thread t = new Thread(null, runnable, name); t.setDaemon(isDeamon); return t; }
java
public static Thread newThread(Runnable runnable, String name, boolean isDeamon) { final Thread t = new Thread(null, runnable, name); t.setDaemon(isDeamon); return t; }
[ "public", "static", "Thread", "newThread", "(", "Runnable", "runnable", ",", "String", "name", ",", "boolean", "isDeamon", ")", "{", "final", "Thread", "t", "=", "new", "Thread", "(", "null", ",", "runnable", ",", "name", ")", ";", "t", ".", "setDaemon",...
创建新线程 @param runnable {@link Runnable} @param name 线程名 @param isDeamon 是否守护线程 @return {@link Thread} @since 4.1.2
[ "创建新线程" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/thread/ThreadUtil.java#L196-L200
train
Creates a new thread with the specified name and a Runnable.
[ 30522, 2270, 10763, 11689, 25597, 28362, 4215, 1006, 2448, 22966, 2448, 22966, 1010, 5164, 2171, 1010, 22017, 20898, 2003, 3207, 22591, 2078, 1007, 1063, 2345, 11689, 1056, 1027, 2047, 11689, 1006, 19701, 1010, 2448, 22966, 1010, 2171, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontendParser.java
CliFrontendParser.mergeOptions
public static Options mergeOptions(@Nullable Options optionsA, @Nullable Options optionsB) { final Options resultOptions = new Options(); if (optionsA != null) { for (Option option : optionsA.getOptions()) { resultOptions.addOption(option); } } if (optionsB != null) { for (Option option : optionsB.getOptions()) { resultOptions.addOption(option); } } return resultOptions; }
java
public static Options mergeOptions(@Nullable Options optionsA, @Nullable Options optionsB) { final Options resultOptions = new Options(); if (optionsA != null) { for (Option option : optionsA.getOptions()) { resultOptions.addOption(option); } } if (optionsB != null) { for (Option option : optionsB.getOptions()) { resultOptions.addOption(option); } } return resultOptions; }
[ "public", "static", "Options", "mergeOptions", "(", "@", "Nullable", "Options", "optionsA", ",", "@", "Nullable", "Options", "optionsB", ")", "{", "final", "Options", "resultOptions", "=", "new", "Options", "(", ")", ";", "if", "(", "optionsA", "!=", "null",...
Merges the given {@link Options} into a new Options object. @param optionsA options to merge, can be null if none @param optionsB options to merge, can be null if none @return
[ "Merges", "the", "given", "{", "@link", "Options", "}", "into", "a", "new", "Options", "object", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontendParser.java#L445-L460
train
Merges two options.
[ 30522, 2270, 10763, 7047, 13590, 7361, 9285, 1006, 1030, 19701, 3085, 7047, 7047, 2050, 1010, 1030, 19701, 3085, 7047, 7047, 2497, 1007, 1063, 2345, 7047, 2765, 7361, 9285, 1027, 2047, 7047, 1006, 1007, 1025, 2065, 1006, 7047, 2050, 999, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java
CommandRunner.runAndHandleErrors
public int runAndHandleErrors(String... args) { String[] argsWithoutDebugFlags = removeDebugFlags(args); boolean debug = argsWithoutDebugFlags.length != args.length; if (debug) { System.setProperty("debug", "true"); } try { ExitStatus result = run(argsWithoutDebugFlags); // The caller will hang up if it gets a non-zero status if (result != null && result.isHangup()) { return (result.getCode() > 0) ? result.getCode() : 0; } return 0; } catch (NoArgumentsException ex) { showUsage(); return 1; } catch (Exception ex) { return handleError(debug, ex); } }
java
public int runAndHandleErrors(String... args) { String[] argsWithoutDebugFlags = removeDebugFlags(args); boolean debug = argsWithoutDebugFlags.length != args.length; if (debug) { System.setProperty("debug", "true"); } try { ExitStatus result = run(argsWithoutDebugFlags); // The caller will hang up if it gets a non-zero status if (result != null && result.isHangup()) { return (result.getCode() > 0) ? result.getCode() : 0; } return 0; } catch (NoArgumentsException ex) { showUsage(); return 1; } catch (Exception ex) { return handleError(debug, ex); } }
[ "public", "int", "runAndHandleErrors", "(", "String", "...", "args", ")", "{", "String", "[", "]", "argsWithoutDebugFlags", "=", "removeDebugFlags", "(", "args", ")", ";", "boolean", "debug", "=", "argsWithoutDebugFlags", ".", "length", "!=", "args", ".", "len...
Run the appropriate and handle and errors. @param args the input arguments @return a return status code (non boot is used to indicate an error)
[ "Run", "the", "appropriate", "and", "handle", "and", "errors", "." ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java#L164-L185
train
Run the command and handle errors.
[ 30522, 2270, 20014, 2448, 5685, 11774, 10559, 18933, 2869, 1006, 5164, 1012, 1012, 1012, 12098, 5620, 1007, 1063, 5164, 1031, 1033, 12098, 5620, 24415, 5833, 3207, 8569, 25708, 17802, 2015, 1027, 3718, 15878, 15916, 10258, 26454, 1006, 12098,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Rowtime.java
Rowtime.watermarksPeriodicBounded
public Rowtime watermarksPeriodicBounded(long delay) { internalProperties.putString(ROWTIME_WATERMARKS_TYPE, ROWTIME_WATERMARKS_TYPE_VALUE_PERIODIC_BOUNDED); internalProperties.putLong(ROWTIME_WATERMARKS_DELAY, delay); return this; }
java
public Rowtime watermarksPeriodicBounded(long delay) { internalProperties.putString(ROWTIME_WATERMARKS_TYPE, ROWTIME_WATERMARKS_TYPE_VALUE_PERIODIC_BOUNDED); internalProperties.putLong(ROWTIME_WATERMARKS_DELAY, delay); return this; }
[ "public", "Rowtime", "watermarksPeriodicBounded", "(", "long", "delay", ")", "{", "internalProperties", ".", "putString", "(", "ROWTIME_WATERMARKS_TYPE", ",", "ROWTIME_WATERMARKS_TYPE_VALUE_PERIODIC_BOUNDED", ")", ";", "internalProperties", ".", "putLong", "(", "ROWTIME_WAT...
Sets a built-in watermark strategy for rowtime attributes which are out-of-order by a bounded time interval. <p>Emits watermarks which are the maximum observed timestamp minus the specified delay. @param delay delay in milliseconds
[ "Sets", "a", "built", "-", "in", "watermark", "strategy", "for", "rowtime", "attributes", "which", "are", "out", "-", "of", "-", "order", "by", "a", "bounded", "time", "interval", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Rowtime.java#L110-L114
train
Sets the watermarks period to be bounded.
[ 30522, 2270, 5216, 7292, 2300, 27373, 4842, 3695, 14808, 15494, 2098, 1006, 2146, 8536, 1007, 1063, 4722, 21572, 4842, 7368, 1012, 8509, 18886, 3070, 1006, 5216, 7292, 1035, 2300, 27373, 1035, 2828, 1010, 5216, 7292, 1035, 2300, 27373, 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/TypeExtractor.java
TypeExtractor.getTypeInfoFactory
@Internal public static <OUT> TypeInfoFactory<OUT> getTypeInfoFactory(Type t) { final Class<?> factoryClass; if (registeredTypeInfoFactories.containsKey(t)) { factoryClass = registeredTypeInfoFactories.get(t); } else { if (!isClassType(t) || !typeToClass(t).isAnnotationPresent(TypeInfo.class)) { return null; } final TypeInfo typeInfoAnnotation = typeToClass(t).getAnnotation(TypeInfo.class); factoryClass = typeInfoAnnotation.value(); // check for valid factory class if (!TypeInfoFactory.class.isAssignableFrom(factoryClass)) { throw new InvalidTypesException("TypeInfo annotation does not specify a valid TypeInfoFactory."); } } // instantiate return (TypeInfoFactory<OUT>) InstantiationUtil.instantiate(factoryClass); }
java
@Internal public static <OUT> TypeInfoFactory<OUT> getTypeInfoFactory(Type t) { final Class<?> factoryClass; if (registeredTypeInfoFactories.containsKey(t)) { factoryClass = registeredTypeInfoFactories.get(t); } else { if (!isClassType(t) || !typeToClass(t).isAnnotationPresent(TypeInfo.class)) { return null; } final TypeInfo typeInfoAnnotation = typeToClass(t).getAnnotation(TypeInfo.class); factoryClass = typeInfoAnnotation.value(); // check for valid factory class if (!TypeInfoFactory.class.isAssignableFrom(factoryClass)) { throw new InvalidTypesException("TypeInfo annotation does not specify a valid TypeInfoFactory."); } } // instantiate return (TypeInfoFactory<OUT>) InstantiationUtil.instantiate(factoryClass); }
[ "@", "Internal", "public", "static", "<", "OUT", ">", "TypeInfoFactory", "<", "OUT", ">", "getTypeInfoFactory", "(", "Type", "t", ")", "{", "final", "Class", "<", "?", ">", "factoryClass", ";", "if", "(", "registeredTypeInfoFactories", ".", "containsKey", "(...
Returns the type information factory for a type using the factory registry or annotations.
[ "Returns", "the", "type", "information", "factory", "for", "a", "type", "using", "the", "factory", "registry", "or", "annotations", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java#L1519-L1539
train
Gets the type info factory.
[ 30522, 1030, 4722, 2270, 10763, 1026, 2041, 1028, 2828, 2378, 14876, 21450, 1026, 2041, 1028, 2131, 13874, 2378, 14876, 21450, 1006, 2828, 1056, 1007, 1063, 2345, 2465, 1026, 1029, 1028, 4713, 26266, 1025, 2065, 1006, 5068, 13874, 2378, 148...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/SslContext.java
SslContext.newHandler
public SslHandler newHandler(ByteBufAllocator alloc, Executor delegatedTaskExecutor) { return newHandler(alloc, startTls, delegatedTaskExecutor); }
java
public SslHandler newHandler(ByteBufAllocator alloc, Executor delegatedTaskExecutor) { return newHandler(alloc, startTls, delegatedTaskExecutor); }
[ "public", "SslHandler", "newHandler", "(", "ByteBufAllocator", "alloc", ",", "Executor", "delegatedTaskExecutor", ")", "{", "return", "newHandler", "(", "alloc", ",", "startTls", ",", "delegatedTaskExecutor", ")", ";", "}" ]
Creates a new {@link SslHandler}. <p>If {@link SslProvider#OPENSSL_REFCNT} is used then the returned {@link SslHandler} will release the engine that is wrapped. If the returned {@link SslHandler} is not inserted into a pipeline then you may leak native memory! <p><b>Beware</b>: the underlying generated {@link SSLEngine} won't have <a href="https://wiki.openssl.org/index.php/Hostname_validation">hostname verification</a> enabled by default. If you create {@link SslHandler} for the client side and want proper security, we advice that you configure the {@link SSLEngine} (see {@link javax.net.ssl.SSLParameters#setEndpointIdentificationAlgorithm(String)}): <pre> SSLEngine sslEngine = sslHandler.engine(); SSLParameters sslParameters = sslEngine.getSSLParameters(); // only available since Java 7 sslParameters.setEndpointIdentificationAlgorithm("HTTPS"); sslEngine.setSSLParameters(sslParameters); </pre> <p> The underlying {@link SSLEngine} may not follow the restrictions imposed by the <a href="https://docs.oracle.com/javase/7/docs/api/javax/net/ssl/SSLEngine.html">SSLEngine javadocs</a> which limits wrap/unwrap to operate on a single SSL/TLS packet. @param alloc If supported by the SSLEngine then the SSLEngine will use this to allocate ByteBuf objects. @param delegatedTaskExecutor the {@link Executor} that will be used to execute tasks that are returned by {@link SSLEngine#getDelegatedTask()}. @return a new {@link SslHandler}
[ "Creates", "a", "new", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContext.java#L924-L926
train
Create a new SslHandler.
[ 30522, 2270, 7020, 2140, 11774, 3917, 2047, 11774, 3917, 1006, 24880, 8569, 13976, 24755, 4263, 2035, 10085, 1010, 4654, 8586, 16161, 2099, 11849, 11927, 19895, 10288, 8586, 16161, 2099, 1007, 1063, 2709, 2047, 11774, 3917, 1006, 2035, 10085,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/api/common/operators/AbstractUdfOperator.java
AbstractUdfOperator.setBroadcastVariables
public <T> void setBroadcastVariables(Map<String, Operator<T>> inputs) { this.broadcastInputs.clear(); this.broadcastInputs.putAll(inputs); }
java
public <T> void setBroadcastVariables(Map<String, Operator<T>> inputs) { this.broadcastInputs.clear(); this.broadcastInputs.putAll(inputs); }
[ "public", "<", "T", ">", "void", "setBroadcastVariables", "(", "Map", "<", "String", ",", "Operator", "<", "T", ">", ">", "inputs", ")", "{", "this", ".", "broadcastInputs", ".", "clear", "(", ")", ";", "this", ".", "broadcastInputs", ".", "putAll", "(...
Clears all previous broadcast inputs and binds the given inputs as broadcast variables of this operator. @param inputs The {@code<name, root>} pairs to be set as broadcast inputs.
[ "Clears", "all", "previous", "broadcast", "inputs", "and", "binds", "the", "given", "inputs", "as", "broadcast", "variables", "of", "this", "operator", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/AbstractUdfOperator.java#L112-L115
train
Sets the broadcast variables.
[ 30522, 2270, 1026, 1056, 1028, 11675, 2275, 12618, 4215, 10526, 10755, 19210, 2015, 1006, 4949, 1026, 5164, 1010, 6872, 1026, 1056, 1028, 1028, 20407, 1007, 1063, 2023, 1012, 3743, 2378, 18780, 2015, 1012, 3154, 1006, 1007, 1025, 2023, 1012...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/corpus/document/sentence/Sentence.java
Sentence.translateCompoundWordLabels
public Sentence translateCompoundWordLabels() { for (IWord word : wordList) { if (word instanceof CompoundWord) word.setLabel(PartOfSpeechTagDictionary.translate(word.getLabel())); } return this; }
java
public Sentence translateCompoundWordLabels() { for (IWord word : wordList) { if (word instanceof CompoundWord) word.setLabel(PartOfSpeechTagDictionary.translate(word.getLabel())); } return this; }
[ "public", "Sentence", "translateCompoundWordLabels", "(", ")", "{", "for", "(", "IWord", "word", ":", "wordList", ")", "{", "if", "(", "word", "instanceof", "CompoundWord", ")", "word", ".", "setLabel", "(", "PartOfSpeechTagDictionary", ".", "translate", "(", ...
按照 PartOfSpeechTagDictionary 指定的映射表将复合词词语词性翻译过去 @return
[ "按照", "PartOfSpeechTagDictionary", "指定的映射表将复合词词语词性翻译过去" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/document/sentence/Sentence.java#L170-L178
train
Translate the label of the compound words in this sentence.
[ 30522, 2270, 6251, 17637, 9006, 6873, 8630, 18351, 20470, 9050, 1006, 1007, 1063, 2005, 1006, 1045, 18351, 2773, 1024, 2773, 9863, 1007, 1063, 2065, 1006, 2773, 6013, 11253, 7328, 18351, 1007, 2773, 1012, 2275, 20470, 2884, 1006, 2112, 1125...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.addEdge
public Graph<K, VV, EV> addEdge(Vertex<K, VV> source, Vertex<K, VV> target, EV edgeValue) { Graph<K, VV, EV> partialGraph = fromCollection(Arrays.asList(source, target), Collections.singletonList(new Edge<>(source.f0, target.f0, edgeValue)), this.context); return this.union(partialGraph); }
java
public Graph<K, VV, EV> addEdge(Vertex<K, VV> source, Vertex<K, VV> target, EV edgeValue) { Graph<K, VV, EV> partialGraph = fromCollection(Arrays.asList(source, target), Collections.singletonList(new Edge<>(source.f0, target.f0, edgeValue)), this.context); return this.union(partialGraph); }
[ "public", "Graph", "<", "K", ",", "VV", ",", "EV", ">", "addEdge", "(", "Vertex", "<", "K", ",", "VV", ">", "source", ",", "Vertex", "<", "K", ",", "VV", ">", "target", ",", "EV", "edgeValue", ")", "{", "Graph", "<", "K", ",", "VV", ",", "EV"...
Adds the given edge to the graph. If the source and target vertices do not exist in the graph, they will also be added. @param source the source vertex of the edge @param target the target vertex of the edge @param edgeValue the edge value @return the new graph containing the existing vertices and edges plus the newly added edge
[ "Adds", "the", "given", "edge", "to", "the", "graph", ".", "If", "the", "source", "and", "target", "vertices", "do", "not", "exist", "in", "the", "graph", "they", "will", "also", "be", "added", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L1415-L1420
train
Add an edge between two vertices.
[ 30522, 2270, 10629, 1026, 1047, 1010, 1058, 2615, 1010, 23408, 1028, 2794, 3351, 1006, 19449, 1026, 1047, 1010, 1058, 2615, 1028, 3120, 1010, 19449, 1026, 1047, 1010, 1058, 2615, 1028, 4539, 1010, 23408, 3341, 10175, 5657, 1007, 1063, 10629...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/jdbc/DataSourceProperties.java
DataSourceProperties.determineUrl
public String determineUrl() { if (StringUtils.hasText(this.url)) { return this.url; } String databaseName = determineDatabaseName(); String url = (databaseName != null) ? this.embeddedDatabaseConnection.getUrl(databaseName) : null; if (!StringUtils.hasText(url)) { throw new DataSourceBeanCreationException( "Failed to determine suitable jdbc url", this, this.embeddedDatabaseConnection); } return url; }
java
public String determineUrl() { if (StringUtils.hasText(this.url)) { return this.url; } String databaseName = determineDatabaseName(); String url = (databaseName != null) ? this.embeddedDatabaseConnection.getUrl(databaseName) : null; if (!StringUtils.hasText(url)) { throw new DataSourceBeanCreationException( "Failed to determine suitable jdbc url", this, this.embeddedDatabaseConnection); } return url; }
[ "public", "String", "determineUrl", "(", ")", "{", "if", "(", "StringUtils", ".", "hasText", "(", "this", ".", "url", ")", ")", "{", "return", "this", ".", "url", ";", "}", "String", "databaseName", "=", "determineDatabaseName", "(", ")", ";", "String", ...
Determine the url to use based on this configuration and the environment. @return the url to use @since 1.4.0
[ "Determine", "the", "url", "to", "use", "based", "on", "this", "configuration", "and", "the", "environment", "." ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java#L275-L288
train
Determine the url to use for the jdbc connection.
[ 30522, 2270, 5164, 5646, 3126, 2140, 1006, 1007, 1063, 2065, 1006, 5164, 21823, 4877, 1012, 24748, 18413, 1006, 2023, 1012, 24471, 2140, 1007, 1007, 1063, 2709, 2023, 1012, 24471, 2140, 1025, 1065, 5164, 7809, 18442, 1027, 4340, 6790, 15058...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/util/IOUtils.java
IOUtils.closeAllQuietly
public static void closeAllQuietly(Iterable<? extends AutoCloseable> closeables) { if (null != closeables) { for (AutoCloseable closeable : closeables) { closeQuietly(closeable); } } }
java
public static void closeAllQuietly(Iterable<? extends AutoCloseable> closeables) { if (null != closeables) { for (AutoCloseable closeable : closeables) { closeQuietly(closeable); } } }
[ "public", "static", "void", "closeAllQuietly", "(", "Iterable", "<", "?", "extends", "AutoCloseable", ">", "closeables", ")", "{", "if", "(", "null", "!=", "closeables", ")", "{", "for", "(", "AutoCloseable", "closeable", ":", "closeables", ")", "{", "closeQ...
Closes all elements in the iterable with closeQuietly().
[ "Closes", "all", "elements", "in", "the", "iterable", "with", "closeQuietly", "()", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/IOUtils.java#L247-L253
train
Close all AutoCloseables ignoring exceptions.
[ 30522, 2270, 10763, 11675, 2485, 8095, 15549, 3388, 2135, 1006, 2009, 6906, 3468, 1026, 1029, 8908, 8285, 20464, 9232, 3085, 1028, 2485, 3085, 2015, 1007, 1063, 2065, 1006, 19701, 999, 1027, 2485, 3085, 2015, 1007, 1063, 2005, 1006, 8285, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
buffer/src/main/java/io/netty/buffer/PoolSubpage.java
PoolSubpage.allocate
long allocate() { if (elemSize == 0) { return toHandle(0); } if (numAvail == 0 || !doNotDestroy) { return -1; } final int bitmapIdx = getNextAvail(); int q = bitmapIdx >>> 6; int r = bitmapIdx & 63; assert (bitmap[q] >>> r & 1) == 0; bitmap[q] |= 1L << r; if (-- numAvail == 0) { removeFromPool(); } return toHandle(bitmapIdx); }
java
long allocate() { if (elemSize == 0) { return toHandle(0); } if (numAvail == 0 || !doNotDestroy) { return -1; } final int bitmapIdx = getNextAvail(); int q = bitmapIdx >>> 6; int r = bitmapIdx & 63; assert (bitmap[q] >>> r & 1) == 0; bitmap[q] |= 1L << r; if (-- numAvail == 0) { removeFromPool(); } return toHandle(bitmapIdx); }
[ "long", "allocate", "(", ")", "{", "if", "(", "elemSize", "==", "0", ")", "{", "return", "toHandle", "(", "0", ")", ";", "}", "if", "(", "numAvail", "==", "0", "||", "!", "doNotDestroy", ")", "{", "return", "-", "1", ";", "}", "final", "int", "...
Returns the bitmap index of the subpage allocation.
[ "Returns", "the", "bitmap", "index", "of", "the", "subpage", "allocation", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/PoolSubpage.java#L80-L100
train
Allocate a new instance of a class from the pool.
[ 30522, 2146, 2035, 24755, 2618, 1006, 1007, 1063, 2065, 1006, 3449, 6633, 5332, 4371, 1027, 1027, 1014, 1007, 1063, 2709, 2000, 11774, 2571, 1006, 1014, 1007, 1025, 1065, 2065, 1006, 16371, 2863, 3567, 4014, 1027, 1027, 1014, 1064, 1064, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/util/KinesisConfigUtil.java
KinesisConfigUtil.validateConsumerConfiguration
public static void validateConsumerConfiguration(Properties config) { checkNotNull(config, "config can not be null"); validateAwsConfiguration(config); if (!(config.containsKey(AWSConfigConstants.AWS_REGION) ^ config.containsKey(ConsumerConfigConstants.AWS_ENDPOINT))) { // per validation in AwsClientBuilder throw new IllegalArgumentException(String.format("For FlinkKinesisConsumer either AWS region ('%s') or AWS endpoint ('%s') must be set in the config.", AWSConfigConstants.AWS_REGION, AWSConfigConstants.AWS_ENDPOINT)); } if (config.containsKey(ConsumerConfigConstants.STREAM_INITIAL_POSITION)) { String initPosType = config.getProperty(ConsumerConfigConstants.STREAM_INITIAL_POSITION); // specified initial position in stream must be either LATEST, TRIM_HORIZON or AT_TIMESTAMP try { InitialPosition.valueOf(initPosType); } catch (IllegalArgumentException e) { StringBuilder sb = new StringBuilder(); for (InitialPosition pos : InitialPosition.values()) { sb.append(pos.toString()).append(", "); } throw new IllegalArgumentException("Invalid initial position in stream set in config. Valid values are: " + sb.toString()); } // specified initial timestamp in stream when using AT_TIMESTAMP if (InitialPosition.valueOf(initPosType) == InitialPosition.AT_TIMESTAMP) { if (!config.containsKey(ConsumerConfigConstants.STREAM_INITIAL_TIMESTAMP)) { throw new IllegalArgumentException("Please set value for initial timestamp ('" + ConsumerConfigConstants.STREAM_INITIAL_TIMESTAMP + "') when using AT_TIMESTAMP initial position."); } validateOptionalDateProperty(config, ConsumerConfigConstants.STREAM_INITIAL_TIMESTAMP, config.getProperty(ConsumerConfigConstants.STREAM_TIMESTAMP_DATE_FORMAT, ConsumerConfigConstants.DEFAULT_STREAM_TIMESTAMP_DATE_FORMAT), "Invalid value given for initial timestamp for AT_TIMESTAMP initial position in stream. " + "Must be a valid format: yyyy-MM-dd'T'HH:mm:ss.SSSXXX or non-negative double value. For example, 2016-04-04T19:58:46.480-00:00 or 1459799926.480 ."); } } validateOptionalPositiveIntProperty(config, ConsumerConfigConstants.SHARD_GETRECORDS_MAX, "Invalid value given for maximum records per getRecords shard operation. Must be a valid non-negative integer value."); validateOptionalPositiveIntProperty(config, ConsumerConfigConstants.SHARD_GETRECORDS_RETRIES, "Invalid value given for maximum retry attempts for getRecords shard operation. Must be a valid non-negative integer value."); validateOptionalPositiveLongProperty(config, ConsumerConfigConstants.SHARD_GETRECORDS_BACKOFF_BASE, "Invalid value given for get records operation base backoff milliseconds. Must be a valid non-negative long value."); validateOptionalPositiveLongProperty(config, ConsumerConfigConstants.SHARD_GETRECORDS_BACKOFF_MAX, "Invalid value given for get records operation max backoff milliseconds. Must be a valid non-negative long value."); validateOptionalPositiveDoubleProperty(config, ConsumerConfigConstants.SHARD_GETRECORDS_BACKOFF_EXPONENTIAL_CONSTANT, "Invalid value given for get records operation backoff exponential constant. Must be a valid non-negative double value."); validateOptionalPositiveLongProperty(config, ConsumerConfigConstants.SHARD_GETRECORDS_INTERVAL_MILLIS, "Invalid value given for getRecords sleep interval in milliseconds. Must be a valid non-negative long value."); validateOptionalPositiveIntProperty(config, ConsumerConfigConstants.SHARD_GETITERATOR_RETRIES, "Invalid value given for maximum retry attempts for getShardIterator shard operation. Must be a valid non-negative integer value."); validateOptionalPositiveLongProperty(config, ConsumerConfigConstants.SHARD_GETITERATOR_BACKOFF_BASE, "Invalid value given for get shard iterator operation base backoff milliseconds. Must be a valid non-negative long value."); validateOptionalPositiveLongProperty(config, ConsumerConfigConstants.SHARD_GETITERATOR_BACKOFF_MAX, "Invalid value given for get shard iterator operation max backoff milliseconds. Must be a valid non-negative long value."); validateOptionalPositiveDoubleProperty(config, ConsumerConfigConstants.SHARD_GETITERATOR_BACKOFF_EXPONENTIAL_CONSTANT, "Invalid value given for get shard iterator operation backoff exponential constant. Must be a valid non-negative double value."); validateOptionalPositiveLongProperty(config, ConsumerConfigConstants.SHARD_DISCOVERY_INTERVAL_MILLIS, "Invalid value given for shard discovery sleep interval in milliseconds. Must be a valid non-negative long value."); validateOptionalPositiveLongProperty(config, ConsumerConfigConstants.LIST_SHARDS_BACKOFF_BASE, "Invalid value given for list shards operation base backoff milliseconds. Must be a valid non-negative long value."); validateOptionalPositiveLongProperty(config, ConsumerConfigConstants.LIST_SHARDS_BACKOFF_MAX, "Invalid value given for list shards operation max backoff milliseconds. Must be a valid non-negative long value."); validateOptionalPositiveDoubleProperty(config, ConsumerConfigConstants.LIST_SHARDS_BACKOFF_EXPONENTIAL_CONSTANT, "Invalid value given for list shards operation backoff exponential constant. Must be a valid non-negative double value."); if (config.containsKey(ConsumerConfigConstants.SHARD_GETRECORDS_INTERVAL_MILLIS)) { checkArgument( Long.parseLong(config.getProperty(ConsumerConfigConstants.SHARD_GETRECORDS_INTERVAL_MILLIS)) < ConsumerConfigConstants.MAX_SHARD_GETRECORDS_INTERVAL_MILLIS, "Invalid value given for getRecords sleep interval in milliseconds. Must be lower than " + ConsumerConfigConstants.MAX_SHARD_GETRECORDS_INTERVAL_MILLIS + " milliseconds." ); } }
java
public static void validateConsumerConfiguration(Properties config) { checkNotNull(config, "config can not be null"); validateAwsConfiguration(config); if (!(config.containsKey(AWSConfigConstants.AWS_REGION) ^ config.containsKey(ConsumerConfigConstants.AWS_ENDPOINT))) { // per validation in AwsClientBuilder throw new IllegalArgumentException(String.format("For FlinkKinesisConsumer either AWS region ('%s') or AWS endpoint ('%s') must be set in the config.", AWSConfigConstants.AWS_REGION, AWSConfigConstants.AWS_ENDPOINT)); } if (config.containsKey(ConsumerConfigConstants.STREAM_INITIAL_POSITION)) { String initPosType = config.getProperty(ConsumerConfigConstants.STREAM_INITIAL_POSITION); // specified initial position in stream must be either LATEST, TRIM_HORIZON or AT_TIMESTAMP try { InitialPosition.valueOf(initPosType); } catch (IllegalArgumentException e) { StringBuilder sb = new StringBuilder(); for (InitialPosition pos : InitialPosition.values()) { sb.append(pos.toString()).append(", "); } throw new IllegalArgumentException("Invalid initial position in stream set in config. Valid values are: " + sb.toString()); } // specified initial timestamp in stream when using AT_TIMESTAMP if (InitialPosition.valueOf(initPosType) == InitialPosition.AT_TIMESTAMP) { if (!config.containsKey(ConsumerConfigConstants.STREAM_INITIAL_TIMESTAMP)) { throw new IllegalArgumentException("Please set value for initial timestamp ('" + ConsumerConfigConstants.STREAM_INITIAL_TIMESTAMP + "') when using AT_TIMESTAMP initial position."); } validateOptionalDateProperty(config, ConsumerConfigConstants.STREAM_INITIAL_TIMESTAMP, config.getProperty(ConsumerConfigConstants.STREAM_TIMESTAMP_DATE_FORMAT, ConsumerConfigConstants.DEFAULT_STREAM_TIMESTAMP_DATE_FORMAT), "Invalid value given for initial timestamp for AT_TIMESTAMP initial position in stream. " + "Must be a valid format: yyyy-MM-dd'T'HH:mm:ss.SSSXXX or non-negative double value. For example, 2016-04-04T19:58:46.480-00:00 or 1459799926.480 ."); } } validateOptionalPositiveIntProperty(config, ConsumerConfigConstants.SHARD_GETRECORDS_MAX, "Invalid value given for maximum records per getRecords shard operation. Must be a valid non-negative integer value."); validateOptionalPositiveIntProperty(config, ConsumerConfigConstants.SHARD_GETRECORDS_RETRIES, "Invalid value given for maximum retry attempts for getRecords shard operation. Must be a valid non-negative integer value."); validateOptionalPositiveLongProperty(config, ConsumerConfigConstants.SHARD_GETRECORDS_BACKOFF_BASE, "Invalid value given for get records operation base backoff milliseconds. Must be a valid non-negative long value."); validateOptionalPositiveLongProperty(config, ConsumerConfigConstants.SHARD_GETRECORDS_BACKOFF_MAX, "Invalid value given for get records operation max backoff milliseconds. Must be a valid non-negative long value."); validateOptionalPositiveDoubleProperty(config, ConsumerConfigConstants.SHARD_GETRECORDS_BACKOFF_EXPONENTIAL_CONSTANT, "Invalid value given for get records operation backoff exponential constant. Must be a valid non-negative double value."); validateOptionalPositiveLongProperty(config, ConsumerConfigConstants.SHARD_GETRECORDS_INTERVAL_MILLIS, "Invalid value given for getRecords sleep interval in milliseconds. Must be a valid non-negative long value."); validateOptionalPositiveIntProperty(config, ConsumerConfigConstants.SHARD_GETITERATOR_RETRIES, "Invalid value given for maximum retry attempts for getShardIterator shard operation. Must be a valid non-negative integer value."); validateOptionalPositiveLongProperty(config, ConsumerConfigConstants.SHARD_GETITERATOR_BACKOFF_BASE, "Invalid value given for get shard iterator operation base backoff milliseconds. Must be a valid non-negative long value."); validateOptionalPositiveLongProperty(config, ConsumerConfigConstants.SHARD_GETITERATOR_BACKOFF_MAX, "Invalid value given for get shard iterator operation max backoff milliseconds. Must be a valid non-negative long value."); validateOptionalPositiveDoubleProperty(config, ConsumerConfigConstants.SHARD_GETITERATOR_BACKOFF_EXPONENTIAL_CONSTANT, "Invalid value given for get shard iterator operation backoff exponential constant. Must be a valid non-negative double value."); validateOptionalPositiveLongProperty(config, ConsumerConfigConstants.SHARD_DISCOVERY_INTERVAL_MILLIS, "Invalid value given for shard discovery sleep interval in milliseconds. Must be a valid non-negative long value."); validateOptionalPositiveLongProperty(config, ConsumerConfigConstants.LIST_SHARDS_BACKOFF_BASE, "Invalid value given for list shards operation base backoff milliseconds. Must be a valid non-negative long value."); validateOptionalPositiveLongProperty(config, ConsumerConfigConstants.LIST_SHARDS_BACKOFF_MAX, "Invalid value given for list shards operation max backoff milliseconds. Must be a valid non-negative long value."); validateOptionalPositiveDoubleProperty(config, ConsumerConfigConstants.LIST_SHARDS_BACKOFF_EXPONENTIAL_CONSTANT, "Invalid value given for list shards operation backoff exponential constant. Must be a valid non-negative double value."); if (config.containsKey(ConsumerConfigConstants.SHARD_GETRECORDS_INTERVAL_MILLIS)) { checkArgument( Long.parseLong(config.getProperty(ConsumerConfigConstants.SHARD_GETRECORDS_INTERVAL_MILLIS)) < ConsumerConfigConstants.MAX_SHARD_GETRECORDS_INTERVAL_MILLIS, "Invalid value given for getRecords sleep interval in milliseconds. Must be lower than " + ConsumerConfigConstants.MAX_SHARD_GETRECORDS_INTERVAL_MILLIS + " milliseconds." ); } }
[ "public", "static", "void", "validateConsumerConfiguration", "(", "Properties", "config", ")", "{", "checkNotNull", "(", "config", ",", "\"config can not be null\"", ")", ";", "validateAwsConfiguration", "(", "config", ")", ";", "if", "(", "!", "(", "config", ".",...
Validate configuration properties for {@link FlinkKinesisConsumer}.
[ "Validate", "configuration", "properties", "for", "{" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/util/KinesisConfigUtil.java#L85-L174
train
Validate the consumer configuration.
[ 30522, 2270, 10763, 11675, 9398, 3686, 8663, 23545, 29566, 2078, 8873, 27390, 3370, 1006, 5144, 9530, 8873, 2290, 1007, 1063, 4638, 17048, 11231, 3363, 1006, 9530, 8873, 2290, 1010, 1000, 9530, 8873, 2290, 2064, 2025, 2022, 19701, 1000, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleService.java
YarnShuffleService.serviceInit
@Override protected void serviceInit(Configuration conf) throws Exception { _conf = conf; boolean stopOnFailure = conf.getBoolean(STOP_ON_FAILURE_KEY, DEFAULT_STOP_ON_FAILURE); try { // In case this NM was killed while there were running spark applications, we need to restore // lost state for the existing executors. We look for an existing file in the NM's local dirs. // If we don't find one, then we choose a file to use to save the state next time. Even if // an application was stopped while the NM was down, we expect yarn to call stopApplication() // when it comes back if (_recoveryPath != null) { registeredExecutorFile = initRecoveryDb(RECOVERY_FILE_NAME); } TransportConf transportConf = new TransportConf("shuffle", new HadoopConfigProvider(conf)); blockHandler = new ExternalShuffleBlockHandler(transportConf, registeredExecutorFile); // If authentication is enabled, set up the shuffle server to use a // special RPC handler that filters out unauthenticated fetch requests List<TransportServerBootstrap> bootstraps = Lists.newArrayList(); boolean authEnabled = conf.getBoolean(SPARK_AUTHENTICATE_KEY, DEFAULT_SPARK_AUTHENTICATE); if (authEnabled) { secretManager = new ShuffleSecretManager(); if (_recoveryPath != null) { loadSecretsFromDb(); } bootstraps.add(new AuthServerBootstrap(transportConf, secretManager)); } int port = conf.getInt( SPARK_SHUFFLE_SERVICE_PORT_KEY, DEFAULT_SPARK_SHUFFLE_SERVICE_PORT); transportContext = new TransportContext(transportConf, blockHandler); shuffleServer = transportContext.createServer(port, bootstraps); // the port should normally be fixed, but for tests its useful to find an open port port = shuffleServer.getPort(); boundPort = port; String authEnabledString = authEnabled ? "enabled" : "not enabled"; // register metrics on the block handler into the Node Manager's metrics system. blockHandler.getAllMetrics().getMetrics().put("numRegisteredConnections", shuffleServer.getRegisteredConnections()); YarnShuffleServiceMetrics serviceMetrics = new YarnShuffleServiceMetrics(blockHandler.getAllMetrics()); MetricsSystemImpl metricsSystem = (MetricsSystemImpl) DefaultMetricsSystem.instance(); metricsSystem.register( "sparkShuffleService", "Metrics on the Spark Shuffle Service", serviceMetrics); logger.info("Registered metrics with Hadoop's DefaultMetricsSystem"); logger.info("Started YARN shuffle service for Spark on port {}. " + "Authentication is {}. Registered executor file is {}", port, authEnabledString, registeredExecutorFile); } catch (Exception e) { if (stopOnFailure) { throw e; } else { noteFailure(e); } } }
java
@Override protected void serviceInit(Configuration conf) throws Exception { _conf = conf; boolean stopOnFailure = conf.getBoolean(STOP_ON_FAILURE_KEY, DEFAULT_STOP_ON_FAILURE); try { // In case this NM was killed while there were running spark applications, we need to restore // lost state for the existing executors. We look for an existing file in the NM's local dirs. // If we don't find one, then we choose a file to use to save the state next time. Even if // an application was stopped while the NM was down, we expect yarn to call stopApplication() // when it comes back if (_recoveryPath != null) { registeredExecutorFile = initRecoveryDb(RECOVERY_FILE_NAME); } TransportConf transportConf = new TransportConf("shuffle", new HadoopConfigProvider(conf)); blockHandler = new ExternalShuffleBlockHandler(transportConf, registeredExecutorFile); // If authentication is enabled, set up the shuffle server to use a // special RPC handler that filters out unauthenticated fetch requests List<TransportServerBootstrap> bootstraps = Lists.newArrayList(); boolean authEnabled = conf.getBoolean(SPARK_AUTHENTICATE_KEY, DEFAULT_SPARK_AUTHENTICATE); if (authEnabled) { secretManager = new ShuffleSecretManager(); if (_recoveryPath != null) { loadSecretsFromDb(); } bootstraps.add(new AuthServerBootstrap(transportConf, secretManager)); } int port = conf.getInt( SPARK_SHUFFLE_SERVICE_PORT_KEY, DEFAULT_SPARK_SHUFFLE_SERVICE_PORT); transportContext = new TransportContext(transportConf, blockHandler); shuffleServer = transportContext.createServer(port, bootstraps); // the port should normally be fixed, but for tests its useful to find an open port port = shuffleServer.getPort(); boundPort = port; String authEnabledString = authEnabled ? "enabled" : "not enabled"; // register metrics on the block handler into the Node Manager's metrics system. blockHandler.getAllMetrics().getMetrics().put("numRegisteredConnections", shuffleServer.getRegisteredConnections()); YarnShuffleServiceMetrics serviceMetrics = new YarnShuffleServiceMetrics(blockHandler.getAllMetrics()); MetricsSystemImpl metricsSystem = (MetricsSystemImpl) DefaultMetricsSystem.instance(); metricsSystem.register( "sparkShuffleService", "Metrics on the Spark Shuffle Service", serviceMetrics); logger.info("Registered metrics with Hadoop's DefaultMetricsSystem"); logger.info("Started YARN shuffle service for Spark on port {}. " + "Authentication is {}. Registered executor file is {}", port, authEnabledString, registeredExecutorFile); } catch (Exception e) { if (stopOnFailure) { throw e; } else { noteFailure(e); } } }
[ "@", "Override", "protected", "void", "serviceInit", "(", "Configuration", "conf", ")", "throws", "Exception", "{", "_conf", "=", "conf", ";", "boolean", "stopOnFailure", "=", "conf", ".", "getBoolean", "(", "STOP_ON_FAILURE_KEY", ",", "DEFAULT_STOP_ON_FAILURE", "...
Start the shuffle server with the given configuration.
[ "Start", "the", "shuffle", "server", "with", "the", "given", "configuration", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleService.java#L156-L217
train
This method is called by the service init method.
[ 30522, 1030, 2058, 15637, 5123, 11675, 2326, 5498, 2102, 1006, 9563, 9530, 2546, 1007, 11618, 6453, 1063, 1035, 9530, 2546, 1027, 9530, 2546, 1025, 22017, 20898, 2644, 2239, 7011, 4014, 5397, 1027, 9530, 2546, 1012, 2131, 5092, 9890, 2319, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/HiveSQLException.java
HiveSQLException.toTStatus
public TStatus toTStatus() { // TODO: convert sqlState, etc. TStatus tStatus = new TStatus(TStatusCode.ERROR_STATUS); tStatus.setSqlState(getSQLState()); tStatus.setErrorCode(getErrorCode()); tStatus.setErrorMessage(getMessage()); tStatus.setInfoMessages(toString(this)); return tStatus; }
java
public TStatus toTStatus() { // TODO: convert sqlState, etc. TStatus tStatus = new TStatus(TStatusCode.ERROR_STATUS); tStatus.setSqlState(getSQLState()); tStatus.setErrorCode(getErrorCode()); tStatus.setErrorMessage(getMessage()); tStatus.setInfoMessages(toString(this)); return tStatus; }
[ "public", "TStatus", "toTStatus", "(", ")", "{", "// TODO: convert sqlState, etc.", "TStatus", "tStatus", "=", "new", "TStatus", "(", "TStatusCode", ".", "ERROR_STATUS", ")", ";", "tStatus", ".", "setSqlState", "(", "getSQLState", "(", ")", ")", ";", "tStatus", ...
Converts current object to a {@link TStatus} object @return a {@link TStatus} object
[ "Converts", "current", "object", "to", "a", "{" ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/HiveSQLException.java#L116-L124
train
Converts this object to a TStatus object.
[ 30522, 2270, 24529, 29336, 2271, 2000, 3215, 29336, 2271, 1006, 1007, 1063, 1013, 1013, 28681, 2080, 1024, 10463, 29296, 9153, 2618, 1010, 4385, 1012, 24529, 29336, 2271, 24529, 29336, 2271, 1027, 2047, 24529, 29336, 2271, 1006, 24529, 29336,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-setting/src/main/java/cn/hutool/setting/Setting.java
Setting.containsKey
@Override public boolean containsKey(Object key) { return this.groupedMap.containsKey(DEFAULT_GROUP, Convert.toStr(key)); }
java
@Override public boolean containsKey(Object key) { return this.groupedMap.containsKey(DEFAULT_GROUP, Convert.toStr(key)); }
[ "@", "Override", "public", "boolean", "containsKey", "(", "Object", "key", ")", "{", "return", "this", ".", "groupedMap", ".", "containsKey", "(", "DEFAULT_GROUP", ",", "Convert", ".", "toStr", "(", "key", ")", ")", ";", "}" ]
默认分组(空分组)中是否包含指定key对应的值 @param key 键 @return 默认分组中是否包含指定key对应的值
[ "默认分组(空分组)中是否包含指定key对应的值" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/Setting.java#L527-L530
train
Returns true if the specified key is in the default group.
[ 30522, 1030, 2058, 15637, 2270, 22017, 20898, 3397, 14839, 1006, 4874, 3145, 1007, 1063, 2709, 2023, 1012, 15131, 2863, 2361, 1012, 3397, 14839, 1006, 12398, 1035, 2177, 1010, 10463, 1012, 2000, 3367, 2099, 1006, 3145, 1007, 1007, 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...
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java
HpackEncoder.encodeInteger
private static void encodeInteger(ByteBuf out, int mask, int n, long i) { assert n >= 0 && n <= 8 : "N: " + n; int nbits = 0xFF >>> (8 - n); if (i < nbits) { out.writeByte((int) (mask | i)); } else { out.writeByte(mask | nbits); long length = i - nbits; for (; (length & ~0x7F) != 0; length >>>= 7) { out.writeByte((int) ((length & 0x7F) | 0x80)); } out.writeByte((int) length); } }
java
private static void encodeInteger(ByteBuf out, int mask, int n, long i) { assert n >= 0 && n <= 8 : "N: " + n; int nbits = 0xFF >>> (8 - n); if (i < nbits) { out.writeByte((int) (mask | i)); } else { out.writeByte(mask | nbits); long length = i - nbits; for (; (length & ~0x7F) != 0; length >>>= 7) { out.writeByte((int) ((length & 0x7F) | 0x80)); } out.writeByte((int) length); } }
[ "private", "static", "void", "encodeInteger", "(", "ByteBuf", "out", ",", "int", "mask", ",", "int", "n", ",", "long", "i", ")", "{", "assert", "n", ">=", "0", "&&", "n", "<=", "8", ":", "\"N: \"", "+", "n", ";", "int", "nbits", "=", "0xFF", ">>>...
Encode integer according to <a href="https://tools.ietf.org/html/rfc7541#section-5.1">Section 5.1</a>.
[ "Encode", "integer", "according", "to", "<a", "href", "=", "https", ":", "//", "tools", ".", "ietf", ".", "org", "/", "html", "/", "rfc7541#section", "-", "5", ".", "1", ">", "Section", "5", ".", "1<", "/", "a", ">", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java#L234-L247
train
Encode a single integer in a byte buffer.
[ 30522, 2797, 10763, 11675, 4372, 16044, 18447, 26320, 1006, 24880, 8569, 2546, 2041, 1010, 20014, 7308, 1010, 20014, 1050, 1010, 2146, 1045, 1007, 1063, 20865, 1050, 1028, 1027, 1014, 1004, 1004, 1050, 1026, 1027, 1022, 1024, 1000, 1050, 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/spark
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
UTF8String.rpad
public UTF8String rpad(int len, UTF8String pad) { int spaces = len - this.numChars(); // number of char need to pad if (spaces <= 0 || pad.numBytes() == 0) { // no padding at all, return the substring of the current string return substring(0, len); } else { int padChars = pad.numChars(); int count = spaces / padChars; // how many padding string needed // the partial string of the padding UTF8String remain = pad.substring(0, spaces - padChars * count); byte[] data = new byte[this.numBytes + pad.numBytes * count + remain.numBytes]; copyMemory(this.base, this.offset, data, BYTE_ARRAY_OFFSET, this.numBytes); int offset = this.numBytes; int idx = 0; while (idx < count) { copyMemory(pad.base, pad.offset, data, BYTE_ARRAY_OFFSET + offset, pad.numBytes); ++ idx; offset += pad.numBytes; } copyMemory(remain.base, remain.offset, data, BYTE_ARRAY_OFFSET + offset, remain.numBytes); return UTF8String.fromBytes(data); } }
java
public UTF8String rpad(int len, UTF8String pad) { int spaces = len - this.numChars(); // number of char need to pad if (spaces <= 0 || pad.numBytes() == 0) { // no padding at all, return the substring of the current string return substring(0, len); } else { int padChars = pad.numChars(); int count = spaces / padChars; // how many padding string needed // the partial string of the padding UTF8String remain = pad.substring(0, spaces - padChars * count); byte[] data = new byte[this.numBytes + pad.numBytes * count + remain.numBytes]; copyMemory(this.base, this.offset, data, BYTE_ARRAY_OFFSET, this.numBytes); int offset = this.numBytes; int idx = 0; while (idx < count) { copyMemory(pad.base, pad.offset, data, BYTE_ARRAY_OFFSET + offset, pad.numBytes); ++ idx; offset += pad.numBytes; } copyMemory(remain.base, remain.offset, data, BYTE_ARRAY_OFFSET + offset, remain.numBytes); return UTF8String.fromBytes(data); } }
[ "public", "UTF8String", "rpad", "(", "int", "len", ",", "UTF8String", "pad", ")", "{", "int", "spaces", "=", "len", "-", "this", ".", "numChars", "(", ")", ";", "// number of char need to pad", "if", "(", "spaces", "<=", "0", "||", "pad", ".", "numBytes"...
Returns str, right-padded with pad to a length of len For example: ('hi', 5, '??') =&gt; 'hi???' ('hi', 1, '??') =&gt; 'h'
[ "Returns", "str", "right", "-", "padded", "with", "pad", "to", "a", "length", "of", "len", "For", "example", ":", "(", "hi", "5", "??", ")", "=", "&gt", ";", "hi???", "(", "hi", "1", "??", ")", "=", "&gt", ";", "h" ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L821-L845
train
Returns a new string of length len with the specified padding string.
[ 30522, 2270, 21183, 2546, 2620, 3367, 4892, 1054, 15455, 1006, 20014, 18798, 1010, 21183, 2546, 2620, 3367, 4892, 11687, 1007, 1063, 20014, 7258, 1027, 18798, 1011, 2023, 1012, 16371, 12458, 8167, 2015, 1006, 1007, 1025, 1013, 1013, 2193, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java
URLUtil.getReader
public static BufferedReader getReader(URL url, Charset charset) { return IoUtil.getReader(getStream(url), charset); }
java
public static BufferedReader getReader(URL url, Charset charset) { return IoUtil.getReader(getStream(url), charset); }
[ "public", "static", "BufferedReader", "getReader", "(", "URL", "url", ",", "Charset", "charset", ")", "{", "return", "IoUtil", ".", "getReader", "(", "getStream", "(", "url", ")", ",", "charset", ")", ";", "}" ]
获得Reader @param url {@link URL} @param charset 编码 @return {@link BufferedReader} @since 3.2.1
[ "获得Reader" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L523-L525
train
Get a buffered reader for the given URL.
[ 30522, 2270, 10763, 17698, 2098, 16416, 4063, 2131, 16416, 4063, 1006, 24471, 2140, 24471, 2140, 1010, 25869, 13462, 25869, 13462, 1007, 1063, 2709, 22834, 21823, 2140, 1012, 2131, 16416, 4063, 1006, 4152, 25379, 1006, 24471, 2140, 1007, 1010...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.writeJpg
public static void writeJpg(Image image, OutputStream out) throws IORuntimeException { write(image, IMAGE_TYPE_JPG, out); }
java
public static void writeJpg(Image image, OutputStream out) throws IORuntimeException { write(image, IMAGE_TYPE_JPG, out); }
[ "public", "static", "void", "writeJpg", "(", "Image", "image", ",", "OutputStream", "out", ")", "throws", "IORuntimeException", "{", "write", "(", "image", ",", "IMAGE_TYPE_JPG", ",", "out", ")", ";", "}" ]
写出图像为JPG格式 @param image {@link Image} @param out 写出到的目标流 @throws IORuntimeException IO异常 @since 4.0.10
[ "写出图像为JPG格式" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1377-L1379
train
Write a JPG image to an OutputStream.
[ 30522, 2270, 10763, 11675, 4339, 3501, 26952, 1006, 3746, 3746, 1010, 27852, 25379, 2041, 1007, 11618, 22834, 15532, 7292, 10288, 24422, 1063, 4339, 1006, 3746, 1010, 3746, 1035, 2828, 1035, 16545, 2290, 1010, 2041, 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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/pregel/VertexCentricIteration.java
VertexCentricIteration.createResult
@Override public DataSet<Vertex<K, VV>> createResult() { if (this.initialVertices == null) { throw new IllegalStateException("The input data set has not been set."); } // prepare the type information TypeInformation<K> keyType = ((TupleTypeInfo<?>) initialVertices.getType()).getTypeAt(0); TypeInformation<Tuple2<K, Message>> messageTypeInfo = new TupleTypeInfo<>(keyType, messageType); TypeInformation<Vertex<K, VV>> vertexType = initialVertices.getType(); TypeInformation<Either<Vertex<K, VV>, Tuple2<K, Message>>> intermediateTypeInfo = new EitherTypeInfo<>(vertexType, messageTypeInfo); TypeInformation<Either<NullValue, Message>> nullableMsgTypeInfo = new EitherTypeInfo<>(TypeExtractor.getForClass(NullValue.class), messageType); TypeInformation<Tuple2<K, Either<NullValue, Message>>> workSetTypeInfo = new TupleTypeInfo<>(keyType, nullableMsgTypeInfo); DataSet<Tuple2<K, Either<NullValue, Message>>> initialWorkSet = initialVertices.map( new InitializeWorkSet<K, VV, Message>()).returns(workSetTypeInfo); final DeltaIteration<Vertex<K, VV>, Tuple2<K, Either<NullValue, Message>>> iteration = initialVertices.iterateDelta(initialWorkSet, this.maximumNumberOfIterations, 0); setUpIteration(iteration); // join with the current state to get vertex values DataSet<Tuple2<Vertex<K, VV>, Either<NullValue, Message>>> verticesWithMsgs = iteration.getSolutionSet().join(iteration.getWorkset()) .where(0).equalTo(0) .with(new AppendVertexState<>()) .returns(new TupleTypeInfo<>( vertexType, nullableMsgTypeInfo)); VertexComputeUdf<K, VV, EV, Message> vertexUdf = new VertexComputeUdf<>(computeFunction, intermediateTypeInfo); CoGroupOperator<?, ?, Either<Vertex<K, VV>, Tuple2<K, Message>>> superstepComputation = verticesWithMsgs.coGroup(edgesWithValue) .where("f0.f0").equalTo(0) .with(vertexUdf); // compute the solution set delta DataSet<Vertex<K, VV>> solutionSetDelta = superstepComputation.flatMap( new ProjectNewVertexValue<>()).returns(vertexType); // compute the inbox of each vertex for the next superstep (new workset) DataSet<Tuple2<K, Either<NullValue, Message>>> allMessages = superstepComputation.flatMap( new ProjectMessages<>()).returns(workSetTypeInfo); DataSet<Tuple2<K, Either<NullValue, Message>>> newWorkSet = allMessages; // check if a combiner has been provided if (combineFunction != null) { MessageCombinerUdf<K, Message> combinerUdf = new MessageCombinerUdf<>(combineFunction, workSetTypeInfo); DataSet<Tuple2<K, Either<NullValue, Message>>> combinedMessages = allMessages .groupBy(0).reduceGroup(combinerUdf) .setCombinable(true); newWorkSet = combinedMessages; } // configure the compute function superstepComputation = superstepComputation.name("Compute Function"); if (this.configuration != null) { for (Tuple2<String, DataSet<?>> e : this.configuration.getBcastVars()) { superstepComputation = superstepComputation.withBroadcastSet(e.f1, e.f0); } } return iteration.closeWith(solutionSetDelta, newWorkSet); }
java
@Override public DataSet<Vertex<K, VV>> createResult() { if (this.initialVertices == null) { throw new IllegalStateException("The input data set has not been set."); } // prepare the type information TypeInformation<K> keyType = ((TupleTypeInfo<?>) initialVertices.getType()).getTypeAt(0); TypeInformation<Tuple2<K, Message>> messageTypeInfo = new TupleTypeInfo<>(keyType, messageType); TypeInformation<Vertex<K, VV>> vertexType = initialVertices.getType(); TypeInformation<Either<Vertex<K, VV>, Tuple2<K, Message>>> intermediateTypeInfo = new EitherTypeInfo<>(vertexType, messageTypeInfo); TypeInformation<Either<NullValue, Message>> nullableMsgTypeInfo = new EitherTypeInfo<>(TypeExtractor.getForClass(NullValue.class), messageType); TypeInformation<Tuple2<K, Either<NullValue, Message>>> workSetTypeInfo = new TupleTypeInfo<>(keyType, nullableMsgTypeInfo); DataSet<Tuple2<K, Either<NullValue, Message>>> initialWorkSet = initialVertices.map( new InitializeWorkSet<K, VV, Message>()).returns(workSetTypeInfo); final DeltaIteration<Vertex<K, VV>, Tuple2<K, Either<NullValue, Message>>> iteration = initialVertices.iterateDelta(initialWorkSet, this.maximumNumberOfIterations, 0); setUpIteration(iteration); // join with the current state to get vertex values DataSet<Tuple2<Vertex<K, VV>, Either<NullValue, Message>>> verticesWithMsgs = iteration.getSolutionSet().join(iteration.getWorkset()) .where(0).equalTo(0) .with(new AppendVertexState<>()) .returns(new TupleTypeInfo<>( vertexType, nullableMsgTypeInfo)); VertexComputeUdf<K, VV, EV, Message> vertexUdf = new VertexComputeUdf<>(computeFunction, intermediateTypeInfo); CoGroupOperator<?, ?, Either<Vertex<K, VV>, Tuple2<K, Message>>> superstepComputation = verticesWithMsgs.coGroup(edgesWithValue) .where("f0.f0").equalTo(0) .with(vertexUdf); // compute the solution set delta DataSet<Vertex<K, VV>> solutionSetDelta = superstepComputation.flatMap( new ProjectNewVertexValue<>()).returns(vertexType); // compute the inbox of each vertex for the next superstep (new workset) DataSet<Tuple2<K, Either<NullValue, Message>>> allMessages = superstepComputation.flatMap( new ProjectMessages<>()).returns(workSetTypeInfo); DataSet<Tuple2<K, Either<NullValue, Message>>> newWorkSet = allMessages; // check if a combiner has been provided if (combineFunction != null) { MessageCombinerUdf<K, Message> combinerUdf = new MessageCombinerUdf<>(combineFunction, workSetTypeInfo); DataSet<Tuple2<K, Either<NullValue, Message>>> combinedMessages = allMessages .groupBy(0).reduceGroup(combinerUdf) .setCombinable(true); newWorkSet = combinedMessages; } // configure the compute function superstepComputation = superstepComputation.name("Compute Function"); if (this.configuration != null) { for (Tuple2<String, DataSet<?>> e : this.configuration.getBcastVars()) { superstepComputation = superstepComputation.withBroadcastSet(e.f1, e.f0); } } return iteration.closeWith(solutionSetDelta, newWorkSet); }
[ "@", "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 vertex-centric graph computation. <p>The Pregel iteration is mapped to delta iteration as follows. The solution set consists of the set of active vertices and the workset contains the set of messages send to vertices during the previous superstep. Initially, the workset contains a null message for each vertex. In the beginning of a superstep, the solution set is joined with the workset to produce a dataset containing tuples of vertex state and messages (vertex inbox). The superstep compute UDF is realized with a coGroup between the vertices with inbox and the graph edges. The output of the compute UDF contains both the new vertex values and the new messages produced. These are directed to the solution set delta and new workset, respectively, with subsequent flatMaps. @return The operator that represents this vertex-centric graph computation.
[ "Creates", "the", "operator", "that", "represents", "this", "vertex", "-", "centric", "graph", "computation", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/pregel/VertexCentricIteration.java#L150-L223
train
Creates the result set.
[ 30522, 1030, 2058, 15637, 30524, 17389, 2595, 24422, 1006, 1000, 1996, 7953, 2951, 2275, 2038, 2025, 2042, 2275, 1012, 1000, 1007, 1025, 1065, 1013, 1013, 7374, 1996, 2828, 2592, 2828, 2378, 14192, 3370, 1026, 1047, 1028, 3145, 13874, 1027,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java
AllWindowedStream.process
@PublicEvolving public <R> SingleOutputStreamOperator<R> process(ProcessAllWindowFunction<T, R, W> function) { String callLocation = Utils.getCallLocationName(); function = input.getExecutionEnvironment().clean(function); TypeInformation<R> resultType = getProcessAllWindowFunctionReturnType(function, getInputType()); return apply(new InternalIterableProcessAllWindowFunction<>(function), resultType, callLocation); }
java
@PublicEvolving public <R> SingleOutputStreamOperator<R> process(ProcessAllWindowFunction<T, R, W> function) { String callLocation = Utils.getCallLocationName(); function = input.getExecutionEnvironment().clean(function); TypeInformation<R> resultType = getProcessAllWindowFunctionReturnType(function, getInputType()); return apply(new InternalIterableProcessAllWindowFunction<>(function), resultType, callLocation); }
[ "@", "PublicEvolving", "public", "<", "R", ">", "SingleOutputStreamOperator", "<", "R", ">", "process", "(", "ProcessAllWindowFunction", "<", "T", ",", "R", ",", "W", ">", "function", ")", "{", "String", "callLocation", "=", "Utils", ".", "getCallLocationName"...
Applies the given window function to each window. The window function is called for each evaluation of the window. The output of the window function is interpreted as a regular non-windowed stream. <p>Note that this function requires that all data in the windows is buffered until the window is evaluated, as the function provides no means of incremental aggregation. @param function The process window function. @return The data stream that is the result of applying the window function to the window.
[ "Applies", "the", "given", "window", "function", "to", "each", "window", ".", "The", "window", "function", "is", "called", "for", "each", "evaluation", "of", "the", "window", ".", "The", "output", "of", "the", "window", "function", "is", "interpreted", "as",...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java#L1090-L1096
train
Process all window function.
[ 30522, 1030, 2270, 6777, 4747, 6455, 2270, 1026, 1054, 1028, 2309, 5833, 18780, 21422, 25918, 8844, 1026, 1054, 1028, 2832, 1006, 2832, 8095, 11101, 5004, 11263, 27989, 1026, 1056, 1010, 1054, 1010, 1059, 1028, 3853, 1007, 1063, 5164, 2655,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/CheckpointCoordinator.java
CheckpointCoordinator.restoreSavepoint
public boolean restoreSavepoint( String savepointPointer, boolean allowNonRestored, Map<JobVertexID, ExecutionJobVertex> tasks, ClassLoader userClassLoader) throws Exception { Preconditions.checkNotNull(savepointPointer, "The savepoint path cannot be null."); LOG.info("Starting job {} from savepoint {} ({})", job, savepointPointer, (allowNonRestored ? "allowing non restored state" : "")); final CompletedCheckpointStorageLocation checkpointLocation = checkpointStorage.resolveCheckpoint(savepointPointer); // Load the savepoint as a checkpoint into the system CompletedCheckpoint savepoint = Checkpoints.loadAndValidateCheckpoint( job, tasks, checkpointLocation, userClassLoader, allowNonRestored); completedCheckpointStore.addCheckpoint(savepoint); // Reset the checkpoint ID counter long nextCheckpointId = savepoint.getCheckpointID() + 1; checkpointIdCounter.setCount(nextCheckpointId); LOG.info("Reset the checkpoint ID of job {} to {}.", job, nextCheckpointId); return restoreLatestCheckpointedState(tasks, true, allowNonRestored); }
java
public boolean restoreSavepoint( String savepointPointer, boolean allowNonRestored, Map<JobVertexID, ExecutionJobVertex> tasks, ClassLoader userClassLoader) throws Exception { Preconditions.checkNotNull(savepointPointer, "The savepoint path cannot be null."); LOG.info("Starting job {} from savepoint {} ({})", job, savepointPointer, (allowNonRestored ? "allowing non restored state" : "")); final CompletedCheckpointStorageLocation checkpointLocation = checkpointStorage.resolveCheckpoint(savepointPointer); // Load the savepoint as a checkpoint into the system CompletedCheckpoint savepoint = Checkpoints.loadAndValidateCheckpoint( job, tasks, checkpointLocation, userClassLoader, allowNonRestored); completedCheckpointStore.addCheckpoint(savepoint); // Reset the checkpoint ID counter long nextCheckpointId = savepoint.getCheckpointID() + 1; checkpointIdCounter.setCount(nextCheckpointId); LOG.info("Reset the checkpoint ID of job {} to {}.", job, nextCheckpointId); return restoreLatestCheckpointedState(tasks, true, allowNonRestored); }
[ "public", "boolean", "restoreSavepoint", "(", "String", "savepointPointer", ",", "boolean", "allowNonRestored", ",", "Map", "<", "JobVertexID", ",", "ExecutionJobVertex", ">", "tasks", ",", "ClassLoader", "userClassLoader", ")", "throws", "Exception", "{", "Preconditi...
Restore the state with given savepoint. @param savepointPointer The pointer to the savepoint. @param allowNonRestored True if allowing checkpoint state that cannot be mapped to any job vertex in tasks. @param tasks Map of job vertices to restore. State for these vertices is restored via {@link Execution#setInitialState(JobManagerTaskRestore)}. @param userClassLoader The class loader to resolve serialized classes in legacy savepoint versions.
[ "Restore", "the", "state", "with", "given", "savepoint", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java#L1144-L1170
train
Restores the state of a savepoint.
[ 30522, 2270, 22017, 20898, 9239, 3736, 3726, 8400, 1006, 5164, 3828, 8400, 8400, 2121, 1010, 22017, 20898, 3499, 8540, 28533, 19574, 1010, 4949, 1026, 3105, 16874, 10288, 3593, 1010, 7781, 5558, 2497, 16874, 10288, 1028, 8518, 1010, 2465, 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-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapreduce/HadoopInputFormatBase.java
HadoopInputFormatBase.writeObject
private void writeObject(ObjectOutputStream out) throws IOException { super.write(out); out.writeUTF(this.mapreduceInputFormat.getClass().getName()); out.writeUTF(this.keyClass.getName()); out.writeUTF(this.valueClass.getName()); this.configuration.write(out); }
java
private void writeObject(ObjectOutputStream out) throws IOException { super.write(out); out.writeUTF(this.mapreduceInputFormat.getClass().getName()); out.writeUTF(this.keyClass.getName()); out.writeUTF(this.valueClass.getName()); this.configuration.write(out); }
[ "private", "void", "writeObject", "(", "ObjectOutputStream", "out", ")", "throws", "IOException", "{", "super", ".", "write", "(", "out", ")", ";", "out", ".", "writeUTF", "(", "this", ".", "mapreduceInputFormat", ".", "getClass", "(", ")", ".", "getName", ...
--------------------------------------------------------------------------------------------
[ "--------------------------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapreduce/HadoopInputFormatBase.java#L282-L288
train
Write the object.
[ 30522, 2797, 11675, 4339, 16429, 20614, 1006, 4874, 5833, 18780, 21422, 2041, 1007, 11618, 22834, 10288, 24422, 1063, 3565, 1012, 4339, 1006, 2041, 1007, 1025, 2041, 1012, 4339, 4904, 2546, 1006, 2023, 1012, 4949, 5596, 18796, 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...
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java
HpackEncoder.encodeHeader
private void encodeHeader(ByteBuf out, CharSequence name, CharSequence value, boolean sensitive, long headerSize) { // If the header value is sensitive then it must never be indexed if (sensitive) { int nameIndex = getNameIndex(name); encodeLiteral(out, name, value, IndexType.NEVER, nameIndex); return; } // If the peer will only use the static table if (maxHeaderTableSize == 0) { int staticTableIndex = HpackStaticTable.getIndex(name, value); if (staticTableIndex == -1) { int nameIndex = HpackStaticTable.getIndex(name); encodeLiteral(out, name, value, IndexType.NONE, nameIndex); } else { encodeInteger(out, 0x80, 7, staticTableIndex); } return; } // If the headerSize is greater than the max table size then it must be encoded literally if (headerSize > maxHeaderTableSize) { int nameIndex = getNameIndex(name); encodeLiteral(out, name, value, IndexType.NONE, nameIndex); return; } HeaderEntry headerField = getEntry(name, value); if (headerField != null) { int index = getIndex(headerField.index) + HpackStaticTable.length; // Section 6.1. Indexed Header Field Representation encodeInteger(out, 0x80, 7, index); } else { int staticTableIndex = HpackStaticTable.getIndex(name, value); if (staticTableIndex != -1) { // Section 6.1. Indexed Header Field Representation encodeInteger(out, 0x80, 7, staticTableIndex); } else { ensureCapacity(headerSize); encodeLiteral(out, name, value, IndexType.INCREMENTAL, getNameIndex(name)); add(name, value, headerSize); } } }
java
private void encodeHeader(ByteBuf out, CharSequence name, CharSequence value, boolean sensitive, long headerSize) { // If the header value is sensitive then it must never be indexed if (sensitive) { int nameIndex = getNameIndex(name); encodeLiteral(out, name, value, IndexType.NEVER, nameIndex); return; } // If the peer will only use the static table if (maxHeaderTableSize == 0) { int staticTableIndex = HpackStaticTable.getIndex(name, value); if (staticTableIndex == -1) { int nameIndex = HpackStaticTable.getIndex(name); encodeLiteral(out, name, value, IndexType.NONE, nameIndex); } else { encodeInteger(out, 0x80, 7, staticTableIndex); } return; } // If the headerSize is greater than the max table size then it must be encoded literally if (headerSize > maxHeaderTableSize) { int nameIndex = getNameIndex(name); encodeLiteral(out, name, value, IndexType.NONE, nameIndex); return; } HeaderEntry headerField = getEntry(name, value); if (headerField != null) { int index = getIndex(headerField.index) + HpackStaticTable.length; // Section 6.1. Indexed Header Field Representation encodeInteger(out, 0x80, 7, index); } else { int staticTableIndex = HpackStaticTable.getIndex(name, value); if (staticTableIndex != -1) { // Section 6.1. Indexed Header Field Representation encodeInteger(out, 0x80, 7, staticTableIndex); } else { ensureCapacity(headerSize); encodeLiteral(out, name, value, IndexType.INCREMENTAL, getNameIndex(name)); add(name, value, headerSize); } } }
[ "private", "void", "encodeHeader", "(", "ByteBuf", "out", ",", "CharSequence", "name", ",", "CharSequence", "value", ",", "boolean", "sensitive", ",", "long", "headerSize", ")", "{", "// If the header value is sensitive then it must never be indexed", "if", "(", "sensit...
Encode the header field into the header block. <strong>The given {@link CharSequence}s must be immutable!</strong>
[ "Encode", "the", "header", "field", "into", "the", "header", "block", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java#L143-L186
train
Encode a single header.
[ 30522, 2797, 11675, 4372, 16044, 4974, 2121, 1006, 24880, 8569, 2546, 2041, 1010, 25869, 3366, 4226, 5897, 2171, 1010, 25869, 3366, 4226, 5897, 3643, 1010, 22017, 20898, 7591, 1010, 2146, 20346, 5332, 4371, 1007, 1063, 1013, 1013, 2065, 199...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
dump/src/main/java/com/networknt/dump/RootDumper.java
RootDumper.dumpRequest
public void dumpRequest(Map<String, Object> result) { if(!dumpConfig.isRequestEnabled()) { return; } Map<String, Object> requestResult = new LinkedHashMap<>(); for(IRequestDumpable dumper: dumperFactory.createRequestDumpers(dumpConfig, exchange)) { if(dumper.isApplicableForRequest()){ dumper.dumpRequest(requestResult); } } result.put(DumpConstants.REQUEST, requestResult); }
java
public void dumpRequest(Map<String, Object> result) { if(!dumpConfig.isRequestEnabled()) { return; } Map<String, Object> requestResult = new LinkedHashMap<>(); for(IRequestDumpable dumper: dumperFactory.createRequestDumpers(dumpConfig, exchange)) { if(dumper.isApplicableForRequest()){ dumper.dumpRequest(requestResult); } } result.put(DumpConstants.REQUEST, requestResult); }
[ "public", "void", "dumpRequest", "(", "Map", "<", "String", ",", "Object", ">", "result", ")", "{", "if", "(", "!", "dumpConfig", ".", "isRequestEnabled", "(", ")", ")", "{", "return", ";", "}", "Map", "<", "String", ",", "Object", ">", "requestResult"...
create dumpers that can dump http request info, and put http request info into Map<String, Object> result @param result a Map<String, Object> to put http request info to
[ "create", "dumpers", "that", "can", "dump", "http", "request", "info", "and", "put", "http", "request", "info", "into", "Map<String", "Object", ">", "result" ]
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/RootDumper.java#L43-L53
train
Dump request information.
[ 30522, 2270, 11675, 15653, 2890, 15500, 1006, 4949, 1026, 5164, 1010, 4874, 1028, 2765, 1007, 1063, 2065, 1006, 999, 15653, 8663, 8873, 2290, 1012, 2003, 2890, 15500, 8189, 23242, 1006, 1007, 1007, 1063, 2709, 1025, 1065, 4949, 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...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointStatsTracker.java
CheckpointStatsTracker.createSnapshot
public CheckpointStatsSnapshot createSnapshot() { CheckpointStatsSnapshot snapshot = latestSnapshot; // Only create a new snapshot if dirty and no update in progress, // because we don't want to block the coordinator. if (dirty && statsReadWriteLock.tryLock()) { try { // Create a new snapshot snapshot = new CheckpointStatsSnapshot( counts.createSnapshot(), summary.createSnapshot(), history.createSnapshot(), latestRestoredCheckpoint); latestSnapshot = snapshot; dirty = false; } finally { statsReadWriteLock.unlock(); } } return snapshot; }
java
public CheckpointStatsSnapshot createSnapshot() { CheckpointStatsSnapshot snapshot = latestSnapshot; // Only create a new snapshot if dirty and no update in progress, // because we don't want to block the coordinator. if (dirty && statsReadWriteLock.tryLock()) { try { // Create a new snapshot snapshot = new CheckpointStatsSnapshot( counts.createSnapshot(), summary.createSnapshot(), history.createSnapshot(), latestRestoredCheckpoint); latestSnapshot = snapshot; dirty = false; } finally { statsReadWriteLock.unlock(); } } return snapshot; }
[ "public", "CheckpointStatsSnapshot", "createSnapshot", "(", ")", "{", "CheckpointStatsSnapshot", "snapshot", "=", "latestSnapshot", ";", "// Only create a new snapshot if dirty and no update in progress,", "// because we don't want to block the coordinator.", "if", "(", "dirty", "&&"...
Creates a new snapshot of the available stats. @return The latest statistics snapshot.
[ "Creates", "a", "new", "snapshot", "of", "the", "available", "stats", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointStatsTracker.java#L157-L180
train
Creates a snapshot of the current checkpoint stats.
[ 30522, 2270, 26520, 9153, 3215, 2015, 2532, 4523, 12326, 9005, 2532, 4523, 12326, 1006, 1007, 1063, 26520, 9153, 3215, 2015, 2532, 4523, 12326, 20057, 12326, 1027, 6745, 2015, 2532, 4523, 12326, 1025, 1013, 1013, 2069, 3443, 1037, 2047, 200...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BinaryHashBucketArea.java
BinaryHashBucketArea.appendRecordAndInsert
boolean appendRecordAndInsert(BinaryRow record, int hashCode) throws IOException { final int posHashCode = findBucket(hashCode); // get the bucket for the given hash code final int bucketArrayPos = posHashCode >> table.bucketsPerSegmentBits; final int bucketInSegmentPos = (posHashCode & table.bucketsPerSegmentMask) << BUCKET_SIZE_BITS; final MemorySegment bucket = this.buckets[bucketArrayPos]; if (!table.tryDistinctBuildRow || !partition.isInMemory() || !findFirstSameBuildRow(bucket, hashCode, bucketInSegmentPos, record)) { int pointer = partition.insertIntoBuildBuffer(record); if (pointer != -1) { // record was inserted into an in-memory partition. a pointer must be inserted into the buckets insertToBucket(bucket, bucketInSegmentPos, hashCode, pointer, true, true); return true; } else { return false; } } else { // distinct build rows in memory. return true; } }
java
boolean appendRecordAndInsert(BinaryRow record, int hashCode) throws IOException { final int posHashCode = findBucket(hashCode); // get the bucket for the given hash code final int bucketArrayPos = posHashCode >> table.bucketsPerSegmentBits; final int bucketInSegmentPos = (posHashCode & table.bucketsPerSegmentMask) << BUCKET_SIZE_BITS; final MemorySegment bucket = this.buckets[bucketArrayPos]; if (!table.tryDistinctBuildRow || !partition.isInMemory() || !findFirstSameBuildRow(bucket, hashCode, bucketInSegmentPos, record)) { int pointer = partition.insertIntoBuildBuffer(record); if (pointer != -1) { // record was inserted into an in-memory partition. a pointer must be inserted into the buckets insertToBucket(bucket, bucketInSegmentPos, hashCode, pointer, true, true); return true; } else { return false; } } else { // distinct build rows in memory. return true; } }
[ "boolean", "appendRecordAndInsert", "(", "BinaryRow", "record", ",", "int", "hashCode", ")", "throws", "IOException", "{", "final", "int", "posHashCode", "=", "findBucket", "(", "hashCode", ")", ";", "// get the bucket for the given hash code", "final", "int", "bucket...
Append record and insert to bucket.
[ "Append", "record", "and", "insert", "to", "bucket", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BinaryHashBucketArea.java#L448-L470
train
Append a record to the build buffer and insert it into the build buffer.
[ 30522, 22017, 20898, 10439, 10497, 2890, 27108, 7847, 8718, 8043, 2102, 1006, 12441, 10524, 2501, 1010, 20014, 23325, 16044, 1007, 11618, 22834, 10288, 24422, 1063, 2345, 20014, 13433, 7377, 4095, 16044, 1027, 2424, 24204, 3388, 1006, 23325, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.fromElements
@SafeVarargs public final <OUT> DataStreamSource<OUT> fromElements(Class<OUT> type, OUT... data) { if (data.length == 0) { throw new IllegalArgumentException("fromElements needs at least one element as argument"); } TypeInformation<OUT> typeInfo; try { typeInfo = TypeExtractor.getForClass(type); } catch (Exception e) { throw new RuntimeException("Could not create TypeInformation for type " + type.getName() + "; please specify the TypeInformation manually via " + "StreamExecutionEnvironment#fromElements(Collection, TypeInformation)", e); } return fromCollection(Arrays.asList(data), typeInfo); }
java
@SafeVarargs public final <OUT> DataStreamSource<OUT> fromElements(Class<OUT> type, OUT... data) { if (data.length == 0) { throw new IllegalArgumentException("fromElements needs at least one element as argument"); } TypeInformation<OUT> typeInfo; try { typeInfo = TypeExtractor.getForClass(type); } catch (Exception e) { throw new RuntimeException("Could not create TypeInformation for type " + type.getName() + "; please specify the TypeInformation manually via " + "StreamExecutionEnvironment#fromElements(Collection, TypeInformation)", e); } return fromCollection(Arrays.asList(data), typeInfo); }
[ "@", "SafeVarargs", "public", "final", "<", "OUT", ">", "DataStreamSource", "<", "OUT", ">", "fromElements", "(", "Class", "<", "OUT", ">", "type", ",", "OUT", "...", "data", ")", "{", "if", "(", "data", ".", "length", "==", "0", ")", "{", "throw", ...
Creates a new data set that contains the given elements. The framework will determine the type according to the based type user supplied. The elements should be the same or be the subclass to the based type. The sequence of elements must not be empty. Note that this operation will result in a non-parallel data stream source, i.e. a data stream source with a degree of parallelism one. @param type The based class type in the collection. @param data The array of elements to create the data stream from. @param <OUT> The type of the returned data stream @return The data stream representing the given array of elements
[ "Creates", "a", "new", "data", "set", "that", "contains", "the", "given", "elements", ".", "The", "framework", "will", "determine", "the", "type", "according", "to", "the", "based", "type", "user", "supplied", ".", "The", "elements", "should", "be", "the", ...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L732-L748
train
Creates a data stream from a collection of elements.
[ 30522, 1030, 3647, 24516, 10623, 2015, 2270, 2345, 1026, 2041, 1028, 2951, 21422, 6499, 3126, 3401, 1026, 2041, 1028, 2013, 12260, 8163, 1006, 2465, 1026, 2041, 1028, 2828, 1010, 2041, 1012, 1012, 1012, 2951, 1007, 1063, 2065, 1006, 2951, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/EscapeUtil.java
EscapeUtil.unescapeHtml4
public static String unescapeHtml4(String html) { Html4Unescape unescape = new Html4Unescape(); return unescape.replace(html).toString(); }
java
public static String unescapeHtml4(String html) { Html4Unescape unescape = new Html4Unescape(); return unescape.replace(html).toString(); }
[ "public", "static", "String", "unescapeHtml4", "(", "String", "html", ")", "{", "Html4Unescape", "unescape", "=", "new", "Html4Unescape", "(", ")", ";", "return", "unescape", ".", "replace", "(", "html", ")", ".", "toString", "(", ")", ";", "}" ]
反转义HTML4中的特殊字符 @param html HTML文本 @return 转义后的文本 @since 4.1.5
[ "反转义HTML4中的特殊字符" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/EscapeUtil.java#L34-L37
train
Unescape HTML 4
[ 30522, 2270, 10763, 5164, 16655, 15782, 5051, 11039, 19968, 2549, 1006, 5164, 16129, 1007, 1063, 16129, 2549, 26639, 19464, 16655, 15782, 5051, 1027, 2047, 16129, 2549, 26639, 19464, 1006, 1007, 1025, 2709, 16655, 15782, 5051, 1012, 5672, 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/core/memory/MemorySegment.java
MemorySegment.putShortBigEndian
public final void putShortBigEndian(int index, short value) { if (LITTLE_ENDIAN) { putShort(index, Short.reverseBytes(value)); } else { putShort(index, value); } }
java
public final void putShortBigEndian(int index, short value) { if (LITTLE_ENDIAN) { putShort(index, Short.reverseBytes(value)); } else { putShort(index, value); } }
[ "public", "final", "void", "putShortBigEndian", "(", "int", "index", ",", "short", "value", ")", "{", "if", "(", "LITTLE_ENDIAN", ")", "{", "putShort", "(", "index", ",", "Short", ".", "reverseBytes", "(", "value", ")", ")", ";", "}", "else", "{", "put...
Writes the given short integer value (16 bit, 2 bytes) to the given position in big-endian byte order. This method's speed depends on the system's native byte order, and it is possibly slower than {@link #putShort(int, short)}. For most cases (such as transient storage in memory or serialization for I/O and network), it suffices to know that the byte order in which the value is written is the same as the one in which it is read, and {@link #putShort(int, short)} is the preferable choice. @param index The position at which the value will be written. @param value The short value to be written. @throws IndexOutOfBoundsException Thrown, if the index is negative, or larger than the segment size minus 2.
[ "Writes", "the", "given", "short", "integer", "value", "(", "16", "bit", "2", "bytes", ")", "to", "the", "given", "position", "in", "big", "-", "endian", "byte", "order", ".", "This", "method", "s", "speed", "depends", "on", "the", "system", "s", "nati...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java#L668-L674
train
Puts a short value into the buffer at the given index in big - endian order.
[ 30522, 2270, 2345, 11675, 8509, 27794, 5638, 6914, 11692, 1006, 20014, 5950, 1010, 2460, 3643, 1007, 1063, 2065, 1006, 2210, 1035, 2203, 2937, 1007, 1063, 8509, 27794, 1006, 5950, 1010, 2460, 1012, 7901, 3762, 4570, 1006, 3643, 1007, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java
ZipUtil.getZipOutputStream
private static ZipOutputStream getZipOutputStream(File zipFile, Charset charset) { return getZipOutputStream(FileUtil.getOutputStream(zipFile), charset); }
java
private static ZipOutputStream getZipOutputStream(File zipFile, Charset charset) { return getZipOutputStream(FileUtil.getOutputStream(zipFile), charset); }
[ "private", "static", "ZipOutputStream", "getZipOutputStream", "(", "File", "zipFile", ",", "Charset", "charset", ")", "{", "return", "getZipOutputStream", "(", "FileUtil", ".", "getOutputStream", "(", "zipFile", ")", ",", "charset", ")", ";", "}" ]
获得 {@link ZipOutputStream} @param zipFile 压缩文件 @param charset 编码 @return {@link ZipOutputStream}
[ "获得", "{", "@link", "ZipOutputStream", "}" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L746-L748
train
Returns a ZipOutputStream for the given file.
[ 30522, 2797, 10763, 14101, 5833, 18780, 21422, 2131, 5831, 6873, 4904, 18780, 21422, 1006, 5371, 14101, 8873, 2571, 1010, 25869, 13462, 25869, 13462, 1007, 1063, 2709, 2131, 5831, 6873, 4904, 18780, 21422, 1006, 5371, 21823, 2140, 1012, 2131,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
java/server/src/org/openqa/selenium/remote/server/log/SessionLogsToFileRepository.java
SessionLogsToFileRepository.createLogFileAndAddToMap
public void createLogFileAndAddToMap(SessionId sessionId) throws IOException { File rcLogFile; // create logFile; rcLogFile = File.createTempFile(sessionId.toString(), ".rclog"); rcLogFile.deleteOnExit(); LogFile logFile = new LogFile(rcLogFile.getAbsolutePath()); sessionToLogFileMap.put(sessionId, logFile); }
java
public void createLogFileAndAddToMap(SessionId sessionId) throws IOException { File rcLogFile; // create logFile; rcLogFile = File.createTempFile(sessionId.toString(), ".rclog"); rcLogFile.deleteOnExit(); LogFile logFile = new LogFile(rcLogFile.getAbsolutePath()); sessionToLogFileMap.put(sessionId, logFile); }
[ "public", "void", "createLogFileAndAddToMap", "(", "SessionId", "sessionId", ")", "throws", "IOException", "{", "File", "rcLogFile", ";", "// create logFile;", "rcLogFile", "=", "File", ".", "createTempFile", "(", "sessionId", ".", "toString", "(", ")", ",", "\".r...
This creates log file object which represents logs in file form. This opens ObjectOutputStream which is used to write logRecords to log file and opens a ObjectInputStream which is used to read logRecords from the file. @param sessionId session-id for the log file entry needs to be created. @throws IOException file i/o exception can occur because of a temp file created
[ "This", "creates", "log", "file", "object", "which", "represents", "logs", "in", "file", "form", ".", "This", "opens", "ObjectOutputStream", "which", "is", "used", "to", "write", "logRecords", "to", "log", "file", "and", "opens", "a", "ObjectInputStream", "whi...
7af172729f17b20269c8ca4ea6f788db48616535
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/selenium/remote/server/log/SessionLogsToFileRepository.java#L49-L56
train
Create a log file and add it to the sessionToLogFileMap.
[ 30522, 2270, 11675, 3443, 21197, 8873, 20898, 14697, 11927, 9626, 2361, 1006, 5219, 3593, 5219, 3593, 1007, 11618, 22834, 10288, 24422, 1063, 5371, 22110, 21197, 8873, 2571, 1025, 1013, 1013, 3443, 8833, 8873, 2571, 1025, 22110, 21197, 8873, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-setting/src/main/java/cn/hutool/setting/AbsSetting.java
AbsSetting.getStrings
public String[] getStrings(String key, String group) { return getStrings(key, group, DEFAULT_DELIMITER); }
java
public String[] getStrings(String key, String group) { return getStrings(key, group, DEFAULT_DELIMITER); }
[ "public", "String", "[", "]", "getStrings", "(", "String", "key", ",", "String", "group", ")", "{", "return", "getStrings", "(", "key", ",", "group", ",", "DEFAULT_DELIMITER", ")", ";", "}" ]
获得数组型 @param key 属性名 @param group 分组名 @return 属性值
[ "获得数组型" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/AbsSetting.java#L124-L126
train
Returns an array of strings from the specified key and group.
[ 30522, 2270, 5164, 1031, 1033, 4152, 18886, 3070, 2015, 1006, 5164, 3145, 1010, 5164, 2177, 1007, 1063, 2709, 4152, 18886, 3070, 2015, 1006, 3145, 1010, 2177, 1010, 12398, 1035, 3972, 27605, 3334, 1007, 1025, 1065, 102, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.get_basic_features
void get_basic_features(final Context ctx, final List<Integer> forms, final List<Integer> postags, final List<Integer> deprels, List<Integer> features) { PUSH(features, FORM(forms, ctx.S0)); PUSH(features, POSTAG(postags, ctx.S0)); PUSH(features, FORM(forms, ctx.S1)); PUSH(features, POSTAG(postags, ctx.S1)); PUSH(features, FORM(forms, ctx.S2)); PUSH(features, POSTAG(postags, ctx.S2)); PUSH(features, FORM(forms, ctx.N0)); PUSH(features, POSTAG(postags, ctx.N0)); PUSH(features, FORM(forms, ctx.N1)); PUSH(features, POSTAG(postags, ctx.N1)); PUSH(features, FORM(forms, ctx.N2)); PUSH(features, POSTAG(postags, ctx.N2)); PUSH(features, FORM(forms, ctx.S0L)); PUSH(features, POSTAG(postags, ctx.S0L)); PUSH(features, DEPREL(deprels, ctx.S0L)); PUSH(features, FORM(forms, ctx.S0R)); PUSH(features, POSTAG(postags, ctx.S0R)); PUSH(features, DEPREL(deprels, ctx.S0R)); PUSH(features, FORM(forms, ctx.S0L2)); PUSH(features, POSTAG(postags, ctx.S0L2)); PUSH(features, DEPREL(deprels, ctx.S0L2)); PUSH(features, FORM(forms, ctx.S0R2)); PUSH(features, POSTAG(postags, ctx.S0R2)); PUSH(features, DEPREL(deprels, ctx.S0R2)); PUSH(features, FORM(forms, ctx.S0LL)); PUSH(features, POSTAG(postags, ctx.S0LL)); PUSH(features, DEPREL(deprels, ctx.S0LL)); PUSH(features, FORM(forms, ctx.S0RR)); PUSH(features, POSTAG(postags, ctx.S0RR)); PUSH(features, DEPREL(deprels, ctx.S0RR)); PUSH(features, FORM(forms, ctx.S1L)); PUSH(features, POSTAG(postags, ctx.S1L)); PUSH(features, DEPREL(deprels, ctx.S1L)); PUSH(features, FORM(forms, ctx.S1R)); PUSH(features, POSTAG(postags, ctx.S1R)); PUSH(features, DEPREL(deprels, ctx.S1R)); PUSH(features, FORM(forms, ctx.S1L2)); PUSH(features, POSTAG(postags, ctx.S1L2)); PUSH(features, DEPREL(deprels, ctx.S1L2)); PUSH(features, FORM(forms, ctx.S1R2)); PUSH(features, POSTAG(postags, ctx.S1R2)); PUSH(features, DEPREL(deprels, ctx.S1R2)); PUSH(features, FORM(forms, ctx.S1LL)); PUSH(features, POSTAG(postags, ctx.S1LL)); PUSH(features, DEPREL(deprels, ctx.S1LL)); PUSH(features, FORM(forms, ctx.S1RR)); PUSH(features, POSTAG(postags, ctx.S1RR)); PUSH(features, DEPREL(deprels, ctx.S1RR)); }
java
void get_basic_features(final Context ctx, final List<Integer> forms, final List<Integer> postags, final List<Integer> deprels, List<Integer> features) { PUSH(features, FORM(forms, ctx.S0)); PUSH(features, POSTAG(postags, ctx.S0)); PUSH(features, FORM(forms, ctx.S1)); PUSH(features, POSTAG(postags, ctx.S1)); PUSH(features, FORM(forms, ctx.S2)); PUSH(features, POSTAG(postags, ctx.S2)); PUSH(features, FORM(forms, ctx.N0)); PUSH(features, POSTAG(postags, ctx.N0)); PUSH(features, FORM(forms, ctx.N1)); PUSH(features, POSTAG(postags, ctx.N1)); PUSH(features, FORM(forms, ctx.N2)); PUSH(features, POSTAG(postags, ctx.N2)); PUSH(features, FORM(forms, ctx.S0L)); PUSH(features, POSTAG(postags, ctx.S0L)); PUSH(features, DEPREL(deprels, ctx.S0L)); PUSH(features, FORM(forms, ctx.S0R)); PUSH(features, POSTAG(postags, ctx.S0R)); PUSH(features, DEPREL(deprels, ctx.S0R)); PUSH(features, FORM(forms, ctx.S0L2)); PUSH(features, POSTAG(postags, ctx.S0L2)); PUSH(features, DEPREL(deprels, ctx.S0L2)); PUSH(features, FORM(forms, ctx.S0R2)); PUSH(features, POSTAG(postags, ctx.S0R2)); PUSH(features, DEPREL(deprels, ctx.S0R2)); PUSH(features, FORM(forms, ctx.S0LL)); PUSH(features, POSTAG(postags, ctx.S0LL)); PUSH(features, DEPREL(deprels, ctx.S0LL)); PUSH(features, FORM(forms, ctx.S0RR)); PUSH(features, POSTAG(postags, ctx.S0RR)); PUSH(features, DEPREL(deprels, ctx.S0RR)); PUSH(features, FORM(forms, ctx.S1L)); PUSH(features, POSTAG(postags, ctx.S1L)); PUSH(features, DEPREL(deprels, ctx.S1L)); PUSH(features, FORM(forms, ctx.S1R)); PUSH(features, POSTAG(postags, ctx.S1R)); PUSH(features, DEPREL(deprels, ctx.S1R)); PUSH(features, FORM(forms, ctx.S1L2)); PUSH(features, POSTAG(postags, ctx.S1L2)); PUSH(features, DEPREL(deprels, ctx.S1L2)); PUSH(features, FORM(forms, ctx.S1R2)); PUSH(features, POSTAG(postags, ctx.S1R2)); PUSH(features, DEPREL(deprels, ctx.S1R2)); PUSH(features, FORM(forms, ctx.S1LL)); PUSH(features, POSTAG(postags, ctx.S1LL)); PUSH(features, DEPREL(deprels, ctx.S1LL)); PUSH(features, FORM(forms, ctx.S1RR)); PUSH(features, POSTAG(postags, ctx.S1RR)); PUSH(features, DEPREL(deprels, ctx.S1RR)); }
[ "void", "get_basic_features", "(", "final", "Context", "ctx", ",", "final", "List", "<", "Integer", ">", "forms", ",", "final", "List", "<", "Integer", ">", "postags", ",", "final", "List", "<", "Integer", ">", "deprels", ",", "List", "<", "Integer", ">"...
获取基本特征 @param ctx 上下文 @param forms 单词 @param postags 词性 @param deprels 依存 @param features 输出特征的储存位置
[ "获取基本特征" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/NeuralNetworkParser.java#L673-L727
train
Get the basic features.
[ 30522, 11675, 2131, 1035, 3937, 1035, 2838, 1006, 2345, 6123, 14931, 2595, 1010, 2345, 2862, 1026, 16109, 1028, 3596, 1010, 2345, 2862, 1026, 16109, 1028, 2695, 26454, 1010, 2345, 2862, 1026, 16109, 1028, 2139, 28139, 4877, 1010, 2862, 1026...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java
ReflectUtil.getConstructor
@SuppressWarnings("unchecked") public static <T> Constructor<T> getConstructor(Class<T> clazz, Class<?>... parameterTypes) { if (null == clazz) { return null; } final Constructor<?>[] constructors = getConstructors(clazz); Class<?>[] pts; for (Constructor<?> constructor : constructors) { pts = constructor.getParameterTypes(); if (ClassUtil.isAllAssignableFrom(pts, parameterTypes)) { // 构造可访问 constructor.setAccessible(true); return (Constructor<T>) constructor; } } return null; }
java
@SuppressWarnings("unchecked") public static <T> Constructor<T> getConstructor(Class<T> clazz, Class<?>... parameterTypes) { if (null == clazz) { return null; } final Constructor<?>[] constructors = getConstructors(clazz); Class<?>[] pts; for (Constructor<?> constructor : constructors) { pts = constructor.getParameterTypes(); if (ClassUtil.isAllAssignableFrom(pts, parameterTypes)) { // 构造可访问 constructor.setAccessible(true); return (Constructor<T>) constructor; } } return null; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "Constructor", "<", "T", ">", "getConstructor", "(", "Class", "<", "T", ">", "clazz", ",", "Class", "<", "?", ">", "...", "parameterTypes", ")", "{", "if", "(", "nul...
查找类中的指定参数的构造方法,如果找到构造方法,会自动设置可访问为true @param <T> 对象类型 @param clazz 类 @param parameterTypes 参数类型,只要任何一个参数是指定参数的父类或接口或相等即可,此参数可以不传 @return 构造方法,如果未找到返回null
[ "查找类中的指定参数的构造方法,如果找到构造方法,会自动设置可访问为true" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L42-L59
train
Gets the first constructor that is assignable from the given parameter types.
[ 30522, 1030, 16081, 9028, 5582, 2015, 1006, 1000, 4895, 5403, 18141, 1000, 1007, 2270, 10763, 1026, 1056, 1028, 9570, 2953, 1026, 1056, 1028, 2131, 8663, 3367, 6820, 16761, 1006, 2465, 1026, 1056, 1028, 18856, 10936, 2480, 1010, 2465, 1026,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java
Launcher.createClassLoader
protected ClassLoader createClassLoader(List<Archive> archives) throws Exception { List<URL> urls = new ArrayList<>(archives.size()); for (Archive archive : archives) { urls.add(archive.getUrl()); } return createClassLoader(urls.toArray(new URL[0])); }
java
protected ClassLoader createClassLoader(List<Archive> archives) throws Exception { List<URL> urls = new ArrayList<>(archives.size()); for (Archive archive : archives) { urls.add(archive.getUrl()); } return createClassLoader(urls.toArray(new URL[0])); }
[ "protected", "ClassLoader", "createClassLoader", "(", "List", "<", "Archive", ">", "archives", ")", "throws", "Exception", "{", "List", "<", "URL", ">", "urls", "=", "new", "ArrayList", "<>", "(", "archives", ".", "size", "(", ")", ")", ";", "for", "(", ...
Create a classloader for the specified archives. @param archives the archives @return the classloader @throws Exception if the classloader cannot be created
[ "Create", "a", "classloader", "for", "the", "specified", "archives", "." ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java#L59-L65
train
Creates a class loader for the given list of archives.
[ 30522, 5123, 2465, 11066, 2121, 3443, 26266, 11066, 2121, 1006, 2862, 1026, 8756, 1028, 8264, 1007, 11618, 6453, 1063, 2862, 1026, 24471, 2140, 1028, 24471, 4877, 1027, 2047, 9140, 9863, 1026, 1028, 1006, 8264, 1012, 2946, 1006, 1007, 1007,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java
ReUtil.extractMultiAndDelPre
public static String extractMultiAndDelPre(String regex, Holder<CharSequence> contentHolder, String template) { if (null == contentHolder || null == regex || null == template) { return null; } // Pattern pattern = Pattern.compile(regex, Pattern.DOTALL); final Pattern pattern = PatternPool.get(regex, Pattern.DOTALL); return extractMultiAndDelPre(pattern, contentHolder, template); }
java
public static String extractMultiAndDelPre(String regex, Holder<CharSequence> contentHolder, String template) { if (null == contentHolder || null == regex || null == template) { return null; } // Pattern pattern = Pattern.compile(regex, Pattern.DOTALL); final Pattern pattern = PatternPool.get(regex, Pattern.DOTALL); return extractMultiAndDelPre(pattern, contentHolder, template); }
[ "public", "static", "String", "extractMultiAndDelPre", "(", "String", "regex", ",", "Holder", "<", "CharSequence", ">", "contentHolder", ",", "String", "template", ")", "{", "if", "(", "null", "==", "contentHolder", "||", "null", "==", "regex", "||", "null", ...
从content中匹配出多个值并根据template生成新的字符串<br> 例如:<br> content 2013年5月 pattern (.*?)年(.*?)月 template: $1-$2 return 2013-5 @param regex 匹配正则字符串 @param contentHolder 被匹配的内容的Holder,value为内容正文,经过这个方法的原文将被去掉匹配之前的内容 @param template 生成内容模板,变量 $1 表示group1的内容,以此类推 @return 按照template拼接后的字符串
[ "从content中匹配出多个值并根据template生成新的字符串<br", ">", "例如:<br", ">", "content", "2013年5月", "pattern", "(", ".", "*", "?", ")", "年", "(", ".", "*", "?", ")", "月", "template:", "$1", "-", "$2", "return", "2013", "-", "5" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L260-L268
train
Extract a multi - and del - pre string from a Holder and a template.
[ 30522, 2270, 10763, 5164, 14817, 12274, 7096, 2937, 14141, 2884, 28139, 1006, 5164, 19723, 10288, 1010, 9111, 1026, 25869, 3366, 4226, 5897, 1028, 4180, 14528, 1010, 5164, 23561, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 4180, 14528, 1064, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/RestServerEndpointConfiguration.java
RestServerEndpointConfiguration.fromConfiguration
public static RestServerEndpointConfiguration fromConfiguration(Configuration config) throws ConfigurationException { Preconditions.checkNotNull(config); final String restAddress = Preconditions.checkNotNull(config.getString(RestOptions.ADDRESS), "%s must be set", RestOptions.ADDRESS.key()); final String restBindAddress = config.getString(RestOptions.BIND_ADDRESS); final String portRangeDefinition = config.getString(RestOptions.BIND_PORT); final SSLHandlerFactory sslHandlerFactory; if (SSLUtils.isRestSSLEnabled(config)) { try { sslHandlerFactory = SSLUtils.createRestServerSSLEngineFactory(config); } catch (Exception e) { throw new ConfigurationException("Failed to initialize SSLEngineFactory for REST server endpoint.", e); } } else { sslHandlerFactory = null; } final Path uploadDir = Paths.get( config.getString(WebOptions.UPLOAD_DIR, config.getString(WebOptions.TMP_DIR)), "flink-web-upload"); final int maxContentLength = config.getInteger(RestOptions.SERVER_MAX_CONTENT_LENGTH); final Map<String, String> responseHeaders = Collections.singletonMap( HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN, config.getString(WebOptions.ACCESS_CONTROL_ALLOW_ORIGIN)); return new RestServerEndpointConfiguration( restAddress, restBindAddress, portRangeDefinition, sslHandlerFactory, uploadDir, maxContentLength, responseHeaders); }
java
public static RestServerEndpointConfiguration fromConfiguration(Configuration config) throws ConfigurationException { Preconditions.checkNotNull(config); final String restAddress = Preconditions.checkNotNull(config.getString(RestOptions.ADDRESS), "%s must be set", RestOptions.ADDRESS.key()); final String restBindAddress = config.getString(RestOptions.BIND_ADDRESS); final String portRangeDefinition = config.getString(RestOptions.BIND_PORT); final SSLHandlerFactory sslHandlerFactory; if (SSLUtils.isRestSSLEnabled(config)) { try { sslHandlerFactory = SSLUtils.createRestServerSSLEngineFactory(config); } catch (Exception e) { throw new ConfigurationException("Failed to initialize SSLEngineFactory for REST server endpoint.", e); } } else { sslHandlerFactory = null; } final Path uploadDir = Paths.get( config.getString(WebOptions.UPLOAD_DIR, config.getString(WebOptions.TMP_DIR)), "flink-web-upload"); final int maxContentLength = config.getInteger(RestOptions.SERVER_MAX_CONTENT_LENGTH); final Map<String, String> responseHeaders = Collections.singletonMap( HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN, config.getString(WebOptions.ACCESS_CONTROL_ALLOW_ORIGIN)); return new RestServerEndpointConfiguration( restAddress, restBindAddress, portRangeDefinition, sslHandlerFactory, uploadDir, maxContentLength, responseHeaders); }
[ "public", "static", "RestServerEndpointConfiguration", "fromConfiguration", "(", "Configuration", "config", ")", "throws", "ConfigurationException", "{", "Preconditions", ".", "checkNotNull", "(", "config", ")", ";", "final", "String", "restAddress", "=", "Preconditions",...
Creates and returns a new {@link RestServerEndpointConfiguration} from the given {@link Configuration}. @param config configuration from which the REST server endpoint configuration should be created from @return REST server endpoint configuration @throws ConfigurationException if SSL was configured incorrectly
[ "Creates", "and", "returns", "a", "new", "{", "@link", "RestServerEndpointConfiguration", "}", "from", "the", "given", "{", "@link", "Configuration", "}", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/RestServerEndpointConfiguration.java#L147-L186
train
Creates a new RestServerEndpointConfiguration from the given configuration.
[ 30522, 2270, 10763, 16626, 2121, 28943, 4859, 8400, 8663, 8873, 27390, 3370, 2013, 8663, 8873, 27390, 3370, 1006, 9563, 9530, 8873, 2290, 1007, 11618, 9563, 10288, 24422, 1063, 3653, 8663, 20562, 2015, 1012, 4638, 17048, 11231, 3363, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/rpc/RpcEndpoint.java
RpcEndpoint.callAsync
protected <V> CompletableFuture<V> callAsync(Callable<V> callable, Time timeout) { return rpcServer.callAsync(callable, timeout); }
java
protected <V> CompletableFuture<V> callAsync(Callable<V> callable, Time timeout) { return rpcServer.callAsync(callable, timeout); }
[ "protected", "<", "V", ">", "CompletableFuture", "<", "V", ">", "callAsync", "(", "Callable", "<", "V", ">", "callable", ",", "Time", "timeout", ")", "{", "return", "rpcServer", ".", "callAsync", "(", "callable", ",", "timeout", ")", ";", "}" ]
Execute the callable in the main thread of the underlying RPC service, returning a future for the result of the callable. If the callable is not completed within the given timeout, then the future will be failed with a {@link TimeoutException}. @param callable Callable to be executed in the main thread of the underlying rpc server @param timeout Timeout for the callable to be completed @param <V> Return type of the callable @return Future for the result of the callable.
[ "Execute", "the", "callable", "in", "the", "main", "thread", "of", "the", "underlying", "RPC", "service", "returning", "a", "future", "for", "the", "result", "of", "the", "callable", ".", "If", "the", "callable", "is", "not", "completed", "within", "the", ...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rpc/RpcEndpoint.java#L299-L301
train
Call a callable asynchronously.
[ 30522, 5123, 1026, 1058, 1028, 4012, 10814, 10880, 11263, 11244, 1026, 1058, 1028, 2655, 3022, 6038, 2278, 1006, 2655, 3085, 1026, 1058, 1028, 2655, 3085, 1010, 2051, 2051, 5833, 1007, 1063, 2709, 1054, 15042, 8043, 6299, 1012, 2655, 3022, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/StreamGraph.java
StreamGraph.addVirtualSelectNode
public void addVirtualSelectNode(Integer originalId, Integer virtualId, List<String> selectedNames) { if (virtualSelectNodes.containsKey(virtualId)) { throw new IllegalStateException("Already has virtual select node with id " + virtualId); } virtualSelectNodes.put(virtualId, new Tuple2<Integer, List<String>>(originalId, selectedNames)); }
java
public void addVirtualSelectNode(Integer originalId, Integer virtualId, List<String> selectedNames) { if (virtualSelectNodes.containsKey(virtualId)) { throw new IllegalStateException("Already has virtual select node with id " + virtualId); } virtualSelectNodes.put(virtualId, new Tuple2<Integer, List<String>>(originalId, selectedNames)); }
[ "public", "void", "addVirtualSelectNode", "(", "Integer", "originalId", ",", "Integer", "virtualId", ",", "List", "<", "String", ">", "selectedNames", ")", "{", "if", "(", "virtualSelectNodes", ".", "containsKey", "(", "virtualId", ")", ")", "{", "throw", "new...
Adds a new virtual node that is used to connect a downstream vertex to only the outputs with the selected names. <p>When adding an edge from the virtual node to a downstream node the connection will be made to the original node, only with the selected names given here. @param originalId ID of the node that should be connected to. @param virtualId ID of the virtual node. @param selectedNames The selected names.
[ "Adds", "a", "new", "virtual", "node", "that", "is", "used", "to", "connect", "a", "downstream", "vertex", "to", "only", "the", "outputs", "with", "the", "selected", "names", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraph.java#L290-L298
train
Add a virtual select node.
[ 30522, 2270, 11675, 5587, 21663, 26302, 4877, 12260, 6593, 3630, 3207, 1006, 16109, 2434, 3593, 1010, 16109, 7484, 3593, 1010, 2862, 1026, 5164, 1028, 3479, 18442, 2015, 1007, 1063, 2065, 1006, 7484, 11246, 22471, 3630, 6155, 1012, 3397, 14...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducer.java
FlinkKafkaProducer.beginTransaction
@Override protected FlinkKafkaProducer.KafkaTransactionState beginTransaction() throws FlinkKafkaException { switch (semantic) { case EXACTLY_ONCE: FlinkKafkaInternalProducer<byte[], byte[]> producer = createTransactionalProducer(); producer.beginTransaction(); return new FlinkKafkaProducer.KafkaTransactionState(producer.getTransactionalId(), producer); case AT_LEAST_ONCE: case NONE: // Do not create new producer on each beginTransaction() if it is not necessary final FlinkKafkaProducer.KafkaTransactionState currentTransaction = currentTransaction(); if (currentTransaction != null && currentTransaction.producer != null) { return new FlinkKafkaProducer.KafkaTransactionState(currentTransaction.producer); } return new FlinkKafkaProducer.KafkaTransactionState(initNonTransactionalProducer(true)); default: throw new UnsupportedOperationException("Not implemented semantic"); } }
java
@Override protected FlinkKafkaProducer.KafkaTransactionState beginTransaction() throws FlinkKafkaException { switch (semantic) { case EXACTLY_ONCE: FlinkKafkaInternalProducer<byte[], byte[]> producer = createTransactionalProducer(); producer.beginTransaction(); return new FlinkKafkaProducer.KafkaTransactionState(producer.getTransactionalId(), producer); case AT_LEAST_ONCE: case NONE: // Do not create new producer on each beginTransaction() if it is not necessary final FlinkKafkaProducer.KafkaTransactionState currentTransaction = currentTransaction(); if (currentTransaction != null && currentTransaction.producer != null) { return new FlinkKafkaProducer.KafkaTransactionState(currentTransaction.producer); } return new FlinkKafkaProducer.KafkaTransactionState(initNonTransactionalProducer(true)); default: throw new UnsupportedOperationException("Not implemented semantic"); } }
[ "@", "Override", "protected", "FlinkKafkaProducer", ".", "KafkaTransactionState", "beginTransaction", "(", ")", "throws", "FlinkKafkaException", "{", "switch", "(", "semantic", ")", "{", "case", "EXACTLY_ONCE", ":", "FlinkKafkaInternalProducer", "<", "byte", "[", "]",...
------------------- Logic for handling checkpoint flushing -------------------------- //
[ "-------------------", "Logic", "for", "handling", "checkpoint", "flushing", "--------------------------", "//" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducer.java#L686-L704
train
Override beginTransaction to create a transactional producer.
[ 30522, 1030, 2058, 15637, 5123, 13109, 19839, 2912, 24316, 9331, 14127, 18796, 2099, 1012, 10556, 24316, 4017, 5521, 3736, 22014, 12259, 4088, 6494, 3619, 18908, 3258, 1006, 1007, 11618, 13109, 19839, 2912, 24316, 6679, 2595, 24422, 1063, 694...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/AbstractHttp2ConnectionHandlerBuilder.java
AbstractHttp2ConnectionHandlerBuilder.connection
protected B connection(Http2Connection connection) { enforceConstraint("connection", "maxReservedStreams", maxReservedStreams); enforceConstraint("connection", "server", isServer); enforceConstraint("connection", "codec", decoder); enforceConstraint("connection", "codec", encoder); this.connection = checkNotNull(connection, "connection"); return self(); }
java
protected B connection(Http2Connection connection) { enforceConstraint("connection", "maxReservedStreams", maxReservedStreams); enforceConstraint("connection", "server", isServer); enforceConstraint("connection", "codec", decoder); enforceConstraint("connection", "codec", encoder); this.connection = checkNotNull(connection, "connection"); return self(); }
[ "protected", "B", "connection", "(", "Http2Connection", "connection", ")", "{", "enforceConstraint", "(", "\"connection\"", ",", "\"maxReservedStreams\"", ",", "maxReservedStreams", ")", ";", "enforceConstraint", "(", "\"connection\"", ",", "\"server\"", ",", "isServer"...
Sets the {@link Http2Connection} to use.
[ "Sets", "the", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/AbstractHttp2ConnectionHandlerBuilder.java#L222-L231
train
Sets the connection.
[ 30522, 5123, 1038, 4434, 1006, 8299, 2475, 8663, 2638, 7542, 4434, 1007, 1063, 16306, 8663, 20528, 18447, 1006, 1000, 4434, 1000, 1010, 1000, 4098, 6072, 25944, 21422, 2015, 1000, 1010, 4098, 6072, 25944, 21422, 2015, 1007, 1025, 16306, 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...
apache/flink
flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java
CliFrontend.run
protected void run(String[] args) throws Exception { LOG.info("Running 'run' command."); final Options commandOptions = CliFrontendParser.getRunCommandOptions(); final Options commandLineOptions = CliFrontendParser.mergeOptions(commandOptions, customCommandLineOptions); final CommandLine commandLine = CliFrontendParser.parse(commandLineOptions, args, true); final RunOptions runOptions = new RunOptions(commandLine); // evaluate help flag if (runOptions.isPrintHelp()) { CliFrontendParser.printHelpForRun(customCommandLines); return; } if (runOptions.getJarFilePath() == null) { throw new CliArgsException("The program JAR file was not specified."); } final PackagedProgram program; try { LOG.info("Building program from JAR file"); program = buildProgram(runOptions); } catch (FileNotFoundException e) { throw new CliArgsException("Could not build the program from JAR file.", e); } final CustomCommandLine<?> customCommandLine = getActiveCustomCommandLine(commandLine); try { runProgram(customCommandLine, commandLine, runOptions, program); } finally { program.deleteExtractedLibraries(); } }
java
protected void run(String[] args) throws Exception { LOG.info("Running 'run' command."); final Options commandOptions = CliFrontendParser.getRunCommandOptions(); final Options commandLineOptions = CliFrontendParser.mergeOptions(commandOptions, customCommandLineOptions); final CommandLine commandLine = CliFrontendParser.parse(commandLineOptions, args, true); final RunOptions runOptions = new RunOptions(commandLine); // evaluate help flag if (runOptions.isPrintHelp()) { CliFrontendParser.printHelpForRun(customCommandLines); return; } if (runOptions.getJarFilePath() == null) { throw new CliArgsException("The program JAR file was not specified."); } final PackagedProgram program; try { LOG.info("Building program from JAR file"); program = buildProgram(runOptions); } catch (FileNotFoundException e) { throw new CliArgsException("Could not build the program from JAR file.", e); } final CustomCommandLine<?> customCommandLine = getActiveCustomCommandLine(commandLine); try { runProgram(customCommandLine, commandLine, runOptions, program); } finally { program.deleteExtractedLibraries(); } }
[ "protected", "void", "run", "(", "String", "[", "]", "args", ")", "throws", "Exception", "{", "LOG", ".", "info", "(", "\"Running 'run' command.\"", ")", ";", "final", "Options", "commandOptions", "=", "CliFrontendParser", ".", "getRunCommandOptions", "(", ")", ...
Executions the run action. @param args Command line arguments for the run action.
[ "Executions", "the", "run", "action", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java#L171-L208
train
Run the command.
[ 30522, 5123, 11675, 2448, 1006, 5164, 1031, 1033, 12098, 5620, 1007, 11618, 6453, 1063, 8833, 1012, 18558, 1006, 1000, 2770, 1005, 2448, 1005, 3094, 1012, 1000, 1007, 1025, 2345, 7047, 15054, 16790, 2015, 1027, 18856, 10128, 4948, 6528, 189...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...