1 /*
2 * Copyright (c) 1999, 2012, 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
178 public Timer() {
179 }
180
181 /*
182 * ------------------------------------------
183 * PUBLIC METHODS
184 * ------------------------------------------
185 */
186
187 /**
188 * Allows the timer MBean to perform any operations it needs before being registered
189 * in the MBean server.
190 * <P>
191 * Not used in this context.
192 *
193 * @param server The MBean server in which the timer MBean will be registered.
194 * @param name The object name of the timer MBean.
195 *
196 * @return The name of the timer MBean registered.
197 *
198 * @exception java.lang.Exception
199 */
200 public ObjectName preRegister(MBeanServer server, ObjectName name)
201 throws java.lang.Exception {
202 return name;
203 }
204
205 /**
206 * Allows the timer MBean to perform any operations needed after having been
207 * registered in the MBean server or after the registration has failed.
208 * <P>
209 * Not used in this context.
210 */
211 public void postRegister (Boolean registrationDone) {
212 }
213
214 /**
215 * Allows the timer MBean to perform any operations it needs before being unregistered
216 * by the MBean server.
217 * <P>
218 * Stops the timer.
219 *
220 * @exception java.lang.Exception
221 */
222 public void preDeregister() throws java.lang.Exception {
223
224 TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(),
225 "preDeregister", "stop the timer");
226
227 // Stop the timer.
228 //
229 stop();
230 }
231
232 /**
233 * Allows the timer MBean to perform any operations needed after having been
234 * unregistered by the MBean server.
235 * <P>
236 * Not used in this context.
237 */
238 public void postDeregister() {
239 }
240
|
1 /*
2 * Copyright (c) 1999, 2013, 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
178 public Timer() {
179 }
180
181 /*
182 * ------------------------------------------
183 * PUBLIC METHODS
184 * ------------------------------------------
185 */
186
187 /**
188 * Allows the timer MBean to perform any operations it needs before being registered
189 * in the MBean server.
190 * <P>
191 * Not used in this context.
192 *
193 * @param server The MBean server in which the timer MBean will be registered.
194 * @param name The object name of the timer MBean.
195 *
196 * @return The name of the timer MBean registered.
197 *
198 * @exception java.lang.Exception if there is a problem during preregistration
199 */
200 public ObjectName preRegister(MBeanServer server, ObjectName name)
201 throws java.lang.Exception {
202 return name;
203 }
204
205 /**
206 * Allows the timer MBean to perform any operations needed after having been
207 * registered in the MBean server or after the registration has failed.
208 * <P>
209 * Not used in this context.
210 */
211 public void postRegister (Boolean registrationDone) {
212 }
213
214 /**
215 * Allows the timer MBean to perform any operations it needs before being unregistered
216 * by the MBean server.
217 * <P>
218 * Stops the timer.
219 *
220 * @exception java.lang.Exception if there is a problem during prederegistration
221 */
222 public void preDeregister() throws java.lang.Exception {
223
224 TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(),
225 "preDeregister", "stop the timer");
226
227 // Stop the timer.
228 //
229 stop();
230 }
231
232 /**
233 * Allows the timer MBean to perform any operations needed after having been
234 * unregistered by the MBean server.
235 * <P>
236 * Not used in this context.
237 */
238 public void postDeregister() {
239 }
240
|