test/java/rmi/activation/Activatable/shutdownGracefully/ShutdownGracefully.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 95,104 **** --- 95,120 ---- System.err.println("activation group will be created " + "in a new VM"); ActivationGroupDesc groupDesc = new ActivationGroupDesc(p, null); ActivationSystem system = ActivationGroup.getSystem(); + if(system == null) { + //Set a 5 seconds timeout + long stopTime = System.currentTimeMillis() + 5000; + do { + try { + Thread.sleep(200); + } catch (InterruptedException ignore) { + } + if((system = ActivationGroup.getSystem()) != null) { + break; + } + } while (System.currentTimeMillis() < stopTime); + if (system == null) { + TestLibrary.bomb("\nfailure: Can't acquire ActivationSystem"); + } + } ActivationGroupID groupID = system.registerGroup(groupDesc); System.err.println("registering activatable"); ActivationDesc desc = new ActivationDesc (groupID, "ShutdownGracefully", null, null);