ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [49/50] [abbrv] ignite git commit: ignite-2893
Date Thu, 06 Apr 2017 13:31:56 GMT
http://git-wip-us.apache.org/repos/asf/ignite/blob/1e186403/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSemaphoreImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSemaphoreImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSemaphoreImpl.java
index a1c0515..6ebd655 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSemaphoreImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSemaphoreImpl.java
@@ -108,6 +108,7 @@ public final class GridCacheSemaphoreImpl implements GridCacheSemaphoreEx,
Exter
      * Synchronization implementation for semaphore. Uses AQS state to represent permits.
      */
     final class Sync extends AbstractQueuedSynchronizer {
+        /** */
         private static final long serialVersionUID = 1192457210091910933L;
 
         /** Map containing number of acquired permits for each node waiting on this semaphore.
*/
@@ -131,7 +132,7 @@ public final class GridCacheSemaphoreImpl implements GridCacheSemaphoreEx,
Exter
          *
          * @param nodeMap NodeMap.
          */
-        protected synchronized void setWaiters(Map<UUID, Integer> nodeMap) {
+        synchronized void setWaiters(Map<UUID, Integer> nodeMap) {
             this.nodeMap = nodeMap;
         }
 
@@ -140,7 +141,7 @@ public final class GridCacheSemaphoreImpl implements GridCacheSemaphoreEx,
Exter
          *
          * @return Number of nodes waiting at this semaphore.
          */
-        public int getWaiters() {
+        int getWaiters() {
             int totalWaiters = 0;
 
             for (Integer i : nodeMap.values()) {
@@ -158,7 +159,7 @@ public final class GridCacheSemaphoreImpl implements GridCacheSemaphoreEx,
Exter
          * @return Number of permits node has acquired at this semaphore. Can be less than
0 if more permits were
          * released than acquired on node.
          */
-        public int getPermitsForNode(UUID nodeID) {
+        int getPermitsForNode(UUID nodeID) {
             return nodeMap.containsKey(nodeID) ? nodeMap.get(nodeID) : 0;
         }
 
@@ -219,9 +220,8 @@ public final class GridCacheSemaphoreImpl implements GridCacheSemaphoreEx,
Exter
 
                 int remaining = available - acquires;
 
-                if (remaining < 0 || compareAndSetGlobalState(available, remaining, false))
{
+                if (remaining < 0 || compareAndSetGlobalState(available, remaining, false))
                     return remaining;
-                }
             }
         }
 
@@ -265,10 +265,10 @@ public final class GridCacheSemaphoreImpl implements GridCacheSemaphoreEx,
Exter
                 if (broken)
                     return 1;
 
-                int current = getState();
+                int curr = getState();
 
-                if (current == 0 || compareAndSetGlobalState(current, 0, true))
-                    return current;
+                if (curr == 0 || compareAndSetGlobalState(curr, 0, true))
+                    return curr;
             }
         }
 
@@ -280,10 +280,9 @@ public final class GridCacheSemaphoreImpl implements GridCacheSemaphoreEx,
Exter
          * @param draining True if used for draining the permits.
          * @return True if this is the call that succeeded to change the global state.
          */
-        protected boolean compareAndSetGlobalState(final int expVal, final int newVal, final
boolean draining) {
+        boolean compareAndSetGlobalState(final int expVal, final int newVal, final boolean
draining) {
             try {
-                return CU.outTx(
-                    retryTopologySafe(new Callable<Boolean>() {
+                return retryTopologySafe(new Callable<Boolean>() {
                         @Override public Boolean call() throws Exception {
                             try (GridNearTxLocal tx = CU.txStartInternal(ctx,
                                 semView,
@@ -331,9 +330,7 @@ public final class GridCacheSemaphoreImpl implements GridCacheSemaphoreEx,
Exter
                                 throw e;
                             }
                         }
-                    }),
-                    ctx
-                );
+                    });
             }
             catch (IgniteCheckedException e) {
                 if (ctx.kernalContext().isStopping()) {
@@ -353,10 +350,9 @@ public final class GridCacheSemaphoreImpl implements GridCacheSemaphoreEx,
Exter
          * @param nodeId ID of the failing node.
          * @return True if this is the call that succeeded to change the global state.
          */
-        protected boolean releaseFailedNode(final UUID nodeId) {
+        boolean releaseFailedNode(final UUID nodeId) {
             try {
-                return CU.outTx(
-                    retryTopologySafe(new Callable<Boolean>() {
+                return retryTopologySafe(new Callable<Boolean>() {
                         @Override public Boolean call() throws Exception {
                             try (
                                 GridNearTxLocal tx = CU.txStartInternal(ctx,
@@ -401,9 +397,7 @@ public final class GridCacheSemaphoreImpl implements GridCacheSemaphoreEx,
Exter
                                 throw e;
                             }
                         }
-                    }),
-                    ctx
-                );
+                    });
             }
             catch (IgniteCheckedException e) {
                 if (ctx.kernalContext().isStopping()) {
@@ -451,8 +445,7 @@ public final class GridCacheSemaphoreImpl implements GridCacheSemaphoreEx,
Exter
     private void initializeSemaphore() throws IgniteCheckedException {
         if (!initGuard.get() && initGuard.compareAndSet(false, true)) {
             try {
-                sync = CU.outTx(
-                    retryTopologySafe(new Callable<Sync>() {
+                sync = retryTopologySafe(new Callable<Sync>() {
                         @Override public Sync call() throws Exception {
                             try (GridNearTxLocal tx = CU.txStartInternal(ctx,
                                 semView, PESSIMISTIC, REPEATABLE_READ)) {
@@ -476,9 +469,7 @@ public final class GridCacheSemaphoreImpl implements GridCacheSemaphoreEx,
Exter
                                 return new Sync(cnt, waiters, failoverSafe);
                             }
                         }
-                    }),
-                    ctx
-                );
+                    });
 
                 if (log.isDebugEnabled())
                     log.debug("Initialized internal sync structure: " + sync);
@@ -672,8 +663,7 @@ public final class GridCacheSemaphoreImpl implements GridCacheSemaphoreEx,
Exter
         try {
             initializeSemaphore();
 
-            ret = CU.outTx(
-                retryTopologySafe(new Callable<Integer>() {
+            ret = retryTopologySafe(new Callable<Integer>() {
                     @Override public Integer call() throws Exception {
                         try (
                             GridNearTxLocal tx = CU.txStartInternal(ctx,
@@ -691,9 +681,7 @@ public final class GridCacheSemaphoreImpl implements GridCacheSemaphoreEx,
Exter
                             return cnt;
                         }
                     }
-                }),
-                ctx
-            );
+                });
         }
         catch (IgniteCheckedException e) {
             throw U.convertException(e);
@@ -729,12 +717,12 @@ public final class GridCacheSemaphoreImpl implements GridCacheSemaphoreEx,
Exter
         try {
             initializeSemaphore();
 
-            boolean result = sync.nonfairTryAcquireShared(1) >= 0;
+            boolean res = sync.nonfairTryAcquireShared(1) >= 0;
 
             if (isBroken())
                 throw new InterruptedException();
 
-            return result;
+            return res;
         }
         catch (IgniteCheckedException e) {
             throw U.convertException(e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/1e186403/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetProxy.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetProxy.java
index 0eb6307..3dfa71f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetProxy.java
@@ -25,14 +25,12 @@ import java.io.ObjectOutput;
 import java.io.ObjectStreamException;
 import java.util.Collection;
 import java.util.Iterator;
-import java.util.concurrent.Callable;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteSet;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.GridCacheGateway;
 import org.apache.ignite.internal.util.GridSpinBusyLock;
-import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.lang.IgniteCallable;
@@ -113,18 +111,8 @@ public class GridCacheSetProxy<T> implements IgniteSet<T>,
Externalizable {
             gate.enter();
 
             try {
-                if (cctx.transactional())
-                    return CU.outTx(new Callable<Integer>() {
-                        @Override public Integer call() throws Exception {
-                            return delegate.size();
-                        }
-                    }, cctx);
-
                 return delegate.size();
             }
-            catch (IgniteCheckedException e) {
-                throw U.convertException(e);
-            }
             finally {
                 gate.leave();
             }
@@ -142,18 +130,8 @@ public class GridCacheSetProxy<T> implements IgniteSet<T>,
Externalizable {
             gate.enter();
 
             try {
-                if (cctx.transactional())
-                    return CU.outTx(new Callable<Boolean>() {
-                        @Override public Boolean call() throws Exception {
-                            return delegate.isEmpty();
-                        }
-                    }, cctx);
-
                 return delegate.isEmpty();
             }
-            catch (IgniteCheckedException e) {
-                throw U.convertException(e);
-            }
             finally {
                 gate.leave();
             }
@@ -171,18 +149,8 @@ public class GridCacheSetProxy<T> implements IgniteSet<T>,
Externalizable {
             gate.enter();
 
             try {
-                if (cctx.transactional())
-                    return CU.outTx(new Callable<Boolean>() {
-                        @Override public Boolean call() throws Exception {
-                            return delegate.contains(o);
-                        }
-                    }, cctx);
-
                 return delegate.contains(o);
             }
-            catch (IgniteCheckedException e) {
-                throw U.convertException(e);
-            }
             finally {
                 gate.leave();
             }
@@ -200,18 +168,8 @@ public class GridCacheSetProxy<T> implements IgniteSet<T>,
Externalizable {
             gate.enter();
 
             try {
-                if (cctx.transactional())
-                    return CU.outTx(new Callable<Object[]>() {
-                        @Override public Object[] call() throws Exception {
-                            return delegate.toArray();
-                        }
-                    }, cctx);
-
                 return delegate.toArray();
             }
-            catch (IgniteCheckedException e) {
-                throw U.convertException(e);
-            }
             finally {
                 gate.leave();
             }
@@ -229,18 +187,8 @@ public class GridCacheSetProxy<T> implements IgniteSet<T>,
Externalizable {
             gate.enter();
 
             try {
-                if (cctx.transactional())
-                    return CU.outTx(new Callable<T1[]>() {
-                        @Override public T1[] call() throws Exception {
-                            return delegate.toArray(a);
-                        }
-                    }, cctx);
-
                 return delegate.toArray(a);
             }
-            catch (IgniteCheckedException e) {
-                throw U.convertException(e);
-            }
             finally {
                 gate.leave();
             }
@@ -258,18 +206,8 @@ public class GridCacheSetProxy<T> implements IgniteSet<T>,
Externalizable {
             gate.enter();
 
             try {
-                if (cctx.transactional())
-                    return CU.outTx(new Callable<Boolean>() {
-                        @Override public Boolean call() throws Exception {
-                            return delegate.add(t);
-                        }
-                    }, cctx);
-
                 return delegate.add(t);
             }
-            catch (IgniteCheckedException e) {
-                throw U.convertException(e);
-            }
             finally {
                 gate.leave();
             }
@@ -287,18 +225,8 @@ public class GridCacheSetProxy<T> implements IgniteSet<T>,
Externalizable {
             gate.enter();
 
             try {
-                if (cctx.transactional())
-                    return CU.outTx(new Callable<Boolean>() {
-                        @Override public Boolean call() throws Exception {
-                            return delegate.remove(o);
-                        }
-                    }, cctx);
-
                 return delegate.remove(o);
             }
-            catch (IgniteCheckedException e) {
-                throw U.convertException(e);
-            }
             finally {
                 gate.leave();
             }
@@ -316,18 +244,8 @@ public class GridCacheSetProxy<T> implements IgniteSet<T>,
Externalizable {
             gate.enter();
 
             try {
-                if (cctx.transactional())
-                    return CU.outTx(new Callable<Boolean>() {
-                        @Override public Boolean call() throws Exception {
-                            return delegate.containsAll(c);
-                        }
-                    }, cctx);
-
                 return delegate.containsAll(c);
             }
-            catch (IgniteCheckedException e) {
-                throw U.convertException(e);
-            }
             finally {
                 gate.leave();
             }
@@ -345,18 +263,8 @@ public class GridCacheSetProxy<T> implements IgniteSet<T>,
Externalizable {
             gate.enter();
 
             try {
-                if (cctx.transactional())
-                    return CU.outTx(new Callable<Boolean>() {
-                        @Override public Boolean call() throws Exception {
-                            return delegate.addAll(c);
-                        }
-                    }, cctx);
-
                 return delegate.addAll(c);
             }
-            catch (IgniteCheckedException e) {
-                throw U.convertException(e);
-            }
             finally {
                 gate.leave();
             }
@@ -374,18 +282,8 @@ public class GridCacheSetProxy<T> implements IgniteSet<T>,
Externalizable {
             gate.enter();
 
             try {
-                if (cctx.transactional())
-                    return CU.outTx(new Callable<Boolean>() {
-                        @Override public Boolean call() throws Exception {
-                            return delegate.retainAll(c);
-                        }
-                    }, cctx);
-
                 return delegate.retainAll(c);
             }
-            catch (IgniteCheckedException e) {
-                throw U.convertException(e);
-            }
             finally {
                 gate.leave();
             }
@@ -403,18 +301,8 @@ public class GridCacheSetProxy<T> implements IgniteSet<T>,
Externalizable {
             gate.enter();
 
             try {
-                if (cctx.transactional())
-                    return CU.outTx(new Callable<Boolean>() {
-                        @Override public Boolean call() throws Exception {
-                            return delegate.removeAll(c);
-                        }
-                    }, cctx);
-
                 return delegate.removeAll(c);
             }
-            catch (IgniteCheckedException e) {
-                throw U.convertException(e);
-            }
             finally {
                 gate.leave();
             }
@@ -432,20 +320,7 @@ public class GridCacheSetProxy<T> implements IgniteSet<T>,
Externalizable {
             gate.enter();
 
             try {
-                if (cctx.transactional()) {
-                    CU.outTx(new Callable<Void>() {
-                        @Override public Void call() throws Exception {
-                            delegate.clear();
-
-                            return null;
-                        }
-                    }, cctx);
-                }
-                else
-                    delegate.clear();
-            }
-            catch (IgniteCheckedException e) {
-                throw U.convertException(e);
+                delegate.clear();
             }
             finally {
                 gate.leave();
@@ -464,18 +339,8 @@ public class GridCacheSetProxy<T> implements IgniteSet<T>,
Externalizable {
             gate.enter();
 
             try {
-                if (cctx.transactional())
-                    return CU.outTx(new Callable<Iterator<T>>() {
-                        @Override public Iterator<T> call() throws Exception {
-                            return delegate.iterator();
-                        }
-                    }, cctx);
-
                 return delegate.iterator();
             }
-            catch (IgniteCheckedException e) {
-                throw U.convertException(e);
-            }
             finally {
                 gate.leave();
             }
@@ -490,20 +355,7 @@ public class GridCacheSetProxy<T> implements IgniteSet<T>,
Externalizable {
         gate.enter();
 
         try {
-            if (cctx.transactional()) {
-                CU.outTx(new Callable<Void>() {
-                    @Override public Void call() throws Exception {
-                        delegate.close();
-
-                        return null;
-                    }
-                }, cctx);
-            }
-            else
-                delegate.close();
-        }
-        catch (IgniteCheckedException e) {
-            throw U.convertException(e);
+            delegate.close();
         }
         finally {
             gate.leave();

http://git-wip-us.apache.org/repos/asf/ignite/blob/1e186403/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridTransactionalCacheQueueImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridTransactionalCacheQueueImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridTransactionalCacheQueueImpl.java
index 846eb69..6a19281 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridTransactionalCacheQueueImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridTransactionalCacheQueueImpl.java
@@ -75,7 +75,7 @@ public class GridTransactionalCacheQueueImpl<T> extends GridCacheQueueAdapter<T>
                         return retVal;
                     }
                 }
-            }).call();
+            });
         }
         catch (IgniteCheckedException e) {
             throw U.convertException(e);
@@ -120,7 +120,7 @@ public class GridTransactionalCacheQueueImpl<T> extends GridCacheQueueAdapter<T>
                         }
                     }
                 }
-            }).call();
+            });
         }
         catch (IgniteCheckedException e) {
             throw U.convertException(e);
@@ -169,7 +169,7 @@ public class GridTransactionalCacheQueueImpl<T> extends GridCacheQueueAdapter<T>
                         return retVal;
                     }
                 }
-            }).call();
+            });
         }
         catch (IgniteCheckedException e) {
             throw U.convertException(e);
@@ -202,7 +202,7 @@ public class GridTransactionalCacheQueueImpl<T> extends GridCacheQueueAdapter<T>
 
                     return null;
                 }
-            }).call();
+            });
         }
         catch (RuntimeException e) {
             throw e;


Mime
View raw message