1.1 --- a/src/java/isac/session/SessionDialog.java Mon Oct 06 22:30:41 2003 +0200
1.2 +++ b/src/java/isac/session/SessionDialog.java Mon Oct 06 22:32:14 2003 +0200
1.3 @@ -6,6 +6,9 @@
1.4 */
1.5 package isac.session;
1.6
1.7 +import java.io.Serializable;
1.8 +import java.rmi.RemoteException;
1.9 +import java.rmi.server.UnicastRemoteObject;
1.10 import java.util.HashMap;
1.11 import java.util.Iterator;
1.12 import java.util.Map;
1.13 @@ -19,17 +22,31 @@
1.14 * To change the template for this generated type comment go to
1.15 * Window>Preferences>Java>Code Generation>Code and Comments
1.16 */
1.17 -public class SessionDialog {
1.18 +public class SessionDialog extends UnicastRemoteObject implements SDialog, Serializable {
1.19 private int counter_;
1.20
1.21 private static UMHandler um_handler_ = new UMHandler();
1.22 private static WSDHandler wsd_handler_=new WSDHandler();
1.23 private Map sessionmap_=new HashMap();
1.24 + private static SessionDialog instance_;
1.25
1.26 - public SessionDialog () {
1.27 + private SessionDialog () throws RemoteException{
1.28 + init();
1.29 System.out.println("SessionDialog constructor");
1.30 }
1.31
1.32 + public static SessionDialog getInstance(){
1.33 + if (instance_==null){
1.34 + try {
1.35 + instance_=new SessionDialog();
1.36 + } catch (RemoteException e) {
1.37 + // TODO Auto-generated catch block
1.38 + e.printStackTrace();
1.39 + }
1.40 + }
1.41 + return instance_;
1.42 + }
1.43 +
1.44 /**
1.45 * this function performes the login and sets up the necessary environment for the user
1.46 * there is no real password-control jet. this method expects the username and password to be equal to continue
1.47 @@ -68,22 +85,27 @@
1.48 }
1.49
1.50 public static void main (String [] args) {
1.51 + init();
1.52 + }
1.53 +
1.54 + private static void init(){
1.55 try {
1.56 // Invoke me as <http://localhost:8080/RPC2>.
1.57 System.out.println("SessionDialog main");
1.58 WebServer server = new WebServer(1050);
1.59 server.setParanoid(false);
1.60 // server.addHandler("sample", new JavaServer());
1.61 - server.addHandler("SDialog", new SessionDialog());
1.62 + server.addHandler("SDialog", getInstance());
1.63 server.addHandler("WSDialog", wsd_handler_);
1.64 server.addHandler("UserModel", um_handler_);
1.65
1.66 } catch (Exception exception) {
1.67 System.err.println("SessionDialog: " + exception.toString());
1.68 }
1.69 +
1.70 }
1.71
1.72 public void finalize(){
1.73 - System.out.println("finalize!");
1.74 + System.out.println("SessionDialog finalize!");
1.75 }
1.76 }