You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by an...@apache.org on 2015/10/28 10:30:28 UTC
[25/46] ignite git commit: ignite-1272: support of custom class
loaders and conditional deployment info for portable marshaller and portable
caches
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java
index 4422952..578f6de 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java
@@ -207,7 +207,8 @@ public class GridCacheDistributedQueryManager<K, V> extends GridCacheQueryManage
cctx.cacheId(),
req.id(),
new IgniteCheckedException("Received request for incorrect cache [expected=" + cctx.name() +
- ", actual=" + req.cacheName()));
+ ", actual=" + req.cacheName()),
+ cctx.deploymentEnabled());
sendQueryResponse(sndId, res, 0);
}
@@ -228,7 +229,8 @@ public class GridCacheDistributedQueryManager<K, V> extends GridCacheQueryManage
catch (Throwable e) {
U.error(log(), "Failed to run query.", e);
- sendQueryResponse(sndId, new GridCacheQueryResponse(cctx.cacheId(), req.id(), e.getCause()), 0);
+ sendQueryResponse(sndId, new GridCacheQueryResponse(cctx.cacheId(), req.id(), e.getCause(),
+ cctx.deploymentEnabled()), 0);
if (e instanceof Error)
throw (Error)e;
@@ -445,7 +447,7 @@ public class GridCacheDistributedQueryManager<K, V> extends GridCacheQueryManage
fut.onPage(null, null, e, true);
else
sendQueryResponse(qryInfo.senderId(),
- new GridCacheQueryResponse(cctx.cacheId(), qryInfo.requestId(), e),
+ new GridCacheQueryResponse(cctx.cacheId(), qryInfo.requestId(), e, cctx.deploymentEnabled()),
qryInfo.query().timeout());
return true;
@@ -455,7 +457,7 @@ public class GridCacheDistributedQueryManager<K, V> extends GridCacheQueryManage
fut.onPage(null, data, null, finished);
else {
GridCacheQueryResponse res = new GridCacheQueryResponse(cctx.cacheId(), qryInfo.requestId(),
- /*finished*/false, /*fields*/false);
+ /*finished*/false, /*fields*/false, cctx.deploymentEnabled());
res.data(data);
res.finished(finished);
@@ -484,7 +486,7 @@ public class GridCacheDistributedQueryManager<K, V> extends GridCacheQueryManage
}
else
sendQueryResponse(qryInfo.senderId(),
- new GridCacheQueryResponse(cctx.cacheId(), qryInfo.requestId(), e),
+ new GridCacheQueryResponse(cctx.cacheId(), qryInfo.requestId(), e, cctx.deploymentEnabled()),
qryInfo.query().timeout());
return true;
@@ -497,7 +499,7 @@ public class GridCacheDistributedQueryManager<K, V> extends GridCacheQueryManage
}
else {
GridCacheQueryResponse res = new GridCacheQueryResponse(cctx.cacheId(), qryInfo.requestId(),
- finished, qryInfo.reducer() == null);
+ finished, qryInfo.reducer() == null, cctx.deploymentEnabled());
res.metadata(metadata);
res.data(entities != null ? entities : data);
@@ -567,7 +569,8 @@ public class GridCacheDistributedQueryManager<K, V> extends GridCacheQueryManage
qry.query().keepPortable(),
qry.query().subjectId(),
qry.query().taskHash(),
- queryTopologyVersion());
+ queryTopologyVersion(),
+ cctx.deploymentEnabled());
addQueryFuture(req.id(), fut);
@@ -612,7 +615,8 @@ public class GridCacheDistributedQueryManager<K, V> extends GridCacheQueryManage
qry.keepPortable(),
qry.subjectId(),
qry.taskHash(),
- queryTopologyVersion());
+ queryTopologyVersion(),
+ cctx.deploymentEnabled());
sendRequest(fut, req, nodes);
}
@@ -678,7 +682,8 @@ public class GridCacheDistributedQueryManager<K, V> extends GridCacheQueryManage
qry.query().keepPortable(),
qry.query().subjectId(),
qry.query().taskHash(),
- queryTopologyVersion());
+ queryTopologyVersion(),
+ cctx.deploymentEnabled());
addQueryFuture(req.id(), fut);
@@ -823,4 +828,4 @@ public class GridCacheDistributedQueryManager<K, V> extends GridCacheQueryManage
return S.toString(CancelMessageId.class, this);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
index c9ce933..c7feda4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
@@ -139,15 +139,18 @@ public class GridCacheQueryRequest extends GridCacheMessage implements GridCache
* @param id Request to cancel.
* @param fields Fields query flag.
* @param topVer Topology version.
+ * @param addDepInfo Deployment info flag.
*/
public GridCacheQueryRequest(int cacheId,
long id,
boolean fields,
- AffinityTopologyVersion topVer) {
+ AffinityTopologyVersion topVer,
+ boolean addDepInfo) {
this.cacheId = cacheId;
this.id = id;
this.fields = fields;
this.topVer = topVer;
+ this.addDepInfo = addDepInfo;
cancel = true;
}
@@ -166,6 +169,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implements GridCache
* @param subjId Subject ID.
* @param taskHash Task name hash code.
* @param topVer Topology version.
+ * @param addDepInfo Deployment info flag.
*/
public GridCacheQueryRequest(
int cacheId,
@@ -178,7 +182,8 @@ public class GridCacheQueryRequest extends GridCacheMessage implements GridCache
boolean keepPortable,
UUID subjId,
int taskHash,
- AffinityTopologyVersion topVer
+ AffinityTopologyVersion topVer,
+ boolean addDepInfo
) {
this.cacheId = cacheId;
this.id = id;
@@ -191,6 +196,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implements GridCache
this.subjId = subjId;
this.taskHash = taskHash;
this.topVer = topVer;
+ this.addDepInfo = addDepInfo;
}
/**
@@ -213,6 +219,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implements GridCache
* @param subjId Subject ID.
* @param taskHash Task name hash code.
* @param topVer Topology version.
+ * @param addDepInfo Deployment info flag.
*/
public GridCacheQueryRequest(
int cacheId,
@@ -233,7 +240,8 @@ public class GridCacheQueryRequest extends GridCacheMessage implements GridCache
boolean keepPortable,
UUID subjId,
int taskHash,
- AffinityTopologyVersion topVer
+ AffinityTopologyVersion topVer,
+ boolean addDepInfo
) {
assert type != null || fields;
assert clause != null || (type == SCAN || type == SET || type == SPI);
@@ -258,6 +266,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implements GridCache
this.subjId = subjId;
this.taskHash = taskHash;
this.topVer = topVer;
+ this.addDepInfo = addDepInfo;
}
/** {@inheritDoc} */
@@ -269,34 +278,36 @@ public class GridCacheQueryRequest extends GridCacheMessage implements GridCache
@Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
super.prepareMarshal(ctx);
+ GridCacheContext cctx = ctx.cacheContext(cacheId);
+
if (keyValFilter != null) {
- if (ctx.deploymentEnabled())
- prepareObject(keyValFilter, ctx);
+ if (addDepInfo)
+ prepareObject(keyValFilter, cctx);
- keyValFilterBytes = CU.marshal(ctx, keyValFilter);
+ keyValFilterBytes = CU.marshal(cctx, keyValFilter);
}
if (rdc != null) {
- if (ctx.deploymentEnabled())
- prepareObject(rdc, ctx);
+ if (addDepInfo)
+ prepareObject(rdc, cctx);
- rdcBytes = CU.marshal(ctx, rdc);
+ rdcBytes = CU.marshal(cctx, rdc);
}
if (trans != null) {
- if (ctx.deploymentEnabled())
- prepareObject(trans, ctx);
+ if (addDepInfo)
+ prepareObject(trans, cctx);
- transBytes = CU.marshal(ctx, trans);
+ transBytes = CU.marshal(cctx, trans);
}
if (!F.isEmpty(args)) {
- if (ctx.deploymentEnabled()) {
+ if (addDepInfo) {
for (Object arg : args)
- prepareObject(arg, ctx);
+ prepareObject(arg, cctx);
}
- argsBytes = CU.marshal(ctx, args);
+ argsBytes = CU.marshal(cctx, args);
}
}
@@ -319,6 +330,11 @@ public class GridCacheQueryRequest extends GridCacheMessage implements GridCache
args = mrsh.unmarshal(argsBytes, ldr);
}
+ /** {@inheritDoc} */
+ @Override public boolean addDeploymentInfo() {
+ return addDepInfo;
+ }
+
/**
* @param ctx Context.
* @throws IgniteCheckedException In case of error.
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
index 78e2ac7..cce465b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
@@ -25,6 +25,7 @@ import java.util.Map;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.GridDirectCollection;
import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
import org.apache.ignite.internal.processors.cache.GridCacheMessage;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
@@ -89,23 +90,28 @@ public class GridCacheQueryResponse extends GridCacheMessage implements GridCach
* @param reqId Request id.
* @param finished Last response or not.
* @param fields Fields query or not.
+ * @param addDepInfo Deployment info flag.
*/
- public GridCacheQueryResponse(int cacheId, long reqId, boolean finished, boolean fields) {
+ public GridCacheQueryResponse(int cacheId, long reqId, boolean finished, boolean fields, boolean addDepInfo) {
this.cacheId = cacheId;
this.reqId = reqId;
this.finished = finished;
this.fields = fields;
+ this.addDepInfo = addDepInfo;
}
/**
* @param cacheId Cache ID.
* @param reqId Request id.
* @param err Error.
+ * @param addDepInfo Deployment info flag.
*/
- public GridCacheQueryResponse(int cacheId, long reqId, Throwable err) {
+ public GridCacheQueryResponse(int cacheId, long reqId, Throwable err, boolean addDepInfo) {
this.cacheId = cacheId;
this.reqId = reqId;
this.err = err;
+ this.addDepInfo = addDepInfo;
+
finished = true;
}
@@ -114,19 +120,21 @@ public class GridCacheQueryResponse extends GridCacheMessage implements GridCach
@Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
super.prepareMarshal(ctx);
+ GridCacheContext cctx = ctx.cacheContext(cacheId);
+
if (err != null)
errBytes = ctx.marshaller().marshal(err);
- metaDataBytes = marshalCollection(metadata, ctx);
- dataBytes = marshalCollection(data, ctx);
+ metaDataBytes = marshalCollection(metadata, cctx);
+ dataBytes = marshalCollection(data, cctx);
- if (ctx.deploymentEnabled() && !F.isEmpty(data)) {
+ if (addDepInfo && !F.isEmpty(data)) {
for (Object o : data) {
if (o instanceof Map.Entry) {
Map.Entry e = (Map.Entry)o;
- prepareObject(e.getKey(), ctx);
- prepareObject(e.getValue(), ctx);
+ prepareObject(e.getKey(), cctx);
+ prepareObject(e.getValue(), cctx);
}
}
}
@@ -143,6 +151,11 @@ public class GridCacheQueryResponse extends GridCacheMessage implements GridCach
data = unmarshalCollection(dataBytes, ctx, ldr);
}
+ /** {@inheritDoc} */
+ @Override public boolean addDeploymentInfo() {
+ return addDepInfo;
+ }
+
/**
* @return Metadata.
*/
@@ -339,4 +352,4 @@ public class GridCacheQueryResponse extends GridCacheMessage implements GridCach
@Override public String toString() {
return S.toString(GridCacheQueryResponse.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
index 1990e18..e517c70 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
@@ -233,12 +233,10 @@ class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler {
locLsnr.onUpdated(F.<CacheEntryEvent<? extends K, ? extends V>>asList(evt));
else {
try {
- if (ctx.config().isPeerClassLoadingEnabled() && ctx.discovery().node(nodeId) != null) {
+ if (cctx.deploymentEnabled() && ctx.discovery().node(nodeId) != null) {
evt.entry().prepareMarshal(cctx);
- GridCacheDeploymentManager depMgr = cctx.deploy();
-
- depMgr.prepare(evt.entry());
+ cctx.deploy().prepare(evt.entry());
}
else
evt.entry().prepareMarshal(cctx);
@@ -551,4 +549,4 @@ class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler {
depInfo = (GridDeploymentInfo)in.readObject();
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
index 11cd3fd..20fb8c2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
@@ -280,6 +280,12 @@ public interface IgniteInternalTx extends AutoCloseable, GridTimeoutObject {
public Collection<Integer> activeCacheIds();
/**
+ * @return {@code true} or {@code false} if the deployment is enabled or disabled for all active caches involved
+ * in this transaction.
+ */
+ public boolean activeCachesDeploymentEnabled();
+
+ /**
* Attempts to set topology version and returns the current value.
* If topology version was previously set, then it's value will
* be returned (but not updated).
@@ -722,4 +728,4 @@ public interface IgniteInternalTx extends AutoCloseable, GridTimeoutObject {
* @param topVer New topology version.
*/
public void onRemap(AffinityTopologyVersion topVer);
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index 88752a2..7d7e3e8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
@@ -1757,6 +1757,11 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter
}
/** {@inheritDoc} */
+ @Override public boolean activeCachesDeploymentEnabled() {
+ return false;
+ }
+
+ /** {@inheritDoc} */
@Nullable @Override public Object addMeta(int key, Object val) {
throw new IllegalStateException("Deserialized transaction can only be used as read-only.");
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
index 3c33d19..2462dda 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
@@ -735,13 +735,13 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
if (filters != null) {
for (CacheEntryPredicate p : filters) {
if (p != null)
- p.prepareMarshal(ctx.cacheContext(cacheId));
+ p.prepareMarshal(this.ctx);
}
}
// Do not serialize filters if they are null.
if (transformClosBytes == null && entryProcessorsCol != null)
- transformClosBytes = CU.marshal(ctx, entryProcessorsCol);
+ transformClosBytes = CU.marshal(this.ctx, entryProcessorsCol);
if (transferExpiry)
transferExpiryPlc = expiryPlc != null && expiryPlc != this.ctx.expiry();
@@ -750,7 +750,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
val.marshal(ctx, context());
- expiryPlcBytes = transferExpiryPlc ? CU.marshal(ctx, new IgniteExternalizableExpiryPolicy(expiryPlc)) : null;
+ expiryPlcBytes = transferExpiryPlc ? CU.marshal(this.ctx, new IgniteExternalizableExpiryPolicy(expiryPlc)) : null;
}
/**
@@ -1038,4 +1038,4 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
return GridToStringBuilder.toString(IgniteTxEntry.class, this, "xidVer", tx == null ? "null" : tx.xidVersion());
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
index c2cc629..530fbdf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
@@ -241,7 +241,8 @@ public class IgniteTxHandler {
req.version(),
null,
e,
- null);
+ null,
+ req.deployInfo() != null);
}
}
});
@@ -327,7 +328,8 @@ public class IgniteTxHandler {
req.version(),
null,
null,
- top.topologyVersion());
+ top.topologyVersion(),
+ req.deployInfo() != null);
try {
ctx.io().send(nearNode, res, req.policy());
@@ -787,7 +789,7 @@ public class IgniteTxHandler {
GridDhtTxPrepareResponse res;
try {
- res = new GridDhtTxPrepareResponse(req.version(), req.futureId(), req.miniId());
+ res = new GridDhtTxPrepareResponse(req.version(), req.futureId(), req.miniId(), req.deployInfo() != null);
// Start near transaction first.
nearTx = !F.isEmpty(req.nearWrites()) ? startNearRemoteTx(ctx.deploy().globalLoader(), nodeId, req) : null;
@@ -833,7 +835,8 @@ public class IgniteTxHandler {
if (nearTx != null)
nearTx.rollback();
- res = new GridDhtTxPrepareResponse(req.version(), req.futureId(), req.miniId(), e);
+ res = new GridDhtTxPrepareResponse(req.version(), req.futureId(), req.miniId(), e,
+ req.deployInfo() != null);
}
try {
@@ -1344,7 +1347,8 @@ public class IgniteTxHandler {
GridCacheTxRecoveryRequest req,
boolean prepared) {
GridCacheTxRecoveryResponse res =
- new GridCacheTxRecoveryResponse(req.version(), req.futureId(), req.miniId(), prepared);
+ new GridCacheTxRecoveryResponse(req.version(), req.futureId(), req.miniId(), prepared,
+ req.deployInfo() != null);
try {
if (log.isDebugEnabled())
@@ -1382,4 +1386,4 @@ public class IgniteTxHandler {
fut.onResult(nodeId, res);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/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 aa0ffe8..f22e753 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
@@ -164,6 +164,9 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
/** Implicit transaction result. */
protected GridCacheReturn implicitRes;
+ /** Flag indicating whether deployment is enabled for caches from this transaction or not. */
+ private boolean depEnabled;
+
/**
* Empty constructor required for {@link Externalizable}.
*/
@@ -276,6 +279,11 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
}
/** {@inheritDoc} */
+ @Override public boolean activeCachesDeploymentEnabled() {
+ return depEnabled;
+ }
+
+ /** {@inheritDoc} */
@Override public boolean isStarted() {
return txMap != null;
}
@@ -3234,6 +3242,9 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
}
else
activeCacheIds.add(cacheId);
+
+ if (activeCacheIds.size() == 1)
+ depEnabled = cacheCtx.deploymentEnabled();
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
index 6e7fadd..0bc102e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
@@ -91,7 +91,7 @@ public class IgniteCacheObjectProcessorImpl extends GridProcessorAdapter impleme
/** {@inheritDoc} */
@Override public byte[] marshal(CacheObjectContext ctx, Object val) throws IgniteCheckedException {
- return CU.marshal(ctx.kernalContext().cache().context(), val);
+ return CU.marshal(ctx.kernalContext().cache().context(), ctx.addDeploymentInfo(), val);
}
/** {@inheritDoc} */
@@ -209,7 +209,8 @@ public class IgniteCacheObjectProcessorImpl extends GridProcessorAdapter impleme
CacheObjectContext res = new CacheObjectContext(ctx,
ccfg.getAffinityMapper() != null ? ccfg.getAffinityMapper() : new GridCacheDefaultAffinityKeyMapper(),
ccfg.isCopyOnRead() && memMode != OFFHEAP_VALUES,
- storeVal);
+ storeVal,
+ ctx.config().isPeerClassLoadingEnabled() && !isPortableEnabled(ccfg));
ctx.resource().injectGeneric(res.defaultAffMapper());
@@ -392,4 +393,4 @@ public class IgniteCacheObjectProcessorImpl extends GridProcessorAdapter impleme
return new CacheObjectByteArrayImpl(valCpy);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/core/src/main/java/org/apache/ignite/marshaller/AbstractMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/AbstractMarshaller.java b/modules/core/src/main/java/org/apache/ignite/marshaller/AbstractMarshaller.java
index 8c79a93..dd5bad0 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/AbstractMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/AbstractMarshaller.java
@@ -37,6 +37,16 @@ public abstract class AbstractMarshaller implements Marshaller {
/** Context. */
protected MarshallerContext ctx;
+
+ /**
+ * Undeployment callback invoked when class loader is being undeployed.
+ *
+ * Some marshallers may want to clean their internal state that uses the undeployed class loader somehow.
+ *
+ * @param ldr Class loader being undeployed.
+ */
+ public abstract void onUndeploy(ClassLoader ldr);
+
/** {@inheritDoc} */
@Override public void setContext(MarshallerContext ctx) {
this.ctx = ctx;
@@ -71,4 +81,4 @@ public abstract class AbstractMarshaller implements Marshaller {
U.close(in, null);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/core/src/main/java/org/apache/ignite/marshaller/jdk/JdkMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/jdk/JdkMarshaller.java b/modules/core/src/main/java/org/apache/ignite/marshaller/jdk/JdkMarshaller.java
index 0f4cf1f..deb3953 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/jdk/JdkMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/jdk/JdkMarshaller.java
@@ -115,7 +115,12 @@ public class JdkMarshaller extends AbstractMarshaller {
}
/** {@inheritDoc} */
+ @Override public void onUndeploy(ClassLoader ldr) {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(JdkMarshaller.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java
index b9b782a..caccd99 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java
@@ -288,7 +288,7 @@ public class OptimizedMarshaller extends AbstractMarshaller {
*
* @param ldr Class loader being undeployed.
*/
- public void onUndeploy(ClassLoader ldr) {
+ @Override public void onUndeploy(ClassLoader ldr) {
for (Class<?> cls : clsMap.keySet()) {
if (ldr.equals(cls.getClassLoader()))
clsMap.remove(cls);
@@ -296,4 +296,4 @@ public class OptimizedMarshaller extends AbstractMarshaller {
U.clearClassCache(ldr);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicEntryProcessorDeploymentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicEntryProcessorDeploymentSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicEntryProcessorDeploymentSelfTest.java
new file mode 100644
index 0000000..0873d2d
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicEntryProcessorDeploymentSelfTest.java
@@ -0,0 +1,211 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.HashSet;
+import java.util.Map;
+import javax.cache.processor.EntryProcessorResult;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheEntryProcessor;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DeploymentMode;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ * Cache EntryProcessor + Deployment.
+ */
+public class GridCacheAtomicEntryProcessorDeploymentSelfTest extends GridCommonAbstractTest {
+ /** IP finder. */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** Entry processor */
+ protected static String TEST_ENT_PROCESSOR = "org.apache.ignite.tests.p2p.CacheDeploymentEntryProcessor";
+
+ /** Test value. */
+ protected static String TEST_VALUE = "org.apache.ignite.tests.p2p.CacheDeploymentTestValue";
+
+ /** */
+ private DeploymentMode depMode;
+
+ /** */
+ private boolean cliendMode;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ if (cliendMode)
+ cfg.setClientMode(cliendMode);
+
+ cfg.setDeploymentMode(depMode);
+
+ cfg.setCacheConfiguration(cacheConfiguration());
+
+ TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+ disco.setIpFinder(IP_FINDER);
+
+ cfg.setDiscoverySpi(disco);
+
+ cfg.setConnectorConfiguration(null);
+
+ return cfg;
+ }
+
+ /**
+ * @return Cache configuration.
+ * @throws Exception In case of error.
+ */
+ protected CacheConfiguration cacheConfiguration() throws Exception {
+ CacheConfiguration cfg = defaultCacheConfiguration();
+
+ cfg.setCacheMode(PARTITIONED);
+ cfg.setWriteSynchronizationMode(FULL_SYNC);
+ cfg.setRebalanceMode(SYNC);
+ cfg.setAtomicityMode(atomicityMode());
+ cfg.setNearConfiguration(new NearCacheConfiguration());
+ cfg.setBackups(1);
+
+ return cfg;
+ }
+
+ protected CacheAtomicityMode atomicityMode() {
+ return ATOMIC;
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
+ public void testInvokeDeployment() throws Exception {
+ depMode = DeploymentMode.CONTINUOUS;
+
+ doTestInvoke();
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
+ public void testInvokeDeployment2() throws Exception {
+ depMode = DeploymentMode.SHARED;
+
+ doTestInvoke();
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
+ public void testInvokeAllDeployment() throws Exception {
+ depMode = DeploymentMode.CONTINUOUS;
+
+ doTestInvokeAll();
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
+ public void testInvokeAllDeployment2() throws Exception {
+ depMode = DeploymentMode.SHARED;
+
+ doTestInvokeAll();
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
+ private void doTestInvoke() throws Exception {
+ try {
+ cliendMode = false;
+ startGrid(0);
+
+ cliendMode = true;
+ startGrid(1);
+
+ ClassLoader ldr = getExternalClassLoader();
+
+ Class procCls = ldr.loadClass(TEST_ENT_PROCESSOR);
+ Class valCls = ldr.loadClass(TEST_VALUE);
+
+ assertTrue(grid(1).configuration().isClientMode());
+
+ IgniteCache cache = grid(1).cache(null);
+
+ cache.put("key", valCls.newInstance());
+
+ Boolean res = (Boolean)cache.invoke("key", (CacheEntryProcessor)procCls.newInstance());
+
+ assertTrue(res);
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
+ private void doTestInvokeAll() throws Exception {
+ try {
+ cliendMode = false;
+ startGrid(0);
+
+ cliendMode = true;
+ startGrid(1);
+
+ ClassLoader ldr = getExternalClassLoader();
+
+ Class procCls = ldr.loadClass(TEST_ENT_PROCESSOR);
+ Class valCls = ldr.loadClass(TEST_VALUE);
+
+ assertTrue(grid(1).configuration().isClientMode());
+
+ IgniteCache cache = grid(1).cache(null);
+
+ HashSet keys = new HashSet();
+
+ for (int i = 0; i < 3; i++) {
+ String key = "key" + i;
+
+ cache.put(key, valCls.newInstance());
+
+ keys.add(key);
+ }
+
+ Map<String, EntryProcessorResult> res = (Map<String, EntryProcessorResult>)cache.invokeAll(keys,
+ (CacheEntryProcessor)procCls.newInstance());
+
+ assertEquals(3, res.size());
+
+ for (EntryProcessorResult result : res.values())
+ assertTrue((Boolean)result.get());
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConditionalDeploymentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConditionalDeploymentSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConditionalDeploymentSelfTest.java
new file mode 100644
index 0000000..c03eb08
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConditionalDeploymentSelfTest.java
@@ -0,0 +1,190 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.managers.communication.GridIoMessageFactory;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.typedef.CO;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ * Cache + conditional deployment test.
+ */
+public class GridCacheConditionalDeploymentSelfTest extends GridCommonAbstractTest {
+ /** IP finder. */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /**
+ *
+ */
+ static {
+ GridIoMessageFactory.registerCustom(TestMessage.DIRECT_TYPE, new CO<Message>() {
+ @Override public Message apply() {
+ return new TestMessage();
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ cfg.setCacheConfiguration(cacheConfiguration());
+
+ TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+ disco.setIpFinder(IP_FINDER);
+
+ cfg.setDiscoverySpi(disco);
+
+ return cfg;
+ }
+
+ /**
+ * @return Cache configuration.
+ * @throws Exception In case of error.
+ */
+ protected CacheConfiguration cacheConfiguration() throws Exception {
+ CacheConfiguration cfg = defaultCacheConfiguration();
+
+ cfg.setCacheMode(PARTITIONED);
+ cfg.setWriteSynchronizationMode(FULL_SYNC);
+ cfg.setRebalanceMode(SYNC);
+ cfg.setAtomicityMode(TRANSACTIONAL);
+ cfg.setBackups(1);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ Ignite ignite0 = startGrid(0);
+
+ startGrid(1);
+
+ ignite0.cache(null).put(1, new TestValue());
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ Ignition.stopAll(true);
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
+ public void testNoDeploymentInfo() throws Exception {
+ GridCacheIoManager ioMgr = cacheIoManager();
+
+ TestMessage msg = new TestMessage();
+
+ assertNull(msg.deployInfo());
+
+ msg.addDepInfo = false;
+
+ IgniteUtils.invoke(GridCacheIoManager.class, ioMgr, "onSend", msg, grid(1).cluster().localNode().id());
+
+ assertNull(msg.deployInfo());
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
+ public void testAddedDeploymentInfo() throws Exception {
+ GridCacheIoManager ioMgr = cacheIoManager();
+
+ TestMessage msg = new TestMessage();
+
+ assertNull(msg.deployInfo());
+
+ msg.addDepInfo = true;
+
+ IgniteUtils.invoke(GridCacheIoManager.class, ioMgr, "onSend", msg, grid(1).cluster().localNode().id());
+
+ assertNotNull(msg.deployInfo());
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
+ public void testAddedDeploymentInfo2() throws Exception {
+ GridCacheContext ctx = cacheContext();
+
+ assertTrue(ctx.deploymentEnabled());
+
+ GridCacheIoManager ioMgr = cacheIoManager();
+
+ TestMessage msg = new TestMessage();
+
+ assertNull(msg.deployInfo());
+
+ msg.addDepInfo = false;
+
+ IgniteUtils.invoke(GridCacheIoManager.class, ioMgr, "onSend", msg, grid(1).cluster().localNode().id());
+
+ assertNull(msg.deployInfo());
+ }
+
+ protected GridCacheContext cacheContext() {
+ return ((IgniteCacheProxy)grid(0).cache(null)).context();
+ }
+
+ protected GridCacheIoManager cacheIoManager() {
+ return grid(0).context().cache().context().io();
+ }
+
+ /**
+ * Test message class.
+ */
+ public static class TestMessage extends GridCacheMessage implements GridCacheDeployable {
+ /** */
+ public static final byte DIRECT_TYPE = (byte)302;
+
+ @Override public byte directType() {
+ return DIRECT_TYPE;
+ }
+
+ @Override public byte fieldsCount() {
+ return 3;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean addDeploymentInfo() {
+ return addDepInfo;
+ }
+ }
+
+ /** */
+ private static class TestValue {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentOffHeapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentOffHeapSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentOffHeapSelfTest.java
index c51d72b..1adc3b4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentOffHeapSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentOffHeapSelfTest.java
@@ -38,19 +38,4 @@ public class GridCacheDeploymentOffHeapSelfTest extends GridCacheDeploymentSelfT
return cacheCfg;
}
-
- /** {@inheritDoc} */
- @Override public void testDeployment() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-1618");
- }
-
- /** {@inheritDoc} */
- @Override public void testDeployment6() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-1618");
- }
-
- /** {@inheritDoc} */
- @Override public void testDeployment7() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-1618");
- }
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java
index 5965852..e18520d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java
@@ -48,28 +48,28 @@ public class GridCacheDeploymentSelfTest extends GridCommonAbstractTest {
private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
/** Name for grid without cache. */
- private static final String GRID_NAME = "grid-no-cache";
+ protected static final String GRID_NAME = "grid-no-cache";
/** First test task name. */
- private static final String TEST_TASK_1 = "org.apache.ignite.tests.p2p.CacheDeploymentTestTask1";
+ protected static final String TEST_TASK_1 = "org.apache.ignite.tests.p2p.CacheDeploymentTestTask1";
/** Second test task name. */
- private static final String TEST_TASK_2 = "org.apache.ignite.tests.p2p.CacheDeploymentTestTask2";
+ protected static final String TEST_TASK_2 = "org.apache.ignite.tests.p2p.CacheDeploymentTestTask2";
/** Third test task name. */
- private static final String TEST_TASK_3 = "org.apache.ignite.tests.p2p.CacheDeploymentTestTask3";
+ protected static final String TEST_TASK_3 = "org.apache.ignite.tests.p2p.CacheDeploymentTestTask3";
/** Test value 1. */
- private static final String TEST_KEY = "org.apache.ignite.tests.p2p.CacheDeploymentTestKey";
+ protected static final String TEST_KEY = "org.apache.ignite.tests.p2p.CacheDeploymentTestKey";
/** Test value 1. */
- private static final String TEST_VALUE_1 = "org.apache.ignite.tests.p2p.CacheDeploymentTestValue";
+ protected static final String TEST_VALUE_1 = "org.apache.ignite.tests.p2p.CacheDeploymentTestValue";
/** Test value 2. */
- private static final String TEST_VALUE_2 = "org.apache.ignite.tests.p2p.CacheDeploymentTestValue2";
+ protected static final String TEST_VALUE_2 = "org.apache.ignite.tests.p2p.CacheDeploymentTestValue2";
/** */
- private DeploymentMode depMode;
+ protected DeploymentMode depMode;
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
@@ -249,11 +249,11 @@ public class GridCacheDeploymentSelfTest extends GridCommonAbstractTest {
stopGrid(GRID_NAME);
- assert g1.cache(null).localSize(CachePeekMode.ALL) == 1;
- assert g1.cache(null).localSize(CachePeekMode.ALL) == 1;
+ assertEquals(1, g1.cache(null).localSize(CachePeekMode.ALL));
+ assertEquals(1, g1.cache(null).localSize(CachePeekMode.ALL));
- assert g2.cache(null).localSize(CachePeekMode.ALL) == 1;
- assert g2.cache(null).localSize(CachePeekMode.ALL) == 1;
+ assertEquals(1, g2.cache(null).localSize(CachePeekMode.ALL));
+ assertEquals(1, g2.cache(null).localSize(CachePeekMode.ALL));
startGrid(3);
}
@@ -436,4 +436,4 @@ public class GridCacheDeploymentSelfTest extends GridCommonAbstractTest {
throw new IllegalStateException("Unable to find matching key [start=" + start + ", primary=" + primary.id() +
", backup=" + backup.id() + ']');
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTransactionalEntryProcessorDeploymentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTransactionalEntryProcessorDeploymentSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTransactionalEntryProcessorDeploymentSelfTest.java
new file mode 100644
index 0000000..bf8cc7a
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTransactionalEntryProcessorDeploymentSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.cache.CacheAtomicityMode;
+
+/**
+ * Cache EntryProcessor + Deployment for transactional cache.
+ */
+public class GridCacheTransactionalEntryProcessorDeploymentSelfTest extends
+ GridCacheAtomicEntryProcessorDeploymentSelfTest {
+ /** {@inheritDoc} */
+ @Override protected CacheAtomicityMode atomicityMode() {
+ return CacheAtomicityMode.TRANSACTIONAL;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/core/src/test/java/org/apache/ignite/spi/communication/GridCacheMessageSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridCacheMessageSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridCacheMessageSelfTest.java
index 47dcdf1..9c97542 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridCacheMessageSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridCacheMessageSelfTest.java
@@ -215,6 +215,11 @@ public class GridCacheMessageSelfTest extends GridCommonAbstractTest {
entries.add(entry);
}
+ /** {@inheritDoc} */
+ @Override public boolean addDeploymentInfo() {
+ return false;
+ }
+
/**
* @return COllection of test messages.
*/
@@ -305,6 +310,11 @@ public class GridCacheMessageSelfTest extends GridCommonAbstractTest {
this.body = body;
}
+ /** {@inheritDoc} */
+ @Override public boolean addDeploymentInfo() {
+ return false;
+ }
+
/**
* @return Body.
*/
@@ -423,6 +433,11 @@ public class GridCacheMessageSelfTest extends GridCommonAbstractTest {
this.body = body;
}
+ /** {@inheritDoc} */
+ @Override public boolean addDeploymentInfo() {
+ return false;
+ }
+
/**
* @return Body.
*/
@@ -553,4 +568,4 @@ public class GridCacheMessageSelfTest extends GridCommonAbstractTest {
return true;
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index 0e5894d..7ee301c 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@ -76,7 +76,7 @@ public class IgniteBasicTestSuite extends TestSuite {
suite.addTest(IgniteKernalSelfTestSuite.suite(ignoredTests));
suite.addTest(IgniteStartUpTestSuite.suite());
suite.addTest(IgniteExternalizableSelfTestSuite.suite());
- suite.addTest(IgniteP2PSelfTestSuite.suite());
+ suite.addTest(IgniteP2PSelfTestSuite.suite(ignoredTests));
suite.addTest(IgniteCacheP2pUnmarshallingErrorTestSuite.suite(ignoredTests));
suite.addTest(IgniteStreamSelfTestSuite.suite());
@@ -116,4 +116,4 @@ public class IgniteBasicTestSuite extends TestSuite {
return suite;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
index 1deb3bc..a4737c2 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
@@ -169,15 +169,15 @@ public class IgniteCacheTestSuite extends TestSuite {
suite.addTestSuite(IgnitePutAllUpdateNonPreloadedPartitionSelfTest.class);
// User's class loader tests.
- suite.addTestSuite(IgniteCacheAtomicExecutionContextTest.class);
- suite.addTestSuite(IgniteCachePartitionedExecutionContextTest.class);
- suite.addTestSuite(IgniteCacheReplicatedExecutionContextTest.class);
- suite.addTestSuite(IgniteCacheTxExecutionContextTest.class);
- suite.addTestSuite(IgniteCacheContinuousExecutionContextTest.class);
- suite.addTestSuite(IgniteCacheIsolatedExecutionContextTest.class);
- suite.addTestSuite(IgniteCacheP2PDisableExecutionContextTest.class);
- suite.addTestSuite(IgniteCachePrivateExecutionContextTest.class);
- suite.addTestSuite(IgniteCacheSharedExecutionContextTest.class);
+ GridTestUtils.addTestIfNeeded(suite, IgniteCacheAtomicExecutionContextTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, IgniteCachePartitionedExecutionContextTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, IgniteCacheReplicatedExecutionContextTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, IgniteCacheTxExecutionContextTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, IgniteCacheContinuousExecutionContextTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, IgniteCacheIsolatedExecutionContextTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, IgniteCacheP2PDisableExecutionContextTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, IgniteCachePrivateExecutionContextTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, IgniteCacheSharedExecutionContextTest.class, ignoredTests);
// Warmup closure tests.
suite.addTestSuite(IgniteWarmupClosureSelfTest.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
index 02a7f7f..796c531 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
@@ -18,6 +18,8 @@
package org.apache.ignite.testsuites;
import junit.framework.TestSuite;
+import org.apache.ignite.internal.processors.cache.GridCacheAtomicEntryProcessorDeploymentSelfTest;
+import org.apache.ignite.internal.processors.cache.GridCacheConditionalDeploymentSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheDeploymentOffHeapSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheDeploymentSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheEntryVersionSelfTest;
@@ -25,6 +27,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheOrderedPreloadingSel
import org.apache.ignite.internal.processors.cache.GridCacheReferenceCleanupSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheReloadSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheReplicatedSynchronousCommitTest;
+import org.apache.ignite.internal.processors.cache.GridCacheTransactionalEntryProcessorDeploymentSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheValueBytesPreloadingSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheValueConsistencyTransactionalNearEnabledSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheValueConsistencyTransactionalSelfTest;
@@ -116,6 +119,9 @@ public class IgniteCacheTestSuite3 extends TestSuite {
suite.addTestSuite(GridCacheDeploymentSelfTest.class);
suite.addTestSuite(GridCacheDeploymentOffHeapSelfTest.class);
+ suite.addTestSuite(GridCacheConditionalDeploymentSelfTest.class);
+ suite.addTestSuite(GridCacheAtomicEntryProcessorDeploymentSelfTest.class);
+ suite.addTestSuite(GridCacheTransactionalEntryProcessorDeploymentSelfTest.class);
suite.addTestSuite(GridCachePutArrayValueSelfTest.class);
suite.addTestSuite(GridCacheReplicatedUnswapAdvancedSelfTest.class);
@@ -183,4 +189,4 @@ public class IgniteCacheTestSuite3 extends TestSuite {
return suite;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteP2PSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteP2PSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteP2PSelfTestSuite.java
index ddf7d37..7bade98 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteP2PSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteP2PSelfTestSuite.java
@@ -17,6 +17,7 @@
package org.apache.ignite.testsuites;
+import java.util.Set;
import junit.framework.TestSuite;
import org.apache.ignite.internal.managers.deployment.GridDeploymentMessageCountSelfTest;
import org.apache.ignite.p2p.GridP2PClassLoadingSelfTest;
@@ -33,17 +34,26 @@ import org.apache.ignite.p2p.GridP2PRemoteClassLoadersSelfTest;
import org.apache.ignite.p2p.GridP2PSameClassLoaderSelfTest;
import org.apache.ignite.p2p.GridP2PTimeoutSelfTest;
import org.apache.ignite.p2p.GridP2PUndeploySelfTest;
+import org.apache.ignite.testframework.GridTestUtils;
/**
* P2P test suite.
*/
public class IgniteP2PSelfTestSuite extends TestSuite {
/**
+ * @return Suite.
+ * @throws Exception If failed.
+ */
+ public static TestSuite suite() throws Exception {
+ return suite(null);
+ }
+
+ /**
* @return P2P tests suite.
* @throws Exception If failed.
*/
@SuppressWarnings({"ProhibitedExceptionDeclared"})
- public static TestSuite suite() throws Exception {
+ public static TestSuite suite(Set<Class> ignoredTests) throws Exception {
TestSuite suite = new TestSuite("Ignite P2P Test Suite");
suite.addTest(new TestSuite(GridP2PDoubleDeploymentSelfTest.class));
@@ -60,8 +70,8 @@ public class IgniteP2PSelfTestSuite extends TestSuite {
suite.addTest(new TestSuite(GridP2PTimeoutSelfTest.class));
suite.addTest(new TestSuite(GridP2PMissedResourceCacheSizeSelfTest.class));
suite.addTest(new TestSuite(GridP2PContinuousDeploymentSelfTest.class));
- suite.addTest(new TestSuite(GridDeploymentMessageCountSelfTest.class));
+ GridTestUtils.addTestIfNeeded(suite, GridDeploymentMessageCountSelfTest.class, ignoredTests);
return suite;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentEntryProcessor.java b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentEntryProcessor.java
new file mode 100644
index 0000000..3d66fec
--- /dev/null
+++ b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentEntryProcessor.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.tests.p2p;
+
+import javax.cache.processor.EntryProcessorException;
+import javax.cache.processor.MutableEntry;
+import org.apache.ignite.cache.CacheEntryProcessor;
+
+/**
+ * Entry processor for {@code GridCacheEntryProcessorDeploymentSelfTest}.
+ */
+public class CacheDeploymentEntryProcessor implements CacheEntryProcessor<String, CacheDeploymentTestValue, Boolean> {
+ /** {@inheritDoc} */
+ @Override public Boolean process(MutableEntry<String, CacheDeploymentTestValue> entry,
+ Object... arguments) throws EntryProcessorException {
+ CacheDeploymentTestValue val = entry.getValue();
+
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df931bd0/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentPortableEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentPortableEntryProcessor.java b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentPortableEntryProcessor.java
new file mode 100644
index 0000000..03d3efc
--- /dev/null
+++ b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentPortableEntryProcessor.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.tests.p2p;
+
+import javax.cache.processor.EntryProcessorException;
+import javax.cache.processor.MutableEntry;
+import org.apache.ignite.cache.CacheEntryProcessor;
+
+/**
+ * Entry processor used by {@code GridCacheEntryProcessorDeploymentSelfTest}.
+ */
+public class CacheDeploymentPortableEntryProcessor implements CacheEntryProcessor<String, String, Boolean> {
+ /** {@inheritDoc} */
+ @Override public Boolean process(MutableEntry<String, String> entry, Object... arguments)
+ throws EntryProcessorException {
+ String val = entry.getKey();
+
+ return true;
+ }
+}