Examples of GridDhtPartitionState


Examples of org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtPartitionState

            for (GridDhtPartitionMap parts : allParts.values()) {
                if (!parts.nodeId().equals(g.localNode().id())) {
                    for (Map.Entry<Integer, GridDhtPartitionState> e : parts.entrySet()) {
                        int p = e.getKey();

                        GridDhtPartitionState state = e.getValue();

                        assert state == OWNING || state == MOVING || state == RENTING :
                            "Invalid state [grid=" + g.name() + ", part=" + p + ", state=" + state +
                                ", parts=" + parts + ']';

                        assert state.active();
                    }
                }
            }
        }
    }
View Full Code Here

Examples of org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtPartitionState

    /**
     * @return If partition is moving or owning or renting.
     */
    public boolean valid() {
        GridDhtPartitionState state = state();

        return state == MOVING || state == OWNING || state == RENTING;
    }
View Full Code Here

Examples of org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtPartitionState

    /**
     * @param entry Entry to add.
     */
    void onAdded(GridDhtCacheEntry<K, V> entry) {
        GridDhtPartitionState state = state();

        assert state != EVICTED : "Adding entry to invalid partition: " + this;

        map.put(entry.key(), entry);

View Full Code Here

Examples of org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtPartitionState

     */
    public boolean reserve() {
        while (true) {
            int reservations = state.getStamp();

            GridDhtPartitionState s = state.getReference();

            if (s == EVICTED)
                return false;

            if (state.compareAndSet(s, s, reservations, reservations + 1))
View Full Code Here

Examples of org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtPartitionState

            int reservations = state.getStamp();

            if (reservations == 0)
                return;

            GridDhtPartitionState s = state.getReference();

            assert s != EVICTED;

            // Decrement reservations.
            if (state.compareAndSet(s, s, reservations, --reservations)) {
View Full Code Here

Examples of org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtPartitionState

     */
    boolean own() {
        while (true) {
            int reservations = state.getStamp();

            GridDhtPartitionState s = state.getReference();

            if (s == RENTING || s == EVICTED)
                return false;

            if (s == OWNING)
View Full Code Here

Examples of org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtPartitionState

     */
    GridFuture<?> rent(boolean updateSeq) {
        while (true) {
            int reservations = state.getStamp();

            GridDhtPartitionState s = state.getReference();

            if (s == RENTING || s == EVICTED)
                return rent;

            if (state.compareAndSet(s, RENTING, reservations, reservations)) {
View Full Code Here

Examples of org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtPartitionState

        // Synchronously wait for all renting partitions to complete.
        for (Iterator<GridDhtLocalPartition<K, V>> it = locParts.values().iterator(); it.hasNext();) {
            GridDhtLocalPartition<K, V> p = it.next();

            GridDhtPartitionState state = p.state();

            if (state == RENTING || state == EVICTED) {
                if (log.isDebugEnabled())
                    log.debug("Waiting for renting partition: " + p);
View Full Code Here

Examples of org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtPartitionState

                    boolean belongs = cctx.affinity().localNode(p, topVer);

                    if (locPart != null) {
                        if (!belongs) {
                            GridDhtPartitionState state = locPart.state();

                            if (state.active()) {
                                locPart.rent(false);

                                updateLocal(p, loc.id(), locPart.state(), updateSeq);

                                if (log.isDebugEnabled())
View Full Code Here

Examples of org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtPartitionState

                            log.debug("Skipping local partition afterExchange (will not create): " + p);

                        continue;
                    }

                    GridDhtPartitionState state = locPart.state();

                    if (state == MOVING) {
                        if (cctx.preloadEnabled()) {
                            Collection<GridNode> owners = owners(p);

                            // If there are no other owners, then become an owner.
                            if (F.isEmpty(owners)) {
                                boolean owned = locPart.own();

                                assert owned : "Failed to own partition [cacheName" + cctx.name() + ", locPart=" +
                                    locPart + ']';

                                updateLocal(p, loc.id(), locPart.state(), updateSeq);

                                changed = true;

                                if (log.isDebugEnabled())
                                    log.debug("Owned partition: " + locPart);
                            }
                            else if (log.isDebugEnabled())
                                log.debug("Will not own partition (there are owners to preload from) [locPart=" +
                                    locPart + ", owners = " + owners + ']');
                        }
                        else
                            updateLocal(p, loc.id(), locPart.state(), updateSeq);
                    }
                }
                else {
                    if (locPart != null) {
                        GridDhtPartitionState state = locPart.state();

                        if (state == MOVING) {
                            locPart.rent(false);

                            updateLocal(p, loc.id(), locPart.state(), updateSeq);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.