First, let me console anyone who may think I haven't put enough effort in to resolving my problem before posting here by saying I have searched through both this forum and many, many, many web sites without much joy. I have encountered the term "garbage collection" but I can't figure out whether this applies and what to do if it does. I hope that someone can give me the answer and I don't mind if you also scold me brutally for not finding it at "extremely obvious location X" because at this stage the relief will far exceed the humiliation.
Q1) I am successfully running an RMI server and client over a network using Netbeans, on Ubuntu PCs (successfully after discovering by accident that the package names have to match!!!). My problem is that the server program terminates after exactly 60 minutes and 1 second. I then have to manually re-run the server programme. This is no good because I am trying to make a file server and I want the server to server object stubs forever without fail. Specifically, how do I stop it timing out?
Here's the business end of the server program:
public static void main(
String args[]) {
try {
System.setProperty("java.rmi.server.hostname", HOST);
Server obj = new Server();
Hello stub = (Hello) UnicastRemoteObject.exportObject(obj, 0);
Registry registry = LocateRegistry.createRegistry(PORT);
registry.bind("Bronx", stub);
System.out.println("Server ready");
} catch (Exception e) {
System.out.println("Server exception: " + e.toString());
e.printStackTrace();
}
}
Q2) I am fairly experienced with
Java but new to networking and web apps. Is RMI the recommended, mainstream
technique for transferring data from a server to a remote Java program and/or Webpage with
applet? Or is
RMI not the way most people would do this?
Many thanks in advance.