ServiceEventRegistrationImpl.java 1.43 KB
Newer Older
Matt Tucker's avatar
Matt Tucker committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
/*
 * $RCSfile$
 * $Revision$
 * $Date$
 *
 * Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
 *
 * This software is the proprietary information of CoolServlets, Inc.
 * Use is subject to license terms.
 */
package org.jivesoftware.messenger.container.spi;

import org.jivesoftware.messenger.container.EventListener;
import org.jivesoftware.messenger.container.EventRegistration;

/**
 * A simple registration event for services.
 *
 * @author Iain Shigeoka
 */
public class ServiceEventRegistrationImpl extends EventRegistration {

    /**
     * The listener for this registration.
     */
    private EventListener listener;

    /**
     * Create an event registration with listener and lookup
     *
     * @param serviceLookup the lookup that generated the registration.
     * @param eventListener the listener for the registration event.
     * @param eventID       the event ID to associate with this event.
     * @param sequenceNo    the sequence number this event will use
     */
    public ServiceEventRegistrationImpl(ServiceLookupImpl serviceLookup,
                                        EventListener eventListener,
                                        long eventID,
                                        long sequenceNo) {
        super(eventID, serviceLookup, sequenceNo);
        this.listener = eventListener;
    }

    public void cancel() {
        ((ServiceLookupImpl)this.getSource()).remove(listener);
    }
}