Skip to content

Instantly share code, notes, and snippets.

Avatar

Tyler Treat tylertreat-wf

View GitHub Profile
View ThreadPoolTest.java
import java.util.concurrent.*;
public class ThreadPoolTest {
public static void main(String[] args) {
BlockingQueue<Runnable> queue = new SynchronousQueue<>();
ExecutorService threadPool = new LoggingThreadPoolExecutor(1, 10, 30, TimeUnit.SECONDS, queue, new BlockingRejectedExecutionHandler());
for (int i = 0; i < 1000; i++) {
threadPool.submit(() -> {
View ThreadPoolTest.java
import java.util.concurrent.*;
public class ThreadPoolTest {
public static void main(String[] args) {
BlockingQueue<Runnable> queue = new ArrayBlockingQueue<>(64);
ExecutorService threadPool = new LoggingThreadPoolExecutor(1, 10, 30, TimeUnit.SECONDS, queue);
for (int i = 0; i < 1000; i++) {
threadPool.submit(() -> {
View NatsTimeout.java
public class Main {
public static void main(String[] args) throws Exception {
ConnectionFactory cf = new ConnectionFactory(Constants.DEFAULT_URL);
final Connection conn = cf.createConnection();
conn.subscribe("foo", new MessageHandler() {
@Override
public void onMessage(Message message) {
conn.publish("bar", "hello".getBytes());
}
View ctrie_bench.go
func BenchmarkInsertMulti(b *testing.B) {
ctrie := New(nil)
b.ResetTimer()
for i := 0; i < b.N; i++ {
for j := 0; j < 1000000; j++ {
ctrie.Insert([]byte(strconv.Itoa(j)), 0)
}
}
}
View gae_rest.go
package goplus
import (
"fmt"
"math/rand"
"net/http"
"strconv"
"github.com/Workiva/go-rest/rest"
)
View bower.json
{
"name": "w-message-client",
"version": "0.0.1",
"dependencies": {
"sockjs-client": "~0.3.4",
"requirejs": "~2.1.15"
}
}
View main.go
package main
import (
"time"
"github.com/tylertreat-wf/vessel/vessel"
)
func main() {
vessel := vessel.NewSockJSVessel("/vessel")