0N/A/*
2362N/A * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage javax.management.timer;
0N/A
0N/A
0N/A
0N/A// java imports
0N/A//
0N/Aimport java.util.Date;
0N/Aimport java.util.Vector;
0N/A// NPCTE fix for bugId 4464388, esc 0, MR , to be added after modification of jmx spec
0N/A//import java.io.Serializable;
0N/A// end of NPCTE fix for bugId 4464388
0N/A
0N/A// jmx imports
0N/A//
0N/Aimport javax.management.InstanceNotFoundException;
0N/A
0N/A/**
0N/A * Exposes the management interface of the timer MBean.
0N/A *
0N/A * @since 1.5
0N/A */
0N/Apublic interface TimerMBean {
0N/A
0N/A /**
0N/A * Starts the timer.
0N/A * <P>
0N/A * If there is one or more timer notifications before the time in the list of notifications, the notification
0N/A * is sent according to the <CODE>sendPastNotifications</CODE> flag and then, updated
0N/A * according to its period and remaining number of occurrences.
0N/A * If the timer notification date remains earlier than the current date, this notification is just removed
0N/A * from the list of notifications.
0N/A */
0N/A public void start();
0N/A
0N/A /**
0N/A * Stops the timer.
0N/A */
0N/A public void stop();
0N/A
0N/A /**
0N/A * Creates a new timer notification with the specified <CODE>type</CODE>, <CODE>message</CODE>
0N/A * and <CODE>userData</CODE> and inserts it into the list of notifications with a given date,
0N/A * period and number of occurrences.
0N/A * <P>
0N/A * If the timer notification to be inserted has a date that is before the current date,
0N/A * the method behaves as if the specified date were the current date. <BR>
0N/A * For once-off notifications, the notification is delivered immediately. <BR>
0N/A * For periodic notifications, the first notification is delivered immediately and the
0N/A * subsequent ones are spaced as specified by the period parameter.
0N/A * <P>
0N/A * Note that once the timer notification has been added into the list of notifications,
0N/A * its associated date, period and number of occurrences cannot be updated.
0N/A * <P>
0N/A * In the case of a periodic notification, the value of parameter <i>fixedRate</i> is used to
0N/A * specify the execution scheme, as specified in {@link java.util.Timer}.
0N/A *
0N/A * @param type The timer notification type.
0N/A * @param message The timer notification detailed message.
0N/A * @param userData The timer notification user data object.
0N/A * @param date The date when the notification occurs.
0N/A * @param period The period of the timer notification (in milliseconds).
0N/A * @param nbOccurences The total number the timer notification will be emitted.
0N/A * @param fixedRate If <code>true</code> and if the notification is periodic, the notification
0N/A * is scheduled with a <i>fixed-rate</i> execution scheme. If
0N/A * <code>false</code> and if the notification is periodic, the notification
0N/A * is scheduled with a <i>fixed-delay</i> execution scheme. Ignored if the
0N/A * notification is not periodic.
0N/A *
0N/A * @return The identifier of the new created timer notification.
0N/A *
0N/A * @exception java.lang.IllegalArgumentException The date is {@code null} or
0N/A * the period or the number of occurrences is negative.
0N/A *
0N/A * @see #addNotification(String, String, Object, Date, long, long)
0N/A */
0N/A// NPCTE fix for bugId 4464388, esc 0, MR, to be added after modification of jmx spec
0N/A// public synchronized Integer addNotification(String type, String message, Serializable userData,
0N/A// Date date, long period, long nbOccurences)
0N/A// end of NPCTE fix for bugId 4464388
0N/A
0N/A public Integer addNotification(String type, String message, Object userData,
0N/A Date date, long period, long nbOccurences, boolean fixedRate)
0N/A throws java.lang.IllegalArgumentException;
0N/A
0N/A /**
0N/A * Creates a new timer notification with the specified <CODE>type</CODE>, <CODE>message</CODE>
0N/A * and <CODE>userData</CODE> and inserts it into the list of notifications with a given date,
0N/A * period and number of occurrences.
0N/A * <P>
0N/A * If the timer notification to be inserted has a date that is before the current date,
0N/A * the method behaves as if the specified date were the current date. <BR>
0N/A * For once-off notifications, the notification is delivered immediately. <BR>
0N/A * For periodic notifications, the first notification is delivered immediately and the
0N/A * subsequent ones are spaced as specified by the period parameter.
0N/A * <P>
0N/A * Note that once the timer notification has been added into the list of notifications,
0N/A * its associated date, period and number of occurrences cannot be updated.
0N/A * <P>
0N/A * In the case of a periodic notification, uses a <i>fixed-delay</i> execution scheme, as specified in
0N/A * {@link java.util.Timer}. In order to use a <i>fixed-rate</i> execution scheme, use
0N/A * {@link #addNotification(String, String, Object, Date, long, long, boolean)} instead.
0N/A *
0N/A * @param type The timer notification type.
0N/A * @param message The timer notification detailed message.
0N/A * @param userData The timer notification user data object.
0N/A * @param date The date when the notification occurs.
0N/A * @param period The period of the timer notification (in milliseconds).
0N/A * @param nbOccurences The total number the timer notification will be emitted.
0N/A *
0N/A * @return The identifier of the new created timer notification.
0N/A *
0N/A * @exception java.lang.IllegalArgumentException The date is {@code null} or
0N/A * the period or the number of occurrences is negative.
0N/A *
0N/A * @see #addNotification(String, String, Object, Date, long, long, boolean)
0N/A */
0N/A// NPCTE fix for bugId 4464388, esc 0, MR , to be added after modification of jmx spec
0N/A// public synchronized Integer addNotification(String type, String message, Serializable userData,
0N/A// Date date, long period)
0N/A// end of NPCTE fix for bugId 4464388 */
0N/A
0N/A public Integer addNotification(String type, String message, Object userData,
0N/A Date date, long period, long nbOccurences)
0N/A throws java.lang.IllegalArgumentException;
0N/A
0N/A /**
0N/A * Creates a new timer notification with the specified <CODE>type</CODE>, <CODE>message</CODE>
0N/A * and <CODE>userData</CODE> and inserts it into the list of notifications with a given date
0N/A * and period and a null number of occurrences.
0N/A * <P>
0N/A * The timer notification will repeat continuously using the timer period using a <i>fixed-delay</i>
0N/A * execution scheme, as specified in {@link java.util.Timer}. In order to use a <i>fixed-rate</i>
0N/A * execution scheme, use {@link #addNotification(String, String, Object, Date, long, long,
0N/A * boolean)} instead.
0N/A * <P>
0N/A * If the timer notification to be inserted has a date that is before the current date,
0N/A * the method behaves as if the specified date were the current date. The
0N/A * first notification is delivered immediately and the subsequent ones are
0N/A * spaced as specified by the period parameter.
0N/A *
0N/A * @param type The timer notification type.
0N/A * @param message The timer notification detailed message.
0N/A * @param userData The timer notification user data object.
0N/A * @param date The date when the notification occurs.
0N/A * @param period The period of the timer notification (in milliseconds).
0N/A *
0N/A * @return The identifier of the new created timer notification.
0N/A *
0N/A * @exception java.lang.IllegalArgumentException The date is {@code null} or
0N/A * the period is negative.
0N/A */
0N/A// NPCTE fix for bugId 4464388, esc 0, MR , to be added after modification of jmx spec
0N/A// public synchronized Integer addNotification(String type, String message, Serializable userData,
0N/A// Date date, long period)
0N/A// end of NPCTE fix for bugId 4464388 */
0N/A
0N/A public Integer addNotification(String type, String message, Object userData,
0N/A Date date, long period)
0N/A throws java.lang.IllegalArgumentException;
0N/A
0N/A /**
0N/A * Creates a new timer notification with the specified <CODE>type</CODE>, <CODE>message</CODE>
0N/A * and <CODE>userData</CODE> and inserts it into the list of notifications with a given date
0N/A * and a null period and number of occurrences.
0N/A * <P>
0N/A * The timer notification will be handled once at the specified date.
0N/A * <P>
0N/A * If the timer notification to be inserted has a date that is before the current date,
0N/A * the method behaves as if the specified date were the current date and the
0N/A * notification is delivered immediately.
0N/A *
0N/A * @param type The timer notification type.
0N/A * @param message The timer notification detailed message.
0N/A * @param userData The timer notification user data object.
0N/A * @param date The date when the notification occurs.
0N/A *
0N/A * @return The identifier of the new created timer notification.
0N/A *
0N/A * @exception java.lang.IllegalArgumentException The date is {@code null}.
0N/A */
0N/A// NPCTE fix for bugId 4464388, esc 0, MR, to be added after modification of jmx spec
0N/A// public synchronized Integer addNotification(String type, String message, Serializable userData, Date date)
0N/A// throws java.lang.IllegalArgumentException {
0N/A// end of NPCTE fix for bugId 4464388
0N/A
0N/A public Integer addNotification(String type, String message, Object userData, Date date)
0N/A throws java.lang.IllegalArgumentException;
0N/A
0N/A /**
0N/A * Removes the timer notification corresponding to the specified identifier from the list of notifications.
0N/A *
0N/A * @param id The timer notification identifier.
0N/A *
0N/A * @exception InstanceNotFoundException The specified identifier does not correspond to any timer notification
0N/A * in the list of notifications of this timer MBean.
0N/A */
0N/A public void removeNotification(Integer id) throws InstanceNotFoundException;
0N/A
0N/A /**
0N/A * Removes all the timer notifications corresponding to the specified type from the list of notifications.
0N/A *
0N/A * @param type The timer notification type.
0N/A *
0N/A * @exception InstanceNotFoundException The specified type does not correspond to any timer notification
0N/A * in the list of notifications of this timer MBean.
0N/A */
0N/A public void removeNotifications(String type) throws InstanceNotFoundException;
0N/A
0N/A /**
0N/A * Removes all the timer notifications from the list of notifications
0N/A * and resets the counter used to update the timer notification identifiers.
0N/A */
0N/A public void removeAllNotifications();
0N/A
0N/A // GETTERS AND SETTERS
0N/A //--------------------
0N/A
0N/A /**
0N/A * Gets the number of timer notifications registered into the list of notifications.
0N/A *
0N/A * @return The number of timer notifications.
0N/A */
0N/A public int getNbNotifications();
0N/A
0N/A /**
0N/A * Gets all timer notification identifiers registered into the list of notifications.
0N/A *
0N/A * @return A vector of <CODE>Integer</CODE> objects containing all the timer notification identifiers.
0N/A * <BR>The vector is empty if there is no timer notification registered for this timer MBean.
0N/A */
0N/A public Vector<Integer> getAllNotificationIDs();
0N/A
0N/A /**
0N/A * Gets all the identifiers of timer notifications corresponding to the specified type.
0N/A *
0N/A * @param type The timer notification type.
0N/A *
0N/A * @return A vector of <CODE>Integer</CODE> objects containing all the identifiers of
0N/A * timer notifications with the specified <CODE>type</CODE>.
0N/A * <BR>The vector is empty if there is no timer notifications registered for this timer MBean
0N/A * with the specified <CODE>type</CODE>.
0N/A */
0N/A public Vector<Integer> getNotificationIDs(String type);
0N/A
0N/A /**
0N/A * Gets the timer notification type corresponding to the specified identifier.
0N/A *
0N/A * @param id The timer notification identifier.
0N/A *
0N/A * @return The timer notification type or null if the identifier is not mapped to any
0N/A * timer notification registered for this timer MBean.
0N/A */
0N/A public String getNotificationType(Integer id);
0N/A
0N/A /**
0N/A * Gets the timer notification detailed message corresponding to the specified identifier.
0N/A *
0N/A * @param id The timer notification identifier.
0N/A *
0N/A * @return The timer notification detailed message or null if the identifier is not mapped to any
0N/A * timer notification registered for this timer MBean.
0N/A */
0N/A public String getNotificationMessage(Integer id);
0N/A
0N/A /**
0N/A * Gets the timer notification user data object corresponding to the specified identifier.
0N/A *
0N/A * @param id The timer notification identifier.
0N/A *
0N/A * @return The timer notification user data object or null if the identifier is not mapped to any
0N/A * timer notification registered for this timer MBean.
0N/A */
0N/A // NPCTE fix for bugId 4464388, esc 0 , MR , 03 sept 2001 , to be added after modification of jmx spec
0N/A //public Serializable getNotificationUserData(Integer id);
0N/A // end of NPCTE fix for bugId 4464388
0N/A public Object getNotificationUserData(Integer id);
0N/A /**
0N/A * Gets a copy of the date associated to a timer notification.
0N/A *
0N/A * @param id The timer notification identifier.
0N/A *
0N/A * @return A copy of the date or null if the identifier is not mapped to any
0N/A * timer notification registered for this timer MBean.
0N/A */
0N/A public Date getDate(Integer id);
0N/A
0N/A /**
0N/A * Gets a copy of the period (in milliseconds) associated to a timer notification.
0N/A *
0N/A * @param id The timer notification identifier.
0N/A *
0N/A * @return A copy of the period or null if the identifier is not mapped to any
0N/A * timer notification registered for this timer MBean.
0N/A */
0N/A public Long getPeriod(Integer id);
0N/A
0N/A /**
0N/A * Gets a copy of the remaining number of occurrences associated to a timer notification.
0N/A *
0N/A * @param id The timer notification identifier.
0N/A *
0N/A * @return A copy of the remaining number of occurrences or null if the identifier is not mapped to any
0N/A * timer notification registered for this timer MBean.
0N/A */
0N/A public Long getNbOccurences(Integer id);
0N/A
0N/A /**
0N/A * Gets a copy of the flag indicating whether a periodic notification is
0N/A * executed at <i>fixed-delay</i> or at <i>fixed-rate</i>.
0N/A *
0N/A * @param id The timer notification identifier.
0N/A *
0N/A * @return A copy of the flag indicating whether a periodic notification is
0N/A * executed at <i>fixed-delay</i> or at <i>fixed-rate</i>.
0N/A */
0N/A public Boolean getFixedRate(Integer id);
0N/A
0N/A /**
0N/A * Gets the flag indicating whether or not the timer sends past notifications.
0N/A *
0N/A * @return The past notifications sending on/off flag value.
0N/A *
0N/A * @see #setSendPastNotifications
0N/A */
0N/A public boolean getSendPastNotifications();
0N/A
0N/A /**
0N/A * Sets the flag indicating whether the timer sends past notifications or not.
0N/A *
0N/A * @param value The past notifications sending on/off flag value.
0N/A *
0N/A * @see #getSendPastNotifications
0N/A */
0N/A public void setSendPastNotifications(boolean value);
0N/A
0N/A /**
0N/A * Tests whether the timer MBean is active.
0N/A * A timer MBean is marked active when the {@link #start start} method is called.
0N/A * It becomes inactive when the {@link #stop stop} method is called.
0N/A *
0N/A * @return <CODE>true</CODE> if the timer MBean is active, <CODE>false</CODE> otherwise.
0N/A */
0N/A public boolean isActive();
0N/A
0N/A /**
0N/A * Tests whether the list of timer notifications is empty.
0N/A *
0N/A * @return <CODE>true</CODE> if the list of timer notifications is empty, <CODE>false</CODE> otherwise.
0N/A */
0N/A public boolean isEmpty();
0N/A}