Skip to content

Instantly share code, notes, and snippets.

Avatar

William Delanoue twillouer

View GitHub Profile
View RabbitMQ.java
private static final GenericObjectPoolConfig<Channel> GENERIC_OBJECT_POOL_CONFIG = new GenericObjectPoolConfig<>();
static {
// RabbitMQ has channel_max to 2047. https://github.com/rabbitmq/rabbitmq-java-client/issues/366
GENERIC_OBJECT_POOL_CONFIG.setMaxTotal(2_000);
GENERIC_OBJECT_POOL_CONFIG.setMinIdle(2);
GENERIC_OBJECT_POOL_CONFIG.setMaxIdle(10); // Reset long channel
GENERIC_OBJECT_POOL_CONFIG.setMaxWaitMillis(TimeUnit.MINUTES.toMillis(10)); // Avoid too long hung
GENERIC_OBJECT_POOL_CONFIG.setJmxEnabled(false);
}
View ReplaceAll
@Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
@Fork(3)
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@State(Scope.Benchmark)
public class ReplaceAllBench {
@Param({ "10", "100", "1000" })
private int size;
View gist:47d461a35445afe82e27
scala> val log = new ProcessLogger {
| val sb = new StringBuilder
| override def buffer[T](f: => T): T = f
| override def out(s: => String): Unit = sb.append(s)
| override def err(s: => String): Unit = sb.append(s)
| }
log: scala.sys.process.ProcessLogger{val sb: StringBuilder} = $anon$1@41385767
scala> ("yes -y 100" #| "head -c 1").!(log)
res3: Int = 0
View gist:35dbb0512eed7fb3cfa6
00:02:34.309 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.TransientConfigurationResultsBuilder] Flushing resolved configuration data in Binary store in /tmp/gradle6679032435100154231.bin. Wrote root :mockito:unspecified:classpath.
00:02:34.309 [DEBUG] [org.gradle.configuration.project.BuildScriptProcessor] Timing: Running the build script took 1.745 secs
00:02:34.310 [ERROR] [org.gradle.BuildExceptionReporter]
00:02:34.311 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
00:02:34.311 [ERROR] [org.gradle.BuildExceptionReporter]
00:02:34.311 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
00:02:34.312 [ERROR] [org.gradle.BuildExceptionReporter] A problem occurred configuring root project 'mockito'.
00:02:34.312 [ERROR] [org.gradle.BuildExceptionReporter] > Could not resolve all dependencies for configuration ':classpath'.
00:02:34.312 [ERROR] [org.gradle.BuildExceptionReporter] > Could not find any version that matches com
@twillouer
twillouer / ToArrayBench.java
Created Nov 15, 2014
Benchmarking of toArray
View ToArrayBench.java
@State(Scope.Benchmark)
public class ToArrayBench {
ArrayList<Byte> list;
@Setup
public void setup() throws Throwable
{
list = new ArrayList<>();
for (int i = 0; i < 10; i++) {
@twillouer
twillouer / KryoMarshaller.java
Created Jul 26, 2014
Kryo + Guava ImmutableList/ImmutableSet
View KryoMarshaller.java
public static final CollectionSerializer IMMUTABLE_SET_SERIALIZER = new CollectionSerializer() {
public Class elementClass;
public Serializer serializer;
public Class genericType;
@Override
public Collection read(Kryo kryo, Input input, Class<Collection> type)
{
View gist:73e1452ad59b1e7c55f4
<properties>
<isDraftCompile>false</isDraftCompile>
</properties>
[...]
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
You can’t perform that action at this time.