Skip to content

Instantly share code, notes, and snippets.

View vietj's full-sized avatar
🤖
Coding the Future

Julien Viet vietj

🤖
Coding the Future
View GitHub Profile
private static long minusOneIfNotLongMax(long value) {
final long valueMinusOne = value - 1;
final long diffFromValue = value - Long.MAX_VALUE;
final long tmp = (diffFromValue - 1) >> 63;
final long mask = ((diffFromValue >> 63) ^ tmp) & tmp;
return (value & mask) | (valueMinusOne & (~mask));
}
// Basic impl
public class ReadWriteStream implements ReadStream<Buffer>, WriteStream<Buffer> {
private Handler<Buffer> dataHandler;
private Handler<Void> endHandler;
private Handler<Void> drainHandler;
private boolean paused;
@Override
public ReadWriteStream exceptionHandler(Handler<Throwable> handler) {
package mystdeim.vertx_examples.mvn_kotlin_proxy.service
import io.vertx.codegen.annotations.GenIgnore
import io.vertx.codegen.annotations.ProxyGen
import io.vertx.codegen.annotations.VertxGen
import io.vertx.core.AsyncResult
import io.vertx.core.Handler
import io.vertx.core.Vertx
import mystdeim.vertx_examples.mvn_kotlin_proxy.model.Account
import mystdeim.vertx_examples.mvn_kotlin_proxy.service.impl.AccountServiceImpl
[INFO] | +- io.swagger.parser.v3:swagger-parser:jar:2.0.0-rc3:compile
[INFO] | | +- io.swagger.parser.v3:swagger-parser-v2-converter:jar:2.0.0-rc3:compile
[INFO] | | | +- io.swagger:swagger-parser:jar:1.0.34:compile
[INFO] | | | | +- io.swagger:swagger-core:jar:1.5.18:compile
[INFO] | | | | | +- (org.apache.commons:commons-lang3:jar:3.2.1:compile - omitted for conflict with 3.5)
[INFO] | | | | | +- (org.slf4j:slf4j-api:jar:1.7.22:compile - omitted for conflict with 1.7.21)
[INFO] | | | | | +- (com.fasterxml.jackson.core:jackson-annotations:jar:2.9.5:compile - version managed from 2.9.3; omitted for duplicate)
[INFO] | | | | | +- (com.fasterxml.jackson.core:jackson-databind:jar:2.9.5:compile - version managed from 2.9.3; omitted for duplicate)
[INFO] | | | | | +- (com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.9.3:compile - omitted for conflict with 2.9.1)
[INFO] | | | | | +- io.swagger:swagger-models:jar:1.5.18:compile
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.http.HttpClient;
import io.vertx.core.http.HttpServerResponse;
public class Main {
public static void main(String[] args) {
/*
* Copyright 2015 Red Hat, Inc. and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
*/
public class MyList<T> {
private final List<T> list;
public MyList(T elt) {
this(Collections.singletonList(elt));
}
private MyList(List<T> list) {
this.list = list;
[INFO] --- maven-dependency-plugin:3.0.2:tree (default-cli) @ vertx-rx-java ---
[INFO] io.vertx:vertx-rx-java:jar:3.6.0-SNAPSHOT
[INFO] +- io.vertx:vertx-rx-java-codegen:jar:3.6.0-SNAPSHOT:compile
[INFO] | \- io.reactivex:rxjava:jar:1.3.5:compile
[INFO] +- io.vertx:vertx-core:test-jar:tests:3.6.0-SNAPSHOT:test
[INFO] | +- io.netty:netty-common:jar:4.1.19.Final:compile
[INFO] | +- io.netty:netty-buffer:jar:4.1.19.Final:compile
[INFO] | +- io.netty:netty-transport:jar:4.1.19.Final:compile
[INFO] | +- io.netty:netty-handler:jar:4.1.19.Final:compile
[INFO] | | \- io.netty:netty-codec:jar:4.1.19.Final:compile
protected Runnable wrapTask(Handler<Void> hTask, boolean checkThread, PoolMetrics metrics) {
Object metric = metrics != null ? metrics.submitted() : null;
return () -> {
Thread th = Thread.currentThread();
if (!(th instanceof VertxThread)) {
throw new IllegalStateException("Uh oh! Event loop context executing with wrong thread! Expected " + contextThread + " got " + th);
}
VertxThread current = (VertxThread) th;
if (THREAD_CHECKS && checkThread) {
if (contextThread == null) {
@vietj
vietj / hsdis-elcapitan.sh
Created December 3, 2017 06:19 — forked from tinkerware/hsdis-elcapitan.sh
Build hsdis for JDK 1.8u92 on El Capitan
# You will need Mercurial; get it with `brew install hg`.
hg clone http://hg.openjdk.java.net/jdk8u/jdk8u
cd jdk8u
hg update jdk8u92-b14
chmod +x ./get_source.sh; ./get_source.sh
cd hotspot/src/share/tools/hsdis
wget http://ftp.heanet.ie/mirrors/gnu/binutils/binutils-2.26.tar.gz
tar -xzf binutils-2.26.tar.gz
make BINUTILS=binutils-2.26 ARCH=amd64