public static void main(String[] args){
		if(args.length != 3){
			System.out.println("args: id of this server, ip address of another server, ip address of database");
			return;
		}
		Server server = null;
		try {
			server = new Server(Integer.parseInt(args[0]), "rmi://"+args[2]+":10001/db");
			//register server to port 10001
			LocateRegistry.createRegistry(10001);
			//bind server object to a rmi address
			Naming.bind("rmi://localhost:10001/server", server);		
			System.out.println("start server " + server.id);
			Thread.sleep(5000);
			server2 = (IConnection) Naming.lookup("rmi://"+args[1]+":10001/server");
			server.leaderElection();
			
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (AlreadyBoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (NotBoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}