Skip to content

Instantly share code, notes, and snippets.

View dweiss's full-sized avatar

Dawid Weiss dweiss

View GitHub Profile
@dweiss
dweiss / gist:9703cfa2713a7fc211a0018a72267d90
Created December 19, 2022 18:05
http client buffer repro
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
@dweiss
dweiss / gist:d77452c52daa178e041adce145c2e86a
Created June 8, 2022 19:57
javac and generic type information lost on jdk11
import java.util.Map;
import java.util.concurrent.Callable;
public class Oddball {
public static void main(String[] args) throws Exception {
Callable<Void> r =
() -> {
class Foo1 {
public Map<String, Integer> field;
}
# Compile with javac -Xdoclint:all/protected ...
/**
* Lucene internals or asking for help on <a
* href="mailto:java-user@lucene.apache.org">java-user@lucene.apache.org</a>
*/
public class Breaks {}
/**
* Lucene internals or asking for help on <a
@dweiss
dweiss / Repro.java
Created December 11, 2020 14:39
Repro for IllegalMonitorStateException in ArrayBlockingQueue
import java.util.*;
import java.util.concurrent.*;
import java.util.stream.*;
import java.util.concurrent.atomic.*;
public class Repro {
public static void main(String[] args) throws Exception {
ArrayBlockingQueue<Object> q = new ArrayBlockingQueue<>(1);
ForkJoinPool fj =
@dweiss
dweiss / gist:1561833
Created January 4, 2012 20:09
demuxins streams
// demuxing multithreaded sysout calls? why not ;)
static class PerThreadOutputStream extends OutputStream {
ThreadLocal<ByteArrayOutputStream> baos = new ThreadLocal<ByteArrayOutputStream>();
private PrintStream sink;
public PerThreadOutputStream(PrintStream sink) {
this.sink = sink;
}
@dweiss
dweiss / gist:1539653
Created December 30, 2011 12:35
junit4 instructions
# get the code from my github fork:
git clone git@github.com:dweiss/lucene-solr.git --depth 1 -b junit4
cd lucene-solr/lucene
# Get a baseline for core tests running on trunk/ant macros.
git checkout trunk
ant test-core -Dtestcase=compileonly
# This is a single run and it depends on the seed, but we'll consider
# it a baseline -> write down the execution time or remember it.
ant test-core -Dtests.seed=random