You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/05/22 15:13:05 UTC

[37/50] [abbrv] ignite git commit: Merge branch ignite-gg-8.0.4.ea2 into ignite-gg-12163

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0a53669/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0a53669/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0a53669/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0a53669/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/IgniteCacheDatabaseSharedManager.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0a53669/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index 704f36d,72272e7..828ca07
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@@ -10125,175 -10145,21 +10147,193 @@@ public abstract class IgniteUtils 
      }
  
      /**
+      * Returns {@link GridIntIterator} for range of primitive integers.
+      * @param start Start.
+      * @param cnt Count.
+      */
+     public static GridIntIterator forRange(final int start, final int cnt) {
+         return new GridIntIterator() {
+             int c = 0;
+ 
+             @Override public boolean hasNext() {
+                 return c < cnt;
+             }
+ 
+             @Override public int next() {
+                 return start + c++;
+             }
+         };
+     }
++
++    /**
 +     * @param lock Lock.
 +     */
 +    public static ReentrantReadWriteLockTracer lockTracer(ReadWriteLock lock) {
 +        return new ReentrantReadWriteLockTracer(lock);
 +    }
 +
 +    /**
 +     * @param lock Lock.
 +     */
 +    public static LockTracer lockTracer(Lock lock) {
 +        return new LockTracer(lock);
 +    }
 +
 +    /**
 +     *
 +     */
 +    public static class ReentrantReadWriteLockTracer implements ReadWriteLock {
 +        /** Read lock. */
 +        private final LockTracer readLock;
 +
 +        /** Write lock. */
 +        private final LockTracer writeLock;
 +
 +        /**
 +         * @param delegate Delegate.
 +         */
 +        public ReentrantReadWriteLockTracer(ReadWriteLock delegate) {
 +            readLock = new LockTracer(delegate.readLock());
 +            writeLock = new LockTracer(delegate.writeLock());
 +        }
 +
 +        /** {@inheritDoc} */
 +        @NotNull @Override public Lock readLock() {
 +            return readLock;
 +        }
 +
 +        /** {@inheritDoc} */
 +        @NotNull @Override public Lock writeLock() {
 +            return writeLock;
 +        }
 +
 +        /**
 +         *
 +         */
 +        public LockTracer getReadLock() {
 +            return readLock;
 +        }
 +
 +        /**
 +         *
 +         */
 +        public LockTracer getWriteLock() {
 +            return writeLock;
 +        }
 +    }
 +
 +    /**
 +     *
 +     */
 +    public static class LockTracer implements Lock {
 +        /** Delegate. */
 +        private final Lock delegate;
 +
 +        private final AtomicLong cnt = new AtomicLong();
 +
 +        /** Count. */
 +        private final ConcurrentMap<String, AtomicLong> cntMap = new ConcurrentHashMap8<>();
 +
 +        /**
 +         * @param delegate Delegate.
 +         */
 +        public LockTracer(Lock delegate) {
 +            this.delegate = delegate;
 +        }
 +
 +        /**
 +         *
 +         */
 +        private void inc(){
 +            cnt.incrementAndGet();
 +
 +            String name = Thread.currentThread().getName();
 +
 +            AtomicLong cnt = cntMap.get(name);
 +
 +            if (cnt == null) {
 +                AtomicLong cnt0 = cntMap.putIfAbsent(name, cnt = new AtomicLong());
 +
 +                if (cnt0 != null)
 +                    cnt = cnt0;
 +            }
 +
 +            cnt.incrementAndGet();
 +        }
 +
 +        /**
 +         *
 +         */
 +        private void dec(){
 +            cnt.decrementAndGet();
 +
 +            String name = Thread.currentThread().getName();
 +
 +            AtomicLong cnt = cntMap.get(name);
 +
 +            cnt.decrementAndGet();
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public void lock() {
 +            delegate.lock();
 +
 +            inc();
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public void lockInterruptibly() throws InterruptedException {
 +            delegate.lockInterruptibly();
 +
 +            inc();
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public boolean tryLock() {
 +            if (delegate.tryLock()) {
 +                inc();
 +
 +                return true;
 +            }
 +            else
 +                return false;
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public boolean tryLock(long time, @NotNull TimeUnit unit) throws InterruptedException {
 +            if (delegate.tryLock(time, unit)) {
 +                inc();
 +
 +                return true;
 +            }
 +            else
 +                return false;
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public void unlock() {
 +            delegate.unlock();
 +
 +            dec();
 +        }
 +
 +        /** {@inheritDoc} */
 +        @NotNull @Override public Condition newCondition() {
-             // Wrapper for condition not supported.
-             throw new UnsupportedOperationException();
++            return delegate.newCondition();
 +        }
 +
 +        /**
 +         *
 +         */
 +        public Map<String, AtomicLong> getLockUnlockCounters() {
 +            return new HashMap<>(cntMap);
 +        }
 +
 +        /**
 +         *
 +         */
 +        public long getLockUnlockCounter() {
 +            return cnt.get();
 +        }
 +    }
  }

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0a53669/pom.xml
----------------------------------------------------------------------
diff --cc pom.xml
index 74e7ef9,8d388a5..77ae019
--- a/pom.xml
+++ b/pom.xml
@@@ -91,7 -92,7 +92,8 @@@
          <module>modules/flink</module>
          <module>modules/kubernetes</module>
          <module>modules/zeromq</module>
+         <module>modules/rocketmq</module>
 +        <module>modules/pds</module>
      </modules>
  
      <profiles>