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
/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/bin/java -ea -DperfReportDir=/Users/michael/netty/microbench/target/reports/performance/ -Didea.launcher.port=7535 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 13.app/bin" -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA 13.app/lib/idea_rt.jar:/Applications/IntelliJ IDEA 13.app/plugins/junit/lib/junit-rt.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/lib/javafx-doclet.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/lib/tools.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/ |
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
private final Queue<Event<CouchbaseRequest>> queue = new ArrayDeque<Event<CouchbaseRequest>>(); | |
final class EventResponseDecoder extends MessageToMessageDecoder<CouchbaseResponse> { | |
@Override | |
protected void decode(ChannelHandlerContext ctx, CouchbaseResponse in, List<Object> out) throws Exception { | |
Event<CouchbaseRequest> event = queue.poll(); | |
((Deferred) event.getReplyTo()).accept(in); | |
} |
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
/** | |
* Helper method to flush the pipeline if possible. | |
* | |
* Hey, I just connected you, | |
* And this is crazy, | |
* But here's my data, | |
* So flush me maybe! | |
* It's hard to read right, | |
* From your channel, | |
* But here's my data, |
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 bench; | |
import java.net.URLEncoder; | |
/** | |
* A new Query implementation trimmed for performance. | |
*/ | |
public class FastQuery { | |
private static final int PARAM_REDUCE_OFFSET = 0; |
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
/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/bin/java -Didea.launcher.port=7545 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 13.app/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/javafx-doclet.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/tools.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/htmlconverter.jar:/Li |
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
int start = 8192; | |
int toFind = 32768; | |
int data[] = new int[] {start, 16384, toFind, 65536}; // 2^13, ^14, ^15, ^16 | |
for (int i = 0; i < 4; i++) { | |
if (start << i == toFind) { | |
System.out.println(i); | |
} | |
} |
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
require 'java' | |
java_import com.couchbase.client.CouchbaseClient | |
java_import java.util.Arrays | |
java_import java.net.URI | |
java_import java.util.concurrent.TimeUnit | |
hosts = Arrays::as_list(URI::create('http://127.0.0.1:8091/pools')) | |
client = CouchbaseClient.new(hosts, 'default', '') |
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.couchbase; | |
import com.couchbase.client.CouchbaseClient; | |
import com.couchbase.client.CouchbaseConnectionFactoryBuilder; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.stereotype.Controller; |
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
// Load 3 Documents and process them one after another | |
// Java 8: | |
Observable | |
.from("doc1", "doc2", "doc3") | |
.flatMap(id -> bucket.get(id)) | |
.subscribe(doc -> System.out.println(doc)); | |
// Java 6 & 7 | |
Observable |
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
final ChannelHandler endpointHandler = new GenericEndpointHandler(this, responseBuffer); | |
bootstrap = new BootstrapAdapter(new Bootstrap() | |
.remoteAddress(hostname, port()) | |
.group(environment.ioPool()) | |
.channel(NioSocketChannel.class) | |
.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) | |
.option(ChannelOption.TCP_NODELAY, false) | |
.handler(new ChannelInitializer<Channel>() { | |
@Override | |
protected void initChannel(Channel channel) throws Exception { |