I am testing a web application using Java Remote Method Invocation (RMI). When I am connected to internet through dongle, broadband; it takes very long time for the RMI to r
You problem is not the the address that you use for the lookup call to the RMI Registry, but rather it's the address in the URL that is the result of the call to lookup. This defaults to the IP address of the first interface on the system so my guess is that when you're connected to the Internet it's your external connection.
What I think is happening is that you make a call to the RMI Registry on 127.0.0.1 and this returns your Internet address the location of the service you want, and so your RMI call gets routed out over the dongle interface.
You need to set the java.rmi.server.hostname property to tell the RMI Registry which hostname or IP Adress to return in its RMI URLs.
So you'll need something like:
String ipAddress = "10.1.2.3"; //Local IP address
System.setProperty("java.rmi.server.hostname",ipAddress);
or
String hostname = "myserver"; //hostname that resolves for a local address
System.setProperty("java.rmi.server.hostname",hostname);