org.apache.ignite.internal.processors.cache.transactions

## Class IgniteTxEntry<K,V>

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry<K,V>

All Implemented Interfaces:
  Externalizable, Serializable, GridPeerDeployAware, OptimizedMarshallable

    public class IgniteTxEntry<K,V>
    extends Object
    implements GridPeerDeployAware, Externalizable, OptimizedMarshallable

Transaction entry. Note that it is essential that this class does not override `Object.equals(Object)` method, as transaction entries should use referential equality.

See Also:
  Serialized Form

### Field Summary

### Fields inherited from interface org.apache.ignite.marshaller.optimized.OptimizedMarshallable

`CLS_ID_FIELD_NAME`

### Constructor Summary

Constructors
Constructor and Description
`IgniteTxEntry()` Required by `Externalizable`
`IgniteTxEntry(GridCacheContext<K,V> ctx, IgniteInternalTx<K,V> tx, GridCacheOperation op, V val, javax.cache.processor.EntryProcessor<K,V,?> entryProcessor, Object[] invokeArgs, long ttl, GridCacheEntryEx<K,V> entry, IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filters, GridCacheVersion drVer)` This constructor is meant for local transactions.
`IgniteTxEntry(GridCacheContext<K,V> ctx, IgniteInternalTx<K,V> tx, GridCacheOperation op, V val, long ttl, long drExpireTime, GridCacheEntryEx<K,V> entry, GridCacheVersion drVer)` This constructor is meant for remote transactions.

### Method Summary

Methods
`void` `addEntryProcessor(javax.cache.processor.EntryProcessor<K,V,?> entryProcessor, Object[] invokeArgs)`
`V` `applyEntryProcessors(V val)`
`GridCacheEntryEx<K,V>` `cached()`
`void` `cached(GridCacheEntryEx<K,V> entry, byte[] keyBytes)`
`int` `cacheId()`
`ClassLoader` `classLoader()` Gets class loader for the class.
`IgniteTxEntry<K,V>` `cleanCopy(GridCacheContext<K,V> ctx)`
`GridCacheContext<K,V>` `context()`
`Class<?>` `deployClass()` Gets top level user class being deployed.
`GridCacheVersion` `dhtVersion()`
`void` `dhtVersion(GridCacheVersion dhtVer)`
`long` `drExpireTime()`
`void` `drExpireTime(long drExpireTime)`
`GridCacheVersion` `drVersion()`
`void` `drVersion(GridCacheVersion drVer)`
`Collection<T2<javax.cache.processor.EntryProcessor<K,V,?>,Object[]>>` `entryProcessors()`
`void` `entryProcessors(Collection<T2<javax.cache.processor.EntryProcessor<K,V,?>,Object[]>> entryProcessorsCol)`
`javax.cache.expiry.ExpiryPolicy` `expiry()`
`void` `expiry(javax.cache.expiry.ExpiryPolicy expiryPlc)`
`GridCacheVersion` `explicitVersion()`
`void` `explicitVersion(GridCacheVersion explicitVer)`
`IgnitePredicate<javax.cache.Cache.Entry<K,V>>[]` `filters()`
`void` `filters(IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filters)`
`boolean` `filtersPassed()`
`void` `filtersPassed(boolean filtersPassed)`
`boolean` `filtersSet()`
`void` `filtersSet(boolean filtersSet)`
`Object` `ggClassId()` Implementation of this method should simply return value of `GG_CLASS_ID` field.
`boolean` `groupLockEntry()`
`void` `groupLockEntry(boolean grpLock)`
`boolean` `hasReadValue()`
`boolean` `hasValue()`
`boolean` `hasWriteValue()`
`boolean` `isRead()`
`K` `key()`
`byte[]` `keyBytes()`
`void` `keyBytes(byte[] keyBytes)`
`boolean` `locallyMapped()`
`void` `locallyMapped(boolean locMapped)`
`boolean` `locked()`
`void` `markLocked()` Marks tx entry as locked.
`void` `marshal(GridCacheSharedContext<K,V> ctx, boolean transferExpiry)`
`UUID` `nodeId()`
`void` `nodeId(UUID nodeId)`
`GridCacheOperation` `op()`
`void` `op(GridCacheOperation op)`
`GridCacheOperation` `previousOperation()`
`V` `previousValue()`
`void` `readExternal(ObjectInput in)`
`void` `readValue(V val)` Sets read value if this tx entrty does not have write value yet.
`String` `toString()`
`long` `ttl()`
`void` `ttl(long ttl)`
`IgniteTxKey<K>` `txKey()`
`void` `unmarshal(GridCacheSharedContext<K,V> ctx, boolean near, ClassLoader clsLdr)` Unmarshalls entry.
`V` `value()`
`void` `value(V val, boolean writeVal, boolean readVal)`
`byte[]` `valueBytes()`
`void` `valueBytes(byte[] valBytes)`
`void` `writeExternal(ObjectOutput out)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### IgniteTxEntry

    public IgniteTxEntry()

Required by `Externalizable`

#### IgniteTxEntry

    public IgniteTxEntry(GridCacheContext<K,V> ctx,
                 IgniteInternalTx<K,V> tx,
                 GridCacheOperation op,
                 V val,
                 long ttl,
                 long drExpireTime,
                 GridCacheEntryEx<K,V> entry,
                 @Nullable
                 GridCacheVersion drVer)

This constructor is meant for remote transactions.

Parameters:
  `ctx` - Cache registry.
  `tx` - Owning transaction.
  `op` - Operation.
  `val` - Value.
  `ttl` - Time to live.
  `drExpireTime` - DR expire time.
  `entry` - Cache entry.
  `drVer` - Data center replication version.

#### IgniteTxEntry

    public IgniteTxEntry(GridCacheContext<K,V> ctx,
                 IgniteInternalTx<K,V> tx,
                 GridCacheOperation op,
                 V val,
                 javax.cache.processor.EntryProcessor<K,V,?> entryProcessor,
                 Object[] invokeArgs,
                 long ttl,
                 GridCacheEntryEx<K,V> entry,
                 IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filters,
                 GridCacheVersion drVer)

This constructor is meant for local transactions.

Parameters:
  `ctx` - Cache registry.
  `tx` - Owning transaction.
  `op` - Operation.
  `val` - Value.
  `entryProcessor` - Entry processor.
  `invokeArgs` - Optional arguments for EntryProcessor.
  `ttl` - Time to live.
  `entry` - Cache entry.
  `filters` - Put filters.
  `drVer` - Data center replication version.

### Method Detail

#### context

    public GridCacheContext<K,V> context()

Returns:
  Cache context for this tx entry.

#### locallyMapped

    public boolean locallyMapped()

Returns:
  Flag indicating if this entry is affinity mapped to the same node.

#### locallyMapped

    public void locallyMapped(boolean locMapped)

Parameters:
  `locMapped` - Flag indicating if this entry is affinity mapped to the same node.

#### groupLockEntry

    public boolean groupLockEntry()

Returns:
  `True` if this entry was added in group lock transaction and this is not a group lock entry.

#### groupLockEntry

    public void groupLockEntry(boolean grpLock)

Parameters:
  `grpLock` - `True` if this entry was added in group lock transaction and this is not a group lock entry.

#### cleanCopy

    public IgniteTxEntry<K,V> cleanCopy(GridCacheContext<K,V> ctx)

Parameters:
  `ctx` - Context.
Returns:
  Clean copy of this entry.

#### nodeId

    public UUID nodeId()

Returns:
  Node ID.

#### nodeId

    public void nodeId(UUID nodeId)

Parameters:
  `nodeId` - Node ID.

#### dhtVersion

    public GridCacheVersion dhtVersion()

Returns:
  DHT version.

#### dhtVersion

    public void dhtVersion(GridCacheVersion dhtVer)

Parameters:
  `dhtVer` - DHT version.

#### locked

    public boolean locked()

Returns:
  `True` if tx entry was marked as locked.

#### markLocked

    public void markLocked()

Marks tx entry as locked.

#### key

    public K key()

Returns:
  Entry key.

#### cacheId

    public int cacheId()

Returns:
  Cache ID.

#### txKey

    public IgniteTxKey<K> txKey()

Returns:
  Tx key.

#### keyBytes

    @Nullable
    public byte[] keyBytes()

Returns:
  Key bytes.

#### keyBytes

    public void keyBytes(byte[] keyBytes)

Parameters:
  `keyBytes` - Key bytes.

#### cached

    public GridCacheEntryEx<K,V> cached()

Returns:
  Underlying cache entry.

#### cached

    public void cached(GridCacheEntryEx<K,V> entry,
              @Nullable
              byte[] keyBytes)

Parameters:
  `entry` - Cache entry.
  `keyBytes` - Key bytes, possibly `null`.

#### value

    @Nullable
    public V value()

Returns:
  Entry value.

#### hasValue

    public boolean hasValue()

Returns:
  `True` if has value explicitly set.

#### hasWriteValue

    public boolean hasWriteValue()

Returns:
  `True` if has write value set.

#### hasReadValue

    public boolean hasReadValue()

Returns:
  `True` if has read value set.

#### previousValue

    @Nullable
    public V previousValue()

Returns:
  Value visible for peek.

#### previousOperation

    @Nullable
    public GridCacheOperation previousOperation()

Returns:
  Previous operation to revert entry in case of filter failure.

#### valueBytes

    @Nullable
    public byte[] valueBytes()

Returns:
  Value bytes.

#### valueBytes

    public void valueBytes(@Nullable
                  byte[] valBytes)

Parameters:
  `valBytes` - Value bytes.

#### ttl

    public long ttl()

Returns:
  Time to live.

#### ttl

    public void ttl(long ttl)

Parameters:
  `ttl` - Time to live.

#### drExpireTime

    public long drExpireTime()

Returns:
  DR expire time.

#### drExpireTime

    public void drExpireTime(long drExpireTime)

Parameters:
  `drExpireTime` - DR expire time.

#### value

    public void value(@Nullable
             V val,
             boolean writeVal,
             boolean readVal)

Parameters:
  `val` - Entry value.
  `writeVal` - Write value flag.
  `readVal` - Read value flag.

#### readValue

    public void readValue(@Nullable
                 V val)

Sets read value if this tx entrty does not have write value yet.

Parameters:
  `val` - Read value to set.

#### addEntryProcessor

    public void addEntryProcessor(javax.cache.processor.EntryProcessor<K,V,?> entryProcessor,
                         Object[] invokeArgs)

Parameters:
  `entryProcessor` - Entry processor.
  `invokeArgs` - Optional arguments for EntryProcessor.

#### entryProcessors

    public Collection<T2<javax.cache.processor.EntryProcessor<K,V,?>,Object[]>> entryProcessors()

Returns:
  Collection of entry processors.

#### applyEntryProcessors

    public V applyEntryProcessors(V val)

Parameters:
  `val` - Value.
Returns:
  New value.

#### entryProcessors

    public void entryProcessors(@Nullable
                       Collection<T2<javax.cache.processor.EntryProcessor<K,V,?>,Object[]>> entryProcessorsCol)

Parameters:
  `entryProcessorsCol` - Collection of entry processors.

#### op

    public GridCacheOperation op()

Returns:
  Cache operation.

#### op

    public void op(GridCacheOperation op)

Parameters:
  `op` - Cache operation.

#### isRead

    public boolean isRead()

Returns:
  `True` if read entry.

#### explicitVersion

    public void explicitVersion(GridCacheVersion explicitVer)

Parameters:
  `explicitVer` - Explicit version.

#### explicitVersion

    public GridCacheVersion explicitVersion()

Returns:
  Explicit version.

#### drVersion

    @Nullable
    public GridCacheVersion drVersion()

Returns:
  DR version.

#### drVersion

    public void drVersion(@Nullable
                 GridCacheVersion drVer)

Parameters:
  `drVer` - DR version.

#### filters

    public IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filters()

Returns:
  Put filters.

#### filters

    public void filters(IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filters)

Parameters:
  `filters` - Put filters.

#### filtersPassed

    public boolean filtersPassed()

Returns:
  `True` if filters passed for fast-commit transactions.

#### filtersPassed

    public void filtersPassed(boolean filtersPassed)

Parameters:
  `filtersPassed` - `True` if filters passed for fast-commit transactions.

#### filtersSet

    public boolean filtersSet()

Returns:
  `True` if filters are set.

#### filtersSet

    public void filtersSet(boolean filtersSet)

Parameters:
  `filtersSet` - `True` if filters are set and should not be replaced.

#### marshal

    public void marshal(GridCacheSharedContext<K,V> ctx,
               boolean transferExpiry)
                 throws IgniteCheckedException

Parameters:
  `ctx` - Context.
  `transferExpiry` - `True` if expire policy should be marshalled.
Throws:
  `IgniteCheckedException` - If failed.

#### unmarshal

    public void unmarshal(GridCacheSharedContext<K,V> ctx,
                 boolean near,
                 ClassLoader clsLdr)
                   throws IgniteCheckedException

Unmarshalls entry.

Parameters:
  `ctx` - Cache context.
  `near` - Near flag.
  `clsLdr` - Class loader.
Throws:
  `IgniteCheckedException` - If un-marshalling failed.

#### expiry

    public void expiry(@Nullable
              javax.cache.expiry.ExpiryPolicy expiryPlc)

Parameters:
  `expiryPlc` - Expiry policy.

#### expiry

    @Nullable
    public javax.cache.expiry.ExpiryPolicy expiry()

Returns:
  Expiry policy.

#### writeExternal

    public void writeExternal(ObjectOutput out)
                       throws IOException

Specified by:
  `writeExternal` in interface `Externalizable`
Throws:
  `IOException`

#### readExternal

    public void readExternal(ObjectInput in)
                      throws IOException,
                             ClassNotFoundException

Specified by:
  `readExternal` in interface `Externalizable`
Throws:
  `IOException`
  `ClassNotFoundException`

#### ggClassId

    public Object ggClassId()

Implementation of this method should simply return value of `GG_CLASS_ID` field.

Specified by:
  `ggClassId` in interface `OptimizedMarshallable`
Returns:
  Class ID for optimized marshalling.

#### deployClass

    public Class<?> deployClass()

Gets top level user class being deployed.

Specified by:
  `deployClass` in interface `GridPeerDeployAware`
Returns:
  Top level user deployed class.

#### classLoader

    public ClassLoader classLoader()

Gets class loader for the class. This class loader must be able to load the class returned from `GridPeerDeployAware.deployClass()` as well as all of its dependencies.

Note that in most cases the class loader returned from this method and the class loader for the class returned from `GridPeerDeployAware.deployClass()` method will be the same. If they are not the same, it is required that the class loader returned from this method still has to be able to load the deploy class and all its dependencies.

Specified by:
  `classLoader` in interface `GridPeerDeployAware`
Returns:
  Class loader for the class.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.0.0-RC1
Release Date | : February 17 2015