ConvertServiceImplpublic class ConvertServiceImpl extends UnicastRemoteObject implements ConvertServiceProxy
Fields Summary |
---|
private ServerLandlord | lord | private ServerDelivery | sender | private JoinManager | manager | private ConvertServiceAdminImpl | admin |
Constructors Summary |
---|
public ConvertServiceImpl()
lord = new ServerLandlord();
sender = new ServerDelivery(this, lord);
|
Methods Summary |
---|
public java.lang.String | convert(Lease l, int i)
Hashtable cache = (Hashtable) lord.getSessionData(l);
if (cache == null)
throw new LeaseDeniedException("Lease expired");
Integer I = new Integer(i);
String s;
s = (String) cache.get(I);
if (s == null) {
s = I.toString();
cache.put(I, s);
}
sender.deliver(i);
return s;
| public java.lang.Object | getAdmin()
if (admin == null)
admin = new ConvertServiceAdminImpl(manager);
return admin;
| public ConvertServiceRegistration | getInstance(long duration)
Hashtable ht = new Hashtable(13);
return new ConvertServiceRegistrationImpl(this, lord.newLease(ht, duration));
| public static void | main(java.lang.String[] args)
System.setSecurityManager(new RMISecurityManager());
String[] groups = new String[] { "" };
Entry[] attributes = new Entry[2];
attributes[0] = new Name("Marketing Converter");
attributes[1] = new Location("4", "4101", "NY/02");
// Create the instance of the service; the JoinManager will
// register it and renew its leases with the lookup service
ConvertServiceImpl csi = (ConvertServiceImpl) new ConvertServiceImpl();
JoinManager manager = new JoinManager(csi, attributes, groups,
null, null, null);
csi.setJoinManager(manager);
| public void | setJoinManager(JoinManager jm)
this.manager = jm;
| public EventRegistration | trackConversions(long duration, RemoteEventListener rel, java.rmi.MarshalledObject key)
return sender.addListener(rel, duration, key);
|
|