Package org.jboss.as.clustering.jgroups

Examples of org.jboss.as.clustering.jgroups.ChannelFactory


    protected void destroyService() {
        // no-op
    }

    protected Channel createChannel() {
        ChannelFactory factory = this.getChannelFactory();
        if (factory == null) {
            throw new IllegalStateException("HAPartitionConfig has no JChannelFactory");
        }
        String stack = this.getChannelStackName();
        if (stack == null) {
            throw new IllegalStateException("HAPartitionConfig has no multiplexer stack");
        }
        try {
            return factory.createChannel(this.getGroupName());
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new RuntimeException("Failure creating multiplexed Channel", e);
        }
View Full Code Here


                final List<BroadcastGroupConfiguration> newConfigs = new ArrayList<BroadcastGroupConfiguration>();
                for(final BroadcastGroupConfiguration config : broadcastGroups) {
                    final String name = config.getName();
                    final String key = "broadcast" + name;
                    if (jgroupFactories.containsKey(key)) {
                        ChannelFactory channelFactory = jgroupFactories.get(key);
                        String channelName = jgroupsChannels.get(key);
                        JChannel channel = (JChannel) channelFactory.createChannel(channelName);
                        channels.put(channelName, channel);
                        newConfigs.add(BroadcastGroupAdd.createBroadcastGroupConfiguration(name, config, channel, channelName));
                    } else {
                        final SocketBinding binding = groupBindings.get(key);
                        if (binding == null) {
                            throw MESSAGES.failedToFindBroadcastSocketBinding(name);
                        }
                       newConfigs.add(BroadcastGroupAdd.createBroadcastGroupConfiguration(name, config, binding));
                    }
                }
                configuration.getBroadcastGroupConfigurations().clear();
                configuration.getBroadcastGroupConfigurations().addAll(newConfigs);
            }
            if(discoveryGroups != null) {
                configuration.setDiscoveryGroupConfigurations(new HashMap<String, DiscoveryGroupConfiguration>());
                for(final Map.Entry<String, DiscoveryGroupConfiguration> entry : discoveryGroups.entrySet()) {
                    final String name = entry.getKey();
                    final String key = "discovery" + name;
                    DiscoveryGroupConfiguration config = null;
                    if (jgroupFactories.containsKey(key)) {
                        ChannelFactory channelFactory = jgroupFactories.get(key);
                        String channelName = jgroupsChannels.get(key);
                        JChannel channel = channels.get(channelName);
                        if (channel == null) {
                            channel = (JChannel) channelFactory.createChannel(key);
                            channels.put(channelName, channel);
                        }
                        config = DiscoveryGroupAdd.createDiscoveryGroupConfiguration(name, entry.getValue(), channel, channelName);
                    } else {
                        final SocketBinding binding = groupBindings.get(key);
View Full Code Here

    protected void destroyService() {
        // no-op
    }

    protected Channel createChannel() {
        ChannelFactory factory = this.getChannelFactory();
        if (factory == null) {
            throw MESSAGES.haPartitionConfigHasNo("JChannelFactory");
        }
        String stack = this.getChannelStackName();
        if (stack == null) {
            throw MESSAGES.haPartitionConfigHasNo("multiplexer stack");
        }
        try {
            return factory.createChannel(this.getGroupName());
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw MESSAGES.failedToCreateMultiplexChannel(e);
        }
View Full Code Here

    protected void destroyService() {
        // no-op
    }

    protected Channel createChannel() {
        ChannelFactory factory = this.getChannelFactory();
        if (factory == null) {
            throw MESSAGES.haPartitionConfigHasNo("JChannelFactory");
        }
        String stack = this.getChannelStackName();
        if (stack == null) {
            throw MESSAGES.haPartitionConfigHasNo("multiplexer stack");
        }
        try {
            return factory.createChannel(this.getGroupName());
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw MESSAGES.failedToCreateMultiplexChannel(e);
        }
View Full Code Here

        try {
            ServiceController<ChannelFactory> controller = ServiceContainerHelper.getService(registry, serviceName);
            ServiceController.Mode mode = controller.getMode();
            controller.setMode(ServiceController.Mode.ACTIVE);
            try {
                ChannelFactory factory = controller.awaitValue();
                // Create a temporary channel, but don't connect it
                Channel channel = factory.createChannel(UUID.randomUUID().toString());
                try {
                    // ProtocolStack.printProtocolSpecAsXML() is very hacky and only works on an uninitialized stack
                    List<Protocol> protocols = channel.getProtocolStack().getProtocols();
                    Collections.reverse(protocols);
                    ProtocolStack stack = new ProtocolStack();
View Full Code Here

        return this.channel;
    }

    @Override
    public void start(StartContext context) throws StartException {
        ChannelFactory factory = this.factory.getValue();
        try {
            this.channel = factory.createChannel(this.id);
            this.channel.addChannelListener(this);
            // Don't connect the channel here
            // This will be done by Infinispan (see AS7-5904)
        } catch (Exception e) {
            throw new StartException(e);
View Full Code Here

        }

        @Override
        protected void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException {

            ChannelFactory factory = getChannelFactory(context, operation);
            // need to check for null
            if (factory == null) {
                context.getFailureDescription().set("required service ChannelFactoryService is not started");
                context.completeStep();
                return;
View Full Code Here

            if (channelFactoryServiceController.getState() != ServiceController.State.UP) {
                // need to start the controller and wait for it to start
                return null ;
            }
            ChannelFactory factory = ChannelFactory.class.cast(channelFactoryServiceController.getValue());

            return factory ;
        }
View Full Code Here

            ServiceName serviceName = ChannelFactoryService.getServiceName(stackName);
            try {
                ServiceController<?> controller = registry.getRequiredService(serviceName);
                controller.setMode(ServiceController.Mode.ACTIVE);
                try {
                    ChannelFactory factory = ServiceContainerHelper.getValue(controller, ChannelFactory.class);
                    // Create a temporary channel, but don't connect it
                    Channel channel = factory.createChannel(UUID.randomUUID().toString());
                    try {
                        // ProtocolStack.printProtocolSpecAsXML() is very hacky and only works on an uninitialized stack
                        List<Protocol> protocols = channel.getProtocolStack().getProtocols();
                        Collections.reverse(protocols);
                        ProtocolStack stack = new ProtocolStack();
View Full Code Here

        return this.channel;
    }

    @Override
    public void start(StartContext context) throws StartException {
        ChannelFactory factory = this.factory.getValue();
        try {
            this.channel = factory.createChannel(this.id);
            if (this.channel.getProtocolStack().findProtocol(STATE_TRANSFER.class, STATE.class, STATE_SOCK.class) != null) {
                this.channel.connect(this.id, null, STATE_TRANSFER_TIMEOUT);
            } else {
                this.channel.connect(this.id);
            }
        } catch (Exception e) {
            throw new StartException(e);
        }
        // Validate view
        String localName = this.channel.getName();
        Address localAddress = this.channel.getAddress();
        for (Address address: this.channel.getView()) {
            String name = this.channel.getName(address);
            if ((name != null) && name.equals(localName) && !address.equals(localAddress)) {
                this.channel.close();
                throw JGroupsMessages.MESSAGES.duplicateNodeName(factory.getProtocolStackConfiguration().getEnvironment().getNodeName());
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.as.clustering.jgroups.ChannelFactory

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.