Package org.wildfly.clustering.group

Examples of org.wildfly.clustering.group.Node


    @Override
    public Map.Entry<K, V> getLocalEntry() {
        K key = this.provider.getKey();
        if (key == null) return null;
        final Map.Entry<K, V> entry = new AbstractMap.SimpleImmutableEntry<>(key, this.provider.getValue());
        final Node node = this.getGroup().getLocalNode();
        try (Batch batch = this.batcher.createBatch()) {
            this.cache.getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES).put(node, entry);
        }
        return entry;
    }
View Full Code Here


        this.channel = channel;
    }

    @Override
    public Node createNode(Address address) {
        Node node = this.nodes.get(address);
        if (node != null) return node;

        IpAddress ipAddress = (IpAddress) this.channel.down(new Event(Event.GET_PHYSICAL_ADDRESS, address));
        InetSocketAddress socketAddress = new InetSocketAddress(ipAddress.getIpAddress(), ipAddress.getPort());
        String name = this.channel.getName(address);
        if (name == null) {
            // If no logical name exists, create one using physical address
            name = String.format("%s:%s", socketAddress.getHostString(), socketAddress.getPort());
        }
        node = new AddressableNode(address, name, socketAddress);
        Node existing = this.nodes.putIfAbsent(address, node);
        return (existing != null) ? existing : node;
    }
View Full Code Here

            ClusteringServerLogger.ROOT_LOGGER.quorumNotReached(this.singletonServiceName.getCanonicalName(), this.quorum);
            return false;
        } else if (size == this.quorum) {
            ClusteringServerLogger.ROOT_LOGGER.quorumJustReached(this.singletonServiceName.getCanonicalName(), this.quorum);
        }
        Node elected = this.election(candidates);
        if (elected != null) {
            ClusteringServerLogger.ROOT_LOGGER.elected(elected.getName(), this.singletonServiceName.getCanonicalName());
        }
        return (elected != null) ? elected.equals(this.group.getValue().getLocalNode()) : false;
    }
View Full Code Here

    }

    @Override
    public void start(StartContext context) throws StartException {
        JGroupsNodeFactory factory = this.factory.getValue();
        Node node = factory.createNode(null);
        this.group = new LocalGroup(this.name, node);
    }
View Full Code Here

        final Future<? extends Map<Address, Rsp<R>>> responses = this.dispatcher.castMessageWithFuture(null, this.createMessage(command), this.createRequestOptions(excludedNodes));

        Map<Node, Future<R>> results = new HashMap<>();
        Set<Node> excluded = (excludedNodes != null) ? new HashSet<>(Arrays.asList(excludedNodes)) : Collections.<Node>emptySet();
        for (Address address: this.dispatcher.getChannel().getView().getMembers()) {
            final Node node = this.factory.createNode(address);
            if (!excluded.contains(node)) {
                Future<R> future = new Future<R>() {
                    @Override
                    public boolean cancel(boolean mayInterruptIfRunning) {
                        return responses.cancel(mayInterruptIfRunning);
View Full Code Here

TOP

Related Classes of org.wildfly.clustering.group.Node

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.