jdk/test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation3Test.java
author ohair
Tue, 25 May 2010 15:58:33 -0700
changeset 5506 202f599c92aa
parent 2 90ce3da70b43
child 16109 eb00701a5769
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2005, 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
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
 * @test
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
 * @bug 6261831
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 * @summary Tests the use of the subject delegation feature on the authenticated
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 *          principals within the RMI connector server's creator codebase with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 *          subject delegation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * @author Luis-Miguel Alventosa
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * @run clean SubjectDelegation3Test SimpleStandard SimpleStandardMBean
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * @run build SubjectDelegation3Test SimpleStandard SimpleStandardMBean
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * @run main SubjectDelegation3Test policy31 ok
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * @run main SubjectDelegation3Test policy32 ko
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * @run main SubjectDelegation3Test policy33 ko
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * @run main SubjectDelegation3Test policy34 ok
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * @run main SubjectDelegation3Test policy35 ko
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import com.sun.jmx.remote.security.JMXPluggableAuthenticator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import java.io.File;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import java.lang.management.ManagementFactory;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
import java.rmi.RemoteException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
import java.rmi.registry.LocateRegistry;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
import java.rmi.registry.Registry;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
import java.util.Collections;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
import java.util.HashMap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
import java.util.Properties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
import javax.management.Attribute;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
import javax.management.MBeanServer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
import javax.management.MBeanServerConnection;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
import javax.management.Notification;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
import javax.management.NotificationListener;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
import javax.management.ObjectName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
import javax.management.remote.JMXConnector;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
import javax.management.remote.JMXConnectorFactory;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
import javax.management.remote.JMXConnectorServer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
import javax.management.remote.JMXConnectorServerFactory;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
import javax.management.remote.JMXPrincipal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
import javax.management.remote.JMXServiceURL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
import javax.security.auth.Subject;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
public class SubjectDelegation3Test {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    public static void main(String[] args) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
        // Check for supported operating systems: Solaris
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        // This test runs only on Solaris due to CR 6285916
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        String osName = System.getProperty("os.name");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        System.out.println("os.name = " + osName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        if (!osName.equals("SunOS")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
            System.out.println("This test runs on Solaris only.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
            System.out.println("Bye! Bye!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        String policyFile = args[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        String testResult = args[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        System.out.println("Policy file = " + policyFile);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        System.out.println("Expected test result = " + testResult);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        JMXConnectorServer jmxcs = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        JMXConnector jmxc = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
            // Create an RMI registry
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
            System.out.println("Start RMI registry...");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
            Registry reg = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
            int port = 5800;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
            while (port++ < 6000) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
                    reg = LocateRegistry.createRegistry(port);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
                    System.out.println("RMI registry running on port " + port);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
                } catch (RemoteException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
                    // Failed to create RMI registry...
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
                    System.out.println("Failed to create RMI registry " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
                                       "on port " + port);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
            if (reg == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
                System.exit(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
            // Set the default password file
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
            final String passwordFile = System.getProperty("test.src") +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
                File.separator + "jmxremote.password";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
            System.out.println("Password file = " + passwordFile);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
            // Set policy file
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
            final String policy = System.getProperty("test.src") +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
                File.separator + policyFile;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
            System.out.println("PolicyFile = " + policy);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
            System.setProperty("java.security.policy", policy);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
            // Instantiate the MBean server
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
            System.out.println("Create the MBean server");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
            MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
            // Register the SimpleStandardMBean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
            System.out.println("Create SimpleStandard MBean");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
            SimpleStandard s = new SimpleStandard("delegate");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
            mbs.registerMBean(s, new ObjectName("MBeans:type=SimpleStandard"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
            // Set Security Manager
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
            System.setSecurityManager(new SecurityManager());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
            // Create Properties containing the username/password entries
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
            Properties props = new Properties();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
            props.setProperty("jmx.remote.x.password.file", passwordFile);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
            // Initialize environment map to be passed to the connector server
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
            System.out.println("Initialize environment map");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
            HashMap env = new HashMap();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
            env.put("jmx.remote.authenticator",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
                    new JMXPluggableAuthenticator(props));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
            // Create an RMI connector server
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
            System.out.println("Create an RMI connector server");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
            JMXServiceURL url =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                new JMXServiceURL("rmi", null, 0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
                                  "/jndi/rmi://:" + port + "/server" + port);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
            jmxcs =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            jmxcs.start();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
            // Create an RMI connector client
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            System.out.println("Create an RMI connector client");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
            HashMap cli_env = new HashMap();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            // These credentials must match those in the default password file
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
            String[] credentials = new String[] { "monitorRole" , "QED" };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            cli_env.put("jmx.remote.credentials", credentials);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            jmxc = JMXConnectorFactory.connect(url, cli_env);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            Subject delegationSubject =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                new Subject(true,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
                            Collections.singleton(new JMXPrincipal("delegate")),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
                            Collections.EMPTY_SET,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                            Collections.EMPTY_SET);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
            MBeanServerConnection mbsc =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                jmxc.getMBeanServerConnection(delegationSubject);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            // Get domains from MBeanServer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            System.out.println("Domains:");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
            String domains[] = mbsc.getDomains();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            for (int i = 0; i < domains.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
                System.out.println("\tDomain[" + i + "] = " + domains[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
            // Get MBean count
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
            System.out.println("MBean count = " + mbsc.getMBeanCount());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
            // Get State attribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
            String oldState =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
                (String) mbsc.getAttribute(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                              new ObjectName("MBeans:type=SimpleStandard"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
                              "State");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
            System.out.println("Old State = \"" + oldState + "\"");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
            // Set State attribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            System.out.println("Set State to \"changed state\"");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
            mbsc.setAttribute(new ObjectName("MBeans:type=SimpleStandard"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                              new Attribute("State", "changed state"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
            // Get State attribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
            String newState =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
                (String) mbsc.getAttribute(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
                              new ObjectName("MBeans:type=SimpleStandard"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
                              "State");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
            System.out.println("New State = \"" + newState + "\"");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
            if (!newState.equals("changed state")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
                System.out.println("Invalid State = \"" + newState + "\"");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
                System.exit(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
            // Add notification listener on SimpleStandard MBean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
            System.out.println("Add notification listener...");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
            mbsc.addNotificationListener(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
                 new ObjectName("MBeans:type=SimpleStandard"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
                 new NotificationListener() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
                     public void handleNotification(Notification notification,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
                                                    Object handback) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
                         System.out.println("Received notification: " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
                                            notification);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
                     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
                 null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
                 null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
            // Unregister SimpleStandard MBean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
            System.out.println("Unregister SimpleStandard MBean...");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
            mbsc.unregisterMBean(new ObjectName("MBeans:type=SimpleStandard"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        } catch (SecurityException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
            if (testResult.equals("ko")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
                System.out.println("Got expected security exception = " + e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
                System.out.println("Got unexpected security exception = " + e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                e.printStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
                throw e;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        } catch (Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
            System.out.println("Unexpected exception caught = " + e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
            e.printStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
            throw e;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        } finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
            // Close connector client
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
            if (jmxc != null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
                jmxc.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
            // Stop connector server
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
            if (jmxcs != null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
                jmxcs.stop();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
            // Say goodbye
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
            System.out.println("Bye! Bye!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
}