Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am somethingnew2-0 on github.
  • I am petercollins (https://keybase.io/petercollins) on keybase.
  • I have a public key ASCRqlDsMJx9stSZY6-hNlCY1CydkxvFnjyy3caJshbHMwo

To claim this, I am signing this object:

@somethingnew2-0
somethingnew2-0 / Singleton.java
Last active December 30, 2015 03:49
A kernel programmer's singleton
import java.util.concurrent.locks.ReentrantLock;
public class Singleton implements Runnable {
private static Singleton INSTANCE;
private static ReentrantLock LOCK = new ReentrantLock();
private Singleton() { }
public Singleton getInstance() {
new Thread(this).run();