jdk/test/java/rmi/testlibrary/ActivationLibrary.java
author tyan
Fri, 20 Dec 2013 15:10:11 -0800
changeset 22085 752c27397429
parent 13256 5886d7607acd
child 23025 ee5c4f07f86c
permissions -rw-r--r--
7168267: Cleanup of rmi regression tests Reviewed-by: smarks
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
13256
5886d7607acd 7142596: RMI JPRT tests are failing
dmocek
parents: 12692
diff changeset
     2
 * Copyright (c) 1998, 2012, 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
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.File;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.rmi.Naming;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.rmi.NoSuchObjectException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.rmi.NotBoundException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.rmi.Remote;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.rmi.activation.Activatable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.rmi.activation.ActivationID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.rmi.activation.ActivationSystem;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.rmi.registry.LocateRegistry;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * Class of test utility/library methods related to Activatable
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * objects.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
public class ActivationLibrary {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
    /** time safeDestroy should wait before failing on shutdown rmid */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    private static final int SAFE_WAIT_TIME;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
        int slopFactor = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
            slopFactor = Integer.valueOf(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
                TestLibrary.getExtraProperty("jcov.sleep.multiplier","1"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
        } catch (NumberFormatException ignore) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
        SAFE_WAIT_TIME = 60000 * slopFactor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    private static final String SYSTEM_NAME =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
        ActivationSystem.class.getName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    private static void mesg(Object mesg) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
        System.err.println("ACTIVATION_LIBRARY: " + mesg.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * Deactivate an activated Activatable
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    public static void deactivate(Remote remote,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
                                  ActivationID id) {
12692
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
    66
        // We do as much as 50 deactivation trials, each separated by
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
    67
        // at least 100 milliseconds sleep time (max sleep time of 5 secs).
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
    68
        final long deactivateSleepTime = 100;
22085
752c27397429 7168267: Cleanup of rmi regression tests
tyan
parents: 13256
diff changeset
    69
        long stopTime = System.currentTimeMillis() + deactivateSleepTime * 50;
752c27397429 7168267: Cleanup of rmi regression tests
tyan
parents: 13256
diff changeset
    70
        while (System.currentTimeMillis() < stopTime) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
                if (Activatable.inactive(id) == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
                    mesg("inactive successful");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
                    return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
                } else {
12692
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
    76
                    mesg("inactive trial failed. Sleeping " +
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
    77
                         deactivateSleepTime +
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
    78
                         " milliseconds before next trial");
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
    79
                    Thread.sleep(deactivateSleepTime);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
            } catch (InterruptedException e) {
12692
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
    82
                Thread.currentThread().interrupt();
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
    83
                mesg("Thread interrupted while trying to deactivate activatable. Exiting deactivation");
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
    84
                return;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
            } catch (Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
                    // forcibly unexport the object
12692
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
    88
                    mesg("Unexpected exception. Have to forcibly unexport the object." +
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
    89
                         " Exception was :");
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
    90
                    e.printStackTrace();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
                    Activatable.unexportObject(remote, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
                } catch (NoSuchObjectException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
                return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        mesg("unable to inactivate after several attempts");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        mesg("unexporting object forcibly instead");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
            Activatable.unexportObject(remote, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        } catch (NoSuchObjectException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * Simple method call to see if rmid is running.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * This method intentionally avoids performing a lookup on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * activation system.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    public static boolean rmidRunning(int port) {
12692
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   114
        int allowedNotReady = 50;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        int connectionRefusedExceptions = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
12692
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   117
        /* We wait as much as a total of 7.5 secs trying to see Rmid running.
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   118
         * We do this by pausing steps of 100 milliseconds (so up to 75 steps),
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   119
         * right after trying to lookup and find RMID running in the other vm.
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   120
         */
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   121
        final long rmidWaitingStepTime = 100;
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   122
        for (int i = 0; i <= 74; i++) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
                LocateRegistry.getRegistry(port).lookup(SYSTEM_NAME);
12692
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   126
                mesg("Activation System available after " +
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   127
                     (i * rmidWaitingStepTime) + " milliseconds");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
            } catch (java.rmi.ConnectException e) {
12692
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   131
                mesg("Remote connection refused after " +
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   132
                     (i * rmidWaitingStepTime) + " milliseconds");
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   133
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
                // ignore connect exceptions until we decide rmid is not up
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
                if ((connectionRefusedExceptions ++) >= allowedNotReady) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
                    return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
12692
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   139
            } catch (java.rmi.NoSuchObjectException nsoe) {
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   140
                /* Activation System still unavailable.
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   141
                 * Ignore this since we are just waiting for its availibility.
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   142
                 * Just signal unavailibility.
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   143
                 */
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   144
                mesg("Activation System still unavailable after more than " +
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   145
                     (i * rmidWaitingStepTime) + " milliseconds");
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   146
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            } catch (NotBoundException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
            } catch (Exception e) {
12692
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   151
                /* print out other types of exceptions as an FYI.
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   152
                 * test should not fail as rmid is likely to be in an
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   153
                 * undetermined state at this point.
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   154
                 */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                mesg("caught an exception trying to" +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
                     " start rmid, last exception was: " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
                     e.getMessage());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                e.printStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
            }
12692
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   160
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   161
            // Waiting for another 100 milliseconds.
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   162
            try {
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   163
                Thread.sleep(100);
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   164
            } catch (InterruptedException e) {
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   165
                Thread.currentThread().interrupt();
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   166
                mesg("Thread interrupted while checking if Activation System is running. Exiting check");
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   167
                return false;
72f0847dd477 7144861: speed up RMI activation tests
olagneau
parents: 5506
diff changeset
   168
            }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    /** cleanup after rmid */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    public static void rmidCleanup(RMID rmid) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        if (rmid != null) {
13256
5886d7607acd 7142596: RMI JPRT tests are failing
dmocek
parents: 12692
diff changeset
   176
            if (!ActivationLibrary.safeDestroy(rmid, SAFE_WAIT_TIME)) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                TestLibrary.bomb("rmid not destroyed in: " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                                 SAFE_WAIT_TIME +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                                 " milliseconds");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        RMID.removeLog();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * Invoke shutdown on rmid in a way that will not cause a test
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * to hang.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * @return whether or not shutdown completed succesfully in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     *         timeAllowed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     */
13256
5886d7607acd 7142596: RMI JPRT tests are failing
dmocek
parents: 12692
diff changeset
   192
    private static boolean safeDestroy(RMID rmid, long timeAllowed) {
5886d7607acd 7142596: RMI JPRT tests are failing
dmocek
parents: 12692
diff changeset
   193
        DestroyThread destroyThread = new DestroyThread(rmid);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        destroyThread.start();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
            destroyThread.join(timeAllowed);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        } catch (InterruptedException ie) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
            Thread.currentThread().interrupt();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        return destroyThread.shutdownSucceeded();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * Thread class to handle the destruction of rmid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    private static class DestroyThread extends Thread {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        private final RMID rmid;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        private final int port;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        private boolean succeeded = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
13256
5886d7607acd 7142596: RMI JPRT tests are failing
dmocek
parents: 12692
diff changeset
   213
        DestroyThread(RMID rmid) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
            this.rmid = rmid;
13256
5886d7607acd 7142596: RMI JPRT tests are failing
dmocek
parents: 12692
diff changeset
   215
            this.port = rmid.getPort();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
            this.setDaemon(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        public void run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
            if (ActivationLibrary.rmidRunning(port)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
                rmid.destroy();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
                synchronized (this) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
                    // flag that the test was able to shutdown rmid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
                    succeeded = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
                mesg("finished destroying rmid");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
                mesg("tried to shutdown when rmid was not running");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        public synchronized boolean shutdownSucceeded() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
            return succeeded;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
}