# Remove dead code.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/448e9c3c Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/448e9c3c Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/448e9c3c Branch: refs/heads/ignite-gg-9933 Commit: 448e9c3c685a8ad08f2e0c02ce455409d487f989 Parents: d6fdf05 Author: sevdokimov <sevdoki...@gridgain.com> Authored: Thu Mar 19 17:35:04 2015 +0300 Committer: sevdokimov <sevdoki...@gridgain.com> Committed: Thu Mar 19 17:35:04 2015 +0300 ---------------------------------------------------------------------- .../cache/GridCacheAffinityManager.java | 50 --------- .../processors/cache/GridPartitionLockKey.java | 104 ------------------- .../preloader/GridDhtPartitionSupplyPool.java | 2 +- .../resources/META-INF/classnames.properties | 1 - 4 files changed, 1 insertion(+), 156 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/448e9c3c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java index c92e1fb..7298188 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java @@ -33,50 +33,13 @@ import java.util.*; * Cache affinity manager. */ public class GridCacheAffinityManager extends GridCacheManagerAdapter { - /** Factor for maximum number of attempts to calculate all partition affinity keys. */ - private static final int MAX_PARTITION_KEY_ATTEMPT_RATIO = 10; - /** Affinity cached function. */ private GridAffinityAssignmentCache aff; - /** Affinity keys. */ - private GridPartitionLockKey[] partAffKeys; - /** {@inheritDoc} */ @Override public void start0() throws IgniteCheckedException { aff = new GridAffinityAssignmentCache(cctx, cctx.namex(), cctx.config().getAffinity(), cctx.config().getAffinityMapper(), cctx.config().getBackups()); - - // Generate internal keys for partitions. - int partCnt = partitions(); - - partAffKeys = new GridPartitionLockKey[partCnt]; - - Collection<Integer> found = new HashSet<>(); - - long affKey = 0; - - while (true) { - GridPartitionLockKey key = new GridPartitionLockKey(affKey); - - int part = aff.partition(key); - - if (found.add(part)) { - // This is a key for not yet calculated partition. - key.partitionId(part); - - partAffKeys[part] = key; - - if (found.size() == partCnt) - break; - } - - affKey++; - - if (affKey > partCnt * MAX_PARTITION_KEY_ATTEMPT_RATIO) - throw new IllegalStateException("Failed to calculate partition affinity keys for given affinity " + - "function [attemptCnt=" + affKey + ", found=" + found + ", cacheName=" + cctx.name() + ']'); - } } /** {@inheritDoc} */ @@ -178,19 +141,6 @@ public class GridCacheAffinityManager extends GridCacheManagerAdapter { } /** - * Gets partition affinity key for given partition id. Partition affinity keys are precalculated - * on manager start. - * - * @param partId Partition ID. - * @return Affinity key. - */ - public GridPartitionLockKey partitionAffinityKey(int partId) { - assert partId >=0 && partId < partAffKeys.length; - - return partAffKeys[partId]; - } - - /** * NOTE: Use this method always when you need to calculate partition id for * a key provided by user. It's required since we should apply affinity mapper * logic in order to find a key that will eventually be passed to affinity function. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/448e9c3c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridPartitionLockKey.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridPartitionLockKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridPartitionLockKey.java deleted file mode 100644 index 62982c0..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridPartitionLockKey.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache; - -import org.apache.ignite.internal.util.tostring.*; -import org.apache.ignite.internal.util.typedef.internal.*; - -import java.io.*; - -/** - * Internal key that is guaranteed to be mapped on particular partition. - * This class is used for group-locking transactions that lock the whole partition. - */ -public class GridPartitionLockKey implements GridCacheInternal, Externalizable { - /** */ - private static final long serialVersionUID = 0L; - - /** Partition ID. */ - private int partId; - - /** Key itself. */ - @GridToStringInclude - private Object key; - - /** - * Required by {@link Externalizable}. - */ - public GridPartitionLockKey() { - // No-op. - } - - /** - * @param key Key. - */ - public GridPartitionLockKey(Object key) { - assert key != null; - - this.key = key; - } - - /** - * @param partId Partition ID. - */ - public void partitionId(int partId) { - this.partId = partId; - } - - /** - * @return Partition ID. - */ - public int partitionId() { - return partId; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (! (o instanceof GridPartitionLockKey)) - return false; - - GridPartitionLockKey that = (GridPartitionLockKey)o; - - return key.equals(that.key); - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - return key.hashCode(); - } - - /** {@inheritDoc} */ - public String toString() { - return S.toString(GridPartitionLockKey.class, this); - } - - /** {@inheritDoc} */ - @Override public void writeExternal(ObjectOutput out) throws IOException { - out.writeInt(partId); - out.writeObject(key); - } - - /** {@inheritDoc} */ - @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - partId = in.readInt(); - key = in.readObject(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/448e9c3c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyPool.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyPool.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyPool.java index 70f7d29..74c1f33 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyPool.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyPool.java @@ -310,7 +310,7 @@ class GridDhtPartitionSupplyPool<K, V> { GridCacheEntryInfo info = e.info(); - if (info != null && !(info.key() instanceof GridPartitionLockKey) && !info.isNew()) { + if (info != null && !info.isNew()) { if (preloadPred == null || preloadPred.apply(info)) s.addEntry(part, info, cctx); else if (log.isDebugEnabled()) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/448e9c3c/modules/core/src/main/resources/META-INF/classnames.properties ---------------------------------------------------------------------- diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties index 8e2f633..68765df 100644 --- a/modules/core/src/main/resources/META-INF/classnames.properties +++ b/modules/core/src/main/resources/META-INF/classnames.properties @@ -421,7 +421,6 @@ org.apache.ignite.internal.processors.cache.GridCacheValueCollection$1 org.apache.ignite.internal.processors.cache.GridCacheWriteBehindStore$StatefulValue org.apache.ignite.internal.processors.cache.GridCacheWriteBehindStore$StoreOperation org.apache.ignite.internal.processors.cache.GridCacheWriteBehindStore$ValueStatus -org.apache.ignite.internal.processors.cache.GridPartitionLockKey org.apache.ignite.internal.processors.cache.IgniteCacheProxy org.apache.ignite.internal.processors.cache.IgniteCacheProxy$1 org.apache.ignite.internal.processors.cache.IgniteCacheProxy$2