InvocationEvent.java
01 /*
02  *
03  * Licensed to the Apache Software Foundation (ASF) under one
04  * or more contributor license agreements.  See the NOTICE file
05  * distributed with this work for additional information
06  * regarding copyright ownership.  The ASF licenses this file
07  * to you under the Apache License, Version 2.0 (the
08  * "License"); you may not use this file except in compliance
09  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  */
21 package org.apache.qpid.management.domain.model;
22 
23 import java.util.EventObject;
24 import java.util.concurrent.BlockingQueue;
25 
26 import org.apache.qpid.management.domain.handler.impl.InvocationResult;
27 
28 /**
29  * Operation invocation event. 
30  * This encapsulates all the information that a method invocation listener needs to know about an operation which is 
31  * going to be invoked.
32  
33  @author Andrea Gazzarini
34  */
35 public class InvocationEvent extends EventObject
36 {
37     private static final long serialVersionUID = 240229490753008597L;
38 
39     private final int _sequenceNumber;
40     private final BlockingQueue<InvocationResult> _exchangeChannel;
41     
42     /**
43      * Builds a new invocation event with the given data.
44      
45      @param source the event source.
46      @param sequenceNumber the sequence number of the method invocation.
47      @param exchangeChannel the exchange channel for synchronous communication.
48      */
49     InvocationEvent(Object source, int sequenceNumber, BlockingQueue<InvocationResult> exchangeChannel)
50     {
51         super(source);
52         this._sequenceNumber = sequenceNumber;
53         this._exchangeChannel = exchangeChannel;
54     }
55     
56     /**
57      * Returns the sequence number that will be / has been used for method invocation.
58      
59      @return the sequence number that will be / has been used for method invocation.
60      */
61     public int getSequenceNumber() 
62     {
63         return _sequenceNumber;
64     }
65     
66     /**
67      * Returns the exchange channel that will be used between event source and event listener for synchronous 
68      * communication.
69      
70      @return the exchange channel that will be used for synchronous communication.
71      */
72     public BlockingQueue<InvocationResult> getExchangeChannel()
73     {
74         return _exchangeChannel;
75     }
76 }