VirtualMachineManagerImpl.java revision 28
/*
* Copyright 1998-2004 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* Public for use by com.sun.jdi.Bootstrap */
public class VirtualMachineManagerImpl implements VirtualMachineManagerService {
private final ThreadGroup mainGroupForJDI;
private int vmSequenceNumber = 0;
private static final int majorVersion = 1;
private static final int minorVersion = 6;
private static VirtualMachineManagerImpl vmm;
public static VirtualMachineManager virtualMachineManager() {
new JDIPermission("virtualMachineManager");
}
synchronized (lock) {
vmm = new VirtualMachineManagerImpl();
}
}
return vmm;
}
protected VirtualMachineManagerImpl() {
/*
* Create a top-level thread group
*/
}
/*
* Load the connectors
*/
while (connectors.hasNext()) {
try {
} catch (ThreadDeath x) {
throw x;
} catch (Exception x) {
continue;
} catch (Error x) {
continue;
}
}
/*
* Load any transport services and encapsulate them with
* an attaching and listening connector.
*/
TransportService.class.getClassLoader());
while (transportServices.hasNext()) {
try {
} catch (ThreadDeath x) {
throw x;
} catch (Exception x) {
continue;
} catch (Error x) {
continue;
}
}
// no connectors found
throw new Error("no Connectors loaded");
}
// Set the default launcher. In order to be compatible
// 1.2/1.3/1.4 we try to make the default launcher
// "com.sun.jdi.CommandLineLaunch". If this connector
// isn't found then we arbitarly pick the first connector.
//
boolean found = false;
found = true;
break;
}
}
}
}
public LaunchingConnector defaultConnector() {
if (defaultConnector == null) {
throw new Error("no default LaunchingConnector");
}
return defaultConnector;
}
}
List<LaunchingConnector> launchingConnectors = new ArrayList<LaunchingConnector>(connectors.size());
if (connector instanceof LaunchingConnector) {
}
}
}
List<AttachingConnector> attachingConnectors = new ArrayList<AttachingConnector>(connectors.size());
if (connector instanceof AttachingConnector) {
}
}
}
List<ListeningConnector> listeningConnectors = new ArrayList<ListeningConnector>(connectors.size());
if (connector instanceof ListeningConnector) {
}
}
}
}
}
}
}
public synchronized VirtualMachine createVirtualMachine(
if (!connection.isOpen()) {
throw new IllegalStateException("connection is not open");
}
try {
++vmSequenceNumber);
} catch (VMDisconnectedException e) {
throw new IOException(e.getMessage());
}
return vm;
}
}
}
}
public int majorInterfaceVersion() {
return majorVersion;
}
public int minorInterfaceVersion() {
return minorVersion;
}
return mainGroupForJDI;
}
}
}
}