public ServerImpl(String ip, String inputfile) throws RemoteException
	{
		servers = new HashMap<Integer, Server>();
		transactionCounter = 0;
		nofAborts = 0;
		// inputfile = "src/given/cases/input_test_case_A_server_"+ 4 + ".txt";
		activeTransaction = null;
		System.out.println(inputfile);
		readGlobalParameters(inputfile);
		resources = new ArrayList<Resource>();
		
		for (int i = 0; i < Globals.NOF_RESOURCES_PER_SERVER; i++)
			resources.add(new Resource());

		try {
			// Find the registry proxy object used to bind non-local objects to the registry:
			registryProxy = (RegistryProxy)Naming.lookup("rmi://" + ip + "/RegistryProxy");
		} catch (NotBoundException nbe) {
			System.out.println("Couldn't find RegistryProxy object in registry. Be sure to use the StartRegistry class to start up your registry.");
			System.exit(1);
		} catch (MalformedURLException mue) {
			System.err.println("Error: Malformed URL; " + mue.getMessage());
			System.exit(1);
		} catch (ConnectException ce) {
			System.err.println("Couldn't connect to the RMI registry. Make sure that a RMI registry is running on the address you specified.");
			System.exit(1);
		}
		// Meet the other servers
		println("Connecting to rmi registry at " + ip);
		// Get the list of all servers registered at the registry
		String[] serverNames = registryProxy.list();
		int maxId = 0;
		// Look them up
		for (String serverName : serverNames) {
			maxId = Math.max(maxId, lookUpServer(serverName));
		}
		// Bind as the next available id
		bindToRegistry(maxId + 1);
		// Notify other servers of our arrival
		for (Server server : servers.values())
			server.newServerConnected(this);
		// Add ourselves to our server list
		servers.put(serverId, this);
		// Open the output file using the append mode
		try {
			startupTime = System.currentTimeMillis();
			output = new PrintWriter(new FileWriter(Globals.OUTPUT_FILE_PREFIX + "_server_" + serverId + ".txt", true));
			output.println("==================================================================");
		} catch (IOException ioe) {
		}
		if (testCase != null)
			println("Test case " + testCase + " started.");
		// Start up the GUI
		gui = new Gui("Server " + serverId, resources, servers, this, (serverId - 1) % 4);
		println("Server " + serverId + " started.");
		if (input != null)
			runTransactions(input);
		else
			runTransactions();
	}