Buggy code:
public class SimpleRuntime < P extends Protocol > extends Runtime < P > implements AcceptConnectionHandler { private ReentrantLock lock = new ReentrantLock ( ) ; public static int DEFAULT_INTERVAL = 1500 ; private static long LOCK_WAIT_MS = SimpleRuntime . DEFAULT_INTERVAL ; public static long DEFAULT_RANDOM_SEED = 0L ; public Address address ; protected SimpleRuntime ( Address address ) { } public static < T extends Protocol > Runtime < T > launch ( final T pinstance , final Address address , final boolean daemon ) { } public static < T extends Protocol > Runtime < T > launchDaemon ( final T pinstance , final Address address ) { } private P pinstance ; @ Override public void acceptConnection ( Address recipient , Connection connection ) throws IOException { } private boolean running = true ; @ Override public void run ( P pinstance , Address address , int intervalMS , long randomSeed ) throws InterruptedException { super . run ( pinstance , address , intervalMS , randomSeed ) ; runtimeState . setAddress ( address ) ; runtimeState . setRandom ( new Random ( randomSeed ) ) ; setProtocolInstance ( pinstance ) ; try { address . bind ( this ) ; } catch ( IOException e1 ) { SimpleRuntime . punt ( e1 ) ; } long lastElapsedMS = 0L ; Random rng = new Random ( randomSeed ) ; ( ( BaseProtocol ) ( pinstance ) ) . logstate ( ) ; while ( running ) { double rate = getRate ( getProtocolInstance ( ) ) ; ( ( BaseProtocol ) ( getProtocolInstance ( ) ) ) . log ( "rate,%g" , rate ) ; int intervalLength = ( ( int ) ( ( ( double ) ( intervalMS ) ) // rate ) ) ; if ( intervalLength <= 0 ) { System . err . printf ( "%s<seq2seq4repair_space>error:<seq2seq4repair_space>Rate<seq2seq4repair_space>*<seq2seq4repair_space>intervalMS<seq2seq4repair_space><=<seq2seq4repair_space>0.<seq2seq4repair_space>Resetting<seq2seq4repair_space>to<seq2seq4repair_space>default.\n" , this ) ; intervalLength = intervalMS ; } Thread . sleep ( Math . max ( 0L , ( intervalLength - lastElapsedMS ) ) ) ; if ( ! ( running ) ) break ; long startTime = getTimeMS ( ) ; Connection connection = null ; Address partner = null ; try { if ( lock . tryLock ( SimpleRuntime . LOCK_WAIT_MS , TimeUnit . MILLISECONDS ) ) { <START_BUG> partner = compile ( getProtocolInstance ( ) ) . select ( this , pinstance , rng . nextDouble ( ) ) ; <END_BUG> debug . printf ( "%s<seq2seq4repair_space>select<seq2seq4repair_space>%s\n" , this , partner ) ; ( ( BaseProtocol ) ( getProtocolInstance ( ) ) ) . log ( "select,%s" , partner ) ; if ( partner == null ) { lock . unlock ( ) ; continue ; } connection = partner . openConnection ( ) ; if ( ! ( running ) ) break ; compile ( getProtocolInstance ( ) ) . gossip ( this , getProtocolInstance ( ) , connection ) ; lock . unlock ( ) ; } else { debug . printf ( "%s<seq2seq4repair_space>active<seq2seq4repair_space>lock<seq2seq4repair_space>fail<seq2seq4repair_space>on<seq2seq4repair_space>init<seq2seq4repair_space>gossip<seq2seq4repair_space>[already<seq2seq4repair_space>engaged<seq2seq4repair_space>in<seq2seq4repair_space>gossip?]\n" , this ) ; ( ( BaseProtocol ) ( getProtocolInstance ( ) ) ) . log ( "lockfail-active" ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } lastElapsedMS = ( getTimeMS ( ) ) - startTime ; } } @ Override public String toString ( ) { } private long getTimeMS ( ) { } @ Override public void stop ( ) { } @ Override public P getProtocolInstance ( ) { } @ Override public void setProtocolInstance ( P pinstance ) { } @ Override public Address getAddress ( ) { } private WeakHashSet < Object > foreignObjects = null ; private RuntimeState foreignState = null ; protected void setForeignState ( WeakHashSet < Object > foreignObjects , RuntimeState foreignState ) { } protected void clearForeignState ( ) { } private RuntimeState runtimeState = new RuntimeState ( ) ; @ Override public RuntimeState getRuntimeState ( Protocol p ) { } @ Override public RuntimeState getRuntimeState ( ) { } @ Override public Distribution < Address > getSelectDistribution ( Protocol protocol ) { } @ Override public double getRate ( Protocol protocol ) { } @ Override public void executeUpdate ( Protocol p1 , Protocol p2 ) { } private Compiler compiler = new SimpleCompiler ( ) ; @ Override public < T extends Protocol > RuntimeAgent < T > compile ( T pinstance ) { } No newline ; at end ; of file ; }

Fix:
partner = compile ( getProtocolInstance ( ) ) . select ( this , getProtocolInstance ( ) , rng . nextDouble ( ) ) ;