< prev index next >

src/share/classes/com/sun/jdi/connect/ListeningConnector.java

Print this page


   1 /*
   2  * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  26 package com.sun.jdi.connect;
  27 
  28 import java.util.Map;
  29 import java.io.IOException;
  30 import com.sun.jdi.VirtualMachine;
  31 
  32 /**
  33  * A connector which listens for a connection initiated by a target VM.
  34  *
  35  * @author Gordon Hirsch
  36  * @since  1.3
  37  */
  38 @jdk.Exported
  39 public interface ListeningConnector extends Connector {
  40     /**
  41      * Indicates whether this listening connector supports multiple
  42      * connections for a single argument map. If so, a call to
  43      * {@link #startListening} may allow
  44      * multiple target VM to become connected.
  45      *
  46      * @return <code>true</code> if multiple connections are supported;
  47      * <code>false</code> otherwise.
  48      */
  49     boolean supportsMultipleConnections();
  50 
  51     /**
  52      * Listens for one or more connections initiated by target VMs.
  53      * The connector uses the given argument map
  54      * in determining the address at which to listen or else it generates
  55      * an appropriate listen address. In either case, an address string
  56      * is returned from this method which can be used in starting target VMs
  57      * to identify this connector. The format of the address string
  58      * is connector, transport, and, possibly, platform dependent.
  59      * <p>
  60      * The argument map associates argument name strings to instances
  61      * of {@link Connector.Argument}. The default argument map for a
  62      * connector can be obtained through {@link Connector#defaultArguments}.
  63      * Argument map values can be changed, but map entries should not be
  64      * added or deleted.
  65      * <p>
  66      * This method does not return a {@link VirtualMachine}, and, normally,
  67      * returns before any target VM initiates
  68      * a connection. The connected target is obtained through
  69      * {@link #accept} (using the same argument map as is passed to this
  70      * method).
  71      * <p>
  72      * If <code>arguments</code> contains addressing information. and
  73      * only one connection will be accepted, the {@link #accept accept} method
  74      * can be called immediately without calling this method.
  75      *
  76      * @return the address at which the connector is listening
  77      * for a connection.
  78      * @throws java.io.IOException when unable to start listening.
  79      * Specific exceptions are dependent on the Connector implementation
  80      * in use.
  81      * @throws IllegalConnectorArgumentsException when one of the
  82      * connector arguments is invalid.
  83      */
  84     String startListening(Map<String,? extends Connector.Argument> arguments)
  85         throws IOException, IllegalConnectorArgumentsException;
  86 
  87     /**
  88      * Cancels listening for connections. The given argument map should match
  89      * the argument map given for a previous {@link #startListening} invocation.
  90      *
  91      * @throws java.io.IOException when unable to stop listening.
  92      * Specific exceptions are dependent on the Connector implementation


   1 /*
   2  * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  26 package com.sun.jdi.connect;
  27 
  28 import java.util.Map;
  29 import java.io.IOException;
  30 import com.sun.jdi.VirtualMachine;
  31 
  32 /**
  33  * A connector which listens for a connection initiated by a target VM.
  34  *
  35  * @author Gordon Hirsch
  36  * @since  1.3
  37  */
  38 @jdk.Exported
  39 public interface ListeningConnector extends Connector {
  40     /**
  41      * Indicates whether this listening connector supports multiple
  42      * connections for a single argument map. If so, a call to
  43      * {@link #startListening} may allow
  44      * multiple target VM to become connected.
  45      *
  46      * @return {@code true} if multiple connections are supported;
  47      * {@code false} otherwise.
  48      */
  49     boolean supportsMultipleConnections();
  50 
  51     /**
  52      * Listens for one or more connections initiated by target VMs.
  53      * The connector uses the given argument map
  54      * in determining the address at which to listen or else it generates
  55      * an appropriate listen address. In either case, an address string
  56      * is returned from this method which can be used in starting target VMs
  57      * to identify this connector. The format of the address string
  58      * is connector, transport, and, possibly, platform dependent.
  59      * <p>
  60      * The argument map associates argument name strings to instances
  61      * of {@link Connector.Argument}. The default argument map for a
  62      * connector can be obtained through {@link Connector#defaultArguments}.
  63      * Argument map values can be changed, but map entries should not be
  64      * added or deleted.
  65      * <p>
  66      * This method does not return a {@link VirtualMachine}, and, normally,
  67      * returns before any target VM initiates
  68      * a connection. The connected target is obtained through
  69      * {@link #accept} (using the same argument map as is passed to this
  70      * method).
  71      * <p>
  72      * If {@code arguments} contains addressing information and
  73      * only one connection will be accepted, the {@link #accept accept} method
  74      * can be called immediately without calling this method.
  75      *
  76      * @return the address at which the connector is listening
  77      * for a connection.
  78      * @throws java.io.IOException when unable to start listening.
  79      * Specific exceptions are dependent on the Connector implementation
  80      * in use.
  81      * @throws IllegalConnectorArgumentsException when one of the
  82      * connector arguments is invalid.
  83      */
  84     String startListening(Map<String,? extends Connector.Argument> arguments)
  85         throws IOException, IllegalConnectorArgumentsException;
  86 
  87     /**
  88      * Cancels listening for connections. The given argument map should match
  89      * the argument map given for a previous {@link #startListening} invocation.
  90      *
  91      * @throws java.io.IOException when unable to stop listening.
  92      * Specific exceptions are dependent on the Connector implementation


< prev index next >