cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1304427 - in /cxf/branches/2.5.x-fixes/distribution/src/main/release/samples: jms_pubsub/src/main/java/demo/jms_greeter/server/Server.java jms_queue/src/main/java/demo/jms_greeter/server/Server.java
Date Fri, 23 Mar 2012 15:16:20 GMT
Author: dkulp
Date: Fri Mar 23 15:16:19 2012
New Revision: 1304427

URL: http://svn.apache.org/viewvc?rev=1304427&view=rev
Log:
Merged revisions 1304370 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1304370 | dkulp | 2012-03-23 10:28:51 -0400 (Fri, 23 Mar 2012) | 3 lines

  Make sure the endpoints are stopped for the jms servers so that the
  connections to the broker can cleanly disconnect without errors.

........

Modified:
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/jms_pubsub/src/main/java/demo/jms_greeter/server/Server.java
    cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/jms_queue/src/main/java/demo/jms_greeter/server/Server.java

Modified: cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/jms_pubsub/src/main/java/demo/jms_greeter/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/jms_pubsub/src/main/java/demo/jms_greeter/server/Server.java?rev=1304427&r1=1304426&r2=1304427&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/jms_pubsub/src/main/java/demo/jms_greeter/server/Server.java
(original)
+++ cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/jms_pubsub/src/main/java/demo/jms_greeter/server/Server.java
Fri Mar 23 15:16:19 2012
@@ -22,20 +22,35 @@ package demo.jms_greeter.server;
 import javax.xml.ws.Endpoint;
 
 public class Server {
+    Endpoint ep;
 
     protected Server() throws Exception {
         System.out.println("Starting Server");
         Object implementor = new GreeterJMSImpl();
         String address = "http://cxf.apache.org/transports/jms";
-        Endpoint.publish(address, implementor);
+        ep = Endpoint.publish(address, implementor);
+
+        Runtime.getRuntime().addShutdownHook(new Thread() {
+            public void run() {
+                shutdown();
+            }
+        });
+    }
+    public void shutdown() {
+        if (ep != null) {
+            ep.stop();
+            ep = null;
+        }
     }
 
     public static void main(String args[]) throws Exception {
-        new Server();
+        Server s = new Server();
         System.out.println("Server ready...");
-
-        Thread.sleep(125 * 60 * 1000);
-        System.out.println("Server exiting");
-        System.exit(0);
+        try {
+            Thread.sleep(5 * 60 * 1000);
+            System.out.println("Server exiting");
+        } finally {
+            s.shutdown();
+        }
     }
 }

Modified: cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/jms_queue/src/main/java/demo/jms_greeter/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/jms_queue/src/main/java/demo/jms_greeter/server/Server.java?rev=1304427&r1=1304426&r2=1304427&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/jms_queue/src/main/java/demo/jms_greeter/server/Server.java
(original)
+++ cxf/branches/2.5.x-fixes/distribution/src/main/release/samples/jms_queue/src/main/java/demo/jms_greeter/server/Server.java
Fri Mar 23 15:16:19 2012
@@ -22,20 +22,36 @@ package demo.jms_greeter.server;
 import javax.xml.ws.Endpoint;
 
 public class Server {
+    Endpoint ep;
 
     protected Server() throws Exception {
         System.out.println("Starting Server");
         Object implementor = new GreeterJMSImpl();
         String address = "http://cxf.apache.org/transports/jms";
-        Endpoint.publish(address, implementor);
+        ep = Endpoint.publish(address, implementor);
+
+        Runtime.getRuntime().addShutdownHook(new Thread() {
+            public void run() {
+                shutdown();
+            }
+        });
+    }
+
+    public void shutdown() {
+        if (ep != null) {
+            ep.stop();
+            ep = null;
+        }
     }
 
     public static void main(String args[]) throws Exception {
-        new Server();
+        Server s = new Server();
         System.out.println("Server ready...");
-
-        Thread.sleep(125 * 60 * 1000);
-        System.out.println("Server exiting");
-        System.exit(0);
+        try {
+            Thread.sleep(5 * 60 * 1000);
+            System.out.println("Server exiting");
+        } finally {
+            s.shutdown();
+        }
     }
 }



Mime
View raw message