I hereby claim:
- I am jhalterman on github.
- I am jhalterman (https://keybase.io/jhalterman) on keybase.
- I have a public key whose fingerprint is 43F6 97A7 C494 AD19 CFCA 48F4 489D 4D97 977C 14CE
To claim this, I am signing this object:
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"sort" | |
"time" | |
) | |
// P is a latency variable that has emits a configured duration 99% of the time, |
package net.jodah.cancellablefuture | |
import java.util.concurrent.atomic.AtomicBoolean | |
import scala.concurrent._ | |
import scala.concurrent.duration.Duration | |
import scala.util.{Failure, Success, Try} | |
object CancellableFuture { | |
def apply[T](body: => T)(implicit executor: ExecutionContext): CancellableFuture[T] = new CancellableFuture(body) |
I hereby claim:
To claim this, I am signing this object:
/* | |
Copyright 2012 Viktor Klang | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |
import java.util.Arrays; | |
public class ThreadAwareExceptionTest { | |
static class ThreadAwareThread extends Thread { | |
Throwable entryPoint; | |
ThreadAwareThread(Runnable runnable) { | |
super(runnable); | |
} |
/** | |
* An exponentially weighted moving average implementation that decays based on the elapsed time since the last update, | |
* approximating a time windowed moving average. | |
*/ | |
public class MovingAverage { | |
private final long windowNanos; | |
// Mutable state | |
private volatile long lastNanos; | |
private volatile double average; |
(defn try-until-success | |
"Accepts a try-fn to try a failure-fn to call upon failure, supplying the failure/exception. The try-fn is retried | |
until no failure is thrown." | |
[try-fn failure-fn] | |
(loop [] | |
(if-let [result (try | |
(try-fn) | |
(catch Exception e | |
(failure-fn e) | |
nil))] |
(deftest create-cas-test | |
(let [test (run! | |
(assoc | |
noop-test | |
:name "foundationdb" | |
:os ubuntu/os | |
:db db | |
:client (cas-register) | |
:model (model/cas-register) | |
:checker (checker/compose {:html timeline/html |
:cas (timeout 5000 (assoc op :type :info :value :timed-out) | |
(let [cas (reify Function | |
(apply [this, tr] | |
(let [ | |
[value value'] (:value op) | |
key_var (byte-array (map byte key)) | |
old_value (.getLong (Tuple/fromBytes (.get (.get tr (byte-array (map byte key))))) 0) | |
new_value (.pack (Tuple/from (into-array [value'])))] | |
(if (= old_value value) | |
(do |
# Usage setjdk 1.8 | |
function setjdk() { | |
if [ $# -ne 0 ]; then | |
removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin' | |
if [ -n "${JAVA_HOME+x}" ]; then | |
removeFromPath $JAVA_HOME | |
fi | |
export JAVA_HOME=`/usr/libexec/java_home -v $@` | |
export PATH=$JAVA_HOME/bin:$PATH | |
fi |