ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [42/42] incubator-ignite git commit: # ignite-286
Date Wed, 29 Apr 2015 14:28:43 GMT
# ignite-286


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5d5bdee8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5d5bdee8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5d5bdee8

Branch: refs/heads/ignite-286
Commit: 5d5bdee8cf81ed94e99ca7646ea60dc74b3431d4
Parents: 9cab2af
Author: sboikov <sboikov@gridgain.com>
Authored: Wed Apr 29 17:27:39 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Wed Apr 29 17:27:39 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheSwapManager.java  | 40 +++++++++++---------
 .../cache/query/GridCacheQueryManager.java      |  4 +-
 .../cache/OffHeapTieredTransactionSelfTest.java |  1 -
 3 files changed, 24 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5d5bdee8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
index da4d40b..eb82218 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
@@ -1559,7 +1559,9 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
      * @return Off-heap iterator.
      */
     public <T> GridCloseableIterator<T> rawOffHeapIterator(final CX2<T2<Long,
Integer>, T2<Long, Integer>, T> c,
-        boolean primary, boolean backup) {
+        boolean primary,
+        boolean backup)
+    {
         assert c != null;
 
         if (!offheapEnabled || (!primary && !backup))
@@ -1575,7 +1577,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
         Set<Integer> parts = primary ? cctx.affinity().primaryPartitions(cctx.localNodeId(),
ver) :
             cctx.affinity().backupPartitions(cctx.localNodeId(), ver);
 
-        return new ClosablePartitionsIterator<T, T>(parts) {
+        return new CloseablePartitionsIterator<T, T>(parts) {
             @Override protected GridCloseableIterator<T> partitionIterator(int part)
                 throws IgniteCheckedException
             {
@@ -1589,14 +1591,15 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter
{
      * @param backup Include backups.
      * @return Raw off-heap iterator.
      */
-    public GridCloseableIterator<Map.Entry<byte[], byte[]>> rawOffHeapIterator(final
boolean primary, final boolean backup) {
+    public GridCloseableIterator<Map.Entry<byte[], byte[]>> rawOffHeapIterator(final
boolean primary,
+        final boolean backup)
+    {
         if (!offheapEnabled || (!primary && !backup))
             return new GridEmptyCloseableIterator<>();
 
         if (primary && backup)
             return new GridCloseableIteratorAdapter<Map.Entry<byte[], byte[]>>()
{
-                private GridCloseableIterator<IgniteBiTuple<byte[], byte[]>>
it =
-                    offheap.iterator(spaceName);
+                private GridCloseableIterator<IgniteBiTuple<byte[], byte[]>>
it = offheap.iterator(spaceName);
 
                 private Map.Entry<byte[], byte[]> cur;
 
@@ -1626,7 +1629,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
         Set<Integer> parts = primary ? cctx.affinity().primaryPartitions(cctx.localNodeId(),
ver) :
             cctx.affinity().backupPartitions(cctx.localNodeId(), ver);
 
-        return new ClosablePartitionsIterator<Map.Entry<byte[], byte[]>, IgniteBiTuple<byte[],
byte[]>>(parts) {
+        return new CloseablePartitionsIterator<Map.Entry<byte[], byte[]>, IgniteBiTuple<byte[],
byte[]>>(parts) {
             private Map.Entry<byte[], byte[]> cur;
 
             @Override protected Map.Entry<byte[], byte[]> onNext() {
@@ -1672,7 +1675,9 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
      * @param backup Include backups.
      * @throws IgniteCheckedException If failed.
      */
-    public GridCloseableIterator<Map.Entry<byte[], byte[]>> rawSwapIterator(boolean
primary, boolean backup) throws IgniteCheckedException {
+    public GridCloseableIterator<Map.Entry<byte[], byte[]>> rawSwapIterator(boolean
primary, boolean backup)
+        throws IgniteCheckedException
+    {
         if (!swapEnabled || (!primary && !backup))
             return new GridEmptyCloseableIterator<>();
 
@@ -1686,7 +1691,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
         Set<Integer> parts = primary ? cctx.affinity().primaryPartitions(cctx.localNodeId(),
ver) :
             cctx.affinity().backupPartitions(cctx.localNodeId(), ver);
 
-        return new ClosablePartitionsIterator<Map.Entry<byte[], byte[]>, Map.Entry<byte[],
byte[]>>(parts) {
+        return new CloseablePartitionsIterator<Map.Entry<byte[], byte[]>, Map.Entry<byte[],
byte[]>>(parts) {
             @Override protected GridCloseableIterator<Map.Entry<byte[], byte[]>>
partitionIterator(int part)
                 throws IgniteCheckedException
             {
@@ -1732,7 +1737,9 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
      * @return Offheap entries iterator.
      * @throws IgniteCheckedException If failed.
      */
-    public <K, V> Iterator<Cache.Entry<K, V>> offheapIterator(boolean primary,
boolean backup, AffinityTopologyVersion topVer)
+    public <K, V> Iterator<Cache.Entry<K, V>> offheapIterator(boolean primary,
+        boolean backup,
+        AffinityTopologyVersion topVer)
         throws IgniteCheckedException
     {
         assert primary || backup;
@@ -1947,7 +1954,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
     /**
      *
      */
-    private abstract class PartitionsIterator<K, V>  extends PartitionsAbstractIterator<Cache.Entry<K,
V>> {
+    private abstract class PartitionsIterator<K, V> extends PartitionsAbstractIterator<Cache.Entry<K,
V>> {
         /**
          * @param parts Partitions
          */
@@ -1958,8 +1965,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
         /** {@inheritDoc} */
         @Override protected Iterator<Cache.Entry<K, V>> partitionIterator(int
part)
             throws IgniteCheckedException {
-            return cacheEntryIterator(
-                GridCacheSwapManager.this.<K, V>lazyIterator(nextPartition(part)));
+            return cacheEntryIterator(GridCacheSwapManager.this.<K, V>lazyIterator(nextPartition(part)));
         }
 
         /**
@@ -2060,7 +2066,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
     /**
      *
      */
-    private abstract class ClosablePartitionsIterator<T, T1 extends T> extends GridCloseableIteratorAdapter<T>
{
+    private abstract class CloseablePartitionsIterator<T, T1 extends T> extends GridCloseableIteratorAdapter<T>
{
         /** */
         private Iterator<Integer> partIt;
 
@@ -2073,14 +2079,14 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter
{
         /**
          * @param parts Partitions
          */
-        public ClosablePartitionsIterator(Collection<Integer> parts) {
+        public CloseablePartitionsIterator(Collection<Integer> parts) {
             this.partIt = parts.iterator();
 
             try {
                 advance();
             }
             catch (IgniteCheckedException e) {
-                e.printStackTrace(); // Should never happen.
+                throw U.convertException(e);
             }
         }
 
@@ -2114,6 +2120,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
 
         /**
          * Switches to next element.
+         * @throws IgniteCheckedException If failed.
          */
         private void advance() throws IgniteCheckedException {
             next = null;
@@ -2153,7 +2160,6 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
          * @return Iterator for given partition.
          * @throws IgniteCheckedException If failed.
          */
-        abstract protected GridCloseableIterator<T1> partitionIterator(int part)
-            throws IgniteCheckedException;
+        abstract protected GridCloseableIterator<T1> partitionIterator(int part) throws
IgniteCheckedException;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5d5bdee8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index e7c4246..16a8028 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -914,9 +914,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
         throws IgniteCheckedException {
         IgniteBiPredicate<K, V> filter = qry.scanFilter();
 
-        Iterator<Map.Entry<byte[], byte[]>> it;
-
-        it = cctx.swap().rawSwapIterator(true, backups);
+        Iterator<Map.Entry<byte[], byte[]>> it = cctx.swap().rawSwapIterator(true,
backups);
 
         return scanIterator(it, filter, qry.keepPortable());
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5d5bdee8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/OffHeapTieredTransactionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/OffHeapTieredTransactionSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/OffHeapTieredTransactionSelfTest.java
index 7af7b5d..671d6c4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/OffHeapTieredTransactionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/OffHeapTieredTransactionSelfTest.java
@@ -86,7 +86,6 @@ public class OffHeapTieredTransactionSelfTest extends GridCommonAbstractTest
{
      * @throws Exception In case of error.
      */
     public void testPutAll() throws Exception {
-
         IgniteCache<String, Integer> cache = grid(0).cache(null);
 
         final int KEYS = 5;


Mime
View raw message