1 /*
2 * Copyright (c) 1999, 2008, 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
369
370
371 /*
372 * ------------------------------------------
373 * PUBLIC METHODS
374 * ------------------------------------------
375 */
376
377 /**
378 * Allows the monitor MBean to perform any operations it needs
379 * before being registered in the MBean server.
380 * <P>
381 * Initializes the reference to the MBean server.
382 *
383 * @param server The MBean server in which the monitor MBean will
384 * be registered.
385 * @param name The object name of the monitor MBean.
386 *
387 * @return The name of the monitor MBean registered.
388 *
389 * @exception Exception
390 */
391 public ObjectName preRegister(MBeanServer server, ObjectName name)
392 throws Exception {
393
394 MONITOR_LOGGER.logp(Level.FINER, Monitor.class.getName(),
395 "preRegister(MBeanServer, ObjectName)",
396 "initialize the reference on the MBean server");
397
398 this.server = server;
399 return name;
400 }
401
402 /**
403 * Allows the monitor MBean to perform any operations needed after
404 * having been registered in the MBean server or after the
405 * registration has failed.
406 * <P>
407 * Not used in this context.
408 */
409 public void postRegister(Boolean registrationDone) {
410 }
411
412 /**
413 * Allows the monitor MBean to perform any operations it needs
414 * before being unregistered by the MBean server.
415 * <P>
416 * Stops the monitor.
417 *
418 * @exception Exception
419 */
420 public void preDeregister() throws Exception {
421
422 MONITOR_LOGGER.logp(Level.FINER, Monitor.class.getName(),
423 "preDeregister()", "stop the monitor");
424
425 // Stop the Monitor.
426 //
427 stop();
428 }
429
430 /**
431 * Allows the monitor MBean to perform any operations needed after
432 * having been unregistered by the MBean server.
433 * <P>
434 * Not used in this context.
435 */
436 public void postDeregister() {
437 }
438
|
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
369
370
371 /*
372 * ------------------------------------------
373 * PUBLIC METHODS
374 * ------------------------------------------
375 */
376
377 /**
378 * Allows the monitor MBean to perform any operations it needs
379 * before being registered in the MBean server.
380 * <P>
381 * Initializes the reference to the MBean server.
382 *
383 * @param server The MBean server in which the monitor MBean will
384 * be registered.
385 * @param name The object name of the monitor MBean.
386 *
387 * @return The name of the monitor MBean registered.
388 *
389 * @exception Exception if there is a problem during preregistration
390 */
391 public ObjectName preRegister(MBeanServer server, ObjectName name)
392 throws Exception {
393
394 MONITOR_LOGGER.logp(Level.FINER, Monitor.class.getName(),
395 "preRegister(MBeanServer, ObjectName)",
396 "initialize the reference on the MBean server");
397
398 this.server = server;
399 return name;
400 }
401
402 /**
403 * Allows the monitor MBean to perform any operations needed after
404 * having been registered in the MBean server or after the
405 * registration has failed.
406 * <P>
407 * Not used in this context.
408 */
409 public void postRegister(Boolean registrationDone) {
410 }
411
412 /**
413 * Allows the monitor MBean to perform any operations it needs
414 * before being unregistered by the MBean server.
415 * <P>
416 * Stops the monitor.
417 *
418 * @exception Exception if there is a problem during prederegistration
419 */
420 public void preDeregister() throws Exception {
421
422 MONITOR_LOGGER.logp(Level.FINER, Monitor.class.getName(),
423 "preDeregister()", "stop the monitor");
424
425 // Stop the Monitor.
426 //
427 stop();
428 }
429
430 /**
431 * Allows the monitor MBean to perform any operations needed after
432 * having been unregistered by the MBean server.
433 * <P>
434 * Not used in this context.
435 */
436 public void postDeregister() {
437 }
438
|