1 /* 2 * The contents of this file are subject to the terms 3 * of the Common Development and Distribution License 4 * (the License). You may not use this file except in 5 * compliance with the License. 6 * 7 * You can obtain a copy of the license at 8 * https://glassfish.dev.java.net/public/CDDLv1.0.html or 9 * glassfish/bootstrap/legal/CDDLv1.0.txt. 10 * See the License for the specific language governing 11 * permissions and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL 14 * Header Notice in each file and include the License file 15 * at glassfish/bootstrap/legal/CDDLv1.0.txt. 16 * If applicable, add the following below the CDDL Header, 17 * with the fields enclosed by brackets [] replaced by 18 * you own identifying information: 19 * "Portions Copyrighted [year] [name of copyright owner]" 20 * 21 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 22 */ 23 24 25 package com.sun.appserv.management.client; 26 27 import java.io.IOException; 28 import javax.management.MBeanServerConnection; 29 import javax.management.remote.JMXConnector; 30 31 /** 32 A source of an MBeanServerConnection. 33 34 @see AppserverConnectionSource 35 @see com.sun.appserv.management.util.jmx.MBeanServerConnectionConnectionSource 36 @see com.sun.appserv.management.util.jmx.MBeanServerConnectionSource 37 */ 38 public interface ConnectionSource 39 { 40 /** 41 Return a valid MBeanServerConnection, making a new connection if necessary, or 42 returning an existing one if still valid. Some implementations may choose 43 to not allow creation of a new connection (when 'forceNew' is specified). 44 <p> 45 Should not be called frequently, as the check for validity will make a remote 46 call. 47 <p> 48 An implementation may choose to ignore the 'forceNew' parameter and always 49 return the same connection. 50 51 @param forceNew creates a new connection instead of reusing an existing one 52 @return the connection, or null if a new one is not possible 53 */ 54 public MBeanServerConnection getMBeanServerConnection( boolean forceNew ) 55 throws IOException; 56 57 /** 58 @return existing connection, valid or not, may be null 59 */ 60 public MBeanServerConnection getExistingMBeanServerConnection(); 61 62 /** 63 @return a JMXConnector or null if not appropriate 64 */ 65 public JMXConnector getJMXConnector( boolean forceNew ) 66 throws IOException; 67 } 68 69 70 71