Package org.objectweb.hello_world_soap_http

Source Code of org.objectweb.hello_world_soap_http.GreeterServerMain$TerminationHandler

package org.objectweb.hello_world_soap_http;

import javax.xml.ws.Endpoint;

import org.objectweb.celtix.Bus;

public class GreeterServerMain {

    protected GreeterServerMain() {
    }

    public static void main(String args[]) throws Exception {
        System.out.println("Starting Server");

        /**
         * Creation of the endpoint could be part of the bus initialisation
         * based on configuration. For now, do it manually.
         */

        Bus bus = Bus.init(args);
        Runtime.getRuntime().addShutdownHook(
            new Thread(new GreeterServerMain().new TerminationHandler(bus, true)));
        Object implementor = new AnnotatedGreeterImpl();
        String address = "http://loalhost:8080/hello_world_soap_http";
        Endpoint.publish(address, implementor);
        bus.run();
    }

    private class TerminationHandler implements Runnable {
        private final Bus bus;
        private final boolean processRemainingTasks;

        TerminationHandler(Bus b, boolean p) {
            bus = b;
            processRemainingTasks = p;
        }

        public void run() {
            try {
                bus.shutdown(processRemainingTasks);
            } catch (Exception ex) {
                System.err.println("Failed to shutdown the bus:\n" + ex.getMessage());
            }
        }
    }
}
TOP

Related Classes of org.objectweb.hello_world_soap_http.GreeterServerMain$TerminationHandler

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.