Skip to content

Commit

Permalink
#ignite-51: IgniteTxEntry implements Message.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivasilinets committed Mar 3, 2015
1 parent ac04da2 commit e1cf752
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
Expand Up @@ -533,14 +533,17 @@ public GridIoMessageFactory(MessageFactory[] ext) {
msg = new CacheContinuousQueryEntry(); msg = new CacheContinuousQueryEntry();


break; break;

case 97: case 97:
msg = new IgniteTxEntry(); msg = new IgniteTxEntry();


break; break;

case 98: case 98:
msg = new IgniteTxEntry.TxEntryValueHolder(); msg = new IgniteTxEntry.TxEntryValueHolder();


break; break;

case 99: case 99:
msg = new GridNearTxPrepareResponse.OwnedValue(); msg = new GridNearTxPrepareResponse.OwnedValue();


Expand Down
Expand Up @@ -58,7 +58,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {


/** Near writes. */ /** Near writes. */
@GridToStringInclude @GridToStringInclude
@GridDirectTransient @GridDirectCollection(IgniteTxEntry.class)
private Collection<IgniteTxEntry> nearWrites; private Collection<IgniteTxEntry> nearWrites;


/** Owned versions by key. */ /** Owned versions by key. */
Expand All @@ -67,9 +67,11 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
private Map<IgniteTxKey, GridCacheVersion> owned; private Map<IgniteTxKey, GridCacheVersion> owned;


/** Owned keys. */ /** Owned keys. */
@GridDirectCollection(IgniteTxKey.class)
private Collection<IgniteTxKey> ownedKeys; private Collection<IgniteTxKey> ownedKeys;


/** Owned values. */ /** Owned values. */
@GridDirectCollection(GridCacheVersion.class)
private Collection<GridCacheVersion> ownedVals; private Collection<GridCacheVersion> ownedVals;


/** Near transaction ID. */ /** Near transaction ID. */
Expand Down Expand Up @@ -294,10 +296,10 @@ public Map<IgniteTxKey, GridCacheVersion> owned() {
super.finishUnmarshal(ctx, ldr); super.finishUnmarshal(ctx, ldr);


if (ownedKeys != null && owned == null) { if (ownedKeys != null && owned == null) {
owned = new HashMap<>();

assert ownedKeys.size() == ownedVals.size(); assert ownedKeys.size() == ownedVals.size();


owned = U.newHashMap(ownedKeys.size());

Iterator<IgniteTxKey> keyIter = ownedKeys.iterator(); Iterator<IgniteTxKey> keyIter = ownedKeys.iterator();


Iterator<GridCacheVersion> valIter = ownedVals.iterator(); Iterator<GridCacheVersion> valIter = ownedVals.iterator();
Expand All @@ -313,7 +315,6 @@ public Map<IgniteTxKey, GridCacheVersion> owned() {
} }


unmarshalTx(nearWrites, true, ctx, ldr); unmarshalTx(nearWrites, true, ctx, ldr);

} }


/** {@inheritDoc} */ /** {@inheritDoc} */
Expand Down
Expand Up @@ -174,9 +174,7 @@ public void addOwnedValue(IgniteTxKey key, GridCacheVersion ver, CacheObject val
if (ownedVals == null) if (ownedVals == null)
ownedVals = new HashMap<>(); ownedVals = new HashMap<>();


OwnedValue oVal = new OwnedValue(); OwnedValue oVal = new OwnedValue(ver, val);

oVal.init(ver, val);


ownedVals.put(key, oVal); ownedVals.put(key, oVal);
} }
Expand Down Expand Up @@ -486,13 +484,17 @@ public static class OwnedValue implements Message {
/** Cache object. */ /** Cache object. */
private CacheObject obj; private CacheObject obj;


public OwnedValue() {
// No-op.
}

/** /**
* Initialize OwnedValues. * Initialize OwnedValues.
* *
* @param vers Cache version. * @param vers Cache version.
* @param obj Cache object. * @param obj Cache object.
*/ */
void init(GridCacheVersion vers, CacheObject obj) { OwnedValue(GridCacheVersion vers, CacheObject obj) {
this.vers = vers; this.vers = vers;
this.obj = obj; this.obj = obj;
} }
Expand Down
Expand Up @@ -19,7 +19,6 @@


import org.apache.ignite.*; import org.apache.ignite.*;
import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.*;
import org.apache.ignite.internal.processors.cache.distributed.*;
import org.apache.ignite.internal.processors.cache.version.*; import org.apache.ignite.internal.processors.cache.version.*;
import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.lang.*;
import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.tostring.*;
Expand Down
Expand Up @@ -31,9 +31,6 @@
* for multiple caches. * for multiple caches.
*/ */
public class IgniteTxKey implements Message { public class IgniteTxKey implements Message {
/** */
private static final long serialVersionUID = 0L;

/** Key. */ /** Key. */
@GridToStringInclude @GridToStringInclude
private KeyCacheObject key; private KeyCacheObject key;
Expand Down

0 comments on commit e1cf752

Please sign in to comment.