Results 1 to 3 of 3
  1. #1
    danberg's Avatar
    danberg is offline Member
    Join Date
    Apr 2009
    Posts
    2
    Rep Power
    0

    Default RMI Server Randomly Terminating

    Hello,

    I am running the following code:

    Java Code:
    public class StartServer 
    {
    	public static void main(String[] args)
    	{
    		
    		try {
    			Registry registry = LocateRegistry.createRegistry(1099);
    			RMIServerMethods serverStub = (RMIServerMethods) UnicastRemoteObject.exportObject(new Server(), 0);
    			registry.rebind("rmiservermethods", serverStub);
    		} catch (RemoteException e) {
    			e.printStackTrace();
    		}
    		
    	}
    }
    After running this the process will terminate (including all of the threads within it) w/o any exceptions after a random amount of time. This happens about 50-60% of the time which means that it does often work. I have tried to start the rmiregistry separately without any success. Has anyone experienced this issue? If so, are you aware of a fix?

    Thanks!
    Last edited by danberg; 04-26-2009 at 02:12 AM.

  2. #2
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    Why would it not terminate? Once execution reaches the end of main() the application has nothing else to do.
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  3. #3
    danberg's Avatar
    danberg is offline Member
    Join Date
    Apr 2009
    Posts
    2
    Rep Power
    0

    Default

    I was thinking that the createRegistry() method would spawn a thread for the rmiregistry and would force the process to stay alive. In addition when it runs correctly it does block (aka when the client is able to get the stub).
    Last edited by danberg; 04-26-2009 at 11:40 PM.

Similar Threads

  1. terminating the page if user sits idle.
    By shivakumari in forum Java Servlet
    Replies: 9
    Last Post: 04-11-2009, 08:46 AM
  2. forcibly terminating io operations
    By arnab321 in forum CLDC and MIDP
    Replies: 2
    Last Post: 11-15-2008, 09:51 PM
  3. terminating a while loop with a string
    By tkdvipers in forum New To Java
    Replies: 3
    Last Post: 07-10-2007, 12:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •