 package primes.bramble;

import java.io.Serializable;
import java.util.ArrayList;

import primes.PrimeGenerator;
import bramble.node.slave.ISlaveNodeRunner;
import bramble.node.slave.SlaveNode;

/**
 * This is an example of how a SlaveNode can be run.
 * 
 * This class is responsible for passing a job from the 
 * API to a class that will accept a job.
 * 
 * @author Tom
 *
 */
public class SlaveNodeRunner implements ISlaveNodeRunner{
	
	private static String IPADDR;
	
	@SuppressWarnings("unused")
	public static void main(String[] args){	
		
		if(args.length != 1){
			System.out.println("Didn't find an IP on the command line, exiting");
			System.exit(1);
		} else {
			IPADDR = args[0];
			System.out.println("Slave node initiated, my IP is " + IPADDR);
		}
		
		new SlaveNodeRunner();
	}
	
	public SlaveNodeRunner(){
		(new SlaveNode<>(IPADDR, this)).listenForever();
	}

	@Override
	public void runJob(int jobID, ArrayList<Serializable> initializationData) {	
		//System.out.print("[" + jobID + "] ");
		PrimeGenerator primeGenerator = new PrimeGenerator(IPADDR, jobID, initializationData);
		primeGenerator.run();
	}

}

@@ -448,22 +448,21 @@
 ate 
-static
+final
  String 
 IPAD
@@ -461,46 +461,20 @@
 ing 
-IPADDR;%0A%09%0A%09@SuppressWarnings(%22unused%22)
+ipAddress;%0A%09
 %0A%09pu
@@ -510,17 +510,16 @@
 %5D args)%7B
-%09
 %0A%09%09%0A%09%09if
@@ -618,44 +618,41 @@
 %0A%09%09%09
-System.exit(1);%0A%09%09%7D else %7B%0A%09%09%09IPADDR
+return;%0A%09%09%7D%0A%09%09%0A%09%09String ipAddress
  = a
@@ -659,17 +659,16 @@
 rgs%5B0%5D;%0A
-%09
 %09%09System
@@ -720,26 +720,23 @@
 %22 + 
-IPADDR);%0A%09%09%7D%0A%09%09%0A%09%09
+ipAddress);%0A%09%09(
 new 
@@ -751,16 +751,39 @@
 eRunner(
+ipAddress)).initialize(
 );%0A%09%7D%0A%09%0A
@@ -806,16 +806,94 @@
 eRunner(
+String ipAddress)%7B%0A%09%09this.ipAddress = ipAddress;%0A%09%7D%0A%09%0A%09public void initialize(
 )%7B%0A%09%09(ne
@@ -906,22 +906,30 @@
 eNode%3C%3E(
-IPADDR
+this.ipAddress
 , this))
@@ -1138,14 +1138,22 @@
 tor(
-IPADDR
+this.ipAddress
 , jo

Refactor static variables out of slave node runner