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
import java.util.*; | |
/** | |
* List implementation that facilitates wrapping an existing list to convert the contents to another type. | |
* | |
* <pre> | |
* List<String> stringList = Arrays.asList("0", "1", "2", "3", "4"); | |
* List<Integer> integerList = new TypeAdaptingList<Integer, String>() { | |
* Integer adapt(String value) { | |
* return Integer.parseInt(value); |
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
import javax.ws.rs.*; | |
import java.io.File; | |
import java.lang.reflect.Method; | |
import java.net.URISyntaxException; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
/** | |
* JAX-RS utility class for locating all JAX-RS resources under a given ClassLoader. |
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
Hi Ryan, | |
You have been identified as a candidate for Amazon or one of its many affiliate companies. As a US Federal Contractor, we are required to request that all candidates complete an on-line application that collects information necessary for Amazon and its affiliates to comply with federal reporting obligations. | |
If you are interested in being considered for an employment opportunity with us, please follow the link below to complete a short application. | |
To access this form, you will need a login name and password. To access your system-generated password, click the link below, then click "Forgot your Login or Password?" link at the bottom of the page. Enter your login name and we will send you an e-mail with a link to reset your password. | |
Your login name is: xxxxxxxxxxxxxxxxxx | |
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
import java.util.concurrent.{TimeUnit, SynchronousQueue} | |
/** | |
* Simple leaky bucket (http://en.wikipedia.org/wiki/Leaky_bucket) implementation using a | |
* SynchronousQueue. | |
* | |
* // This should take roughly 10 seconds to complete. | |
* val bucket = new LeakyBucket(100, TimeUnit.SECONDS) | |
* for (i <- 1 to 1000) { | |
* bucket.take() |
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
# | |
# WTF is java.net.URI thinking? | |
# | |
scala> new URI("http", null, "hostname", 80, "/foo", "bar%20is=baz", null) | |
res5: java.net.URI = http://hostname:80/foo?bar%2520is=baz | |
# | |
# Oh, I see...I have to do this the inconvenient way. | |
# | |
scala> URI.create("http://hostname:80/foo?bar%20is=baz") |
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
/** | |
* Set the duration for which commit point is to be reserved by the deletion policy. | |
* | |
* @param indexVersion version of the commit point to be reserved | |
* @param reserveTime time in milliseconds for which the commit point is to be reserved | |
*/ | |
public void setReserveDuration(Long indexVersion, long reserveTime) { | |
long timeToSet = System.currentTimeMillis() + reserveTime; | |
for(;;) { | |
Long previousTime = reserves.put(indexVersion, timeToSet); |
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
Title: Scalable Application Specific Databases with Berkeley DB Java Edition | |
Short Description (400 chars): In 2011 Yammer replaced a creaking 10B row messaging | |
database with BDB JE. This improved our availability, simplified scaling and lowered | |
delivery latency. I will discuss evaluating whether BDB JE is right for your situation, | |
problems you may run into with along the way and useful patterns for leveraging BDB | |
JE as an embedded solution to building reliable application specific databases at scale. | |
Full Description (a few paragraphs): |
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
import com.sleepycat.je.*; | |
import java.io.File; | |
import java.io.IOException; | |
import java.io.UnsupportedEncodingException; | |
public class NewIndexTest { | |
public static void main(String[] args) throws IOException { | |
File envHome = new File("bdb-temp-dir"); | |
try { |
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.yammer.testvendor; | |
import com.yammer.dropwizard.jersey.JacksonMessageBodyProvider; | |
import com.yammer.dropwizard.json.Json; | |
import javax.ws.rs.Consumes; | |
import javax.ws.rs.Produces; | |
import javax.ws.rs.core.MediaType; | |
import java.lang.annotation.Annotation; | |
import java.lang.reflect.Type; |
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.yammer.runner; | |
import java.io.File; | |
import java.lang.reflect.Method; | |
import java.net.URL; | |
import java.net.URLClassLoader; | |
import java.util.Arrays; | |
import java.util.jar.Attributes; | |
import java.util.jar.JarFile; |
OlderNewer