0
저는 java rmi를 처음 사용합니다. 그리고 저는 rmi 프로그램을 서비스로 만들고 싶습니다. 예를 들어, 나는 원격 인터페이스를 가지고 :자바 RMI 프로그래밍 서비스
public interface Handler implements Remote {
public void insert (String str) throws RemoteException, NotBoundException;
}
public class HandlerImpl extends UnicastRemoteObject implements Handler {
public HandlerImpl (int port) {
super(port);
}
public void insert (String str) throws RemoteException, NotBoundException {
// insert string to a file
}
}
을 그리고 나는 또한 그것을 등록하는 클래스가하십시오
Server server = new Server();
때 프로그램과 프로그램을 작성하는 경우 이제
class Server {
public Server() {
Registry svcReg = LocateRegistry.createRegistry(999);
Handler handler = new HandlerImpl (1000);
svcReg.rebind("insert", handler);
}
}
을 종료되면 서비스가 사라집니다. 서버를 백그라운드에서 실행하고 "원격 메소드"를 호출 할 수있는 서비스와 같은 적절한 방법은 무엇입니까?
감사합니다.