Package com.sleepycat.je.rep.utilint

Examples of com.sleepycat.je.rep.utilint.ServiceDispatcher$Service


        return result;
    }

    private Win32ServiceControlDelegate getControlDelegate(Long timeout) throws Win32Exception {
        Service iisService = getIISService();
        String serviceName = iisService.getConfig().getName();
        List<String> serviceDependencies = Arrays.asList(iisService.getConfig().getDependencies());
        long serviceTimeout = (timeout == null ? SERVICE_CONTROL_TIMEOUT : timeout);
        return new Win32ServiceControlDelegate(serviceName, serviceDependencies, null, serviceTimeout);
    }
View Full Code Here


            this.reverseDependents = new ArrayList<String>(dependents);
            Collections.reverse(this.dependents);
        }
        this.timeout = timeout;

        service = new Service(serviceName);
    }
View Full Code Here

            return;

        log.debug("Starting list of services for Service [" + serviceName + "], services [" + services + "]");
        for (String relatedServiceName : services) {
            try {
                Service relatedService = new Service(relatedServiceName);
                int relatedServiceStatus = relatedService.getStatus();
                if (relatedServiceStatus == Service.SERVICE_STOPPED
                    || relatedServiceStatus == Service.SERVICE_STOP_PENDING) {
                    log.debug("Starting Service [" + relatedServiceName + "]");
                    relatedService.start(this.timeout);
                    log.debug("Service started [" + relatedServiceName + "]");
                    relatedService.close();
                }
            } catch (Exception e) {
                log.warn("Unable to start [" + relatedServiceName + "] from the list [" + services
                    + "]. Will continue with the rest. Cause:" + e);
            }
View Full Code Here

            return;

        log.debug("Stopping list of services for Service [" + serviceName + "], services [" + services + "]");
        for (String relatedServiceName : services) {
            try {
                Service relatedService = new Service(relatedServiceName);
                int relatedServiceStatus = relatedService.getStatus();
                if (!(relatedServiceStatus == Service.SERVICE_STOPPED || relatedServiceStatus == Service.SERVICE_STOP_PENDING)) {
                    log.debug("Stopping Service [" + relatedServiceName + "]");
                    relatedService.stop(this.timeout);
                    log.debug("Service stopped [" + relatedServiceName + "]");
                    relatedService.close();
                }
            } catch (Exception e) {
                log.warn("Unable to stop [" + relatedServiceName + "] from the list [" + services
                    + "]. Will continue with the rest. Cause:" + e);
            }
View Full Code Here

            return null;
        }
    }

    public void output(String[] args) throws SigarException {
        Service service = null;
        String name = args[0];
        String cmd = null;

        if (args.length == 2) {
            cmd = args[1];
        }
       
        try {
            service = new Service(name);
       
            if ((cmd == null) || cmd.equals("state")) {
                service.list(this.out);
            }
            else if (cmd.equals("start")) {
                service.start();
            }
            else if (cmd.equals("stop")) {
                service.stop();
            }
            else if (cmd.equals("pause")) {
                service.pause();
            }
            else if (cmd.equals("resume")) {
                service.resume();
            }
            else if (cmd.equals("delete")) {
                service.delete();
            }
            else if (cmd.equals("restart")) {
                service.stop(0);
                service.start();
            }
            else {
                println("Unsupported service command: " + args[1]);
                println("Valid commands: " + COMMANDS);
            }
        } finally {
            if (service != null) {
                service.close();
            }
        }
    }
View Full Code Here

public class ServiceStatus {

    private static void printStatus(String name)
        throws Win32Exception {

        Service service = new Service(name);
        System.out.println(name + ": " +
                           service.getStatusString());
        service.close();
    }
View Full Code Here

    public TestService(String name) {
        super(name);
    }

    public void testServiceOpen() throws Exception {
        Service service = new Service(EVENTLOG_NAME);
        service.getConfig();
        service.close();
       
        String dummyName = "DOESNOTEXIST";
        try {
            new Service(dummyName);
            assertTrue(false);
        } catch (Win32Exception e) {
            traceln(dummyName + ": " + e.getMessage());
            assertTrue(true);
        }
View Full Code Here

    public void testDeleteService() throws Exception {
        if (!TEST_DELETE) {
            return;
        }
        Service service = new Service(TEST_NAME);
        service.delete();
    }
View Full Code Here

    public TestService(String name) {
        super(name);
    }

    public void testServiceOpen() throws Exception {
        Service service = new Service("Eventlog");
        service.getConfig();
        service.close();
       
        String dummyName = "DOESNOTEXIST";
        try {
            new Service(dummyName);
            assertTrue(false);
        } catch (Win32Exception e) {
            traceln(dummyName + ": " + e.getMessage());
            assertTrue(true);
        }
View Full Code Here

    public void testDeleteService() throws Exception {
        if (!TEST_DELETE) {
            return;
        }
        Service service = new Service(TEST_NAME);
        service.delete();
    }
View Full Code Here

TOP

Related Classes of com.sleepycat.je.rep.utilint.ServiceDispatcher$Service

Copyright © 2018 www.massapicom. 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.