This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example; | |
import java.util.HashSet; | |
import java.util.LinkedHashMap; | |
import java.util.Set; | |
public class TrieTreeNode { | |
private char ch; | |
private Set<Long> ids = new HashSet<>(); | |
LinkedHashMap<Character, TrieTreeNode> children = new LinkedHashMap<>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example; | |
import java.util.*; | |
import java.util.concurrent.*; | |
/** | |
* Hello world! | |
*/ | |
public class App { | |
static BlockingQueue<Runnable> blockingQueue = new ArrayBlockingQueue<>(200); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.br; | |
import java.lang.reflect.Field; | |
import java.util.HashMap; | |
import java.util.Map; | |
@MyTable("t_table") | |
public class AnnotatedMap<K, V> extends HashMap<K,V> { | |
public AnnotatedMap() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example; | |
import java.io.IOException; | |
import java.net.InetSocketAddress; | |
import java.net.SocketException; | |
import java.nio.ByteBuffer; | |
import java.nio.channels.SelectionKey; | |
import java.nio.channels.Selector; | |
import java.nio.channels.SocketChannel; | |
import java.util.ArrayList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<head> | |
<meta charset="UTF-8"> | |
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> | |
</head> | |
<body> | |
</body> | |
<div id="app"> | |
<textarea v-model="input"> | |
</textarea> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.honey; | |
import java.io.File; | |
import java.io.IOException; | |
import java.net.InetSocketAddress; | |
import java.nio.ByteBuffer; | |
import java.nio.channels.SelectionKey; | |
import java.nio.channels.Selector; | |
import java.nio.channels.SocketChannel; | |
import java.util.ArrayList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.honey; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.concurrent.*; | |
public class ConsumerQueueDemo { | |
public static void main(String[] args) { | |
//making hot spot code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.honey; | |
import javax.crypto.Cipher; | |
import javax.crypto.spec.IvParameterSpec; | |
import javax.crypto.spec.SecretKeySpec; | |
import java.nio.charset.StandardCharsets; | |
import java.util.Base64; | |
import java.util.Random; | |
public class AesDemo { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MultiThreadHashMap { | |
private static final Object PRESENT = new Object(); | |
public static void main(String[] args) throws InterruptedException, BrokenBarrierException { | |
final Map<String,Object> map = new HashMap<>(); //let map do resize multiple times | |
int N = 1000; | |
final CyclicBarrier cyclicBarrier = new CyclicBarrier(N+1); | |
for (int i = 0; i < N; i++) { | |
new Thread(new Runnable() { | |
@Override | |
public void run() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dump script from http://dubbo.apache.org/zh-cn/docs/dev/principals/dummy.html | |
JAVA_HOME=/usr/java | |
OUTPUT_HOME=~/output | |
DEPLOY_HOME=`dirname $0` | |
HOST_NAME=`hostname` | |
DUMP_PIDS=`ps --no-heading -C java -f --width 1000 | grep "$DEPLOY_HOME" |awk '{print $2}'` | |
if [ -z "$DUMP_PIDS" ]; then | |
echo "The server $HOST_NAME is not started!" |
NewerOlder