Package org.jboss.as.network

Examples of org.jboss.as.network.SocketBinding


        config.setSocketTimeout(20000);

        // Read node to set configuration.
        if (modelconf.hasDefined(CommonAttributes.ADVERTISE_SOCKET)) {
            // There should be a socket-binding....
            final SocketBinding binding = this.binding.getValue();
            if (binding != null) {
                config.setAdvertisePort(binding.getMulticastPort());
                config.setAdvertiseGroupAddress(binding.getMulticastSocketAddress().getHostName());
                config.setAdvertiseInterface(binding.getSocketAddress().getAddress().getHostAddress());
                if (!defaultavert)
                    log.error("Mod_cluster requires Advertise but Multicast interface is not available");
                config.setAdvertise(true);
            }
        }
View Full Code Here


        final SecurityRealmService securityRealmService = securityRealmServiceValue.getOptionalValue();

        InetSocketAddress bindAddress = null;
        InetSocketAddress secureBindAddress = null;

        SocketBinding basicBinding = injectedSocketBindingValue.getOptionalValue();
        SocketBinding secureBinding = injectedSecureSocketBindingValue.getOptionalValue();
        final NetworkInterfaceBinding interfaceBinding = interfaceBindingValue.getOptionalValue();
        if (interfaceBinding != null) {
            useUnmanagedBindings = true;
            final int port = portValue.getOptionalValue();
            if (port > 0) {
                bindAddress = new InetSocketAddress(interfaceBinding.getAddress(), port);
            }
            final int securePort = securePortValue.getOptionalValue();
            if (securePort > 0) {
                secureBindAddress = new InetSocketAddress(interfaceBinding.getAddress(), securePort);
            }
        } else {
            if (basicBinding != null) {
                bindAddress = basicBinding.getSocketAddress();
            }
            if (secureBinding != null) {
                secureBindAddress = secureBinding.getSocketAddress();
            }
        }

        try {
            serverManagement = ManagementHttpServer.create(bindAddress, secureBindAddress, 50, modelControllerClient, executorService, securityRealmService);
View Full Code Here

                        final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR));
                        final PathElement element = address.getLastElement();
                        final String bindingName = element.getValue();
                        final ModelNode bindingModel = context.readResource(PathAddress.EMPTY_ADDRESS).getModel();
                        final ServiceController<?> controller = context.getServiceRegistry(true).getRequiredService(SOCKET_BINDING.append(bindingName));
                        final SocketBinding binding = controller.getState() == ServiceController.State.UP ? SocketBinding.class.cast(controller.getValue()) : null;
                        final boolean bound = binding != null && binding.isBound();
                        if (binding == null) {
                            // existing is not started, so can't update it. Instead reinstall the service
                            handleBindingReinstall(context, bindingName, bindingModel);
                        }
                        else if (bound) {
View Full Code Here

                @Override
                public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException {
                    final ModelNode result = context.getResult();
                    final ServiceController<?> controller = context.getServiceRegistry(false).getRequiredService(SOCKET_BINDING.append(element.getValue()));
                    if(controller != null && controller.getState() == ServiceController.State.UP) {
                        final SocketBinding binding = SocketBinding.class.cast(controller.getValue());
                        AbstractBindingMetricsHandler.this.execute(operation, binding, result);
                    } else {
                        result.set(getNoMetrics());
                    }
                    context.completeStep();
View Full Code Here

                destinationAddress, destinationPort, this.sourceInterfaceInjectedValue.getOptionalValue(), this.sourcePort,
                this.fixedSourcePort);
    }

    private InetAddress getDestinationAddress() {
        final SocketBinding localDestinationSocketBinding = this.localDestinationSocketBindingInjectedValue.getValue();
        return localDestinationSocketBinding.getSocketAddress().getAddress();
    }
View Full Code Here

        final SocketBinding localDestinationSocketBinding = this.localDestinationSocketBindingInjectedValue.getValue();
        return localDestinationSocketBinding.getSocketAddress().getAddress();
    }

    private int getDestinationPort() {
        final SocketBinding localDestinationSocketBinding = this.localDestinationSocketBindingInjectedValue.getValue();
        // instead of directly using SocketBinding.getPort(), we go via the SocketBinding.getSocketAddress()
        // since the getPort() method doesn't take into account whether the port is a fixed port or whether a offset
        // needs to be added. Alternatively, we could introduce a getAbsolutePort() in the SocketBinding class.
        final InetSocketAddress socketAddress = localDestinationSocketBinding.getSocketAddress();
        return socketAddress.getPort();
    }
View Full Code Here

        this.multicastPort = multicastPort;
    }

    @Override
    public synchronized void start(StartContext context) throws StartException {
        this.binding = new SocketBinding(name, port, isFixedPort,
           multicastAddress, multicastPort,
           interfaceBinding.getOptionalValue(), socketBindings.getValue());
    }
View Full Code Here

        this.binding = null;
    }

    @Override
    public synchronized SocketBinding getValue() throws IllegalStateException {
        final SocketBinding binding = this.binding;
        if(binding == null) {
            throw new IllegalStateException();
        }
        return binding;
    }
View Full Code Here

        config.setSocketTimeout(20000);

        // Read node to set configuration.
        if (modelconf.hasDefined(CommonAttributes.ADVERTISE_SOCKET)) {
            // There should be a socket-binding....
            final SocketBinding binding = this.binding.getValue();
            if (binding != null) {
                config.setAdvertisePort(binding.getMulticastPort());
                config.setAdvertiseGroupAddress(binding.getMulticastSocketAddress().getHostName());
                config.setAdvertiseInterface(binding.getSocketAddress().getAddress().getHostAddress());
                if (!defaultavert)
                    ROOT_LOGGER.multicastInterfaceNotAvailable();
                config.setAdvertise(true);
            }
        }
View Full Code Here

                ServiceName serviceName = IntegrationServices.SYSTEM_SERVICES_PROVIDER.append("BINDINGS");
                ServiceBuilder<Void> builder = serviceTarget.addService(serviceName, new AbstractService<Void>() {
                    @Override
                    public void start(StartContext context) throws StartException {
                        for (ServiceName serviceName : socketBindingNames) {
                            SocketBinding binding = (SocketBinding) serviceContainer.getRequiredService(serviceName).getValue();
                            Dictionary<String, String> props = new Hashtable<String, String>();
                            props.put("socketBinding", serviceName.getSimpleName());
                            InetSocketAddress value = binding.getSocketAddress();
                            syscontext.registerService(InetSocketAddress.class.getName(), value, props);
                        }
                    }
                });
                ServiceName[] serviceNameArray = socketBindingNames.toArray(new ServiceName[socketBindingNames.size()]);
View Full Code Here

TOP

Related Classes of org.jboss.as.network.SocketBinding

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.