ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [09/12] incubator-ignite git commit: #ignite-758:CacheProjectionContext implements Serializable.
Date Thu, 16 Apr 2015 08:30:45 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3811c9a1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueriesProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueriesProxy.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueriesProxy.java
index 68b7643..a37a18e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueriesProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueriesProxy.java
@@ -37,7 +37,10 @@ public class CacheQueriesProxy<K, V> implements CacheQueries<K,
V>, Externalizab
     private GridCacheGateway<K, V> gate;
 
     /** */
-    private CacheProjectionContext<K, V> prj;
+    private GridCacheContext<K, V> cctx;
+
+    /** */
+    private CacheProjectionContext prj;
 
     /** */
     private CacheQueries<K, V> delegate;
@@ -56,11 +59,12 @@ public class CacheQueriesProxy<K, V> implements CacheQueries<K,
V>, Externalizab
      * @param prj Optional cache projection.
      * @param delegate Delegate object.
      */
-    public CacheQueriesProxy(GridCacheContext<K, V> cctx, @Nullable CacheProjectionContext<K,
V> prj,
+    public CacheQueriesProxy(GridCacheContext<K, V> cctx, @Nullable CacheProjectionContext
prj,
         CacheQueries<K, V> delegate) {
         assert cctx != null;
         assert delegate != null;
 
+        this.cctx = cctx;
         gate = cctx.gate();
 
         this.prj = prj;
@@ -72,13 +76,13 @@ public class CacheQueriesProxy<K, V> implements CacheQueries<K,
V>, Externalizab
      *
      * @return Cache projection.
      */
-    public CacheProjection<K, V> projection() {
+    public CacheProjectionContext projection() {
         return prj;
     }
 
     /** {@inheritDoc} */
     @Override public CacheQuery<List<?>> createSqlFieldsQuery(String qry) {
-        CacheProjectionContext<K, V> prev = gate.enter(prj);
+        CacheProjectionContext prev = gate.enter(prj);
 
         try {
             return delegate.createSqlFieldsQuery(qry);
@@ -90,7 +94,7 @@ public class CacheQueriesProxy<K, V> implements CacheQueries<K,
V>, Externalizab
 
     /** {@inheritDoc} */
     @Override public CacheQuery<Map.Entry<K, V>> createFullTextQuery(String clsName,
String search) {
-        CacheProjectionContext<K, V> prev = gate.enter(prj);
+        CacheProjectionContext prev = gate.enter(prj);
 
         try {
             return delegate.createFullTextQuery(clsName, search);
@@ -102,7 +106,7 @@ public class CacheQueriesProxy<K, V> implements CacheQueries<K,
V>, Externalizab
 
     /** {@inheritDoc} */
     @Override public CacheQuery<Map.Entry<K, V>> createScanQuery(@Nullable IgniteBiPredicate<K,
V> filter) {
-        CacheProjectionContext<K, V> prev = gate.enter(prj);
+        CacheProjectionContext prev = gate.enter(prj);
 
         try {
             return delegate.createScanQuery(filter);
@@ -114,7 +118,7 @@ public class CacheQueriesProxy<K, V> implements CacheQueries<K,
V>, Externalizab
 
     /** {@inheritDoc} */
     @Override public <R> CacheQuery<R> createSpiQuery() {
-        CacheProjectionContext<K, V> prev = gate.enter(prj);
+        CacheProjectionContext prev = gate.enter(prj);
 
         try {
             return delegate.createSpiQuery();
@@ -126,7 +130,7 @@ public class CacheQueriesProxy<K, V> implements CacheQueries<K,
V>, Externalizab
 
     /** {@inheritDoc} */
     @Override public QueryCursor<List<?>> execute(String space, GridCacheTwoStepQuery
qry) {
-        CacheProjectionContext<K, V> prev = gate.enter(prj);
+        CacheProjectionContext prev = gate.enter(prj);
 
         try {
             return delegate.execute(space, qry);
@@ -138,7 +142,7 @@ public class CacheQueriesProxy<K, V> implements CacheQueries<K,
V>, Externalizab
 
     /** {@inheritDoc} */
     @Override public QueryCursor<List<?>> executeTwoStepQuery(String space, String
sqlQry, Object[] params) {
-        CacheProjectionContext<K, V> prev = gate.enter(prj);
+        CacheProjectionContext prev = gate.enter(prj);
 
         try {
             return delegate.executeTwoStepQuery(space, sqlQry, params);
@@ -150,7 +154,7 @@ public class CacheQueriesProxy<K, V> implements CacheQueries<K,
V>, Externalizab
 
     /** {@inheritDoc} */
     @Override public QueryMetrics metrics() {
-        CacheProjectionContext<K, V> prev = gate.enter(prj);
+        CacheProjectionContext prev = gate.enter(prj);
 
         try {
             return delegate.metrics();
@@ -162,7 +166,7 @@ public class CacheQueriesProxy<K, V> implements CacheQueries<K,
V>, Externalizab
 
     /** {@inheritDoc} */
     @Override public Collection<GridCacheSqlMetadata> sqlMetadata() throws IgniteCheckedException
{
-        CacheProjectionContext<K, V> prev = gate.enter(prj);
+        CacheProjectionContext prev = gate.enter(prj);
 
         try {
             return delegate.sqlMetadata();
@@ -174,7 +178,7 @@ public class CacheQueriesProxy<K, V> implements CacheQueries<K,
V>, Externalizab
 
     /** {@inheritDoc} */
     @Override public CacheQuery<List<?>> createSqlFieldsQuery(String qry, boolean
incMeta) {
-        CacheProjectionContext<K, V> prev = gate.enter(prj);
+        CacheProjectionContext prev = gate.enter(prj);
 
         try {
             return delegate.createSqlFieldsQuery(qry, incMeta);
@@ -186,15 +190,17 @@ public class CacheQueriesProxy<K, V> implements CacheQueries<K,
V>, Externalizab
 
     /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(cctx);
         out.writeObject(prj);
         out.writeObject(delegate);
     }
 
     /** {@inheritDoc} */
     @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
-        prj = (CacheProjectionContext<K, V>)in.readObject();
+        cctx = (GridCacheContext<K,V>)in.readObject();
+        prj = (CacheProjectionContext)in.readObject();
         delegate = (CacheQueries<K, V>)in.readObject();
 
-        gate = prj.context().gate();
+        gate = cctx.gate();
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3811c9a1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 8f2a19f..00d3f16 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -2583,7 +2583,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
 
             Collection<KeyCacheObject> enlisted = new ArrayList<>();
 
-            CacheProjectionContext<K, V> prj = cacheCtx.projectionPerCall();
+            CacheProjectionContext prj = cacheCtx.projectionPerCall();
 
             final IgniteInternalFuture<Set<KeyCacheObject>> loadFut = enlistWrite(
                 cacheCtx,
@@ -2794,7 +2794,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
             ExpiryPolicy plc;
 
             if (!F.isEmpty(filter)) {
-                CacheProjectionContext<K, V> prj = cacheCtx.projectionPerCall();
+                CacheProjectionContext prj = cacheCtx.projectionPerCall();
 
                 plc = prj != null ? prj.expiry() : null;
             }


Mime
View raw message