FileDocCategorySizeDatePackage
ServerDelivery.javaAPI DocExample4145Thu Mar 16 11:52:48 GMT 2000None

ServerDelivery

public class ServerDelivery extends Object

Fields Summary
private Remote
source
private ServerLandlord
lord
private Vector
leases
private TaskManager
pool
Constructors Summary
public ServerDelivery(Remote source, ServerLandlord ll)

        this.source = source;
        lord = ll;
        leases = new Vector();
        pool = new TaskManager();
    
Methods Summary
public synchronized EventRegistrationaddListener(RemoteEventListener l, long duration, java.rmi.MarshalledObject key, long seqnum)

        SessionData sd = new SessionData();
        sd.listener = l;
        sd.key = key;

        Lease lease = lord.newLease(sd, duration);
        leases.addElement(lease);

        return new EventRegistration(ConvertEvent.ID, source, lease, seqnum);
    
public voiddeliver(int value, long seq)

        if (leases.isEmpty())
            return;

        Object[] allLeases = leases.toArray();
        for (int i = 0; i < allLeases.length; i++) {
            Lease l = (Lease) allLeases[i];
            SessionData obj = (SessionData) lord.getSessionData(l);
            if (obj == null) {
                leases.remove(l);
            } else {
                deliverEvent(obj, seq, value, l);
            }
        }
    
private voiddeliverEvent(ServerDelivery$SessionData data, long seq, int value, Lease lease)

        ConvertEvent event = new ConvertEvent(source, value, seq, data.key);
        pool.add(new CallbackTask(data.listener, event, lease));