RMI server ending

P

Pete

I have noticed a problem where if I run my server locally on my PC
the server seems to run forever. This is the command I use locally:

java -Djava.rmi.server.logCalls=true
-Djava.rmi.server.disableHttp=true -cp c:\radical ecomm/eCommServer

If I restart it with the command like:

java -Djava.rmi.server.logCalls=true
-Djava.rmi.server.disableHttp=true -Djava.rmi.server.hostname=x.x.x.x
-cp c:\radical ecomm/eCommServer

It runs fine, but 5 minutes after there is no activity, the server
ends without producing any errors or any messages.

If I start it with the following command:

java -Djava.rmi.server.logCalls=true -Djava.rmi.dgc.leaseValue=9000000
-Djava.rmi.server.disableHttp=true -Djava.rmi.server.hostname=x.x.x.x
-cp c:\radical ecomm/eCommServer

It runs fine also, but 2.5 hours after the last activity from my
client, it ends the same way.

I know I am misunderstanding what I'm doing, but I need help in
determining what I need to do to make this run basically forever
unless I want to stop it.

My understanding was that it is a server process and it should run
forever. I don't understand what is different between when I run it
locally and when I run it attached to the Internet.

Can anyone shed some light on this?

Thanks!
 
E

EJP

It only runs until it is garbage-collected. It will be GC'd when (1)
there are no remote references (e.g. a remote client or the Registry),
at which point DGC will kick in to expire the lease, and (2) there are
no local references, at which local GC will kick in, which unexports the
object. You could retain a local reference to the server object to stop
it being GC'd locally, or you could bind it to a Registry which will act
as a remote client of infinite duration.

EJP
 
P

Pete

I had been doing a:

java.rmi.registry.LocateRegistry.createRegistry(nPort);

to save the step of starting the rmiregistry. On a tip from a
colleage I have changed it back to not call that command which
forces me to:

start rmiregistry
then start my server

But 15 minutes after the last activity, my server ends.

The window with the rmiregistry is still loaded. I can go to my
remote client and try connecting back, but since my server has
ended, there is no communications, even though the rmiregistry
is still loaded.

I have purchased the Java.rmi book and received it today to look
at what I am doing differently compared to the examples. I have
tried the calculator example from Sun locally and it works just
like my server, it stays running while loaded internally (intranet).
I have not tried to load to be accessed from the internet to see its
behaviour.

Any other suggestions?

Thanks.
 
P

Pete

(e-mail address removed) (Pete) wrote in message
I have
tried the calculator example from Sun locally and it works just
like my server, it stays running while loaded internally (intranet).
I have not tried to load to be accessed from the internet to see its
behaviour.

A couple more things. I have tried the Sun Calculator RMI demo from
the
internet and it exhibits the same behaviour, so I guess it isn't
something
I'm doing in my server.

If I run the demo locally, after the client ends, the server remains
running indefinitely. If I load the client from a remote location on
the internet and have it access the server, once the client ends, the
server will end in approximately 5-15 minutes. I haven't looked for
the cause for different ending times.

I understand what the earlier post from EJP is saying and what I need
to do, but I don't understand what causes the server to not loose the
reference when running locally as compared to across the internet.

Locally, when I end the client I begin getting the following logging
messages approximatly 5 minutes after the client ends:

Wed Aug 13 08:38:50 CDT 2003:RMI:RMI TCP
Connection(4)-192.168.20.31:[192.168.20
..31: sun.rmi.transport.DGCImpl[0:0:0, 2]: void
clean(java.rmi.server.ObjID[], lo
ng, java.rmi.dgc.VMID, boolean)]

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Java RMI questions and MyEclipse 8
Error with server 3
RMI Problem 2
Jboss RMI persistence 0
RMI - at my wits end 3
Python client/server that reads HTML body from server 1
RMI & connection refused 10
RMI in java 15

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top