1 /*
2  * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.  Oracle designates this
8  * particular file as subject to the "Classpath" exception as provided
9  * by Oracle in the LICENSE file that accompanied this code.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22  * or visit www.oracle.com if you need additional information or have any
23  * questions.
24  */
25 
26 package javax.management.timer;
27 
28 /**
29  * This class provides definitions of the notifications sent by timer MBeans.
30  * <BR>It defines a timer notification identifier which allows to retrieve a timer notification
31  * from the list of notifications of a timer MBean.
32  * <P>
33  * The timer notifications are created and handled by the timer MBean.
34  *
35  * @since 1.5
36  */
37 public class TimerNotification extends javax.management.Notification {
38 
39 
40     /* Serial version */
41     private static final long serialVersionUID = 1798492029603825750L;
42 
43     /*
44      * ------------------------------------------
45      *  PRIVATE VARIABLES
46      * ------------------------------------------
47      */
48 
49     /**
50      * @serial Timer notification identifier.
51      *         This identifier is used to retrieve a timer notification from the timer list of notifications.
52      */
53     private Integer notificationID;
54 
55 
56     /*
57      * ------------------------------------------
58      *  CONSTRUCTORS
59      * ------------------------------------------
60      */
61 
62     /**
63      * Creates a timer notification object.
64      *
65      * @param type The notification type.
66      * @param source The notification producer.
67      * @param sequenceNumber The notification sequence number within the source object.
68      * @param timeStamp The notification emission date.
69      * @param msg The notification message.
70      * @param id The notification identifier.
71      *
72      */
TimerNotification(String type, Object source, long sequenceNumber, long timeStamp, String msg, Integer id)73     public TimerNotification(String type, Object source, long sequenceNumber, long timeStamp, String msg, Integer id) {
74 
75         super(type, source, sequenceNumber, timeStamp, msg);
76         this.notificationID = id;
77     }
78 
79     /*
80      * ------------------------------------------
81      *  PUBLIC METHODS
82      * ------------------------------------------
83      */
84 
85     // GETTERS AND SETTERS
86     //--------------------
87 
88     /**
89      * Gets the identifier of this timer notification.
90      *
91      * @return The identifier.
92      */
getNotificationID()93     public Integer getNotificationID() {
94         return notificationID;
95     }
96 
97     /*
98      * ------------------------------------------
99      *  PACKAGE METHODS
100      * ------------------------------------------
101      */
102 
103     /**
104      * Creates and returns a copy of this object.
105      *
106      */
cloneTimerNotification()107     Object cloneTimerNotification() {
108 
109         TimerNotification clone = new TimerNotification(this.getType(), this.getSource(), this.getSequenceNumber(),
110                                                         this.getTimeStamp(), this.getMessage(), notificationID);
111         clone.setUserData(this.getUserData());
112         return clone;
113     }
114 }
115