Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
shishkovilja committed Jul 29, 2024
1 parent 4709b15 commit a234726
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,11 @@ public Collection<GridCacheVersion> versions() {
writer.onHeaderWritten();
}

switch (writer.state()) {
case 3:
if (!writer.writeCollection("vers", vers, MessageCollectionItemType.MSG))
return false;

writer.incrementState();
if (writer.state() == 3) {
if (!writer.writeCollection("vers", vers, MessageCollectionItemType.MSG))
return false;

writer.incrementState();
}

return true;
Expand All @@ -118,15 +116,13 @@ public Collection<GridCacheVersion> versions() {
if (!super.readFrom(buf, reader))
return false;

switch (reader.state()) {
case 3:
vers = reader.readCollection("vers", MessageCollectionItemType.MSG);
if (reader.state() == 3) {
vers = reader.readCollection("vers", MessageCollectionItemType.MSG);

if (!reader.isLastRead())
return false;

reader.incrementState();
if (!reader.isLastRead())
return false;

reader.incrementState();
}

return reader.afterMessageRead(GridDhtTxOnePhaseCommitAckRequest.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,14 @@ public long accessTtl() {
* @param ctx Cache context.
* @throws IgniteCheckedException If failed.
*/
@Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
@Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) throws IgniteCheckedException {
super.prepareMarshal(ctx);

assert ctx != null;
assert !F.isEmpty(keys);
assert readersFlags == null || keys.size() == readersFlags.size();

GridCacheContext cctx = ctx.cacheContext(cacheId);
GridCacheContext<?, ?> cctx = ctx.cacheContext(cacheId);

prepareMarshalCacheObjects(keys, cctx);
}
Expand All @@ -305,10 +305,10 @@ public long accessTtl() {
* @param ldr Loader.
* @throws IgniteCheckedException If failed.
*/
@Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
@Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, ClassLoader ldr) throws IgniteCheckedException {
super.finishUnmarshal(ctx, ldr);

GridCacheContext cctx = ctx.cacheContext(cacheId);
GridCacheContext<?, ?> cctx = ctx.cacheContext(cacheId);

finishUnmarshalCacheObjects(keys, cctx, ldr);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public IgniteUuid miniId() {
* @return Entries.
*/
public Collection<GridCacheEntryInfo> entries() {
return entries != null ? entries : Collections.<GridCacheEntryInfo>emptyList();
return entries != null ? entries : Collections.emptyList();
}

/**
Expand Down Expand Up @@ -178,10 +178,10 @@ public void error(IgniteCheckedException err) {

/** {@inheritDoc}
* @param ctx*/
@Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
@Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) throws IgniteCheckedException {
super.prepareMarshal(ctx);

GridCacheContext cctx = ctx.cacheContext(cacheId);
GridCacheContext<?, ?> cctx = ctx.cacheContext(cacheId);

if (entries != null) {
for (GridCacheEntryInfo info : entries)
Expand All @@ -193,10 +193,10 @@ public void error(IgniteCheckedException err) {
}

/** {@inheritDoc} */
@Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
@Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, ClassLoader ldr) throws IgniteCheckedException {
super.finishUnmarshal(ctx, ldr);

GridCacheContext cctx = ctx.cacheContext(cacheId());
GridCacheContext<?, ?> cctx = ctx.cacheContext(cacheId());

if (entries != null) {
for (GridCacheEntryInfo info : entries)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,11 @@ public boolean isEmpty() {
writer.onHeaderWritten();
}

switch (writer.state()) {
case 0:
if (!writer.writeCollection("txLocks", txLocks, MessageCollectionItemType.MSG))
return false;

writer.incrementState();
if (writer.state() == 0) {
if (!writer.writeCollection("txLocks", txLocks, MessageCollectionItemType.MSG))
return false;

writer.incrementState();
}

return true;
Expand All @@ -103,15 +101,13 @@ public boolean isEmpty() {
if (!reader.beforeMessageRead())
return false;

switch (reader.state()) {
case 0:
txLocks = reader.readCollection("txLocks", MessageCollectionItemType.MSG);
if (reader.state() == 0) {
txLocks = reader.readCollection("txLocks", MessageCollectionItemType.MSG);

if (!reader.isLastRead())
return false;

reader.incrementState();
if (!reader.isLastRead())
return false;

reader.incrementState();
}

return reader.afterMessageRead(TxLockList.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public Collection<IgniteTxKey> txKeys() {
}

/** {@inheritDoc} */
@Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
@Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) throws IgniteCheckedException {
super.prepareMarshal(ctx);

txKeysArr = new IgniteTxKey[txKeys.size()];
Expand All @@ -120,7 +120,7 @@ public Collection<IgniteTxKey> txKeys() {
}

/** {@inheritDoc} */
@Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
@Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, ClassLoader ldr) throws IgniteCheckedException {
super.finishUnmarshal(ctx, ldr);

txKeys = U.newHashSet(txKeysArr.length);
Expand Down Expand Up @@ -207,9 +207,4 @@ public Collection<IgniteTxKey> txKeys() {
@Override public byte fieldsCount() {
return 5;
}

/** {@inheritDoc} */
@Override public void onAckReceived() {
// No-op.
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class TxLocksResponse extends GridCacheMessage {
/** Locks for near txKeys of near transactions. */
@GridToStringInclude
@GridDirectTransient
private Map<IgniteTxKey, TxLockList> nearTxKeyLocks = new HashMap<>();
private final Map<IgniteTxKey, TxLockList> nearTxKeyLocks = new HashMap<>();

/** Remote keys involved into transactions. Doesn't include near keys. */
@GridToStringInclude
Expand Down Expand Up @@ -153,7 +153,7 @@ public void addKey(IgniteTxKey key) {
}

/** {@inheritDoc} */
@Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
@Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) throws IgniteCheckedException {
super.prepareMarshal(ctx);

if (nearTxKeyLocks != null && !nearTxKeyLocks.isEmpty()) {
Expand Down Expand Up @@ -190,7 +190,7 @@ public void addKey(IgniteTxKey key) {
}

/** {@inheritDoc} */
@Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
@Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, ClassLoader ldr) throws IgniteCheckedException {
try {
super.finishUnmarshal(ctx, ldr);

Expand Down Expand Up @@ -325,9 +325,4 @@ public void addKey(IgniteTxKey key) {
@Override public byte fieldsCount() {
return 7;
}

/** {@inheritDoc} */
@Override public void onAckReceived() {
// No-op.
}
}

0 comments on commit a234726

Please sign in to comment.