Package gnu.trove.set.hash

Examples of gnu.trove.set.hash.TShortHashSet$TShortHashIterator


        if (line.version > msg.getVersion()) {
            LOG.warn("Got PUTX with version {} which is older than current version {}", msg.getVersion(), line.version);
            return LINE_NO_CHANGE;
        }

        final TShortHashSet sharers = new TShortHashSet((msg.getSharers() != null ? msg.getSharers().length : 0) + 1);
        if (msg.getSharers() != null)
            sharers.addAll(msg.getSharers());
        if (hasServer && msg.getNode() != Comm.SERVER)
            sharers.add(Comm.SERVER); // this is so we make sure the server was notified for the ownership transfer. this is done by INV
        sharers.remove(myNodeId()); // don't INV myself

        int change = LINE_NO_CHANGE;
        change |= line.getState().isLessThan(State.O) ? LINE_OWNER_CHANGED : 0;
        change |= setState(line, sharers.isEmpty() ? State.E : State.O) ? LINE_STATE_CHANGED : 0;
        if (sharers.isEmpty())
            change |= setOwner(line, myNodeId()) ? LINE_OWNER_CHANGED : 0;
        else
            setOwner(line, msg.getNode()); // We set owner to the PREVIOUS owner - used// change |= setOwner(line, cluster.getMyNodeId()) ? LINE_OWNER_CHANGED : 0;
        line.sharers.addAll(sharers);
        line.version = msg.getVersion();
View Full Code Here


        freeLineList.addFirst(line);
    }

    private TShortHashSet allocateSharerSet(int size) {
        if (freeSharerSetList == null)
            return new TShortHashSet(size);

        TShortHashSet sharers = freeSharerSetList.pollFirst();
        if (sharers != null)
            return sharers;
        return new TShortHashSet(size);
    }
View Full Code Here

        try {
            assert message.isBroadcast() && !message.isResponse();

            assignMessageId(message);
            final boolean unicast = getNumPeerNodes() < minimumNodesToMulticast;
            final TShortHashSet nodes = new TShortHashSet();
            for (NodePeer peer : peers.values()) {
                nodes.add(peer.node);
                peer.sendMessage(message, unicast);
                executor.submit(peer);
            }
            if (nodes.isEmpty()) {
                if (message instanceof LineMessage) {
                    LOG.debug("No other nodes in cluster. Responding with NOT_FOUND to message {}", message);
                    receive(Message.NOT_FOUND((LineMessage) message).setIncoming());
                }
                return;
View Full Code Here

        try {
            assert message.isBroadcast() && !message.isResponse();

            assignMessageId(message);
            final boolean unicast = getNumPeerNodes() < minimumNodesToMulticast;
            final TShortHashSet nodes = new TShortHashSet();
            for (NodePeer peer : peers.values()) {
                nodes.add(peer.node);
                peer.sendMessage(message, unicast);
                executor.submit(peer);
            }
            if (nodes.isEmpty()) {
                if (message instanceof LineMessage) {
                    LOG.debug("No other nodes in cluster. Responding with NOT_FOUND to message {}", message);
                    receive(Message.NOT_FOUND((LineMessage) message).setIncoming());
                }
                return;
View Full Code Here

        if (line.version > msg.getVersion()) {
            LOG.warn("Got PUTX with version {} which is older than current version {}", msg.getVersion(), line.version);
            return LINE_NO_CHANGE;
        }

        final TShortHashSet sharers = new TShortHashSet((msg.getSharers() != null ? msg.getSharers().length : 0) + 1);
        if (msg.getSharers() != null)
            sharers.addAll(msg.getSharers());
        if (hasServer && msg.getNode() != Comm.SERVER)
            sharers.add(Comm.SERVER); // this is so we make sure the server was notified for the ownership transfer. this is done by INV
        sharers.remove(myNodeId()); // don't INV myself

        int change = LINE_NO_CHANGE;
        change |= line.getState().isLessThan(State.O) ? LINE_OWNER_CHANGED : 0;
        change |= setState(line, sharers.isEmpty() ? State.E : State.O) ? LINE_STATE_CHANGED : 0;
        if (sharers.isEmpty())
            change |= setOwner(line, myNodeId()) ? LINE_OWNER_CHANGED : 0;
        else
            setOwner(line, msg.getNode()); // We set owner to the PREVIOUS owner - used// change |= setOwner(line, cluster.getMyNodeId()) ? LINE_OWNER_CHANGED : 0;
        line.sharers.addAll(sharers);
        line.version = msg.getVersion();
View Full Code Here

        freeLineList.addFirst(line);
    }

    private TShortHashSet allocateSharerSet(int size) {
        if (freeSharerSetList == null)
            return new TShortHashSet(size);

        TShortHashSet sharers = freeSharerSetList.pollFirst();
        if (sharers != null)
            return sharers;
        return new TShortHashSet(size);
    }
View Full Code Here

        final LineMessage message;
        final TShortHashSet nodes;

        public BroadcastEntry(LineMessage message, Set<Short> nodes) {
            this.message = message;
            this.nodes = new TShortHashSet(nodes);
            this.nodes.remove(Comm.SERVER); // NOT TO SERVER
            LOG.debug("Awaiting ACKS for message {} from nodes {}", message, this.nodes);
        }
View Full Code Here

        if (line.version > msg.getVersion()) {
            LOG.warn("Got PUTX with version {} which is older than current version {}", msg.getVersion(), line.version);
            return LINE_NO_CHANGE;
        }

        final TShortHashSet sharers = new TShortHashSet((msg.getSharers() != null ? msg.getSharers().length : 0) + 1);
        if (msg.getSharers() != null)
            sharers.addAll(msg.getSharers());
        if (hasServer && msg.getNode() != Comm.SERVER)
            sharers.add(Comm.SERVER); // this is so we make sure the server was notified for the ownership transfer. this is done by INV
        sharers.remove(myNodeId()); // don't INV myself

        int change = LINE_NO_CHANGE;
        change |= line.getState().isLessThan(State.O) ? LINE_OWNER_CHANGED : 0;
        change |= setState(line, sharers.isEmpty() ? State.E : State.O) ? LINE_STATE_CHANGED : 0;
        if (sharers.isEmpty())
            change |= setOwner(line, myNodeId()) ? LINE_OWNER_CHANGED : 0;
        else
            setOwner(line, msg.getNode()); // We set owner to the PREVIOUS owner - used// change |= setOwner(line, cluster.getMyNodeId()) ? LINE_OWNER_CHANGED : 0;
        line.sharers.addAll(sharers);
        line.version = msg.getVersion();
View Full Code Here

        freeLineList.addFirst(line);
    }

    private TShortHashSet allocateSharerSet(int size) {
        if (freeSharerSetList == null)
            return new TShortHashSet(size);

        TShortHashSet sharers = freeSharerSetList.pollFirst();
        if (sharers != null)
            return sharers;
        return new TShortHashSet(size);
    }
View Full Code Here

        final LineMessage message;
        final TShortHashSet nodes;

        public BroadcastEntry(LineMessage message, Set<Short> nodes) {
            this.message = message;
            this.nodes = new TShortHashSet(nodes);
            this.nodes.remove(Comm.SERVER); // NOT TO SERVER
            LOG.debug("Awaiting ACKS for message {} from nodes {}", message, this.nodes);
        }
View Full Code Here

TOP

Related Classes of gnu.trove.set.hash.TShortHashSet$TShortHashIterator

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.