Index: modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java (date 1418639191000) +++ modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java (date 1418712303000) @@ -11,11 +11,11 @@ import org.apache.ignite.IgniteCluster; import org.apache.ignite.product.*; -import org.gridgain.grid.*; import org.gridgain.grid.kernal.*; import org.jetbrains.annotations.*; import java.util.*; +import java.util.concurrent.*; /** * Interface representing a single grid node. Use {@link #attribute(String)} or @@ -99,7 +99,7 @@ * that comes with JDK as it also provides ability to view any node parameter * as a graph. */ -public interface ClusterNode extends GridMetadataAware { +public interface ClusterNode { /** * Gets globally unique node ID. A new ID is generated every time a node restarts. * @@ -246,4 +246,39 @@ * @return {@code True} if this node is a client node, {@code false} otherwise. */ public boolean isClient(); + + /** + * Adds a new metadata. + * + * @param name Metadata name. + * @param val Metadata value. + * @param Type of the value. + * @return Metadata previously associated with given name, or + * {@code null} if there was none. + */ + @Nullable public V addMeta(String name, V val); + + /** + * Adds given metadata value only if it was absent. + * + * @param name Metadata name. + * @param c Factory closure to produce value to add if it's not attached already. + * Not that unlike {@link #addMeta(String, Object)} method the factory closure will + * not be called unless the value is required and therefore value will only be created + * when it is actually needed. If {@code null} and metadata value is missing - {@code null} + * will be returned from this method. + * @param Type of the value. + * @return The value of the metadata after execution of this method. + */ + @Nullable public V addMetaIfAbsent(String name, @Nullable Callable c); + + + /** + * Gets metadata by name. + * + * @param name Metadata name. + * @param Type of the value. + * @return Metadata value or {@code null}. + */ + @Nullable public V meta(String name); } Index: modules/core/src/main/java/org/apache/ignite/cluster/ClusterNodeLocalMap.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/apache/ignite/cluster/ClusterNodeLocalMap.java (date 1418639191000) +++ modules/core/src/main/java/org/apache/ignite/cluster/ClusterNodeLocalMap.java (date 1418712303000) @@ -9,7 +9,6 @@ package org.apache.ignite.cluster; -import org.gridgain.grid.*; import org.jetbrains.annotations.*; import java.util.concurrent.*; @@ -26,7 +25,7 @@ *

* You can get an instance of {@code GridNodeLocalMap} by calling {@link org.apache.ignite.IgniteCluster#nodeLocalMap()} method. */ -public interface ClusterNodeLocalMap extends ConcurrentMap, GridMetadataAware { +public interface ClusterNodeLocalMap extends ConcurrentMap { /** * Gets the value with given key. If that value does not exist, calls given closure * to get the default value, puts it into the map and returns it. If closure is {@code null} Index: modules/core/src/main/java/org/apache/ignite/compute/ComputeJobSibling.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/apache/ignite/compute/ComputeJobSibling.java (date 1418639191000) +++ modules/core/src/main/java/org/apache/ignite/compute/ComputeJobSibling.java (date 1418712303000) @@ -11,7 +11,6 @@ import org.apache.ignite.*; import org.apache.ignite.lang.*; -import org.gridgain.grid.*; import java.util.*; @@ -19,7 +18,7 @@ * Job sibling interface defines a job from the same split. In other words a sibling is a job returned * from the same {@link ComputeTask#map(List, Object)} method invocation. */ -public interface ComputeJobSibling extends GridMetadataAware { +public interface ComputeJobSibling { /** * Gets ID of this grid job sibling. Note that ID stays constant * throughout job life time, even if a job gets failed over to another Index: modules/core/src/main/java/org/apache/ignite/compute/ComputeLoadBalancer.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/apache/ignite/compute/ComputeLoadBalancer.java (date 1418639191000) +++ modules/core/src/main/java/org/apache/ignite/compute/ComputeLoadBalancer.java (date 1418712303000) @@ -11,7 +11,6 @@ import org.apache.ignite.*; import org.apache.ignite.cluster.*; -import org.gridgain.grid.*; import org.jetbrains.annotations.*; import java.util.*; @@ -93,7 +92,7 @@ * } * */ -public interface ComputeLoadBalancer extends GridMetadataAware { +public interface ComputeLoadBalancer { /** * Gets the next balanced node according to the underlying load balancing policy. * Index: modules/core/src/main/java/org/apache/ignite/logger/java/IgniteJavaLogger.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/apache/ignite/logger/java/IgniteJavaLogger.java (date 1418639191000) +++ modules/core/src/main/java/org/apache/ignite/logger/java/IgniteJavaLogger.java (date 1418712303000) @@ -11,8 +11,6 @@ import org.apache.ignite.*; import org.apache.ignite.logger.*; -import org.gridgain.grid.*; -import org.gridgain.grid.util.lang.*; import org.gridgain.grid.util.typedef.*; import org.gridgain.grid.util.typedef.internal.*; import org.jetbrains.annotations.*; @@ -75,7 +73,7 @@ * logger in your task/job code. See {@link org.apache.ignite.resources.IgniteLoggerResource} annotation about logger * injection. */ -public class IgniteJavaLogger extends GridMetadataAwareAdapter implements IgniteLogger, IgniteLoggerNodeIdAware { +public class IgniteJavaLogger implements IgniteLogger, IgniteLoggerNodeIdAware { /** */ private static final long serialVersionUID = 0L; Index: modules/core/src/main/java/org/gridgain/grid/GridMetadataAware.java =================================================================== --- modules/core/src/main/java/org/gridgain/grid/GridMetadataAware.java (date 1418639191000) +++ modules/core/src/main/java/org/gridgain/grid/GridMetadataAware.java (date 1418639191000) @@ -1,179 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid; - -import org.jetbrains.annotations.*; -import java.io.*; -import java.util.*; -import java.util.concurrent.*; - -/** - * Allows to attach metadata attributes to any entity that implements - * this interface. This promotes meta-programming technique throughout the - * GridGain APIs by allowing to attach and query the metadata information to top-level - * entities in GridGain APIs. - *

- * Note that unlike other types of attributes the metadata is explicitly - * local to VM. Local metadata does not have any distribution semantic and is not - * specifically distributed in any way. Note, however, that if object that implements this - * interface gets serialized and deserialized on the remote node the attachments may or may not - * be carried over (depending on the implementation). All classes that come with GridGain - * and implement this interface support proper serialization and deserialization. - *

- * For example, this may become useful for cache entries or - * cache transactions. Cache entry attachment can be used whenever entry - * needs to carry additional context and it is too expensive to keep - * looking that context up from a separate map by a key. For example, - * an expiration policy used by caches may add some expiration - * context to cache entries to properly expire them. - */ -public interface GridMetadataAware extends Serializable { - /** - * Copies all metadata from another instance. - * - * @param from Metadata aware instance to copy metadata from. - */ - public void copyMeta(GridMetadataAware from); - - /** - * Copies all metadata from given map. - * - * @param data Map to copy metadata from. - */ - public void copyMeta(Map data); - - /** - * Adds a new metadata. - * - * @param name Metadata name. - * @param val Metadata value. - * @param Type of the value. - * @return Metadata previously associated with given name, or - * {@code null} if there was none. - */ - @Nullable public V addMeta(String name, V val); - - /** - * Adds given metadata value only if it was absent. - * - * @param name Metadata name. - * @param val Value to add if it's not attached already. - * @param Type of the value. - * @return {@code null} if new value was put, or current value if put didn't happen. - */ - @Nullable public V putMetaIfAbsent(String name, V val); - - /** - * Adds given metadata value only if it was absent. - * - * @param name Metadata name. - * @param c Factory closure to produce value to add if it's not attached already. - * Not that unlike {@link #addMeta(String, Object)} method the factory closure will - * not be called unless the value is required and therefore value will only be created - * when it is actually needed. - * @param Type of the value. - * @return {@code null} if new value was put, or current value if put didn't happen. - */ - @Nullable public V putMetaIfAbsent(String name, Callable c); - - /** - * Adds given metadata value only if it was absent. Unlike - * {@link #putMetaIfAbsent(String, Callable)}, this method always returns - * the latest value and never previous one. - * - * @param name Metadata name. - * @param val Value to add if it's not attached already. - * @param Type of the value. - * @return The value of the metadata after execution of this method. - */ - public V addMetaIfAbsent(String name, V val); - - /** - * Adds given metadata value only if it was absent. - * - * @param name Metadata name. - * @param c Factory closure to produce value to add if it's not attached already. - * Not that unlike {@link #addMeta(String, Object)} method the factory closure will - * not be called unless the value is required and therefore value will only be created - * when it is actually needed. If {@code null} and metadata value is missing - {@code null} - * will be returned from this method. - * @param Type of the value. - * @return The value of the metadata after execution of this method. - */ - @Nullable public V addMetaIfAbsent(String name, @Nullable Callable c); - - /** - * Gets metadata by name. - * - * @param name Metadata name. - * @param Type of the value. - * @return Metadata value or {@code null}. - */ - public V meta(String name); - - /** - * Removes metadata by name. - * - * @param name Name of the metadata to remove. - * @param Type of the value. - * @return Value of removed metadata or {@code null}. - */ - public V removeMeta(String name); - - /** - * Removes metadata only if its current value is equal to {@code val} passed in. - * - * @param name Name of metadata attribute. - * @param val Value to compare. - * @param Value type. - * @return {@code True} if value was removed, {@code false} otherwise. - */ - public boolean removeMeta(String name, V val); - - /** - * Gets all metadata in this entry. - * - * @param Type of the value. - * @return All metadata in this entry. - */ - public Map allMeta(); - - /** - * Tests whether or not given metadata is set. - * - * @param name Name of the metadata to test. - * @return Whether or not given metadata is set. - */ - public boolean hasMeta(String name); - - /** - * Tests whether or not metadata with given name and value is set. Returns {@code true} if - * attachment with given name it set and its value is equals to provided value. Otherwise returns - * {@code false}. - * - * @param name Name of the metadata. - * @param val Value to compare. Cannot be {@code null}. - * @param Type of the value. - * @return {@code true} if metadata with given name is set and its value is equals to provided value - - * otherwise returns {@code false}. - */ - public boolean hasMeta(String name, V val); - - /** - * Replaces given metadata with new {@code newVal} value only if its current value - * is equal to {@code curVal}. Otherwise, it is no-op. - * - * @param name Name of the metadata. - * @param curVal Current value to check. - * @param newVal New value. - * @return {@code true} if replacement occurred, {@code false} otherwise. - */ - public boolean replaceMeta(String name, V curVal, V newVal); -} Index: modules/core/src/main/java/org/gridgain/grid/cache/GridCacheEntry.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/gridgain/grid/cache/GridCacheEntry.java (date 1418639191000) +++ modules/core/src/main/java/org/gridgain/grid/cache/GridCacheEntry.java (date 1418712303000) @@ -11,11 +11,11 @@ import org.apache.ignite.*; import org.apache.ignite.lang.*; -import org.gridgain.grid.*; import org.jetbrains.annotations.*; import java.util.*; import java.util.Map.*; +import java.util.concurrent.*; /** * This interface provides a rich API for working with individual cache entries. It @@ -78,7 +78,7 @@ * @param Key type. * @param Value type. */ -public interface GridCacheEntry extends Map.Entry, GridMetadataAware { +public interface GridCacheEntry extends Map.Entry { /** * Cache projection to which this entry belongs. Note that entry and its * parent projections have same flags and filters. @@ -557,4 +557,77 @@ * @throws IgniteCheckedException If failed to evaluate entry size. */ public int memorySize() throws IgniteCheckedException; + + /** + * Removes metadata by name. + * + * @param name Name of the metadata to remove. + * @param Type of the value. + * @return Value of removed metadata or {@code null}. + */ + public V removeMeta(String name); + + /** + * Removes metadata only if its current value is equal to {@code val} passed in. + * + * @param name Name of metadata attribute. + * @param val Value to compare. + * @param Value type. + * @return {@code True} if value was removed, {@code false} otherwise. + */ + public boolean removeMeta(String name, V val); + + /** + * Gets metadata by name. + * + * @param name Metadata name. + * @param Type of the value. + * @return Metadata value or {@code null}. + */ + public V meta(String name); + + /** + * Adds given metadata value only if it was absent. + * + * @param name Metadata name. + * @param c Factory closure to produce value to add if it's not attached already. + * Not that unlike {@link #addMeta(String, Object)} method the factory closure will + * not be called unless the value is required and therefore value will only be created + * when it is actually needed. + * @param Type of the value. + * @return {@code null} if new value was put, or current value if put didn't happen. + */ + @Nullable public V putMetaIfAbsent(String name, Callable c); + + /** + * Adds given metadata value only if it was absent. + * + * @param name Metadata name. + * @param val Value to add if it's not attached already. + * @param Type of the value. + * @return {@code null} if new value was put, or current value if put didn't happen. + */ + @Nullable public V putMetaIfAbsent(String name, V val); + + /** + * Adds a new metadata. + * + * @param name Metadata name. + * @param val Metadata value. + * @param Type of the value. + * @return Metadata previously associated with given name, or + * {@code null} if there was none. + */ + @Nullable public V addMeta(String name, V val); + + /** + * Replaces given metadata with new {@code newVal} value only if its current value + * is equal to {@code curVal}. Otherwise, it is no-op. + * + * @param name Name of the metadata. + * @param curVal Current value to check. + * @param newVal New value. + * @return {@code true} if replacement occurred, {@code false} otherwise. + */ + public boolean replaceMeta(String name, V curVal, V newVal); } Index: modules/core/src/main/java/org/gridgain/grid/cache/GridCacheTx.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/gridgain/grid/cache/GridCacheTx.java (date 1418639191000) +++ modules/core/src/main/java/org/gridgain/grid/cache/GridCacheTx.java (date 1418712303000) @@ -11,7 +11,7 @@ import org.apache.ignite.*; import org.apache.ignite.lang.*; -import org.gridgain.grid.*; +import org.jetbrains.annotations.*; import java.util.*; @@ -105,7 +105,7 @@ * } * */ -public interface GridCacheTx extends GridMetadataAware, AutoCloseable { +public interface GridCacheTx extends AutoCloseable { /** * Gets unique identifier for this transaction. * @@ -240,4 +240,33 @@ * @throws IgniteCheckedException If rollback failed. */ public void rollback() throws IgniteCheckedException; + + /** + * Removes metadata by name. + * + * @param name Name of the metadata to remove. + * @param Type of the value. + * @return Value of removed metadata or {@code null}. + */ + @Nullable public V removeMeta(String name); + + /** + * Gets metadata by name. + * + * @param name Metadata name. + * @param Type of the value. + * @return Metadata value or {@code null}. + */ + @Nullable public V meta(String name); + + /** + * Adds a new metadata. + * + * @param name Metadata name. + * @param val Metadata value. + * @param Type of the value. + * @return Metadata previously associated with given name, or + * {@code null} if there was none. + */ + @Nullable public V addMeta(String name, V val); } Index: modules/core/src/main/java/org/gridgain/grid/cache/store/GridCacheStore.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/gridgain/grid/cache/store/GridCacheStore.java (date 1418639191000) +++ modules/core/src/main/java/org/gridgain/grid/cache/store/GridCacheStore.java (date 1418712303000) @@ -12,7 +12,6 @@ import org.apache.ignite.*; import org.apache.ignite.lang.*; import org.apache.ignite.portables.*; -import org.gridgain.grid.*; import org.gridgain.grid.cache.*; import org.gridgain.grid.cache.store.jdbc.*; import org.jetbrains.annotations.*; @@ -43,8 +42,8 @@ * *

* All transactional operations of this API are provided with ongoing {@link GridCacheTx}, - * if any. As transaction is {@link GridMetadataAware}, you can attach any metadata to - * it, e.g. to recognize if several operations belong to the same transaction or not. + * if any. You can attach any metadata to it, e.g. to recognize if several operations belong + * to the same transaction or not. * Here is an example of how attach a JDBC connection as transaction metadata: *

  * Connection conn = tx.meta("some.name");
Index: modules/core/src/main/java/org/gridgain/grid/kernal/ClusterNodeLocalMapImpl.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- modules/core/src/main/java/org/gridgain/grid/kernal/ClusterNodeLocalMapImpl.java	(date 1418639191000)
+++ modules/core/src/main/java/org/gridgain/grid/kernal/ClusterNodeLocalMapImpl.java	(date 1418712303000)
@@ -10,15 +10,12 @@
 package org.gridgain.grid.kernal;
 
 import org.apache.ignite.cluster.*;
-import org.gridgain.grid.*;
 import org.gridgain.grid.util.typedef.*;
 import org.gridgain.grid.util.typedef.internal.*;
-import org.gridgain.grid.util.lang.*;
 import org.jdk8.backport.*;
 import org.jetbrains.annotations.*;
 
 import java.io.*;
-import java.util.*;
 import java.util.concurrent.*;
 
 /**
@@ -33,9 +30,6 @@
     private static final ThreadLocal stash = new ThreadLocal<>();
 
     /** */
-    private GridMetadataAwareAdapter impl = new GridMetadataAwareAdapter();
-
-    /** */
     private GridKernalContext ctx;
 
     /**
@@ -63,80 +57,6 @@
     /** {@inheritDoc} */
     @Override public V addIfAbsent(K key, V val) {
         return F.addIfAbsent(this, key, val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public  V addMeta(String name, V val) {
-        return impl.addMeta(name, val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public  V putMetaIfAbsent(String name, V val) {
-        return impl.putMetaIfAbsent(name, val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public  V putMetaIfAbsent(String name, Callable c) {
-        return impl.putMetaIfAbsent(name, c);
-    }
-
-    /** {@inheritDoc} */
-    @Override public  V addMetaIfAbsent(String name, V val) {
-        return impl.addMetaIfAbsent(name, val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public  V addMetaIfAbsent(String name, Callable c) {
-        return impl.addMetaIfAbsent(name, c);
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Nullable
-    @Override public  V meta(String name) {
-        return (V)impl.meta(name);
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Nullable
-    @Override public  V removeMeta(String name) {
-        return (V)impl.removeMeta(name);
-    }
-
-    /** {@inheritDoc} */
-    @Override public  boolean removeMeta(String name, V val) {
-        return impl.removeMeta(name, val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public  Map allMeta() {
-        return impl.allMeta();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean hasMeta(String name) {
-        return impl.hasMeta(name);
-    }
-
-    /** {@inheritDoc} */
-    @Override public  boolean hasMeta(String name, V val) {
-        return impl.hasMeta(name, val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public  boolean replaceMeta(String name, V curVal, V newVal) {
-        return impl.replaceMeta(name, curVal, newVal);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void copyMeta(GridMetadataAware from) {
-        impl.copyMeta(from);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void copyMeta(Map data) {
-        impl.copyMeta(data);
     }
 
     /** {@inheritDoc} */
Index: modules/core/src/main/java/org/gridgain/grid/kernal/GridJobContextImpl.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- modules/core/src/main/java/org/gridgain/grid/kernal/GridJobContextImpl.java	(date 1418639191000)
+++ modules/core/src/main/java/org/gridgain/grid/kernal/GridJobContextImpl.java	(date 1418712303000)
@@ -12,14 +12,12 @@
 import org.apache.ignite.*;
 import org.apache.ignite.compute.*;
 import org.apache.ignite.lang.*;
-import org.gridgain.grid.*;
 import org.gridgain.grid.cache.*;
 import org.gridgain.grid.cache.affinity.*;
 import org.gridgain.grid.kernal.processors.job.*;
 import org.gridgain.grid.kernal.processors.timeout.*;
 import org.gridgain.grid.util.typedef.*;
 import org.gridgain.grid.util.typedef.internal.*;
-import org.gridgain.grid.util.lang.*;
 import org.gridgain.grid.util.tostring.*;
 import org.jetbrains.annotations.*;
 
@@ -31,7 +29,7 @@
 /**
  * Remote job context implementation.
  */
-public class GridJobContextImpl extends GridMetadataAwareAdapter implements ComputeJobContext, Externalizable {
+public class GridJobContextImpl implements ComputeJobContext, Externalizable {
     /** */
     private static final long serialVersionUID = 0L;
 
Index: modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingImpl.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingImpl.java	(date 1418639191000)
+++ modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingImpl.java	(date 1418712303000)
@@ -13,7 +13,6 @@
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.compute.*;
 import org.apache.ignite.lang.*;
-import org.gridgain.grid.util.lang.*;
 import org.gridgain.grid.util.typedef.internal.*;
 
 import java.io.*;
@@ -25,7 +24,7 @@
 /**
  * This class provides implementation for job sibling.
  */
-public class GridJobSiblingImpl extends GridMetadataAwareAdapter implements ComputeJobSibling, Externalizable {
+public class GridJobSiblingImpl implements ComputeJobSibling, Externalizable {
     /** */
     private static final long serialVersionUID = 0L;
 
Index: modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContext.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContext.java	(date 1418639191000)
+++ modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContext.java	(date 1418712303000)
@@ -13,7 +13,6 @@
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.plugin.*;
 import org.apache.ignite.product.*;
-import org.gridgain.grid.*;
 import org.gridgain.grid.kernal.managers.security.*;
 import org.gridgain.grid.kernal.managers.checkpoint.*;
 import org.gridgain.grid.kernal.managers.collision.*;
@@ -63,7 +62,7 @@
  *
  */
 @GridToStringExclude
-public interface GridKernalContext extends GridMetadataAware, Iterable {
+public interface GridKernalContext extends Iterable {
     /**
      * Gets list of all grid components in the order they were added.
      *
Index: modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContextImpl.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContextImpl.java	(date 1418639191000)
+++ modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContextImpl.java	(date 1418712303000)
@@ -13,7 +13,6 @@
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.plugin.*;
 import org.apache.ignite.product.*;
-import org.gridgain.grid.*;
 import org.gridgain.grid.kernal.managers.checkpoint.*;
 import org.gridgain.grid.kernal.managers.collision.*;
 import org.gridgain.grid.kernal.managers.communication.*;
@@ -57,7 +56,6 @@
 import org.gridgain.grid.kernal.processors.task.*;
 import org.gridgain.grid.kernal.processors.timeout.*;
 import org.gridgain.grid.util.direct.*;
-import org.gridgain.grid.util.lang.*;
 import org.gridgain.grid.util.tostring.*;
 import org.gridgain.grid.util.typedef.*;
 import org.gridgain.grid.util.typedef.internal.*;
@@ -75,7 +73,7 @@
  * Implementation of kernal context.
  */
 @GridToStringExclude
-public class GridKernalContextImpl extends GridMetadataAwareAdapter implements GridKernalContext, Externalizable {
+public class GridKernalContextImpl implements GridKernalContext, Externalizable {
     /** */
     private static final long serialVersionUID = 0L;
 
Index: modules/core/src/main/java/org/gridgain/grid/kernal/GridLoggerProxy.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- modules/core/src/main/java/org/gridgain/grid/kernal/GridLoggerProxy.java	(date 1418639191000)
+++ modules/core/src/main/java/org/gridgain/grid/kernal/GridLoggerProxy.java	(date 1418712303000)
@@ -12,10 +12,8 @@
 import org.apache.ignite.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.lifecycle.*;
-import org.gridgain.grid.*;
 import org.gridgain.grid.util.typedef.*;
 import org.gridgain.grid.util.typedef.internal.*;
-import org.gridgain.grid.util.lang.*;
 import org.gridgain.grid.util.tostring.*;
 import org.jetbrains.annotations.*;
 
@@ -27,8 +25,7 @@
 /**
  *
  */
-public class GridLoggerProxy extends GridMetadataAwareAdapter implements IgniteLogger, LifecycleAware,
-    Externalizable {
+public class GridLoggerProxy implements IgniteLogger, LifecycleAware, Externalizable {
     /** */
     private static final long serialVersionUID = 0L;
 
Index: modules/core/src/main/java/org/gridgain/grid/kernal/executor/GridExecutorService.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- modules/core/src/main/java/org/gridgain/grid/kernal/executor/GridExecutorService.java	(date 1418639191000)
+++ modules/core/src/main/java/org/gridgain/grid/kernal/executor/GridExecutorService.java	(date 1418712303000)
@@ -12,10 +12,8 @@
 import org.apache.ignite.*;
 import org.apache.ignite.compute.*;
 import org.apache.ignite.lang.*;
-import org.gridgain.grid.*;
 import org.gridgain.grid.kernal.*;
 import org.gridgain.grid.util.future.*;
-import org.gridgain.grid.util.lang.*;
 import org.gridgain.grid.util.typedef.*;
 import org.gridgain.grid.util.typedef.internal.*;
 
@@ -64,7 +62,7 @@
  * }
  * 
*/ -public class GridExecutorService extends GridMetadataAwareAdapter implements ExecutorService, Externalizable { +public class GridExecutorService implements ExecutorService, Externalizable { /** */ private static final long serialVersionUID = 0L; Index: modules/core/src/main/java/org/gridgain/grid/kernal/managers/loadbalancer/GridLoadBalancerAdapter.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/gridgain/grid/kernal/managers/loadbalancer/GridLoadBalancerAdapter.java (date 1418639191000) +++ modules/core/src/main/java/org/gridgain/grid/kernal/managers/loadbalancer/GridLoadBalancerAdapter.java (date 1418712303000) @@ -10,15 +10,13 @@ package org.gridgain.grid.kernal.managers.loadbalancer; import org.apache.ignite.compute.*; -import org.gridgain.grid.util.lang.*; import java.io.*; /** * This adapter allows for graceful exception when load balancer gets marshalled. */ -public abstract class GridLoadBalancerAdapter extends GridMetadataAwareAdapter implements ComputeLoadBalancer, - Externalizable { +public abstract class GridLoadBalancerAdapter implements ComputeLoadBalancer, Externalizable { /** */ private static final long serialVersionUID = 0L; Index: modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java (date 1418639191000) +++ modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java (date 1418712303000) @@ -52,8 +52,6 @@ import static org.gridgain.grid.cache.GridCachePeekMode.*; import static org.gridgain.grid.cache.GridCacheTxConcurrency.*; import static org.gridgain.grid.cache.GridCacheTxIsolation.*; -import static org.gridgain.grid.cache.GridCacheTxState.*; -import static org.apache.ignite.events.IgniteEventType.*; import static org.gridgain.grid.kernal.GridClosureCallMode.*; import static org.gridgain.grid.kernal.processors.dr.GridDrType.*; import static org.gridgain.grid.kernal.processors.task.GridTaskThreadContextKey.*; @@ -62,7 +60,7 @@ * Adapter for different cache implementations. */ @SuppressWarnings("unchecked") -public abstract class GridCacheAdapter extends GridMetadataAwareAdapter implements GridCache, +public abstract class GridCacheAdapter implements GridCache, GridCacheProjectionEx, Externalizable { /** */ private static final long serialVersionUID = 0L; Index: modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEntryEx.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEntryEx.java (date 1418639191000) +++ modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEntryEx.java (date 1418712303000) @@ -11,7 +11,6 @@ import org.apache.ignite.*; import org.apache.ignite.lang.*; -import org.gridgain.grid.*; import org.gridgain.grid.cache.*; import org.gridgain.grid.kernal.processors.cache.distributed.*; import org.gridgain.grid.kernal.processors.dr.*; @@ -19,11 +18,12 @@ import org.jetbrains.annotations.*; import java.util.*; +import java.util.concurrent.*; /** * Internal API for cache entry ({@code 'Ex'} stands for extended). */ -public interface GridCacheEntryEx extends GridMetadataAware { +public interface GridCacheEntryEx { /** * @return Memory size. * @throws IgniteCheckedException If failed. @@ -884,4 +884,85 @@ * @throws IgniteCheckedException If failed. */ @Nullable public V unswap(boolean ignoreFlags, boolean needVal) throws IgniteCheckedException; + + /** + * Tests whether or not given metadata is set. + * + * @param name Name of the metadata to test. + * @return Whether or not given metadata is set. + */ + public boolean hasMeta(String name); + + /** + * Gets metadata by name. + * + * @param name Metadata name. + * @param Type of the value. + * @return Metadata value or {@code null}. + */ + @Nullable public V meta(String name); + + /** + * Adds a new metadata. + * + * @param name Metadata name. + * @param val Metadata value. + * @param Type of the value. + * @return Metadata previously associated with given name, or + * {@code null} if there was none. + */ + @Nullable public V addMeta(String name, V val); + + /** + * Adds given metadata value only if it was absent. + * + * @param name Metadata name. + * @param val Value to add if it's not attached already. + * @param Type of the value. + * @return {@code null} if new value was put, or current value if put didn't happen. + */ + @Nullable public V putMetaIfAbsent(String name, V val); + + /** + * Adds given metadata value only if it was absent. + * + * @param name Metadata name. + * @param c Factory closure to produce value to add if it's not attached already. + * Not that unlike {@link #addMeta(String, Object)} method the factory closure will + * not be called unless the value is required and therefore value will only be created + * when it is actually needed. + * @param Type of the value. + * @return {@code null} if new value was put, or current value if put didn't happen. + */ + @Nullable public V putMetaIfAbsent(String name, Callable c); + + /** + * Replaces given metadata with new {@code newVal} value only if its current value + * is equal to {@code curVal}. Otherwise, it is no-op. + * + * @param name Name of the metadata. + * @param curVal Current value to check. + * @param newVal New value. + * @return {@code true} if replacement occurred, {@code false} otherwise. + */ + public boolean replaceMeta(String name, V curVal, V newVal); + + /** + * Removes metadata by name. + * + * @param name Name of the metadata to remove. + * @param Type of the value. + * @return Value of removed metadata or {@code null}. + */ + @Nullable public V removeMeta(String name); + + /** + * Removes metadata only if its current value is equal to {@code val} passed in. + * + * @param name Name of metadata attribute. + * @param val Value to compare. + * @param Value type. + * @return {@code True} if value was removed, {@code false} otherwise. + */ + public boolean removeMeta(String name, V val); } Index: modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEntryImpl.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEntryImpl.java (date 1418639191000) +++ modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEntryImpl.java (date 1418712303000) @@ -11,7 +11,6 @@ import org.apache.ignite.*; import org.apache.ignite.lang.*; -import org.gridgain.grid.*; import org.gridgain.grid.cache.*; import org.gridgain.grid.kernal.processors.cache.distributed.dht.*; import org.gridgain.grid.util.lang.*; @@ -565,7 +564,7 @@ /** {@inheritDoc} */ @SuppressWarnings({"unchecked"}) @Override public V1 meta(String name) { - GridCacheEntryEx e = unwrapForMeta(); + GridCacheEntryEx e = unwrapForMeta(); return e.meta(name); } @@ -573,33 +572,12 @@ /** {@inheritDoc} */ @SuppressWarnings({"unchecked"}) @Override public V1 removeMeta(String name) { - GridCacheEntryEx e = unwrapForMeta(); + GridCacheEntryEx e = unwrapForMeta(); return e.removeMeta(name); } /** {@inheritDoc} */ - @Override public Map allMeta() { - GridCacheEntryEx e = unwrapForMeta(); - - return e.allMeta(); - } - - /** {@inheritDoc} */ - @Override public boolean hasMeta(String name) { - GridCacheEntryEx e = unwrapForMeta(); - - return e.hasMeta(name); - } - - /** {@inheritDoc} */ - @Override public boolean hasMeta(String name, Object val) { - GridCacheEntryEx e = unwrapForMeta(); - - return e.hasMeta(name, val); - } - - /** {@inheritDoc} */ @Override public V1 putMetaIfAbsent(String name, V1 val) { GridCacheEntryEx cached = unwrapForMeta(); @@ -614,38 +592,10 @@ } /** {@inheritDoc} */ - @Override public V1 addMetaIfAbsent(String name, V1 val) { - GridCacheEntryEx cached = unwrapForMeta(); - - return cached.addMetaIfAbsent(name, val); - } - - /** {@inheritDoc} */ - @Override public V1 addMetaIfAbsent(String name, Callable c) { - GridCacheEntryEx cached = unwrapForMeta(); - - return cached.addMetaIfAbsent(name, c); - } - - /** {@inheritDoc} */ @Override public boolean replaceMeta(String name, V1 curVal, V1 newVal) { GridCacheEntryEx cached = unwrapForMeta(); return cached.replaceMeta(name, curVal, newVal); - } - - /** {@inheritDoc} */ - @Override public void copyMeta(GridMetadataAware from) { - GridCacheEntryEx cached = unwrapForMeta(); - - cached.copyMeta(from); - } - - /** {@inheritDoc} */ - @Override public void copyMeta(Map data) { - GridCacheEntryEx cached = unwrapForMeta(); - - cached.copyMeta(data); } /** {@inheritDoc} */ Index: modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionEntry.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionEntry.java (date 1418639191000) +++ modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionEntry.java (date 1418712303000) @@ -11,7 +11,6 @@ import org.apache.ignite.*; import org.apache.ignite.lang.*; -import org.gridgain.grid.*; import org.gridgain.grid.cache.*; import org.gridgain.grid.util.typedef.*; import org.gridgain.grid.util.typedef.internal.*; @@ -383,21 +382,6 @@ } /** {@inheritDoc} */ - @Override public Map allMeta() { - return cached.allMeta(); - } - - /** {@inheritDoc} */ - @Override public boolean hasMeta(String name) { - return cached.hasMeta(name); - } - - /** {@inheritDoc} */ - @Override public boolean hasMeta(String name, Object val) { - return cached.hasMeta(name, val); - } - - /** {@inheritDoc} */ @Override public V putMetaIfAbsent(String name, V val) { return cached.putMetaIfAbsent(name, val); } @@ -408,28 +392,8 @@ } /** {@inheritDoc} */ - @Override public V addMetaIfAbsent(String name, V val) { - return cached.addMetaIfAbsent(name, val); - } - - /** {@inheritDoc} */ - @Override public V addMetaIfAbsent(String name, Callable c) { - return cached.addMetaIfAbsent(name, c); - } - - /** {@inheritDoc} */ @Override public boolean replaceMeta(String name, V curVal, V newVal) { return cached.replaceMeta(name, curVal, newVal); - } - - /** {@inheritDoc} */ - @Override public void copyMeta(GridMetadataAware from) { - cached.copyMeta(from); - } - - /** {@inheritDoc} */ - @Override public void copyMeta(Map data) { - cached.copyMeta(data); } /** {@inheritDoc} */ Index: modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheFilterEvaluationEntry.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheFilterEvaluationEntry.java (date 1418639191000) +++ modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheFilterEvaluationEntry.java (date 1418712303000) @@ -11,7 +11,6 @@ import org.apache.ignite.*; import org.apache.ignite.lang.*; -import org.gridgain.grid.*; import org.gridgain.grid.cache.*; import org.gridgain.grid.util.typedef.internal.*; import org.jetbrains.annotations.*; @@ -353,16 +352,6 @@ } /** {@inheritDoc} */ - @Override public void copyMeta(GridMetadataAware from) { - impl.copyMeta(from); - } - - /** {@inheritDoc} */ - @Override public void copyMeta(Map data) { - impl.copyMeta(data); - } - - /** {@inheritDoc} */ @Nullable @Override public V addMeta(String name, V val) { return impl.addMeta(name, val); } @@ -378,16 +367,6 @@ } /** {@inheritDoc} */ - @Override public V addMetaIfAbsent(String name, V val) { - return impl.addMetaIfAbsent(name, val); - } - - /** {@inheritDoc} */ - @Nullable @Override public V addMetaIfAbsent(String name, @Nullable Callable c) { - return impl.addMetaIfAbsent(name, c); - } - - /** {@inheritDoc} */ @Override public V meta(String name) { return impl.meta(name); } @@ -400,21 +379,6 @@ /** {@inheritDoc} */ @Override public boolean removeMeta(String name, V val) { return impl.removeMeta(name, val); - } - - /** {@inheritDoc} */ - @Override public Map allMeta() { - return impl.allMeta(); - } - - /** {@inheritDoc} */ - @Override public boolean hasMeta(String name) { - return impl.hasMeta(name); - } - - /** {@inheritDoc} */ - @Override public boolean hasMeta(String name, V val) { - return impl.hasMeta(name, val); } /** {@inheritDoc} */ Index: modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheLogger.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheLogger.java (date 1418639191000) +++ modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheLogger.java (date 1418712303000) @@ -13,7 +13,6 @@ import org.apache.ignite.lang.*; import org.gridgain.grid.util.typedef.*; import org.gridgain.grid.util.typedef.internal.*; -import org.gridgain.grid.util.lang.*; import org.gridgain.grid.util.tostring.*; import org.jetbrains.annotations.*; @@ -23,7 +22,7 @@ * Logger which automatically attaches {@code [cacheName]} to every log statement. */ @GridToStringExclude -class GridCacheLogger extends GridMetadataAwareAdapter implements IgniteLogger, Externalizable { +class GridCacheLogger implements IgniteLogger, Externalizable { /** */ private static final long serialVersionUID = 0L; Index: modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java (date 1418639191000) +++ modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java (date 1418712303000) @@ -11,7 +11,6 @@ import org.apache.ignite.*; import org.apache.ignite.lang.*; -import org.gridgain.grid.*; import org.gridgain.grid.cache.*; import org.gridgain.grid.kernal.managers.deployment.*; import org.gridgain.grid.kernal.processors.cache.distributed.dht.*; @@ -3662,30 +3661,6 @@ } /** {@inheritDoc} */ - @Override public void copyMeta(GridMetadataAware from) { - A.notNull(from, "from"); - - synchronized (this) { - Map m = from.allMeta(); - - ensureData(m.size()); - - attributeDataExtras().putAll(from.allMeta()); - } - } - - /** {@inheritDoc} */ - @Override public void copyMeta(Map attrData) { - A.notNull(attrData, "data"); - - synchronized (this) { - ensureData(attrData.size()); - - attributeDataExtras().putAll(attrData); - } - } - - /** {@inheritDoc} */ @SuppressWarnings({"unchecked"}) @Nullable @Override public V1 addMeta(String name, V1 val) { A.notNull(name, "name", val, "val"); @@ -3711,8 +3686,7 @@ /** {@inheritDoc} */ @SuppressWarnings({"unchecked"}) - @Nullable - @Override public V1 removeMeta(String name) { + @Nullable @Override public V1 removeMeta(String name) { A.notNull(name, "name"); synchronized (this) { @@ -3757,36 +3731,11 @@ } /** {@inheritDoc} */ - @SuppressWarnings( {"unchecked", "RedundantCast"}) - @Override public synchronized Map allMeta() { - GridLeanMap attrData = attributeDataExtras(); - - if (attrData == null) - return Collections.emptyMap(); - - if (attrData.size() <= 5) - // This is a singleton unmodifiable map. - return (Map)attrData; - - // Return a copy. - return new HashMap<>((Map)attrData); - } - - /** {@inheritDoc} */ @Override public boolean hasMeta(String name) { return meta(name) != null; } /** {@inheritDoc} */ - @Override public boolean hasMeta(String name, V1 val) { - A.notNull(name, "name"); - - Object v = meta(name); - - return v != null && v.equals(val); - } - - /** {@inheritDoc} */ @SuppressWarnings({"unchecked"}) @Nullable @Override public V1 putMetaIfAbsent(String name, V1 val) { A.notNull(name, "name", val, "val"); @@ -3812,41 +3761,6 @@ if (v == null) try { return addMeta(name, c.call()); - } - catch (Exception e) { - throw F.wrap(e); - } - - return v; - } - } - - /** {@inheritDoc} */ - @SuppressWarnings({"unchecked"}) - @Override public V1 addMetaIfAbsent(String name, V1 val) { - A.notNull(name, "name", val, "val"); - - synchronized (this) { - V1 v = meta(name); - - if (v == null) - addMeta(name, v = val); - - return v; - } - } - - /** {@inheritDoc} */ - @SuppressWarnings({"unchecked"}) - @Nullable @Override public V1 addMetaIfAbsent(String name, @Nullable Callable c) { - A.notNull(name, "name", c, "c"); - - synchronized (this) { - V1 v = meta(name); - - if (v == null && c != null) - try { - addMeta(name, v = c.call()); } catch (Exception e) { throw F.wrap(e); Index: modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxProxyImpl.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxProxyImpl.java (date 1418639191000) +++ modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxProxyImpl.java (date 1418712303000) @@ -11,15 +11,12 @@ import org.apache.ignite.*; import org.apache.ignite.lang.*; -import org.gridgain.grid.*; import org.gridgain.grid.cache.*; import org.gridgain.grid.util.tostring.*; import org.gridgain.grid.util.typedef.internal.*; -import org.jetbrains.annotations.*; import java.io.*; import java.util.*; -import java.util.concurrent.*; /** * Cache transaction proxy. @@ -213,43 +210,12 @@ leave(); } } - /** {@inheritDoc} */ - @Override public void copyMeta(GridMetadataAware from) { - tx.copyMeta(from); - } - - /** {@inheritDoc} */ - @Override public void copyMeta(Map data) { - tx.copyMeta(data); - } - - /** {@inheritDoc} */ @Override public V1 addMeta(String name, V1 val) { return tx.addMeta(name, val); } /** {@inheritDoc} */ - @Override public V1 putMetaIfAbsent(String name, V1 val) { - return tx.putMetaIfAbsent(name, val); - } - - /** {@inheritDoc} */ - @Override public V1 putMetaIfAbsent(String name, Callable c) { - return tx.putMetaIfAbsent(name, c); - } - - /** {@inheritDoc} */ - @Nullable @Override public V1 addMetaIfAbsent(String name, V1 val) { - return tx.addMeta(name, val); - } - - /** {@inheritDoc} */ - @Override public V1 addMetaIfAbsent(String name, @Nullable Callable c) { - return tx.addMetaIfAbsent(name, c); - } - - /** {@inheritDoc} */ @SuppressWarnings({"RedundantTypeArguments"}) @Override public V1 meta(String name) { return tx.meta(name); @@ -259,31 +225,6 @@ @SuppressWarnings({"RedundantTypeArguments"}) @Override public V1 removeMeta(String name) { return tx.removeMeta(name); - } - - /** {@inheritDoc} */ - @Override public boolean removeMeta(String name, V1 val) { - return tx.removeMeta(name, val); - } - - /** {@inheritDoc} */ - @Override public Map allMeta() { - return tx.allMeta(); - } - - /** {@inheritDoc} */ - @Override public boolean hasMeta(String name) { - return tx.hasMeta(name); - } - - /** {@inheritDoc} */ - @Override public boolean hasMeta(String name, V1 val) { - return tx.hasMeta(name, val); - } - - /** {@inheritDoc} */ - @Override public boolean replaceMeta(String name, V1 curVal, V1 newVal) { - return tx.replaceMeta(name, curVal, newVal); } /** {@inheritDoc} */ Index: modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridPartitionedCacheEntryImpl.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridPartitionedCacheEntryImpl.java (date 1418639191000) +++ modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridPartitionedCacheEntryImpl.java (date 1418712303000) @@ -11,7 +11,6 @@ import org.apache.ignite.*; import org.apache.ignite.lang.*; -import org.gridgain.grid.*; import org.gridgain.grid.cache.*; import org.gridgain.grid.kernal.processors.cache.*; import org.gridgain.grid.kernal.processors.cache.distributed.dht.*; @@ -276,120 +275,6 @@ } /** {@inheritDoc} */ - @Override public V1 addMetaIfAbsent(String name, Callable c) { - V1 v = null; - - GridDhtCacheEntry de = dht().peekExx(key); - - if (de != null) - v = de.addMetaIfAbsent(name, c); - - if (ctx.isNear()) { - GridNearCacheEntry ne = de != null ? near().peekExx(key) : - near().entryExx(key, ctx.affinity().affinityTopologyVersion()); - - if (ne != null) { - V1 v1 = ne.addMetaIfAbsent(name, c); - - if (v == null) - v = v1; - } - } - - return v; - } - - /** {@inheritDoc} */ - @Override public V1 addMetaIfAbsent(String name, V1 val) { - V1 v = null; - - GridDhtCacheEntry de = dht().peekExx(key); - - if (de != null) - v = de.addMetaIfAbsent(name, val); - - if (ctx.isNear()) { - GridNearCacheEntry ne = de != null ? near().peekExx(key) : - near().entryExx(key, ctx.affinity().affinityTopologyVersion()); - - if (ne != null) { - V1 v1 = ne.addMetaIfAbsent(name, val); - - if (v == null) - v = v1; - } - } - - return v; - } - - /** {@inheritDoc} */ - @Override public Map allMeta() { - Map m = null; - - GridDhtCacheEntry de = dht().peekExx(key); - - if (de != null) - m = de.allMeta(); - - if (ctx.isNear()) { - GridNearCacheEntry ne = near().peekExx(key); - - if (ne != null) { - Map m1 = ne.allMeta(); - - if (m == null) - m = m1; - else if (!m1.isEmpty()) { - for (Map.Entry e1 : m1.entrySet()) - if (!m.containsKey(e1.getKey())) // Give preference to DHT. - m.put(e1.getKey(), e1.getValue()); - } - } - } - - return m; - } - - /** {@inheritDoc} */ - @Override public boolean hasMeta(String name) { - boolean b = false; - - GridDhtCacheEntry de = dht().peekExx(key); - - if (de != null) - b = de.hasMeta(name); - - if (ctx.isNear()) { - GridNearCacheEntry ne = near().peekExx(key); - - if (ne != null) - b |= ne.hasMeta(name); - } - - return b; - } - - /** {@inheritDoc} */ - @Override public boolean hasMeta(String name, Object val) { - boolean b = false; - - GridDhtCacheEntry de = dht().peekExx(key); - - if (de != null) - b = de.hasMeta(name, val); - - if (ctx.isNear()) { - GridNearCacheEntry ne = near().peekExx(key); - - if (ne != null) - b |= ne.hasMeta(name, val); - } - - return b; - } - - /** {@inheritDoc} */ @SuppressWarnings( {"RedundantCast"}) @Override public V1 meta(String name) { V1 v = null; @@ -521,38 +406,6 @@ } return b; - } - - /** {@inheritDoc} */ - @Override public void copyMeta(Map data) { - GridDhtCacheEntry de = dht().peekExx(key); - - if (de != null) - de.copyMeta(data); - - if (ctx.isNear()) { - GridNearCacheEntry ne = de != null ? near().peekExx(key) : - near().entryExx(key, ctx.affinity().affinityTopologyVersion()); - - if (ne != null) - ne.copyMeta(data); - } - } - - /** {@inheritDoc} */ - @Override public void copyMeta(GridMetadataAware from) { - GridDhtCacheEntry de = dht().peekExx(key); - - if (de != null) - de.copyMeta(from); - - if (ctx.isNear()) { - GridNearCacheEntry ne = de != null ? near().peekExx(key) : - near().entryExx(key, ctx.affinity().affinityTopologyVersion()); - - if (ne != null) - ne.copyMeta(from); - } } /** {@inheritDoc} */ Index: modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryManager.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryManager.java (date 1418639191000) +++ modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryManager.java (date 1418712303000) @@ -16,7 +16,6 @@ import org.apache.ignite.resources.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.indexing.*; -import org.gridgain.grid.*; import org.gridgain.grid.cache.*; import org.gridgain.grid.cache.query.*; import org.gridgain.grid.kernal.*; @@ -2804,17 +2803,6 @@ } /** {@inheritDoc} */ - @Override public void copyMeta(GridMetadataAware from) { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public void copyMeta(Map data) { - throw new UnsupportedOperationException(); - - } - - /** {@inheritDoc} */ @Nullable @Override public V addMeta(String name, V val) { throw new UnsupportedOperationException(); } @@ -2830,16 +2818,6 @@ } /** {@inheritDoc} */ - @Override public V addMetaIfAbsent(String name, V val) { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Nullable @Override public V addMetaIfAbsent(String name, @Nullable Callable c) { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ @Override public V meta(String name) { return null; } @@ -2852,21 +2830,6 @@ /** {@inheritDoc} */ @Override public boolean removeMeta(String name, V val) { throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public Map allMeta() { - return null; - } - - /** {@inheritDoc} */ - @Override public boolean hasMeta(String name) { - return false; - } - - /** {@inheritDoc} */ - @Override public boolean hasMeta(String name, V val) { - return false; } /** {@inheritDoc} */ Index: modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/continuous/GridCacheContinuousQueryEntry.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/continuous/GridCacheContinuousQueryEntry.java (date 1418639191000) +++ modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/continuous/GridCacheContinuousQueryEntry.java (date 1418712303000) @@ -12,7 +12,6 @@ import org.apache.ignite.*; import org.apache.ignite.lang.*; import org.apache.ignite.marshaller.*; -import org.gridgain.grid.*; import org.gridgain.grid.cache.*; import org.gridgain.grid.kernal.managers.deployment.*; import org.gridgain.grid.kernal.processors.cache.*; @@ -582,20 +581,6 @@ } /** {@inheritDoc} */ - @Override public void copyMeta(GridMetadataAware from) { - assert impl != null; - - impl.copyMeta(from); - } - - /** {@inheritDoc} */ - @Override public void copyMeta(Map data) { - assert impl != null; - - impl.copyMeta(data); - } - - /** {@inheritDoc} */ @Nullable @Override public V addMeta(String name, V val) { assert impl != null; @@ -617,20 +602,6 @@ } /** {@inheritDoc} */ - @Override public V addMetaIfAbsent(String name, V val) { - assert impl != null; - - return impl.addMetaIfAbsent(name, val); - } - - /** {@inheritDoc} */ - @Nullable @Override public V addMetaIfAbsent(String name, @Nullable Callable c) { - assert impl != null; - - return impl.addMetaIfAbsent(name, c); - } - - /** {@inheritDoc} */ @Override public V meta(String name) { assert impl != null; @@ -649,27 +620,6 @@ assert impl != null; return impl.removeMeta(name, val); - } - - /** {@inheritDoc} */ - @Override public Map allMeta() { - assert impl != null; - - return impl.allMeta(); - } - - /** {@inheritDoc} */ - @Override public boolean hasMeta(String name) { - assert impl != null; - - return impl.hasMeta(name); - } - - /** {@inheritDoc} */ - @Override public boolean hasMeta(String name, V val) { - assert impl != null; - - return impl.hasMeta(name, val); } /** {@inheritDoc} */ Index: modules/core/src/main/java/org/gridgain/grid/util/GridUtils.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/gridgain/grid/util/GridUtils.java (date 1418639191000) +++ modules/core/src/main/java/org/gridgain/grid/util/GridUtils.java (date 1418712303000) @@ -1757,25 +1757,6 @@ } /** - * Copies metadata from given object into the passed in metadata aware - * instance - if object is not {@code null} and implements {@link GridMetadataAware}. - * Otherwise - returns passed metadata aware instance unchanged. - * - * @param t Passed in metadata aware instance. - * @param obj Object to copy metadata from. - * @param Type of the metadata aware instance. - * @return Metadata aware instance with metadata potentially copied. - */ - public static T withMeta(T t, @Nullable Object obj) { - assert t != null; - - if (obj instanceof GridMetadataAware) - t.copyMeta((GridMetadataAware)obj); - - return t; - } - - /** * Replace password in URI string with a single '*' character. *

* Parses given URI by applying ".*://(.*:.*)@.*" Index: modules/core/src/main/java/org/gridgain/grid/util/lang/GridComputeJobWrapper.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/gridgain/grid/util/lang/GridComputeJobWrapper.java (date 1418639191000) +++ modules/core/src/main/java/org/gridgain/grid/util/lang/GridComputeJobWrapper.java (date 1418712303000) @@ -11,7 +11,6 @@ import org.apache.ignite.*; import org.apache.ignite.compute.*; -import org.gridgain.grid.*; import org.gridgain.grid.util.typedef.internal.*; import org.jetbrains.annotations.*; @@ -21,7 +20,7 @@ * Convenient wrapper for grid job. It allows to create a job clone in cases when the same * job needs to be cloned to multiple grid nodes during mapping phase of task execution. */ -public class GridComputeJobWrapper extends GridMetadataAwareAdapter implements ComputeJob, Callable, +public class GridComputeJobWrapper implements ComputeJob, Callable, GridPeerDeployAware { /** */ private static final long serialVersionUID = 0L; @@ -33,21 +32,14 @@ private transient volatile GridPeerDeployAware p; /** - * Creates a wrapper with given grid {@code job}. If {@code job} implements {@link GridMetadataAware} - * interface and {@code copyMeta} is {@code true} - the metadata information will be - * copied from given {@code job} to this wrapper. + * Creates a wrapper with given grid {@code job}. * * @param job Job to wrap. - * @param cpMeta Whether or not to copy metadata in case when {@code job} - * implements {@link GridMetadataAware} interface. */ - public GridComputeJobWrapper(ComputeJob job, boolean cpMeta) { + public GridComputeJobWrapper(ComputeJob job) { A.notNull(job, "job"); this.job = job; - - if (cpMeta && job instanceof GridMetadataAware) - copyMeta((GridMetadataAware)job); } /** Index: modules/core/src/main/java/org/gridgain/grid/util/lang/GridFunc.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/gridgain/grid/util/lang/GridFunc.java (date 1418639191000) +++ modules/core/src/main/java/org/gridgain/grid/util/lang/GridFunc.java (date 1418712303000) @@ -1616,29 +1616,6 @@ } /** - * Convenient utility method that returns collections of metadata values for a given - * collection of metadata aware objects. - *

- * Note that this method doesn't create a new collection but simply iterates over the input one. - * - * @param objs Collection of metadata aware object. - * @param name Name of the metadata. - * @param Type of the metadata. - * @return Collections of metadata value for a given collection of metadata aware objects. - */ - public static Collection meta(Collection objs, String name) { - A.notNull(objs, "objs", name, "attach"); - - Collection c = new ArrayList<>(objs.size()); - - for (GridMetadataAware n : objs) { - c.add(n.meta(name)); - } - - return c; - } - - /** * Gets closure that calls {@code System.out.println()} on its bound variable. * * @param Type of the bound variable. @@ -5669,129 +5646,6 @@ A.notNull(c, "c", f, "f"); F.forEach(asList(c), f, p); - } - - /** - * Creates predicate that accepts subclass of {@link GridMetadataAware} - * interface and evaluates to {@code true} if it contains all provided metadata. - * - * @param meta Collection of metadata. - * @param Type of returned predicate. - * @return Predicate that accepts subclass of {@link GridMetadataAware} interface and - * evaluates to {@code true} if it contains all provided metadata. - * @see #meta(String...) - * @see #meta(Iterable) - * @see #meta(String, Object) - */ - public static IgnitePredicate metaEntry(@Nullable Map.Entry... meta) { - return metaEntry(isEmpty(meta) ? Collections.>emptyList() : asList(meta)); - } - - /** - * Creates predicate that accepts subclass of {@link GridMetadataAware} interface - * and evaluates to {@code true} if it contains all provided metadata. - * - * @param meta Collection of metadata. - * @param Type of returned predicate. - * @return Predicate that accepts subclass of {@link GridMetadataAware} interface and - * evaluates to {@code true} if it contains all provided metadata. - * @see #meta(String...) - * @see #meta(Iterable) - * @see #meta(String, Object) - */ - public static IgnitePredicate metaEntry( - @Nullable final Collection> meta) { - return isEmpty(meta) ? GridFunc.alwaysFalse() : new P1() { - @Override public boolean apply(T e) { - assert meta != null; - - for (Map.Entry t : meta) { - if (!F.eq(e.meta(t.getKey()), t.getValue())) - return false; - } - - return true; - } - }; - } - - /** - * Creates predicate that accepts subclass of {@link GridMetadataAware} interface - * and evaluates to {@code true} if it contains all provided metadata. - * - * @param meta Collection of metadata as a map. - * @param Type of returned predicate. - * @return Predicate that accepts subclass of {@link GridMetadataAware} - * interface and evaluates to {@code true} if it contains all provided metadata. - * @see #meta(String...) - * @see #meta(Iterable) - * @see #meta(String, Object) - * @see #metaEntry(Entry[]) - * @see #metaEntry(Collection) - */ - public static IgnitePredicate meta(@Nullable Map meta) { - if (isEmpty(meta)) - return metaEntry(Collections.>emptySet()); - else { - assert meta != null; - - return metaEntry(meta.entrySet()); - } - } - - /** - * Creates predicate that accepts subclass of {@link GridMetadataAware} interface - * and evaluates to {@code true} if it contains given metadata. - * - * @param name Metadata name. - * @param val Metadata value. - * @param Type of returned predicate. - * @return Predicate that accepts subclass of {@link GridMetadataAware} interface - * and evaluates to {@code true} if it contains given metadata. - * @see #metaEntry(Entry[]) - * @see #meta(String...) - * @see #meta(Iterable) - */ - public static IgnitePredicate meta(String name, Object val) { - A.notNull(name, "name", val, "val"); - - return metaEntry(F.t(name, val)); - } - - /** - * Creates predicate that accepts subclass of {@link GridMetadataAware} interface - * and evaluates to {@code true} if it contains given metadata names (values are ignored). - * - * @param names Metadata names to evaluate by. - * @param Type of returned predicate. - * @return Predicate that accepts subclass of {@link GridMetadataAware} interface and - * evaluates to {@code true} if it contains given metadata names (values are ignored). - */ - public static IgnitePredicate meta(@Nullable String... names) { - return meta(isEmpty(names) ? Collections.emptyList() : asList(names)); - } - - /** - * Creates predicate that accepts subclass of {@link GridMetadataAware} interface and - * evaluates to {@code true} if it contains given metadata names (values are ignored). - * - * @param names Metadata names to evaluate by. - * @param Type of returned predicate. - * @return Predicate that accepts subclass of {@link GridMetadataAware} interface and - * evaluates to {@code true} if it contains given metadata names (values are ignored). - */ - public static IgnitePredicate meta(@Nullable final Iterable names) { - return isEmpty(names) ? GridFunc.alwaysFalse() : new P1() { - @Override public boolean apply(T e) { - assert names != null; - - for (String name : names) - if (!e.hasMeta(name)) - return false; - - return true; - } - }; } /** Index: modules/core/src/main/java/org/gridgain/grid/util/lang/GridMetadataAwareAdapter.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/gridgain/grid/util/lang/GridMetadataAwareAdapter.java (date 1418639191000) +++ modules/core/src/main/java/org/gridgain/grid/util/lang/GridMetadataAwareAdapter.java (date 1418712303000) @@ -9,7 +9,6 @@ package org.gridgain.grid.util.lang; -import org.gridgain.grid.*; import org.gridgain.grid.util.typedef.*; import org.gridgain.grid.util.typedef.internal.*; import org.gridgain.grid.util.*; @@ -20,12 +19,12 @@ import java.util.concurrent.*; /** - * Convenient adapter for {@link GridMetadataAware}. + * Convenient adapter for working with metadata. *

Thread Safety

* This class provides necessary synchronization for thread-safe access. */ @SuppressWarnings( {"SynchronizeOnNonFinalField"}) -public class GridMetadataAwareAdapter implements GridMetadataAware { +public class GridMetadataAwareAdapter { /** */ private static final long serialVersionUID = 0L; @@ -72,8 +71,12 @@ return false; } - /** {@inheritDoc} */ - @Override public void copyMeta(GridMetadataAware from) { + /** + * Copies all metadata from another instance. + * + * @param from Metadata aware instance to copy metadata from. + */ + public void copyMeta(GridMetadataAwareAdapter from) { A.notNull(from, "from"); synchronized (mux) { @@ -85,8 +88,12 @@ } } - /** {@inheritDoc} */ - @Override public void copyMeta(Map data) { + /** + * Copies all metadata from given map. + * + * @param data Map to copy metadata from. + */ + public void copyMeta(Map data) { A.notNull(data, "data"); synchronized (mux) { @@ -96,9 +103,17 @@ } } - /** {@inheritDoc} */ + /** + * Adds a new metadata. + * + * @param name Metadata name. + * @param val Metadata value. + * @param Type of the value. + * @return Metadata previously associated with given name, or + * {@code null} if there was none. + */ @SuppressWarnings({"unchecked"}) - @Nullable @Override public V addMeta(String name, V val) { + @Nullable public V addMeta(String name, V val) { A.notNull(name, "name", val, "val"); synchronized (mux) { @@ -108,9 +123,15 @@ } } - /** {@inheritDoc} */ + /** + * Gets metadata by name. + * + * @param name Metadata name. + * @param Type of the value. + * @return Metadata value or {@code null}. + */ @SuppressWarnings({"unchecked"}) - @Nullable @Override public V meta(String name) { + @Nullable public V meta(String name) { A.notNull(name, "name"); synchronized (mux) { @@ -118,10 +139,15 @@ } } - /** {@inheritDoc} */ + /** + * Removes metadata by name. + * + * @param name Name of the metadata to remove. + * @param Type of the value. + * @return Value of removed metadata or {@code null}. + */ @SuppressWarnings({"unchecked"}) - @Nullable - @Override public V removeMeta(String name) { + @Nullable public V removeMeta(String name) { A.notNull(name, "name"); synchronized (mux) { @@ -137,9 +163,16 @@ } } - /** {@inheritDoc} */ + /** + * Removes metadata only if its current value is equal to {@code val} passed in. + * + * @param name Name of metadata attribute. + * @param val Value to compare. + * @param Value type. + * @return {@code True} if value was removed, {@code false} otherwise. + */ @SuppressWarnings({"unchecked"}) - @Override public boolean removeMeta(String name, V val) { + public boolean removeMeta(String name, V val) { A.notNull(name, "name", val, "val"); synchronized (mux) { @@ -158,9 +191,14 @@ } } - /** {@inheritDoc} */ + /** + * Gets all metadata in this entry. + * + * @param Type of the value. + * @return All metadata in this entry. + */ @SuppressWarnings( {"unchecked", "RedundantCast"}) - @Override public Map allMeta() { + public Map allMeta() { synchronized (mux) { if (data == null) return Collections.emptyMap(); @@ -174,13 +212,23 @@ } } - /** {@inheritDoc} */ - @Override public boolean hasMeta(String name) { + /** + * Tests whether or not given metadata is set. + * + * @param name Name of the metadata to test. + * @return Whether or not given metadata is set. + */ + public boolean hasMeta(String name) { return meta(name) != null; } - /** {@inheritDoc} */ - @Override public boolean hasMeta(String name, V val) { + /** + * Tests whether or not given metadata is set. + * + * @param name Name of the metadata to test. + * @return Whether or not given metadata is set. + */ + public boolean hasMeta(String name, V val) { A.notNull(name, "name"); Object v = meta(name); @@ -188,9 +236,16 @@ return v != null && v.equals(val); } - /** {@inheritDoc} */ + /** + * Adds given metadata value only if it was absent. + * + * @param name Metadata name. + * @param val Value to add if it's not attached already. + * @param Type of the value. + * @return {@code null} if new value was put, or current value if put didn't happen. + */ @SuppressWarnings({"unchecked"}) - @Nullable @Override public V putMetaIfAbsent(String name, V val) { + @Nullable public V putMetaIfAbsent(String name, V val) { A.notNull(name, "name", val, "val"); synchronized (mux) { @@ -203,9 +258,19 @@ } } - /** {@inheritDoc} */ + /** + * Adds given metadata value only if it was absent. + * + * @param name Metadata name. + * @param c Factory closure to produce value to add if it's not attached already. + * Not that unlike {@link #addMeta(String, Object)} method the factory closure will + * not be called unless the value is required and therefore value will only be created + * when it is actually needed. + * @param Type of the value. + * @return {@code null} if new value was put, or current value if put didn't happen. + */ @SuppressWarnings({"unchecked", "ClassReferencesSubclass"}) - @Nullable @Override public V putMetaIfAbsent(String name, Callable c) { + @Nullable public V putMetaIfAbsent(String name, Callable c) { A.notNull(name, "name", c, "c"); synchronized (mux) { @@ -223,9 +288,18 @@ } } - /** {@inheritDoc} */ + /** + * Adds given metadata value only if it was absent. Unlike + * {@link #putMetaIfAbsent(String, Callable)}, this method always returns + * the latest value and never previous one. + * + * @param name Metadata name. + * @param val Value to add if it's not attached already. + * @param Type of the value. + * @return The value of the metadata after execution of this method. + */ @SuppressWarnings({"unchecked"}) - @Override public V addMetaIfAbsent(String name, V val) { + public V addMetaIfAbsent(String name, V val) { A.notNull(name, "name", val, "val"); synchronized (mux) { @@ -238,9 +312,20 @@ } } - /** {@inheritDoc} */ + /** + * Adds given metadata value only if it was absent. + * + * @param name Metadata name. + * @param c Factory closure to produce value to add if it's not attached already. + * Not that unlike {@link #addMeta(String, Object)} method the factory closure will + * not be called unless the value is required and therefore value will only be created + * when it is actually needed. If {@code null} and metadata value is missing - {@code null} + * will be returned from this method. + * @param Type of the value. + * @return The value of the metadata after execution of this method. + */ @SuppressWarnings({"unchecked"}) - @Nullable @Override public V addMetaIfAbsent(String name, @Nullable Callable c) { + @Nullable public V addMetaIfAbsent(String name, @Nullable Callable c) { A.notNull(name, "name", c, "c"); synchronized (mux) { @@ -258,9 +343,17 @@ } } - /** {@inheritDoc} */ + /** + * Replaces given metadata with new {@code newVal} value only if its current value + * is equal to {@code curVal}. Otherwise, it is no-op. + * + * @param name Name of the metadata. + * @param curVal Current value to check. + * @param newVal New value. + * @return {@code true} if replacement occurred, {@code false} otherwise. + */ @SuppressWarnings({"RedundantTypeArguments"}) - @Override public boolean replaceMeta(String name, V curVal, V newVal) { + public boolean replaceMeta(String name, V curVal, V newVal) { A.notNull(name, "name", newVal, "newVal", curVal, "curVal"); synchronized (mux) { @@ -317,7 +410,7 @@ /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntDeclareCloneNotSupportedException", "OverriddenMethodCallDuringObjectConstruction"}) - @Override public Object clone() { + public Object clone() { try { GridMetadataAwareAdapter clone = (GridMetadataAwareAdapter)super.clone(); Index: modules/core/src/test/java/org/gridgain/grid/GridTestJobContext.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/test/java/org/gridgain/grid/GridTestJobContext.java (date 1418639191000) +++ modules/core/src/test/java/org/gridgain/grid/GridTestJobContext.java (date 1418712303000) @@ -19,7 +19,7 @@ /** * Test job context. */ -public class GridTestJobContext extends GridMetadataAwareAdapter implements ComputeJobContext { +public class GridTestJobContext implements ComputeJobContext { /** */ private final IgniteUuid jobId; Index: modules/core/src/test/java/org/gridgain/grid/lang/GridTupleSelfTest.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/test/java/org/gridgain/grid/lang/GridTupleSelfTest.java (date 1418639191000) +++ modules/core/src/test/java/org/gridgain/grid/lang/GridTupleSelfTest.java (date 1418712303000) @@ -10,13 +10,10 @@ package org.gridgain.grid.lang; import org.apache.ignite.lang.*; -import org.gridgain.grid.*; import org.gridgain.grid.util.lang.*; -import org.gridgain.grid.util.typedef.*; import org.gridgain.testframework.junits.common.*; import java.util.*; -import java.util.concurrent.*; /** * @@ -156,87 +153,5 @@ catch (NoSuchElementException e) { info("Caught expected exception: " + e); } - } - - /** - * Helper method that checks the correctness of {@link GridMetadataAware} - * implementation. - * - * @param ma Metadata aware object. - */ - private void checkMetadataAware(GridMetadataAware ma) { - // addMeta(name, val). - assert ma.addMeta("attr1", "val1") == null; - assert ma.addMeta("attr2", 1) == null; - - // hasMeta(name). - assert ma.hasMeta("attr1"); - assert !ma.hasMeta("attr3"); - - // hasMeta(name, val). - assert ma.hasMeta("attr1", "val1"); - assert !ma.hasMeta("attr1", "some another val"); - - // meta(name). - assertEquals("val1", ma.meta("attr1")); - assertEquals(1, ma.meta("attr2")); - - // allMeta(). - Map allMeta = ma.allMeta(); - - assert allMeta != null; - assert allMeta.size() == 2; - - assertEquals("val1", allMeta.get("attr1")); - assertEquals(1, allMeta.get("attr2")); - - // addMetaIfAbsent(name, val). - assert ma.addMetaIfAbsent("attr2", 2) == 1; - assert ma.addMetaIfAbsent("attr3", 3) == 3; - - // addMetaIfAbsent(name, c). - assert ma.addMetaIfAbsent("attr2", new Callable() { - @Override public Integer call() throws Exception { - return 5; - } - }) == 1; - - assert ma.addMetaIfAbsent("attr4", new Callable() { - @Override public Integer call() throws Exception { - return 5; - } - }) == 5; - - // removeMeta(name). - assertEquals(3, ma.removeMeta("attr3")); - assertEquals(5, ma.removeMeta("attr4")); - - assert ma.removeMeta("attr156") == null; - - // replaceMeta(name, newVal, curVal). - assert !ma.replaceMeta("attr2", 5, 4); - assert ma.replaceMeta("attr2", 1, 4); - - // copyMeta(from). - ma.copyMeta(new GridMetadataAwareAdapter(F.asMap("k1", "v1", "k2", 2))); - - assertEquals("v1", ma.meta("k1")); - assertEquals(2, ma.meta("k2")); - assertEquals("val1", allMeta.get("attr1")); - assertEquals(4, allMeta.get("attr2")); - - assert !ma.hasMeta("k3"); - - // copyMeta(from). - ma.copyMeta(F.asMap("1", 1, "2", 2)); - - assertEquals(1, ma.meta("1")); - assertEquals(2, ma.meta("2")); - assertEquals("v1", ma.meta("k1")); - assertEquals(2, ma.meta("k2")); - assertEquals("val1", allMeta.get("attr1")); - assertEquals(4, allMeta.get("attr2")); - - assert !ma.hasMeta("3"); } } Index: modules/core/src/test/java/org/gridgain/testframework/junits/logger/GridTestLog4jLogger.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/test/java/org/gridgain/testframework/junits/logger/GridTestLog4jLogger.java (date 1418639191000) +++ modules/core/src/test/java/org/gridgain/testframework/junits/logger/GridTestLog4jLogger.java (date 1418712303000) @@ -58,7 +58,7 @@ * logger in your task/job code. See {@link org.apache.ignite.resources.IgniteLoggerResource} annotation about logger * injection. */ -public class GridTestLog4jLogger extends GridMetadataAwareAdapter implements IgniteLogger, IgniteLoggerNodeIdAware { +public class GridTestLog4jLogger implements IgniteLogger, IgniteLoggerNodeIdAware { /** */ private static final long serialVersionUID = 0L; Index: modules/jcl/src/main/java/org/gridgain/grid/logger/jcl/GridJclLogger.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/jcl/src/main/java/org/gridgain/grid/logger/jcl/GridJclLogger.java (date 1418639191000) +++ modules/jcl/src/main/java/org/gridgain/grid/logger/jcl/GridJclLogger.java (date 1418712303000) @@ -65,7 +65,7 @@ * logger in your task/job code. See {@link org.apache.ignite.resources.IgniteLoggerResource} annotation about logger * injection. */ -public class GridJclLogger extends GridMetadataAwareAdapter implements IgniteLogger { +public class GridJclLogger implements IgniteLogger { /** */ private static final long serialVersionUID = 0L; Index: modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jLogger.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jLogger.java (date 1418639191000) +++ modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jLogger.java (date 1418712303000) @@ -58,7 +58,7 @@ * logger in your task/job code. See {@link org.apache.ignite.resources.IgniteLoggerResource} annotation about logger * injection. */ -public class IgniteLog4jLogger extends GridMetadataAwareAdapter implements IgniteLogger, IgniteLoggerNodeIdAware, +public class IgniteLog4jLogger implements IgniteLogger, IgniteLoggerNodeIdAware, IgniteLog4jFileAware { /** */ private static final long serialVersionUID = 0L; Index: modules/schedule/src/main/java/org/gridgain/grid/kernal/processors/schedule/ScheduleFutureImpl.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/schedule/src/main/java/org/gridgain/grid/kernal/processors/schedule/ScheduleFutureImpl.java (date 1418639191000) +++ modules/schedule/src/main/java/org/gridgain/grid/kernal/processors/schedule/ScheduleFutureImpl.java (date 1418712303000) @@ -35,7 +35,7 @@ /** * Implementation of {@link org.apache.ignite.scheduler.SchedulerFuture} interface. */ -class ScheduleFutureImpl extends GridMetadataAwareAdapter implements SchedulerFuture, Externalizable { +class ScheduleFutureImpl implements SchedulerFuture, Externalizable { /** */ private static final long serialVersionUID = 0L; @@ -772,8 +772,7 @@ * * @param */ - private static class ScheduleFutureSnapshot extends GridMetadataAwareAdapter implements - SchedulerFuture { + private static class ScheduleFutureSnapshot implements SchedulerFuture { /** */ private static final long serialVersionUID = 0L; Index: modules/slf4j/src/main/java/org/gridgain/grid/logger/slf4j/GridSlf4jLogger.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/slf4j/src/main/java/org/gridgain/grid/logger/slf4j/GridSlf4jLogger.java (date 1418639191000) +++ modules/slf4j/src/main/java/org/gridgain/grid/logger/slf4j/GridSlf4jLogger.java (date 1418712303000) @@ -29,7 +29,7 @@ * logger in your task/job code. See {@link org.apache.ignite.resources.IgniteLoggerResource} annotation about logger * injection. */ -public class GridSlf4jLogger extends GridMetadataAwareAdapter implements IgniteLogger { +public class GridSlf4jLogger implements IgniteLogger { /** */ private static final long serialVersionUID = 0L; Index: modules/spring/src/main/java/org/gridgain/grid/GridSpringBean.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/spring/src/main/java/org/gridgain/grid/GridSpringBean.java (date 1418639191000) +++ modules/spring/src/main/java/org/gridgain/grid/GridSpringBean.java (date 1418712303000) @@ -66,7 +66,7 @@ * *

*/ -public class GridSpringBean extends GridMetadataAwareAdapter implements Ignite, DisposableBean, InitializingBean, +public class GridSpringBean implements Ignite, DisposableBean, InitializingBean, ApplicationContextAware, Externalizable { /** */ private static final long serialVersionUID = 0L;