classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] [PATCH/JDWP] Add shutdown method to transport


From: Keith Seitz
Subject: [cp-patches] [PATCH/JDWP] Add shutdown method to transport
Date: Fri, 02 Sep 2005 17:22:30 -0700
User-agent: Mozilla Thunderbird 1.0.6-1.1.fc4 (X11/20050720)

Hi,

I've committed the attached patch, which adds a shutdown method to ITransport.java and friends.

Keith

ChangeLog
2005-09-02  Keith Seitz  <address@hidden>

* gnu/classpath/jdwp/transport/ITransport.java (shutdown): New method. * gnu/classpath/jdwp/transport/JdwpConnection.java (JdwpConnection): Add
        ThreadGroup argument.
* gnu/classpath/jdwp/transport/SocketTransport.java (shutdown): New method.
Index: gnu/classpath/jdwp/transport/ITransport.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/classpath/jdwp/transport/ITransport.java,v
retrieving revision 1.2
diff -u -p -r1.2 ITransport.java
--- gnu/classpath/jdwp/transport/ITransport.java        2 Jul 2005 20:32:10 
-0000       1.2
+++ gnu/classpath/jdwp/transport/ITransport.java        3 Sep 2005 00:20:48 
-0000
@@ -49,7 +49,7 @@ import java.util.HashMap;
  * A class representing a transport layer. This class serves as a generic
  * interface for all transport types used in the JDWP back-end.
  *
- * @author Keith Seitz <address@hidden>
+ * @author Keith Seitz (address@hidden)
  */
 public interface ITransport
 {
@@ -69,6 +69,11 @@ public interface ITransport
    */
   public void initialize ()
     throws TransportException;
+
+  /**
+   * Shutdown the transport
+   */
+  public void shutdown ();
 
   /**
    * Get the input stream for the transport
Index: gnu/classpath/jdwp/transport/JdwpConnection.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/classpath/jdwp/transport/JdwpConnection.java,v
retrieving revision 1.4
diff -u -p -r1.4 JdwpConnection.java
--- gnu/classpath/jdwp/transport/JdwpConnection.java    2 Jul 2005 20:32:10 
-0000       1.4
+++ gnu/classpath/jdwp/transport/JdwpConnection.java    3 Sep 2005 00:20:48 
-0000
@@ -96,8 +96,9 @@ public class JdwpConnection
    *
    * @param transport  the transport to use for communications
    */
-  public JdwpConnection (ITransport transport)
+  public JdwpConnection (ThreadGroup group, ITransport transport)
   {
+    super (group, "JDWP connection thread");
     _transport = transport;
     _commandQueue = new ArrayList ();
     _shutdown = false;
@@ -177,7 +178,7 @@ public class JdwpConnection
               2. Transport was shutdown
               In either case, we make sure that all of the
               back-end gets shutdown. */
-           Jdwp.getInstance().shutdown ();
+           Jdwp.getDefault().shutdown ();
          }
        catch (Throwable t)
          {
Index: gnu/classpath/jdwp/transport/SocketTransport.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/classpath/jdwp/transport/SocketTransport.java,v
retrieving revision 1.2
diff -u -p -r1.2 SocketTransport.java
--- gnu/classpath/jdwp/transport/SocketTransport.java   2 Jul 2005 20:32:10 
-0000       1.2
+++ gnu/classpath/jdwp/transport/SocketTransport.java   3 Sep 2005 00:20:48 
-0000
@@ -57,7 +57,7 @@ import javax.net.SocketFactory;
  * configury string that looks like "name=dt_socket,
  * address=localhost:1234,server=y".
  *
- * @author Keith Seitz <address@hidden>
+ * @author Keith Seitz (address@hidden)
  */
 class SocketTransport
   implements ITransport
@@ -142,6 +142,22 @@ class SocketTransport
       {
        // This will grab UnknownHostException, too.
        throw new TransportException (ioe);
+      }
+  }
+
+  /**
+   * Shutdown the socket. This could cause SocketExceptions
+   * for anyone blocked on socket i/o
+   */
+  public void shutdown ()
+  {
+    try
+      {
+       _socket.close ();
+      }
+    catch (Throwable t)
+      {
+       // We don't really care about errors at this point
       }
   }
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]