ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [38/50] [abbrv] incubator-ignite git commit: IGNITE-146 (remove async instance caching inside Async support adapter and always create new instance)
Date Fri, 30 Jan 2015 08:35:10 GMT
IGNITE-146 (remove async instance caching inside Async support adapter and always create new
instance)


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

Branch: refs/heads/ignite-71
Commit: 25fb8e5ca42d8137c37ce513868bd246a5cc146a
Parents: fc768b8
Author: sevdokimov <sevdokimov@gridgain.com>
Authored: Thu Jan 29 13:05:20 2015 +0300
Committer: sevdokimov <sevdokimov@gridgain.com>
Committed: Thu Jan 29 17:22:35 2015 +0300

----------------------------------------------------------------------
 .../ignite/lang/IgniteAsyncSupportAdapter.java  | 27 +++-----------------
 1 file changed, 4 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25fb8e5c/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupportAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupportAdapter.java
b/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupportAdapter.java
index e9ab2a1..3d8e14c 100644
--- a/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupportAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupportAdapter.java
@@ -24,15 +24,9 @@ import org.apache.ignite.internal.*;
  * Adapter for {@link IgniteAsyncSupport}.
  */
 public class IgniteAsyncSupportAdapter<T extends IgniteAsyncSupport> implements IgniteAsyncSupport
{
-    /** */
-    private static final Object mux = new Object();
-
     /** Future for previous asynchronous operation. */
     protected ThreadLocal<IgniteInternalFuture<?>> curFut;
 
-    /** */
-    private volatile T asyncInstance;
-
     /**
      * Default constructor.
      */
@@ -44,29 +38,16 @@ public class IgniteAsyncSupportAdapter<T extends IgniteAsyncSupport>
implements
      * @param async Async enabled flag.
      */
     public IgniteAsyncSupportAdapter(boolean async) {
-        if (async) {
+        if (async)
             curFut = new ThreadLocal<>();
-
-            asyncInstance = (T)this;
-        }
     }
 
     /** {@inheritDoc} */
     @Override public T withAsync() {
-        T res = asyncInstance;
-
-        if (res == null) {
-            res = createAsyncInstance();
-
-            synchronized (mux) {
-                if (asyncInstance != null)
-                    return asyncInstance;
-
-                asyncInstance = res;
-            }
-        }
+        if (isAsync())
+            return (T)this;
 
-        return res;
+        return createAsyncInstance();
     }
 
     /**


Mime
View raw message