Skip to content

Instantly share code, notes, and snippets.

View jbrisbin's full-sized avatar

Jon Brisbin jbrisbin

View GitHub Profile
@jbrisbin
jbrisbin / gist:2229845
Created March 28, 2012 19:43
Bench test against 128 load-balanced riak_core vnodes serving misultin web requests
> ab -k -c 100 -n 50000 http://localhost:3000/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Completed 5000 requests
Completed 10000 requests
Completed 15000 requests
@jbrisbin
jbrisbin / riak_core_v8.js
Created April 11, 2012 14:44
Test file for V8-based riak_core vnodes
var JSON = require("json");
var core = require("riak_core");
(function() {
exports.handle_command = function(msg) {
return core.reply({
"result": "result value"
});
}
@jbrisbin
jbrisbin / gist:3209024
Created July 30, 2012 18:38
InvocationTargetException stacktrace
java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_31]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_31]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_31]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_31]
at org.springframework.data.rest.webmvc.RepositoryRestController.query(RepositoryRestController.java:573) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_31]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_31]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_31]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_31]
@jbrisbin
jbrisbin / rest_shell_example.txt
Created September 25, 2012 18:34
Sample REST shell interaction
+-( restsh ):> bin/restsh
___ ___ __ _____ __ _ _ _ _ __
| _ \ __/' _/_ _/' _/| || | / / | \ \
| v / _|`._`. | | `._`.| >< | / / / > >
|_|_\___|___/ |_| |___/|_||_| |_/_/ /_/
Welcome to the REST shell. For assistance hit TAB or type "help".
http://localhost:8080:> discover
rel href
@jbrisbin
jbrisbin / rest_shell_1.1.2_example.txt
Created October 22, 2012 15:54
Sample REST shell interaction
> JAVA_OPTS="-DbaseUri=http://localhost:8080/exporter" rest-shell
___ ___ __ _____ __ _ _ _ _ __
| _ \ __/' _/_ _/' _/| || | / / | \ \
| v / _|`._`. | | `._`.| >< | / / / > >
|_|_\___|___/ |_| |___/|_||_| |_/_/ /_/
Welcome to the REST shell. For assistance hit TAB or type "help".
http://localhost:8080:> discover #{env.baseUri}
rel href
@jbrisbin
jbrisbin / gist:4234670
Created December 7, 2012 17:00
New Spring Data REST JavaConfig
public class RestExporterWebInitializer implements WebApplicationInitializer {
@Override public void onStartup(ServletContext servletContext) throws ServletException {
AnnotationConfigWebApplicationContext rootCtx = new AnnotationConfigWebApplicationContext();
rootCtx.register(JpaRepositoryConfig.class, MongoDbRepositoryConfig.class);
servletContext.addListener(new ContextLoaderListener(rootCtx));
AnnotationConfigWebApplicationContext webCtx = new AnnotationConfigWebApplicationContext();
webCtx.register(RestExporterExampleRestConfig.class);
package org.springframework.data.rest.webmvc;
import static java.lang.String.*;
import static java.util.Collections.*;
import static org.springframework.data.rest.core.util.UriUtils.*;
import static org.springframework.data.rest.repository.support.RepositoryUtils.*;
import static org.springframework.util.ReflectionUtils.*;
import java.io.IOException;
import java.net.URI;
@jbrisbin
jbrisbin / gist:5146690
Created March 12, 2013 20:25
Stacktrace of error in DELETE using Spring Data REST + Neo4J
org.neo4j.graphdb.NotInTransactionException
at org.neo4j.kernel.impl.index.IndexConnectionBroker.acquireResourceConnection(IndexConnectionBroker.java:49)
at org.neo4j.index.impl.lucene.LuceneIndex.getConnection(LuceneIndex.java:85)
at org.neo4j.index.impl.lucene.LuceneIndex.remove(LuceneIndex.java:196)
at org.springframework.data.neo4j.support.typerepresentation.AbstractIndexingTypeRepresentationStrategy.remove(AbstractIndexingTypeRepresentationStrategy.java:91)
at org.springframework.data.neo4j.support.typerepresentation.AbstractIndexingTypeRepresentationStrategy.preEntityRemoval(AbstractIndexingTypeRepresentationStrategy.java:86)
at org.springframework.data.neo4j.support.mapping.EntityRemover.removeNode(EntityRemover.java:49)
at org.springframework.data.neo4j.support.mapping.EntityRemover.removeNodeEntity(EntityRemover.java:45)
at org.springframework.data.neo4j.support.mapping.EntityRemover.remove(EntityRemover.java:85)
at org.springframework.data.neo4j.support.Neo4jTemplate.delete(Neo4jTemplate.j
@jbrisbin
jbrisbin / gist:5416187
Created April 18, 2013 21:00
IDEA error compiling Groovy sources
Groovyc: Apr 18, 2013 3:57:44 PM org.codehaus.groovy.runtime.m12n.MetaInfExtensionModule newModule
WARNING: Module [reactor-groovy-module] - Unable to load extension class [reactor.groovy.ext.ObservableExtensions]
Apr 18, 2013 3:57:44 PM org.codehaus.groovy.runtime.m12n.MetaInfExtensionModule newModule
WARNING: Module [reactor-groovy-module] - Unable to load extension class [reactor.groovy.ext.LinkableExtensions]
Apr 18, 2013 3:57:44 PM org.codehaus.groovy.runtime.m12n.MetaInfExtensionModule newModule
WARNING: Module [reactor-groovy-module] - Unable to load extension class [reactor.groovy.ext.PromiseExtensions]
Apr 18, 2013 3:57:44 PM org.codehaus.groovy.runtime.m12n.MetaInfExtensionModule newModule
WARNING: Module [reactor-groovy-module] - Unable to load extension class [reactor.groovy.ext.ReactorStaticExtensions]
java.lang.StackOverflowError
at sun.nio.cs.UTF_8$Decoder.decodeArrayLoop(UTF_8.java:201)
@jbrisbin
jbrisbin / gist:5600246
Last active December 17, 2015 11:09
Example of Riak data support based on Reactor.
// Set a UriTemplateSelector to respond to any events happening on data in the 'test' bucket
riak.on(U("/test/{key}"), (Event ev) -> {
String key = ev.getHeaders().get("key");
boolean isStore = StoreEvent.class.isInstance(ev);
// Only count down on store
if (isStore) {
latch.countDown();
}
});