3 import java.rmi.RemoteException;
4 import java.rmi.server.RemoteServer;
5 import java.rmi.server.ServerNotActiveException;
6 import java.text.SimpleDateFormat;
7 import java.util.ArrayList;
18 private static final ArrayList<ClientInterface> remoteObserverList =
new ArrayList<ClientInterface>();
19 private static final ArrayList<String> remoteObserverListHostNames =
new ArrayList<String>();
34 }
catch (ServerNotActiveException e1) {
42 remoteObserverList.add(observer);
48 SimpleDateFormat sdf =
new SimpleDateFormat(
"HH:mm:ss");
49 String time = sdf.format(
new Date());
53 + remoteObserverListHostNames.get(remoteObserverListHostNames
65 int index = remoteObserverList.indexOf(observer);
66 remoteObserverList.remove(observer);
68 SimpleDateFormat sdf =
new SimpleDateFormat(
"HH:mm:ss");
69 String time = sdf.format(
new Date());
73 + remoteObserverListHostNames.get(index));
75 remoteObserverListHostNames.remove(index);
84 public static synchronized void update(Class t, List<Object> o) {
85 List<ClientInterface> brokenRemoteObserverList =
new ArrayList<ClientInterface>();
87 SimpleDateFormat sdf =
new SimpleDateFormat(
"HH:mm:ss");
88 String time = sdf.format(
new Date());
96 .get(remoteObserverList.indexOf(observer));
100 observer.update(t, o);
101 }
catch (Exception e) {
102 System.out.println(
"");
111 brokenRemoteObserverList.add(observer);
120 index = remoteObserverList.indexOf(observer);
121 remoteObserverList.remove(observer);
122 remoteObserverListHostNames.remove(index);
126 + remoteObserverList.size()
139 .get(remoteObserverList.indexOf(observer));
143 observer.serverTerminated();
144 }
catch (Exception e) {
145 System.out.println(
"");
147 .getString(
"ObserverUpdater.14") + e.getMessage());