Package org.jboss.modcluster

Examples of org.jboss.modcluster.ModClusterServiceMBean


        if (context.isNormalServer() && context.getServiceRegistry(false).getService(ContainerEventHandlerService.SERVICE_NAME) != null) {
            context.addStep(new OperationStepHandler() {
                @Override
                public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
                    ServiceController<?> controller = context.getServiceRegistry(false).getService(ContainerEventHandlerService.SERVICE_NAME);
                    ModClusterServiceMBean service = (ModClusterServiceMBean) controller.getValue();
                    Map<InetSocketAddress, String> map = service.getProxyInfo();
                    ROOT_LOGGER.debugf("Mod_cluster ProxyInfo %s", map);
                    if (!map.isEmpty()) {
                        final ModelNode result = new ModelNode();
                        InetSocketAddress[] addr = map.keySet().toArray(new InetSocketAddress[map.size()]);
                        for (InetSocketAddress address : addr) {
View Full Code Here


        if (context.isNormalServer() && context.getServiceRegistry(false).getService(ContainerEventHandlerService.SERVICE_NAME) != null) {
            context.addStep(new OperationStepHandler() {
                @Override
                public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
                    ServiceController<?> controller = context.getServiceRegistry(false).getService(ContainerEventHandlerService.SERVICE_NAME);
                    final ModClusterServiceMBean service = (ModClusterServiceMBean) controller.getValue();
                    ROOT_LOGGER.debugf("stop-context: %s", operation);

                    final String webHost = VIRTUAL_HOST.resolveModelAttribute(context, operation).asString();
                    final String webContext = CONTEXT.resolveModelAttribute(context, operation).asString();
                    final int waitTime = WAIT_TIME.resolveModelAttribute(context, operation).asInt();

                    try {
                        service.stopContext(webHost, webContext, waitTime, TimeUnit.SECONDS);
                    } catch (IllegalArgumentException e) {
                        throw new OperationFailedException(new ModelNode().set(ModClusterLogger.ROOT_LOGGER.contextOrHostNotFound(webHost, webContext)));
                    }

                    context.completeStep(new OperationContext.RollbackHandler() {
                        @Override
                        public void handleRollback(OperationContext context, ModelNode operation) {
                            // TODO We're assuming that the context was previously enabled, but it could have been disabled
                            service.enableContext(webHost, webContext);
                        }
                    });
                }
            }, OperationContext.Stage.RUNTIME);
        }
View Full Code Here

        if (context.isNormalServer() && context.getServiceRegistry(false).getService(ContainerEventHandlerService.SERVICE_NAME) != null) {
            context.addStep(new OperationStepHandler() {
                @Override
                public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
                    ServiceController<?> controller = context.getServiceRegistry(false).getService(ContainerEventHandlerService.SERVICE_NAME);
                    final ModClusterServiceMBean service = (ModClusterServiceMBean) controller.getValue();
                    service.disable();

                    context.completeStep(new OperationContext.RollbackHandler() {
                        @Override
                        public void handleRollback(OperationContext context, ModelNode operation) {
                            service.enable();
                        }
                    });
                }
            }, OperationContext.Stage.RUNTIME);
        }
View Full Code Here

        if (context.isNormalServer() && context.getServiceRegistry(false).getService(ContainerEventHandlerService.SERVICE_NAME) != null) {
            context.addStep(new OperationStepHandler() {
                @Override
                public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
                    ServiceController<?> controller = context.getServiceRegistry(false).getService(ContainerEventHandlerService.SERVICE_NAME);
                    final ModClusterServiceMBean service = (ModClusterServiceMBean) controller.getValue();
                    ROOT_LOGGER.debugf("disable-context: %s", operation);

                    final String webHost = VIRTUAL_HOST.resolveModelAttribute(context, operation).asString();
                    final String webContext = CONTEXT.resolveModelAttribute(context, operation).asString();

                    try {
                        service.disableContext(webHost, webContext);
                    } catch (IllegalArgumentException e) {
                        throw new OperationFailedException(new ModelNode().set(ModClusterLogger.ROOT_LOGGER.contextOrHostNotFound(webHost, webContext)));
                    }

                    context.completeStep(new OperationContext.RollbackHandler() {
                        @Override
                        public void handleRollback(OperationContext context, ModelNode operation) {
                            service.enableContext(webHost, webContext);
                        }
                    });
                }
            }, OperationContext.Stage.RUNTIME);
        }
View Full Code Here

        if (context.isNormalServer() && context.getServiceRegistry(false).getService(ContainerEventHandlerService.SERVICE_NAME) != null) {
            context.addStep(new OperationStepHandler() {
                @Override
                public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
                    ServiceController<?> controller = context.getServiceRegistry(false).getService(ContainerEventHandlerService.SERVICE_NAME);
                    final ModClusterServiceMBean service = (ModClusterServiceMBean) controller.getValue();
                    ROOT_LOGGER.debugf("enable-context: %s", operation);

                    final String webHost = VIRTUAL_HOST.resolveModelAttribute(context, operation).asString();
                    final String webContext = CONTEXT.resolveModelAttribute(context, operation).asString();

                    try {
                        service.enableContext(webHost, webContext);
                    } catch (IllegalArgumentException e) {
                        throw new OperationFailedException(new ModelNode().set(ModClusterLogger.ROOT_LOGGER.contextOrHostNotFound(webHost, webContext)));
                    }

                    context.completeStep(new OperationContext.RollbackHandler() {
                        @Override
                        public void handleRollback(OperationContext context, ModelNode operation) {
                            service.disableContext(webHost, webContext);
                        }
                    });
                }
            }, OperationContext.Stage.RUNTIME);
        }
View Full Code Here

        if (context.isNormalServer() && context.getServiceRegistry(false).getService(ContainerEventHandlerService.SERVICE_NAME) != null) {
            context.addStep(new OperationStepHandler() {
                @Override
                public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
                    ServiceController<?> controller = context.getServiceRegistry(false).getService(ContainerEventHandlerService.SERVICE_NAME);
                    ModClusterServiceMBean service = (ModClusterServiceMBean) controller.getValue();
                    service.reset();
                    context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER);
                }
            }, OperationContext.Stage.RUNTIME);
        }
View Full Code Here

        if (context.isNormalServer() && context.getServiceRegistry(false).getService(ContainerEventHandlerService.SERVICE_NAME) != null) {
            context.addStep(new OperationStepHandler() {
                @Override
                public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
                    ServiceController<?> controller = context.getServiceRegistry(false).getService(ContainerEventHandlerService.SERVICE_NAME);
                    ModClusterServiceMBean service = (ModClusterServiceMBean) controller.getValue();
                    Map<InetSocketAddress, String> map = service.getProxyInfo();
                    ROOT_LOGGER.debugf("Mod_cluster ListProxies %s", map);
                    if (!map.isEmpty()) {
                        final ModelNode result = new ModelNode();
                        InetSocketAddress[] addr = map.keySet().toArray(new InetSocketAddress[map.size()]);
                        for (InetSocketAddress address : addr) {
View Full Code Here

        if (context.isNormalServer() && context.getServiceRegistry(false).getService(ContainerEventHandlerService.SERVICE_NAME) != null) {
            context.addStep(new OperationStepHandler() {
                @Override
                public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
                    ServiceController<?> controller = context.getServiceRegistry(false).getService(ContainerEventHandlerService.SERVICE_NAME);
                    final ModClusterServiceMBean service = (ModClusterServiceMBean) controller.getValue();
                    ROOT_LOGGER.debugf("add-proxy: %s", operation);

                    final String host = HOST.resolveModelAttribute(context, operation).asString();
                    final int port = PORT.resolveModelAttribute(context, operation).asInt();

                    // Keeping this test here to maintain same behavior as previous versions.
                    try {
                        InetAddress.getByName(host);
                    } catch (UnknownHostException e) {
                        throw new OperationFailedException(ModClusterLogger.ROOT_LOGGER.couldNotResolveProxyIpAddress(), e);
                    }

                    service.addProxy(host, port);

                    context.completeStep(new OperationContext.RollbackHandler() {
                        @Override
                        public void handleRollback(OperationContext context, ModelNode operation) {
                            service.removeProxy(host, port);
                        }
                    });
                }
            }, OperationContext.Stage.RUNTIME);
        }
View Full Code Here

        if (context.isNormalServer() && context.getServiceRegistry(false).getService(ContainerEventHandlerService.SERVICE_NAME) != null) {
            context.addStep(new OperationStepHandler() {
                @Override
                public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
                    ServiceController<?> controller = context.getServiceRegistry(false).getService(ContainerEventHandlerService.SERVICE_NAME);
                    final ModClusterServiceMBean service = (ModClusterServiceMBean) controller.getValue();
                    ROOT_LOGGER.debugf("enable: %s", operation);

                    final int waitTime = WAIT_TIME.resolveModelAttribute(context, operation).asInt();

                    service.stop(waitTime, TimeUnit.SECONDS);

                    context.completeStep(new OperationContext.RollbackHandler() {
                        @Override
                        public void handleRollback(OperationContext context, ModelNode operation) {
                            // TODO We're assuming that the all contexts were previously enabled, but they could have been disabled
                            service.enable();
                        }
                    });
                }
            }, OperationContext.Stage.RUNTIME);
        }
View Full Code Here

        if (context.isNormalServer() && context.getServiceRegistry(false).getService(ContainerEventHandlerService.SERVICE_NAME) != null) {
            context.addStep(new OperationStepHandler() {
                @Override
                public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
                    ServiceController<?> controller = context.getServiceRegistry(false).getService(ContainerEventHandlerService.SERVICE_NAME);
                    final ModClusterServiceMBean service = (ModClusterServiceMBean) controller.getValue();
                    ROOT_LOGGER.debugf("remove-proxy: %s", operation);

                    final String host = HOST.resolveModelAttribute(context, operation).asString();
                    final int port = PORT.resolveModelAttribute(context, operation).asInt();

                    // Keeping this test here to maintain same behavior as previous versions.
                    try {
                        InetAddress.getByName(host);
                    } catch (UnknownHostException e) {
                        throw new OperationFailedException(ModClusterLogger.ROOT_LOGGER.couldNotResolveProxyIpAddress(), e);
                    }

                    service.removeProxy(host, port);

                    context.completeStep(new OperationContext.RollbackHandler() {
                        @Override
                        public void handleRollback(OperationContext context, ModelNode operation) {
                            // TODO What if mod_cluster was never aware of this proxy?
                            service.addProxy(host, port);
                        }
                    });
                }
            }, OperationContext.Stage.RUNTIME);
        }
View Full Code Here

TOP

Related Classes of org.jboss.modcluster.ModClusterServiceMBean

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.