How to trnsfer Control from a infinite loop method to a different method, and to take back control back to infinite loop method?
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import org.openrtk.idl.epprtk.epp_Command;
    import org.openrtk.idl.epprtk.epp_Exception;
    import org.openrtk.idl.epprtk.epp_Greeting;
    import org.openrtk.idl.epprtk.epp_Response;
    import org.openrtk.idl.epprtk.epp_Result;
    import org.openrtk.idl.epprtk.epp_XMLException;
    import org.openrtk.idl.epprtk.contact.epp_ContactInfoReq;
    import org.openrtk.idl.epprtk.contact.epp_ContactInfoRsp;
    import com.tucows.oxrs.epprtk.rtk.EPPClient;
    import com.tucows.oxrs.epprtk.rtk.transport.EPPTransportException;
    import com.tucows.oxrs.epprtk.rtk.xml.EPPContactInfo;
    public class ClientTest  {
    	static EPPClient my_client;
    	static int timeout = 1000*60;
    	static epp_Greeting greeting;
    	static String epp_host_name = "hjkhjt";
    	static int epp_host_port = 66;
    	static String epp_client_id = "ghg";
    	static String epp_password = "jyghgh";
    	//Creating EPP Client
    	public static EPPClient getClient()
    	{
    		try
    		{
    			my_client = new EPPClient(epp_host_name, epp_host_port, epp_client_id, epp_password);
    			my_client.setEPPTimeout(timeout);
    			my_client.setLang("en-US");
    			greeting = my_client.connectAndGetGreeting();
    			//my_client.login(epp_client_id,epp_password);
    			if(greeting != null)
    			{
    				System.out.println("Greeting Recieved");
    			}
    			else
    			{
    				System.out.println("No Greeting Receieved");
    			}
    		}
    		catch ( Exception xcp )
    		{
    			System.err.println("Exception! ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]");
    			xcp.printStackTrace();
    		}
    
    		return my_client;
    	}
    	public static EPPClient useClient(int x)
    	{
    		EPPClient client = getClient();
    		if(x==1)
    		{
    			int i;
    			System.out.println("Hold Client Alive");
    			for(i=5;i>0;i++)
    			{
    				try
    				{
    					client.hello();
    					greeting = client.connectAndGetGreeting();
    					Thread.sleep(1000*60);  // 1 Min delay
    				}
    				catch (InterruptedException ie)
    				{
    					System.out.println(ie.getMessage());
    				} catch (epp_Exception e) {
    					e.printStackTrace();
    				} catch (epp_XMLException e) {
    					e.printStackTrace();
    				} catch (IOException e) {
    					e.printStackTrace();
    				} catch (EPPTransportException e) {
    					e.printStackTrace();
    				}
    				if(my_client != null)
    				{System.out.println("Client Alive");}
    			}
    		}
    		if(x==2)
    			System.out.println("Returning EPP Client");
    		return client;
    
    	}
    	public static void  contactInfo(EPPClient xy)//2.3.4 
    	{
    		try
    		{
    			xy.login(epp_client_id,epp_password);
    			epp_Command command_data ;
    			System.out.println(" EPP Contact INFO command");
    			String default_contact_id = "OTE-C5";
    			epp_ContactInfoReq contact_info_request = new epp_ContactInfoReq();
    			command_data = new epp_Command();
    			command_data.m_client_trid = getClientTrid(epp_client_id);
    			contact_info_request.m_cmd = command_data;
    			contact_info_request.m_id = default_contact_id;
    			EPPContactInfo contact_info = new EPPContactInfo();
    			contact_info.setRequestData(contact_info_request);
    			contact_info = (EPPContactInfo) xy.processAction(contact_info);
    			epp_ContactInfoRsp contact_info_response = contact_info.getResponseData();
    			epp_Response response = contact_info_response.m_rsp;
    			if(response != null)
    			{
    				epp_Result[] results = response.m_results;
    				//    				epp_AuthInfo contact_auth_info = contact_info_response.m_auth_info;
    				System.out.println("ContactInfo results: ["+results[0].m_code+"] ["+results[0].m_msg+"]");
    				System.out.println("             Contact ID: ["+contact_info_response.m_id+"]");
    				System.out.println("             Contact Name: ["+contact_info_response.m_addresses[0].m_name+"]");
    				System.out.println("             Contact Organization: ["+contact_info_response.m_addresses[0].m_org+"]");
    				System.out.println("             Contact Address Street1: ["+contact_info_response.m_addresses[0].m_address.m_street1+"]");
    				System.out.println("             Contact Address Street2: ["+contact_info_response.m_addresses[0].m_address.m_street2+"]");
    				System.out.println("             Contact Address City: ["+contact_info_response.m_addresses[0].m_address.m_city+"]");
    				System.out.println("             Contact Address State/Province: ["+contact_info_response.m_addresses[0].m_address.m_state_province+"]");
    				System.out.println("             Contact Address Postal Code: ["+contact_info_response.m_addresses[0].m_address.m_postal_code+"]");
    				System.out.println("             Contact Address Country: ["+contact_info_response.m_addresses[0].m_address.m_country_code+"]");
    				System.out.println("             Contact Voice: ["+contact_info_response.m_voice.m_value+"]");
    				System.out.println("			 Contact Voice Extension: ["+contact_info_response.m_voice.m_extension+"]");//extension)
    				System.out.println("             Fax: ["+contact_info_response.m_fax.m_value+":"+contact_info_response.m_fax.m_extension+"]");
    				System.out.println("             Contact EMail: ["+contact_info_response.m_email+"]");
    				System.out.println("             Auth INFO: ["+contact_info_response.m_auth_info+"]");
    				System.out.println("End of the EPP Contact Info command");
    				System.out.println();
    				System.out.println("****************"); System.out.println();
    			}
    			else
    			{
    				System.out.println("No Response For ontact INFO command");
    			}
    		}
    		catch(epp_XMLException xcp)
    		{
    			System.err.println("epp_XMLException! ["+xcp.m_error_message+"]");
    		}
    		catch ( epp_Exception xcp )
    		{
    			System.err.println("epp_Exception!");
    			epp_Result[] results = xcp.m_details;
    			System.err.println("\tresults: "+results[0]+"]");
    		}
    		catch ( Exception xcp )
    		{
    			System.err.println("Contact Info failed! ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]");
    			xcp.printStackTrace();
    		}  
    
    	} 
    	protected static String getClientTrid(String epp_client_id)
    	{
    		return "ABC:"+epp_client_id+":"+System.currentTimeMillis();
    	}
    	public static void main (String []args)
    	{
    		System.out.println("Enter your Choice '1'- Hold '2'- Execute Command ");	
    		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    		int choice =0;
    		try {
    			choice =Integer.parseInt( br.readLine());
    		} catch (IOException ioe) {
    			System.out.println("IO error !");
    			System.exit(1);
    		}
    		useClient(choice); 
    		EPPClient y = useClient(choice);
    		contactInfo(y);
    	}
    }


How to trnsfer Control from a infinite loop method to a different method, and to take back control back to infinite loop method?
===

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import org.openrtk.idl.epprtk.epp_Command;
    import org.openrtk.idl.epprtk.epp_Exception;
    import org.openrtk.idl.epprtk.epp_Greeting;
    import org.openrtk.idl.epprtk.epp_Response;
    import org.openrtk.idl.epprtk.epp_Result;
    import org.openrtk.idl.epprtk.epp_XMLException;
    import org.openrtk.idl.epprtk.contact.epp_ContactInfoReq;
    import org.openrtk.idl.epprtk.contact.epp_ContactInfoRsp;
    import com.tucows.oxrs.epprtk.rtk.EPPClient;
    import com.tucows.oxrs.epprtk.rtk.transport.EPPTransportException;
    import com.tucows.oxrs.epprtk.rtk.xml.EPPContactInfo;
    public class ClientTest  {
    	static EPPClient my_client;
    	static int timeout = 1000*60;
    	static epp_Greeting greeting;
    	static String epp_host_name = "hjkhjt";
    	static int epp_host_port = 66;
    	static String epp_client_id = "ghg";
    	static String epp_password = "jyghgh";
    	//Creating EPP Client
    	public static EPPClient getClient()
    	{
    		try
    		{
    			my_client = new EPPClient(epp_host_name, epp_host_port, epp_client_id, epp_password);
    			my_client.setEPPTimeout(timeout);
    			my_client.setLang("en-US");
    			greeting = my_client.connectAndGetGreeting();
    			//my_client.login(epp_client_id,epp_password);
    			if(greeting != null)
    			{
    				System.out.println("Greeting Recieved");
    			}
    			else
    			{
    				System.out.println("No Greeting Receieved");
    			}
    		}
    		catch ( Exception xcp )
    		{
    			System.err.println("Exception! ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]");
    			xcp.printStackTrace();
    		}
    
    		return my_client;
    	}
    	public static EPPClient useClient(int x)
    	{
    		EPPClient client = getClient();
    		if(x==1)
    		{
    			int i;
    			System.out.println("Hold Client Alive");
    			for(i=5;i>0;i++)
    			{
    				try
    				{
    					client.hello();
    					greeting = client.connectAndGetGreeting();
    					Thread.sleep(1000*60);  // 1 Min delay
    				}
    				catch (InterruptedException ie)
    				{
    					System.out.println(ie.getMessage());
    				} catch (epp_Exception e) {
    					e.printStackTrace();
    				} catch (epp_XMLException e) {
    					e.printStackTrace();
    				} catch (IOException e) {
    					e.printStackTrace();
    				} catch (EPPTransportException e) {
    					e.printStackTrace();
    				}
    				if(my_client != null)
    				{System.out.println("Client Alive");}
    			}
    		}
    		if(x==2)
    			System.out.println("Returning EPP Client");
    		return client;
    
    	}
    	public static void  contactInfo(EPPClient xy)//2.3.4 
    	{
    		try
    		{
    			xy.login(epp_client_id,epp_password);
    			epp_Command command_data ;
    			System.out.println(" EPP Contact INFO command");
    			String default_contact_id = "OTE-C5";
    			epp_ContactInfoReq contact_info_request = new epp_ContactInfoReq();
    			command_data = new epp_Command();
    			command_data.m_client_trid = getClientTrid(epp_client_id);
    			contact_info_request.m_cmd = command_data;
    			contact_info_request.m_id = default_contact_id;
    			EPPContactInfo contact_info = new EPPContactInfo();
    			contact_info.setRequestData(contact_info_request);
    			contact_info = (EPPContactInfo) xy.processAction(contact_info);
    			epp_ContactInfoRsp contact_info_response = contact_info.getResponseData();
    			epp_Response response = contact_info_response.m_rsp;
    			if(response != null)
    			{
    				epp_Result[] results = response.m_results;
    				//    				epp_AuthInfo contact_auth_info = contact_info_response.m_auth_info;
    				System.out.println("ContactInfo results: ["+results[0].m_code+"] ["+results[0].m_msg+"]");
    				System.out.println("             Contact ID: ["+contact_info_response.m_id+"]");
    				System.out.println("             Contact Name: ["+contact_info_response.m_addresses[0].m_name+"]");
    				System.out.println("             Contact Organization: ["+contact_info_response.m_addresses[0].m_org+"]");
    				System.out.println("             Contact Address Street1: ["+contact_info_response.m_addresses[0].m_address.m_street1+"]");
    				System.out.println("             Contact Address Street2: ["+contact_info_response.m_addresses[0].m_address.m_street2+"]");
    				System.out.println("             Contact Address City: ["+contact_info_response.m_addresses[0].m_address.m_city+"]");
    				System.out.println("             Contact Address State/Province: ["+contact_info_response.m_addresses[0].m_address.m_state_province+"]");
    				System.out.println("             Contact Address Postal Code: ["+contact_info_response.m_addresses[0].m_address.m_postal_code+"]");
    				System.out.println("             Contact Address Country: ["+contact_info_response.m_addresses[0].m_address.m_country_code+"]");
    				System.out.println("             Contact Voice: ["+contact_info_response.m_voice.m_value+"]");
    				System.out.println("			 Contact Voice Extension: ["+contact_info_response.m_voice.m_extension+"]");//extension)
    				System.out.println("             Fax: ["+contact_info_response.m_fax.m_value+":"+contact_info_response.m_fax.m_extension+"]");
    				System.out.println("             Contact EMail: ["+contact_info_response.m_email+"]");
    				System.out.println("             Auth INFO: ["+contact_info_response.m_auth_info+"]");
    				System.out.println("End of the EPP Contact Info command");
    				System.out.println();
    				System.out.println("****************"); System.out.println();
    			}
    			else
    			{
    				System.out.println("No Response For ontact INFO command");
    			}
    		}
    		catch(epp_XMLException xcp)
    		{
    			System.err.println("epp_XMLException! ["+xcp.m_error_message+"]");
    		}
    		catch ( epp_Exception xcp )
    		{
    			System.err.println("epp_Exception!");
    			epp_Result[] results = xcp.m_details;
    			System.err.println("\tresults: "+results[0]+"]");
    		}
    		catch ( Exception xcp )
    		{
    			System.err.println("Contact Info failed! ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]");
    			xcp.printStackTrace();
    		}  
    
    	} 
    	protected static String getClientTrid(String epp_client_id)
    	{
    		return "ABC:"+epp_client_id+":"+System.currentTimeMillis();
    	}
    	public static void main (String []args)
    	{
    		System.out.println("Enter your Choice '1'- Hold '2'- Execute Command ");	
    		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    		int choice =0;
    		try {
    			choice =Integer.parseInt( br.readLine());
    		} catch (IOException ioe) {
    			System.out.println("IO error !");
    			System.exit(1);
    		}
    		useClient(choice); 
    		EPPClient y = useClient(choice);
    		contactInfo(y);
    	}
    }

