Skip to content

Instantly share code, notes, and snippets.

@jhalterman
jhalterman / ThreadAwareExceptionTest.java
Last active May 27, 2017 03:54
Experiments in thread aware exceptions
import java.util.Arrays;
public class ThreadAwareExceptionTest {
static class ThreadAwareThread extends Thread {
Throwable entryPoint;
ThreadAwareThread(Runnable runnable) {
super(runnable);
}
@jhalterman
jhalterman / minscalaactors.scala
Created November 15, 2017 03:27 — forked from viktorklang/minscalaactors.scala
Minimalist Scala Actors
/*
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

Keybase proof

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:

@jhalterman
jhalterman / CancellableFuture.scala
Last active January 30, 2022 12:01
A cancellable Scala Future
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)