jdk/src/share/classes/javax/management/remote/JMXConnector.java
author yan
Mon, 12 May 2014 14:33:13 +0400
changeset 24368 2b4801b94265
parent 23010 6dadb192ad81
permissions -rw-r--r--
8038795: Tidy warnings cleanup for javax.management Reviewed-by: dfuchs Contributed-by: Alexander Stepanov <alexander.v.stepanov@oracle.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 21656
diff changeset
     2
 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4156
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4156
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4156
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4156
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4156
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package javax.management.remote;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.Closeable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.util.Map;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import javax.management.ListenerNotFoundException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import javax.management.MBeanServerConnection;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import javax.management.NotificationFilter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import javax.management.NotificationListener;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import javax.security.auth.Subject;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * <p>The client end of a JMX API connector.  An object of this type can
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * be used to establish a connection to a connector server.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * <p>A newly-created object of this type is unconnected.  Its {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * #connect connect} method must be called before it can be used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * However, objects created by {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * JMXConnectorFactory#connect(JMXServiceURL, Map)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * JMXConnectorFactory.connect} are already connected.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
public interface JMXConnector extends Closeable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
      * <p>Name of the attribute that specifies the credentials to send
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
      * to the connector server during connection.  The value
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
      * associated with this attribute, if any, is a serializable
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
      * object of an appropriate type for the server's {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
      * JMXAuthenticator}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     public static final String CREDENTIALS =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
         "jmx.remote.credentials";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * <p>Establishes the connection to the connector server.  This
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * method is equivalent to {@link #connect(Map)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * connect(null)}.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * @exception IOException if the connection could not be made
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * because of a communication problem.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * @exception SecurityException if the connection could not be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * made for security reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    public void connect() throws IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * <p>Establishes the connection to the connector server.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * <p>If <code>connect</code> has already been called successfully
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * on this object, calling it again has no effect.  If, however,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * {@link #close} was called after <code>connect</code>, the new
21656
d4c777ccb1db 8028014: Doclint warning/error cleanup in javax.management
rriggs
parents: 5506
diff changeset
    79
     * <code>connect</code> will throw an <code>IOException</code>.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * <p>Otherwise, either <code>connect</code> has never been called
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * on this object, or it has been called but produced an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * exception.  Then calling <code>connect</code> will attempt to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * establish a connection to the connector server.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * @param env the properties of the connection.  Properties in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * this map override properties in the map specified when the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * <code>JMXConnector</code> was created, if any.  This parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * can be null, which is equivalent to an empty map.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * @exception IOException if the connection could not be made
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * because of a communication problem.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * @exception SecurityException if the connection could not be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * made for security reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    public void connect(Map<String,?> env) throws IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * <p>Returns an <code>MBeanServerConnection</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * representing a remote MBean server.  For a given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * <code>JMXConnector</code>, two successful calls to this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * will usually return the same <code>MBeanServerConnection</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * object, though this is not required.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * <p>For each method in the returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * <code>MBeanServerConnection</code>, calling the method causes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * the corresponding method to be called in the remote MBean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * server.  The value returned by the MBean server method is the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * value returned to the client.  If the MBean server method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * produces an <code>Exception</code>, the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * <code>Exception</code> is seen by the client.  If the MBean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * server method, or the attempt to call it, produces an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * <code>Error</code>, the <code>Error</code> is wrapped in a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * {@link JMXServerErrorException}, which is seen by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * client.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * <p>Calling this method is equivalent to calling
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * {@link #getMBeanServerConnection(Subject) getMBeanServerConnection(null)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * meaning that no delegation subject is specified and that all the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * operations called on the <code>MBeanServerConnection</code> must
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * use the authenticated subject, if any.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * @return an object that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * <code>MBeanServerConnection</code> interface by forwarding its
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * methods to the remote MBean server.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * @exception IOException if a valid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * <code>MBeanServerConnection</code> cannot be created, for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * instance because the connection to the remote MBean server has
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * not yet been established (with the {@link #connect(Map)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * connect} method), or it has been closed, or it has broken.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    public MBeanServerConnection getMBeanServerConnection()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
            throws IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * <p>Returns an <code>MBeanServerConnection</code> object representing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * a remote MBean server on which operations are performed on behalf of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * the supplied delegation subject. For a given <code>JMXConnector</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * and <code>Subject</code>, two successful calls to this method will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * usually return the same <code>MBeanServerConnection</code> object,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * though this is not required.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * <p>For each method in the returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * <code>MBeanServerConnection</code>, calling the method causes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * the corresponding method to be called in the remote MBean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * server on behalf of the given delegation subject instead of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * authenticated subject. The value returned by the MBean server
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * method is the value returned to the client. If the MBean server
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * method produces an <code>Exception</code>, the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * <code>Exception</code> is seen by the client. If the MBean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * server method, or the attempt to call it, produces an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * <code>Error</code>, the <code>Error</code> is wrapped in a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * {@link JMXServerErrorException}, which is seen by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * client.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * @param delegationSubject the <code>Subject</code> on behalf of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * which requests will be performed.  Can be null, in which case
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * requests will be performed on behalf of the authenticated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * Subject, if any.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * @return an object that implements the <code>MBeanServerConnection</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * interface by forwarding its methods to the remote MBean server on behalf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * of a given delegation subject.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * @exception IOException if a valid <code>MBeanServerConnection</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * cannot be created, for instance because the connection to the remote
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * MBean server has not yet been established (with the {@link #connect(Map)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * connect} method), or it has been closed, or it has broken.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    public MBeanServerConnection getMBeanServerConnection(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
                                               Subject delegationSubject)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
            throws IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * <p>Closes the client connection to its server.  Any ongoing or new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * request using the MBeanServerConnection returned by {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * #getMBeanServerConnection()} will get an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * <code>IOException</code>.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * <p>If <code>close</code> has already been called successfully
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * on this object, calling it again has no effect.  If
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * <code>close</code> has never been called, or if it was called
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * but produced an exception, an attempt will be made to close the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * connection.  This attempt can succeed, in which case
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * <code>close</code> will return normally, or it can generate an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * exception.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * <p>Closing a connection is a potentially slow operation.  For
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * example, if the server has crashed, the close operation might
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * have to wait for a network protocol timeout.  Callers that do
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * not want to block in a close operation should do it in a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * separate thread.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * @exception IOException if the connection cannot be closed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * cleanly.  If this exception is thrown, it is not known whether
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * the server end of the connection has been cleanly closed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    public void close() throws IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * <p>Adds a listener to be informed of changes in connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * status.  The listener will receive notifications of type {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * JMXConnectionNotification}.  An implementation can send other
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * types of notifications too.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * <p>Any number of listeners can be added with this method.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * same listener can be added more than once with the same or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * different values for the filter and handback.  There is no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * special treatment of a duplicate entry.  For example, if a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * listener is registered twice with no filter, then its
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * <code>handleNotification</code> method will be called twice for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * each notification.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * @param listener a listener to receive connection status
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * notifications.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * @param filter a filter to select which notifications are to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * delivered to the listener, or null if all notifications are to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * be delivered.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * @param handback an object to be given to the listener along
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * with each notification.  Can be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * @exception NullPointerException if <code>listener</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * @see #removeConnectionNotificationListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * @see javax.management.NotificationBroadcaster#addNotificationListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    public void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        addConnectionNotificationListener(NotificationListener listener,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
                                          NotificationFilter filter,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
                                          Object handback);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * <p>Removes a listener from the list to be informed of changes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * in status.  The listener must previously have been added.  If
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * there is more than one matching listener, all are removed.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * @param listener a listener to receive connection status
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * notifications.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * @exception NullPointerException if <code>listener</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     * @exception ListenerNotFoundException if the listener is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     * registered with this <code>JMXConnector</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * @see #removeConnectionNotificationListener(NotificationListener,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * NotificationFilter, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     * @see #addConnectionNotificationListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * @see javax.management.NotificationEmitter#removeNotificationListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    public void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
        removeConnectionNotificationListener(NotificationListener listener)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
            throws ListenerNotFoundException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     * <p>Removes a listener from the list to be informed of changes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     * in status.  The listener must previously have been added with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * the same three parameters.  If there is more than one matching
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * listener, only one is removed.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     * @param l a listener to receive connection status notifications.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * @param f a filter to select which notifications are to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * delivered to the listener.  Can be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     * @param handback an object to be given to the listener along
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     * with each notification.  Can be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     * @exception ListenerNotFoundException if the listener is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * registered with this <code>JMXConnector</code>, or is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * registered with the given filter and handback.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * @see #removeConnectionNotificationListener(NotificationListener)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * @see #addConnectionNotificationListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * @see javax.management.NotificationEmitter#removeNotificationListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
    public void removeConnectionNotificationListener(NotificationListener l,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
                                                     NotificationFilter f,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
                                                     Object handback)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
            throws ListenerNotFoundException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * <p>Gets this connection's ID from the connector server.  For a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * given connector server, every connection will have a unique id
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     * which does not change during the lifetime of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     * connection.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     * @return the unique ID of this connection.  This is the same as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * the ID that the connector server includes in its {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * JMXConnectionNotification}s.  The {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * javax.management.remote package description} describes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * conventions for connection IDs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * @exception IOException if the connection ID cannot be obtained,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * for instance because the connection is closed or broken.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
    public String getConnectionId() throws IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
}