KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > advisory > ProducerEvent


1 /**
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one or more
4  * contributor license agreements. See the NOTICE file distributed with
5  * this work for additional information regarding copyright ownership.
6  * The ASF licenses this file to You under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with
8  * the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.apache.activemq.advisory;
19
20 import org.apache.activemq.command.ProducerId;
21
22 import javax.jms.Destination JavaDoc;
23
24 import java.util.EventObject JavaDoc;
25
26 /**
27  * An event when the number of producers on a given destination changes.
28  *
29  * @version $Revision: 359679 $
30  */

31 public abstract class ProducerEvent extends EventObject JavaDoc {
32     private static final long serialVersionUID = 2442156576867593780L;
33     private final Destination JavaDoc destination;
34     private final ProducerId producerId;
35     private final int producerCount;
36
37     public ProducerEvent(ProducerEventSource source, Destination JavaDoc destination, ProducerId producerId, int producerCount) {
38         super(source);
39         this.destination = destination;
40         this.producerId = producerId;
41         this.producerCount = producerCount;
42     }
43
44     public ProducerEventSource getAdvisor() {
45         return (ProducerEventSource) getSource();
46     }
47
48     public Destination JavaDoc getDestination() {
49         return destination;
50     }
51
52     /**
53      * Returns the current number of producers active at the time this advisory was sent.
54      *
55      */

56     public int getProducerCount() {
57         return producerCount;
58     }
59
60     public ProducerId getProducerId() {
61         return producerId;
62     }
63
64     public abstract boolean isStarted();
65 }
66
Popular Tags