You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/06/09 08:33:02 UTC
[13/24] incubator-ignite git commit: ignite-545: merge from
ignite-sprint-6
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96f0956d/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 2ed6c62..cd4d543 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -24,6 +24,7 @@ import org.apache.ignite.cache.query.annotations.*;
import org.apache.ignite.configuration.*;
import org.apache.ignite.events.*;
import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.managers.communication.*;
import org.apache.ignite.internal.processors.*;
import org.apache.ignite.internal.processors.cache.*;
import org.apache.ignite.internal.processors.cache.query.*;
@@ -35,6 +36,7 @@ import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.internal.util.worker.*;
import org.apache.ignite.lang.*;
+import org.apache.ignite.plugin.extensions.communication.*;
import org.apache.ignite.spi.indexing.*;
import org.jetbrains.annotations.*;
import org.jsr166.*;
@@ -391,27 +393,39 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
/**
+ * @param space Space name.
+ * @return Cache object context.
+ */
+ private CacheObjectContext cacheObjectContext(String space) {
+ return ctx.cache().internalCache(space).context().cacheObjectContext();
+ }
+
+ /**
* Writes key-value pair to index.
*
* @param space Space.
* @param key Key.
- * @param keyBytes Byte array with key data.
* @param val Value.
- * @param valBytes Byte array with value data.
* @param ver Cache entry version.
* @param expirationTime Expiration time or 0 if never expires.
* @throws IgniteCheckedException In case of error.
*/
@SuppressWarnings("unchecked")
- public <K, V> void store(final String space, final K key, @Nullable byte[] keyBytes, final V val,
- @Nullable byte[] valBytes, byte[] ver, long expirationTime) throws IgniteCheckedException {
+ public void store(final String space, final CacheObject key, final CacheObject val,
+ byte[] ver, long expirationTime) throws IgniteCheckedException {
assert key != null;
assert val != null;
if (log.isDebugEnabled())
log.debug("Store [space=" + space + ", key=" + key + ", val=" + val + "]");
- ctx.indexing().store(space, key, val, expirationTime);
+ CacheObjectContext coctx = null;
+
+ if (ctx.indexing().enabled()) {
+ coctx = cacheObjectContext(space);
+
+ ctx.indexing().store(space, key.value(coctx, false), val.value(coctx, false), expirationTime);
+ }
if (idx == null)
return;
@@ -420,7 +434,10 @@ public class GridQueryProcessor extends GridProcessorAdapter {
throw new IllegalStateException("Failed to write to index (grid is stopping).");
try {
- final Class<?> valCls = val.getClass();
+ if (coctx == null)
+ coctx = cacheObjectContext(space);
+
+ Class<?> valCls = null;
TypeId id;
@@ -431,8 +448,11 @@ public class GridQueryProcessor extends GridProcessorAdapter {
id = new TypeId(space, typeId);
}
- else
+ else {
+ valCls = val.value(coctx, false).getClass();
+
id = new TypeId(space, valCls);
+ }
TypeDescriptor desc = types.get(id);
@@ -444,9 +464,13 @@ public class GridQueryProcessor extends GridProcessorAdapter {
"(multiple classes with same simple name are stored in the same cache) " +
"[expCls=" + desc.valueClass().getName() + ", actualCls=" + valCls.getName() + ']');
- if (!ctx.cacheObjects().isPortableObject(key) && !desc.keyClass().isAssignableFrom(key.getClass()))
- throw new IgniteCheckedException("Failed to update index, incorrect key class [expCls=" +
- desc.keyClass().getName() + ", actualCls=" + key.getClass().getName() + "]");
+ if (!ctx.cacheObjects().isPortableObject(key)) {
+ Class<?> keyCls = key.value(coctx, false).getClass();
+
+ if (!desc.keyClass().isAssignableFrom(keyCls))
+ throw new IgniteCheckedException("Failed to update index, incorrect key class [expCls=" +
+ desc.keyClass().getName() + ", actualCls=" + keyCls.getName() + "]");
+ }
idx.store(space, desc, key, val, ver, expirationTime);
}
@@ -628,6 +652,13 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
/**
+ * @return Message factory for {@link GridIoManager}.
+ */
+ public MessageFactory messageFactory() {
+ return idx == null ? null : idx.messageFactory();
+ }
+
+ /**
* Closeable iterator.
*/
private static interface ClIter<X> extends AutoCloseable, Iterator<X> {
@@ -687,13 +718,17 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @throws IgniteCheckedException Thrown in case of any errors.
*/
@SuppressWarnings("unchecked")
- public void remove(String space, Object key, Object val) throws IgniteCheckedException {
+ public void remove(String space, CacheObject key, CacheObject val) throws IgniteCheckedException {
assert key != null;
if (log.isDebugEnabled())
log.debug("Remove [space=" + space + ", key=" + key + ", val=" + val + "]");
- ctx.indexing().remove(space, key);
+ if (ctx.indexing().enabled()) {
+ CacheObjectContext coctx = cacheObjectContext(space);
+
+ ctx.indexing().remove(space, key.value(coctx, false));
+ }
if (idx == null)
return;
@@ -795,11 +830,15 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @param key key.
* @throws IgniteCheckedException If failed.
*/
- public void onSwap(String spaceName, Object key) throws IgniteCheckedException {
+ public void onSwap(String spaceName, CacheObject key) throws IgniteCheckedException {
if (log.isDebugEnabled())
log.debug("Swap [space=" + spaceName + ", key=" + key + "]");
- ctx.indexing().onSwap(spaceName, key);
+ if (ctx.indexing().enabled()) {
+ CacheObjectContext coctx = cacheObjectContext(spaceName);
+
+ ctx.indexing().onSwap(spaceName, key.value(coctx, false));
+ }
if (idx == null)
return;
@@ -821,15 +860,18 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @param spaceName Space name.
* @param key Key.
* @param val Value.
- * @param valBytes Value bytes.
* @throws IgniteCheckedException If failed.
*/
- public void onUnswap(String spaceName, Object key, Object val, byte[] valBytes)
+ public void onUnswap(String spaceName, CacheObject key, CacheObject val)
throws IgniteCheckedException {
if (log.isDebugEnabled())
log.debug("Unswap [space=" + spaceName + ", key=" + key + ", val=" + val + "]");
- ctx.indexing().onUnswap(spaceName, key, val);
+ if (ctx.indexing().enabled()) {
+ CacheObjectContext coctx = cacheObjectContext(spaceName);
+
+ ctx.indexing().onUnswap(spaceName, key.value(coctx, false), val.value(coctx, false));
+ }
if (idx == null)
return;
@@ -838,7 +880,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
throw new IllegalStateException("Failed to process swap event (grid is stopping).");
try {
- idx.onUnswap(spaceName, key, val, valBytes);
+ idx.onUnswap(spaceName, key, val);
}
finally {
busyLock.leaveBusy();
@@ -894,10 +936,19 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @param parent Parent in case of embeddable.
* @throws IgniteCheckedException In case of error.
*/
- static void processAnnotationsInClass(boolean key, Class<?> cls, TypeDescriptor type,
+ private void processAnnotationsInClass(boolean key, Class<?> cls, TypeDescriptor type,
@Nullable ClassProperty parent) throws IgniteCheckedException {
- if (U.isJdk(cls))
+ if (U.isJdk(cls) || idx.isGeometryClass(cls)) {
+ if (parent == null && !key && idx.isSqlType(cls) ) { // We have to index primitive _val.
+ String idxName = "_val_idx";
+
+ type.addIndex(idxName, idx.isGeometryClass(cls) ? GEO_SPATIAL : SORTED);
+
+ type.addFieldToIndex(idxName, "_VAL", 0, false);
+ }
+
return;
+ }
if (parent != null && parent.knowsClass(cls))
throw new IgniteCheckedException("Recursive reference found in type: " + cls.getName());
@@ -969,7 +1020,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @param desc Class description.
* @throws IgniteCheckedException In case of error.
*/
- static void processAnnotation(boolean key, QuerySqlField sqlAnn, QueryTextField txtAnn,
+ private void processAnnotation(boolean key, QuerySqlField sqlAnn, QueryTextField txtAnn,
Class<?> cls, ClassProperty prop, TypeDescriptor desc) throws IgniteCheckedException {
if (sqlAnn != null) {
processAnnotationsInClass(key, cls, desc, prop);
@@ -980,7 +1031,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
if (sqlAnn.index()) {
String idxName = prop.name() + "_idx";
- desc.addIndex(idxName, isGeometryClass(prop.type()) ? GEO_SPATIAL : SORTED);
+ desc.addIndex(idxName, idx.isGeometryClass(prop.type()) ? GEO_SPATIAL : SORTED);
desc.addFieldToIndex(idxName, prop.name(), 0, sqlAnn.descending());
}
@@ -1007,7 +1058,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @param d Type descriptor.
* @throws IgniteCheckedException If failed.
*/
- static void processClassMeta(CacheTypeMetadata meta, TypeDescriptor d)
+ private void processClassMeta(CacheTypeMetadata meta, TypeDescriptor d)
throws IgniteCheckedException {
Class<?> keyCls = d.keyClass();
Class<?> valCls = d.valueClass();
@@ -1022,7 +1073,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
String idxName = prop.name() + "_idx";
- d.addIndex(idxName, isGeometryClass(prop.type()) ? GEO_SPATIAL : SORTED);
+ d.addIndex(idxName, idx.isGeometryClass(prop.type()) ? GEO_SPATIAL : SORTED);
d.addFieldToIndex(idxName, prop.name(), 0, false);
}
@@ -1034,7 +1085,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
String idxName = prop.name() + "_idx";
- d.addIndex(idxName, isGeometryClass(prop.type()) ? GEO_SPATIAL : SORTED);
+ d.addIndex(idxName, idx.isGeometryClass(prop.type()) ? GEO_SPATIAL : SORTED);
d.addFieldToIndex(idxName, prop.name(), 0, true);
}
@@ -1094,7 +1145,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
String idxName = prop.name() + "_idx";
- d.addIndex(idxName, isGeometryClass(prop.type()) ? GEO_SPATIAL : SORTED);
+ d.addIndex(idxName, idx.isGeometryClass(prop.type()) ? GEO_SPATIAL : SORTED);
d.addFieldToIndex(idxName, prop.name(), 0, false);
}
@@ -1106,7 +1157,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
String idxName = prop.name() + "_idx";
- d.addIndex(idxName, isGeometryClass(prop.type()) ? GEO_SPATIAL : SORTED);
+ d.addIndex(idxName, idx.isGeometryClass(prop.type()) ? GEO_SPATIAL : SORTED);
d.addFieldToIndex(idxName, prop.name(), 0, true);
}
@@ -1279,31 +1330,6 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
/**
- * @param cls Field type.
- * @return {@code True} if given type is a spatial geometry type based on {@code com.vividsolutions.jts} library.
- * @throws IgniteCheckedException If failed.
- */
- private static boolean isGeometryClass(Class<?> cls) throws IgniteCheckedException { // TODO optimize
- Class<?> dataTypeCls;
-
- try {
- dataTypeCls = Class.forName("org.h2.value.DataType");
- }
- catch (ClassNotFoundException ignored) {
- return false; // H2 is not in classpath.
- }
-
- try {
- Method method = dataTypeCls.getMethod("isGeometryClass", Class.class);
-
- return (Boolean)method.invoke(null, cls);
- }
- catch (Exception e) {
- throw new IgniteCheckedException("Failed to invoke 'org.h2.value.DataType.isGeometryClass' method.", e);
- }
- }
-
- /**
*
*/
private abstract static class Property {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96f0956d/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java
index b7b6f4c..4fdc027 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryNextPageResponse.java
@@ -23,6 +23,7 @@ import org.apache.ignite.plugin.extensions.communication.*;
import java.io.*;
import java.nio.*;
+import java.util.*;
/**
* Next page response.
@@ -44,11 +45,15 @@ public class GridQueryNextPageResponse implements Message {
private int allRows;
/** */
- private byte[] rows;
+ private int cols;
+
+ /** */
+ @GridDirectCollection(Message.class)
+ private Collection<Message> vals;
/** */
@GridDirectTransient
- private transient Object plainRows;
+ private transient Collection<?> plainRows;
/**
* For {@link Externalizable}.
@@ -62,18 +67,21 @@ public class GridQueryNextPageResponse implements Message {
* @param qry Query.
* @param page Page.
* @param allRows All rows count.
- * @param rows Rows.
+ * @param cols Number of columns in row.
+ * @param vals Values for rows in this page added sequentially.
* @param plainRows Not marshalled rows for local node.
*/
- public GridQueryNextPageResponse(long qryReqId, int qry, int page, int allRows,
- byte[] rows, Object plainRows) {
- assert rows != null ^ plainRows != null;
+ public GridQueryNextPageResponse(long qryReqId, int qry, int page, int allRows, int cols,
+ Collection<Message> vals, Collection<?> plainRows) {
+ assert vals != null ^ plainRows != null;
+ assert cols > 0 : cols;
this.qryReqId = qryReqId;
this.qry = qry;
this.page = page;
this.allRows = allRows;
- this.rows = rows;
+ this.cols = cols;
+ this.vals = vals;
this.plainRows = plainRows;
}
@@ -106,16 +114,23 @@ public class GridQueryNextPageResponse implements Message {
}
/**
- * @return Rows.
+ * @return Columns in row.
*/
- public byte[] rows() {
- return rows;
+ public int columns() {
+ return cols;
+ }
+
+ /**
+ * @return Values.
+ */
+ public Collection<Message> values() {
+ return vals;
}
/**
* @return Plain rows.
*/
- public Object plainRows() {
+ public Collection<?> plainRows() {
return plainRows;
}
@@ -143,29 +158,34 @@ public class GridQueryNextPageResponse implements Message {
writer.incrementState();
case 1:
- if (!writer.writeInt("page", page))
+ if (!writer.writeInt("cols", cols))
return false;
writer.incrementState();
case 2:
- if (!writer.writeInt("qry", qry))
+ if (!writer.writeInt("page", page))
return false;
writer.incrementState();
case 3:
- if (!writer.writeLong("qryReqId", qryReqId))
+ if (!writer.writeInt("qry", qry))
return false;
writer.incrementState();
case 4:
- if (!writer.writeByteArray("rows", rows))
+ if (!writer.writeLong("qryReqId", qryReqId))
return false;
writer.incrementState();
+ case 5:
+ if (!writer.writeCollection("vals", vals, MessageCollectionItemType.MSG))
+ return false;
+
+ writer.incrementState();
}
return true;
@@ -188,7 +208,7 @@ public class GridQueryNextPageResponse implements Message {
reader.incrementState();
case 1:
- page = reader.readInt("page");
+ cols = reader.readInt("cols");
if (!reader.isLastRead())
return false;
@@ -196,7 +216,7 @@ public class GridQueryNextPageResponse implements Message {
reader.incrementState();
case 2:
- qry = reader.readInt("qry");
+ page = reader.readInt("page");
if (!reader.isLastRead())
return false;
@@ -204,7 +224,7 @@ public class GridQueryNextPageResponse implements Message {
reader.incrementState();
case 3:
- qryReqId = reader.readLong("qryReqId");
+ qry = reader.readInt("qry");
if (!reader.isLastRead())
return false;
@@ -212,7 +232,15 @@ public class GridQueryNextPageResponse implements Message {
reader.incrementState();
case 4:
- rows = reader.readByteArray("rows");
+ qryReqId = reader.readLong("qryReqId");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 5:
+ vals = reader.readCollection("vals", MessageCollectionItemType.MSG);
if (!reader.isLastRead())
return false;
@@ -231,6 +259,6 @@ public class GridQueryNextPageResponse implements Message {
/** {@inheritDoc} */
@Override public byte fieldsCount() {
- return 5;
+ return 6;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96f0956d/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java
index b4c6668..3d3bcf9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java
@@ -22,7 +22,6 @@ import org.apache.ignite.internal.*;
import org.apache.ignite.internal.processors.cache.query.*;
import org.apache.ignite.internal.util.tostring.*;
import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.marshaller.*;
import org.apache.ignite.plugin.extensions.communication.*;
import java.nio.*;
@@ -46,12 +45,9 @@ public class GridQueryRequest implements Message {
/** */
@GridToStringInclude
- @GridDirectTransient
+ @GridDirectCollection(GridCacheSqlQuery.class)
private Collection<GridCacheSqlQuery> qrys;
- /** */
- private byte[] qrysBytes;
-
/**
* Default constructor.
*/
@@ -64,17 +60,13 @@ public class GridQueryRequest implements Message {
* @param pageSize Page size.
* @param space Space.
* @param qrys Queries.
- * @param qrysBytes Marshalled queries.
*/
- public GridQueryRequest(long reqId, int pageSize, String space, Collection<GridCacheSqlQuery> qrys, byte[] qrysBytes) {
+ public GridQueryRequest(long reqId, int pageSize, String space, Collection<GridCacheSqlQuery> qrys) {
this.reqId = reqId;
this.pageSize = pageSize;
this.space = space;
- assert qrysBytes != null;
-
this.qrys = qrys;
- this.qrysBytes = qrysBytes;
}
/**
@@ -101,10 +93,7 @@ public class GridQueryRequest implements Message {
/**
* @return Queries.
*/
- public Collection<GridCacheSqlQuery> queries(Marshaller m) throws IgniteCheckedException {
- if (qrys == null && qrysBytes != null)
- qrys = m.unmarshal(qrysBytes, null);
-
+ public Collection<GridCacheSqlQuery> queries() throws IgniteCheckedException {
return qrys;
}
@@ -132,7 +121,7 @@ public class GridQueryRequest implements Message {
writer.incrementState();
case 1:
- if (!writer.writeByteArray("qrysBytes", qrysBytes))
+ if (!writer.writeCollection("qrys", qrys, MessageCollectionItemType.MSG))
return false;
writer.incrementState();
@@ -171,7 +160,7 @@ public class GridQueryRequest implements Message {
reader.incrementState();
case 1:
- qrysBytes = reader.readByteArray("qrysBytes");
+ qrys = reader.readCollection("qrys", MessageCollectionItemType.MSG);
if (!reader.isLastRead())
return false;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96f0956d/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceField.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceField.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceField.java
index 6b921f4..fed7ebd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceField.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceField.java
@@ -22,6 +22,7 @@ import org.jetbrains.annotations.*;
import java.lang.annotation.*;
import java.lang.reflect.*;
+import java.util.*;
/**
* Wrapper for data where resource should be injected.
@@ -43,10 +44,7 @@ class GridResourceField {
* @param field Field where resource should be injected.
* @param ann Resource annotation.
*/
- GridResourceField(Field field, @Nullable Annotation ann) {
- assert field != null;
- assert ann != null || GridResourceUtils.mayRequireResources(field);
-
+ GridResourceField(@NotNull Field field, @NotNull Annotation ann) {
this.field = field;
this.ann = ann;
@@ -78,6 +76,16 @@ class GridResourceField {
return ann == null;
}
+ /**
+ * @param c Closure.
+ */
+ public static GridResourceField[] toArray(Collection<GridResourceField> c) {
+ if (c.isEmpty())
+ return EMPTY_ARRAY;
+
+ return c.toArray(new GridResourceField[c.size()]);
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(GridResourceField.class, this);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96f0956d/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
index 8410e71..1e85ecd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
@@ -21,6 +21,7 @@ import org.apache.ignite.*;
import org.apache.ignite.internal.managers.deployment.*;
import org.apache.ignite.internal.util.*;
import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
import org.jetbrains.annotations.*;
import org.jsr166.*;
@@ -38,20 +39,8 @@ class GridResourceIoc {
private final ConcurrentMap<ClassLoader, Set<Class<?>>> taskMap =
new ConcurrentHashMap8<>();
- /** Field cache. */
- private final ConcurrentMap<Class<?>, ConcurrentMap<Class<? extends Annotation>, GridResourceField[]>> fieldCache =
- new ConcurrentHashMap8<>();
-
- /** Method cache. */
- private final ConcurrentMap<Class<?>, ConcurrentMap<Class<? extends Annotation>, GridResourceMethod[]>> mtdCache =
- new ConcurrentHashMap8<>();
-
- /**
- * Cache for classes that do not require injection with some annotation.
- * Maps annotation classes to set a set of target classes to skip.
- */
- private final ConcurrentMap<Class<? extends Annotation>, Set<Class<?>>> skipCache =
- new ConcurrentHashMap8<>();
+ /** Class descriptors cache. */
+ private final ConcurrentMap<Class<?>, ClassDescriptor> clsDescs = new ConcurrentHashMap8<>();
/** */
private final ConcurrentMap<Class<?>, Class<? extends Annotation>[]> annCache =
@@ -64,18 +53,8 @@ class GridResourceIoc {
Set<Class<?>> clss = taskMap.remove(ldr);
if (clss != null) {
- fieldCache.keySet().removeAll(clss);
- mtdCache.keySet().removeAll(clss);
-
- for (Map.Entry<Class<? extends Annotation>, Set<Class<?>>> e : skipCache.entrySet()) {
- Set<Class<?>> skipClss = e.getValue();
-
- if (skipClss != null)
- e.getValue().removeAll(clss);
- }
-
- for (Class<?> cls : clss)
- annCache.remove(cls);
+ clsDescs.keySet().removeAll(clss);
+ annCache.keySet().removeAll(clss);
}
}
@@ -84,8 +63,8 @@ class GridResourceIoc {
*/
void undeployAll() {
taskMap.clear();
- mtdCache.clear();
- fieldCache.clear();
+ clsDescs.clear();
+ annCache.clear();
}
/**
@@ -107,15 +86,26 @@ class GridResourceIoc {
@Nullable Class<?> depCls)
throws IgniteCheckedException
{
- assert target != null;
- assert annCls != null;
- assert injector != null;
+ return injectInternal(target, annCls, injector, dep, depCls, null);
+ }
- if (isAnnotationPresent(target, annCls, dep))
- // Use identity hash set to compare via referential equality.
- return injectInternal(target, annCls, injector, dep, depCls, new GridLeanIdentitySet<>());
+ /**
+ * @param cls Class.
+ */
+ private ClassDescriptor descriptor(@Nullable GridDeployment dep, Class<?> cls) {
+ ClassDescriptor res = clsDescs.get(cls);
- return false;
+ if (res == null) {
+ if (dep != null) {
+ Set<Class<?>> classes = F.addIfAbsent(taskMap, dep.classLoader(), F.<Class<?>>newCSet());
+
+ classes.add(cls);
+ }
+
+ res = F.addIfAbsent(clsDescs, cls, new ClassDescriptor(cls));
+ }
+
+ return res;
}
/**
@@ -133,73 +123,54 @@ class GridResourceIoc {
GridResourceInjector injector,
@Nullable GridDeployment dep,
@Nullable Class<?> depCls,
- Set<Object> checkedObjs)
+ @Nullable Set<Object> checkedObjs)
throws IgniteCheckedException
{
- assert target != null;
- assert annCls != null;
- assert injector != null;
- assert checkedObjs != null;
-
Class<?> targetCls = target.getClass();
- Set<Class<?>> skipClss = skipCache.get(annCls);
+ ClassDescriptor descr = descriptor(dep, targetCls);
- // Skip this class if it does not need to be injected.
- if (skipClss != null && skipClss.contains(targetCls))
- return false;
+ T2<GridResourceField[], GridResourceMethod[]> annotatedMembers = descr.annotatedMembers(annCls);
- // Check if already inspected to avoid indefinite recursion.
- if (!checkedObjs.add(target))
+ if (descr.recursiveFields().length == 0 && annotatedMembers == null)
return false;
- int annCnt = 0;
+ if (checkedObjs == null && descr.recursiveFields().length > 0)
+ checkedObjs = new GridLeanIdentitySet<>();
- boolean injected = false;
+ if (checkedObjs != null && !checkedObjs.add(target))
+ return false;
- for (GridResourceField field : getFieldsWithAnnotation(dep, targetCls, annCls)) {
- if (field.processFieldValue()) {
- Field f = field.getField();
+ boolean injected = false;
- try {
- Object obj = f.get(target);
+ for (Field field : descr.recursiveFields()) {
+ try {
+ Object obj = field.get(target);
- if (obj != null) {
- // Recursion.
- boolean injected0 = injectInternal(obj, annCls, injector, dep, depCls, checkedObjs);
+ if (obj != null) {
+ assert checkedObjs != null;
- injected |= injected0;
- }
- }
- catch (IllegalAccessException e) {
- throw new IgniteCheckedException("Failed to inject resource [field=" + f.getName() +
- ", target=" + target + ']', e);
+ injected |= injectInternal(obj, annCls, injector, dep, depCls, checkedObjs);
}
}
- else {
- injector.inject(field, target, depCls, dep);
-
- injected = true;
+ catch (IllegalAccessException e) {
+ throw new IgniteCheckedException("Failed to inject resource [field=" + field.getName() +
+ ", target=" + target + ']', e);
}
-
- annCnt++;
}
- for (GridResourceMethod mtd : getMethodsWithAnnotation(dep, targetCls, annCls)) {
- injector.inject(mtd, target, depCls, dep);
-
- injected = true;
-
- annCnt++;
- }
+ if (annotatedMembers != null) {
+ for (GridResourceField field : annotatedMembers.get1()) {
+ injector.inject(field, target, depCls, dep);
- if (annCnt == 0) {
- if (skipClss == null)
- skipClss = F.addIfAbsent(skipCache, annCls, F.<Class<?>>newCSet());
+ injected = true;
+ }
- assert skipClss != null;
+ for (GridResourceMethod mtd : annotatedMembers.get2()) {
+ injector.inject(mtd, target, depCls, dep);
- skipClss.add(targetCls);
+ injected = true;
+ }
}
return injected;
@@ -217,29 +188,9 @@ class GridResourceIoc {
assert target != null;
assert annCls != null;
- Class<?> targetCls = target.getClass();
-
- Set<Class<?>> skipClss = skipCache.get(annCls);
-
- if (skipClss != null && skipClss.contains(targetCls))
- return false;
-
- GridResourceField[] fields = getFieldsWithAnnotation(dep, targetCls, annCls);
-
- if (fields.length > 0)
- return true;
+ ClassDescriptor desc = descriptor(dep, target.getClass());
- GridResourceMethod[] mtds = getMethodsWithAnnotation(dep, targetCls, annCls);
-
- if (mtds.length > 0)
- return true;
-
- if (skipClss == null)
- skipClss = F.addIfAbsent(skipCache, annCls, F.<Class<?>>newCSet());
-
- skipClss.add(targetCls);
-
- return false;
+ return desc.recursiveFields().length > 0 || desc.annotatedMembers(annCls) != null;
}
/**
@@ -260,17 +211,14 @@ class GridResourceIoc {
Class<? extends Annotation>[] res = annCache.get(cls);
if (res == null) {
- Collection<Class<? extends Annotation>> res0 =
- new HashSet<>(annClss.size(), 1.0f);
+ Collection<Class<? extends Annotation>> res0 = new ArrayList<>();
for (Class<? extends Annotation> annCls : annClss) {
if (isAnnotationPresent(target, annCls, dep))
res0.add(annCls);
}
- res = new Class[res0.size()];
-
- res0.toArray(res);
+ res = res0.toArray(new Class[res0.size()]);
annCache.putIfAbsent(cls, res);
}
@@ -279,36 +227,6 @@ class GridResourceIoc {
}
/**
- * For tests only.
- *
- * @param cls Class for test.
- * @return {@code true} if cached, {@code false} otherwise.
- */
- boolean isCached(Class<?> cls) {
- return isCached(cls.getName());
- }
-
- /**
- * For tests only.
- *
- * @param clsName Class for test.
- * @return {@code true} if cached, {@code false} otherwise.
- */
- boolean isCached(String clsName) {
- for (Class<?> aClass : fieldCache.keySet()) {
- if (aClass.getName().equals(clsName))
- return true;
- }
-
- for (Class<?> aClass : mtdCache.keySet()) {
- if (aClass.getName().equals(clsName))
- return true;
- }
-
- return false;
- }
-
- /**
* Gets set of methods with given annotation.
*
* @param dep Deployment.
@@ -318,156 +236,111 @@ class GridResourceIoc {
*/
GridResourceMethod[] getMethodsWithAnnotation(@Nullable GridDeployment dep, Class<?> cls,
Class<? extends Annotation> annCls) {
- GridResourceMethod[] mtds = getMethodsFromCache(cls, annCls);
+ ClassDescriptor desc = descriptor(dep, cls);
- if (mtds == null) {
- List<GridResourceMethod> mtdsList = new ArrayList<>();
-
- for (Class cls0 = cls; !cls0.equals(Object.class); cls0 = cls0.getSuperclass()) {
- for (Method mtd : cls0.getDeclaredMethods()) {
- Annotation ann = mtd.getAnnotation(annCls);
-
- if (ann != null)
- mtdsList.add(new GridResourceMethod(mtd, ann));
- }
- }
+ T2<GridResourceField[], GridResourceMethod[]> t2 = desc.annotatedMembers(annCls);
- if (mtdsList.isEmpty())
- mtds = GridResourceMethod.EMPTY_ARRAY;
- else
- mtds = mtdsList.toArray(new GridResourceMethod[mtdsList.size()]);
-
- cacheMethods(dep, cls, annCls, mtds);
- }
+ return t2 == null ? GridResourceMethod.EMPTY_ARRAY : t2.get2();
+ }
- return mtds;
+ /** {@inheritDoc} */
+ public void printMemoryStats() {
+ X.println(">>> taskMapSize: " + taskMap.size());
+ X.println(">>> classDescriptorsCacheSize: " + clsDescs.size());
}
/**
- * Gets all entries from the specified class or its super-classes that have
- * been annotated with annotation provided.
*
- * @param cls Class in which search for methods.
- * @param dep Deployment.
- * @param annCls Annotation.
- * @return Set of entries with given annotations.
*/
- private GridResourceField[] getFieldsWithAnnotation(@Nullable GridDeployment dep, Class<?> cls,
- Class<? extends Annotation> annCls) {
- GridResourceField[] fields = getFieldsFromCache(cls, annCls);
+ private static class ClassDescriptor {
+ /** */
+ private final Field[] recursiveFields;
+
+ /** */
+ private final Map<Class<? extends Annotation>, T2<GridResourceField[], GridResourceMethod[]>> annMap;
+
+ /**
+ * @param cls Class.
+ */
+ ClassDescriptor(Class<?> cls) {
+ Map<Class<? extends Annotation>, T2<List<GridResourceField>, List<GridResourceMethod>>> annMap
+ = new HashMap<>();
- if (fields == null) {
- List<GridResourceField> fieldsList = new ArrayList<>();
+ List<Field> recursiveFieldsList = new ArrayList<>();
boolean allowImplicitInjection = !GridNoImplicitInjection.class.isAssignableFrom(cls);
for (Class cls0 = cls; !cls0.equals(Object.class); cls0 = cls0.getSuperclass()) {
for (Field field : cls0.getDeclaredFields()) {
- Annotation ann = field.getAnnotation(annCls);
-
- if (ann != null)
- fieldsList.add(new GridResourceField(field, ann));
- else if (allowImplicitInjection && GridResourceUtils.mayRequireResources(field)) {
- // Account for anonymous inner classes.
- fieldsList.add(new GridResourceField(field, null));
- }
- }
- }
-
- if (fieldsList.isEmpty())
- fields = GridResourceField.EMPTY_ARRAY;
- else
- fields = fieldsList.toArray(new GridResourceField[fieldsList.size()]);
+ Annotation[] fieldAnns = field.getAnnotations();
- cacheFields(dep, cls, annCls, fields);
- }
+ for (Annotation ann : fieldAnns) {
+ T2<List<GridResourceField>, List<GridResourceMethod>> t2 = annMap.get(ann.annotationType());
- return fields;
- }
+ if (t2 == null) {
+ t2 = new T2<List<GridResourceField>, List<GridResourceMethod>>(
+ new ArrayList<GridResourceField>(),
+ new ArrayList<GridResourceMethod>());
- /**
- * Gets all fields for a given class with given annotation from cache.
- *
- * @param cls Class to get fields from.
- * @param annCls Annotation class for fields.
- * @return List of fields with given annotation, possibly {@code null}.
- */
- @Nullable private GridResourceField[] getFieldsFromCache(Class<?> cls, Class<? extends Annotation> annCls) {
- Map<Class<? extends Annotation>, GridResourceField[]> annCache = fieldCache.get(cls);
+ annMap.put(ann.annotationType(), t2);
+ }
- return annCache != null ? annCache.get(annCls) : null;
- }
-
- /**
- * Caches list of fields with given annotation from given class.
- *
- * @param cls Class the fields belong to.
- * @param dep Deployment.
- * @param annCls Annotation class for the fields.
- * @param fields Fields to cache.
- */
- private void cacheFields(@Nullable GridDeployment dep, Class<?> cls, Class<? extends Annotation> annCls,
- GridResourceField[] fields) {
- if (dep != null) {
- Set<Class<?>> classes = F.addIfAbsent(taskMap, dep.classLoader(), F.<Class<?>>newCSet());
+ t2.get1().add(new GridResourceField(field, ann));
+ }
- assert classes != null;
+ if (allowImplicitInjection
+ && fieldAnns.length == 0
+ && GridResourceUtils.mayRequireResources(field)) {
+ field.setAccessible(true);
- classes.add(cls);
- }
+ // Account for anonymous inner classes.
+ recursiveFieldsList.add(field);
+ }
+ }
- Map<Class<? extends Annotation>, GridResourceField[]> rsrcFields =
- F.addIfAbsent(fieldCache, cls, F.<Class<? extends Annotation>, GridResourceField[]>newCMap());
+ for (Method mtd : cls0.getDeclaredMethods()) {
+ for (Annotation ann : mtd.getAnnotations()) {
+ T2<List<GridResourceField>, List<GridResourceMethod>> t2 = annMap.get(ann.annotationType());
- assert rsrcFields != null;
+ if (t2 == null) {
+ t2 = new T2<List<GridResourceField>, List<GridResourceMethod>>(
+ new ArrayList<GridResourceField>(),
+ new ArrayList<GridResourceMethod>());
- rsrcFields.put(annCls, fields);
- }
+ annMap.put(ann.annotationType(), t2);
+ }
- /**
- * Gets all methods for a given class with given annotation from cache.
- *
- * @param cls Class to get methods from.
- * @param annCls Annotation class for fields.
- * @return List of methods with given annotation, possibly {@code null}.
- */
- @Nullable private GridResourceMethod[] getMethodsFromCache(Class<?> cls, Class<? extends Annotation> annCls) {
- Map<Class<? extends Annotation>, GridResourceMethod[]> annCache = mtdCache.get(cls);
+ t2.get2().add(new GridResourceMethod(mtd, ann));
+ }
+ }
+ }
- return annCache != null ? annCache.get(annCls) : null;
- }
+ recursiveFields = recursiveFieldsList.isEmpty() ? U.EMPTY_FIELDS
+ : recursiveFieldsList.toArray(new Field[recursiveFieldsList.size()]);
- /**
- * Caches list of methods with given annotation from given class.
- *
- * @param rsrcCls Class the fields belong to.
- * @param dep Deployment.
- * @param annCls Annotation class for the fields.
- * @param mtds Methods to cache.
- */
- private void cacheMethods(@Nullable GridDeployment dep, Class<?> rsrcCls, Class<? extends Annotation> annCls,
- GridResourceMethod[] mtds) {
- if (dep != null) {
- Set<Class<?>> classes = F.addIfAbsent(taskMap, dep.classLoader(), F.<Class<?>>newCSet());
+ this.annMap = IgniteUtils.limitedMap(annMap.size());
- assert classes != null;
+ for (Map.Entry<Class<? extends Annotation>, T2<List<GridResourceField>, List<GridResourceMethod>>> entry
+ : annMap.entrySet()) {
+ GridResourceField[] fields = GridResourceField.toArray(entry.getValue().get1());
+ GridResourceMethod[] mtds = GridResourceMethod.toArray(entry.getValue().get2());
- classes.add(rsrcCls);
+ this.annMap.put(entry.getKey(), new T2<>(fields, mtds));
+ }
}
- Map<Class<? extends Annotation>, GridResourceMethod[]> rsrcMtds = F.addIfAbsent(mtdCache,
- rsrcCls, F.<Class<? extends Annotation>, GridResourceMethod[]>newCMap());
-
- assert rsrcMtds != null;
-
- rsrcMtds.put(annCls, mtds);
- }
+ /**
+ * @return Recursive fields.
+ */
+ public Field[] recursiveFields() {
+ return recursiveFields;
+ }
- /** {@inheritDoc} */
- public void printMemoryStats() {
- X.println(">>> taskMapSize: " + taskMap.size());
- X.println(">>> fieldCacheSize: " + fieldCache.size());
- X.println(">>> mtdCacheSize: " + mtdCache.size());
- X.println(">>> skipCacheSize: " + skipCache.size());
+ /**
+ * @return Fields.
+ */
+ @Nullable public T2<GridResourceField[], GridResourceMethod[]> annotatedMembers(Class<? extends Annotation> annCls) {
+ return annMap.get(annCls);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96f0956d/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceMethod.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceMethod.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceMethod.java
index aba9405..ad08a40 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceMethod.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceMethod.java
@@ -21,6 +21,7 @@ import org.apache.ignite.internal.util.typedef.internal.*;
import java.lang.annotation.*;
import java.lang.reflect.*;
+import java.util.*;
/**
* Wrapper for data where resource should be injected.
@@ -48,6 +49,8 @@ class GridResourceMethod {
this.mtd = mtd;
this.ann = ann;
+
+ mtd.setAccessible(true);
}
/**
@@ -68,6 +71,16 @@ class GridResourceMethod {
return ann;
}
+ /**
+ * @param c Closure.
+ */
+ public static GridResourceMethod[] toArray(Collection<GridResourceMethod> c) {
+ if (c.isEmpty())
+ return EMPTY_ARRAY;
+
+ return c.toArray(new GridResourceMethod[c.size()]);
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(GridResourceMethod.class, this);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96f0956d/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java
index f08a287..f5ba492 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java
@@ -23,7 +23,6 @@ import org.apache.ignite.compute.*;
import org.apache.ignite.internal.*;
import org.apache.ignite.internal.managers.deployment.*;
import org.apache.ignite.internal.processors.*;
-import org.apache.ignite.internal.util.lang.*;
import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.lifecycle.*;
import org.apache.ignite.resources.*;
@@ -147,8 +146,8 @@ public class GridResourceProcessor extends GridProcessorAdapter {
Method mtd = rsrcMtd.getMethod();
try {
- mtd.setAccessible(true);
-
+ // No need to call mtd.setAccessible(true);
+ // It has been called in GridResourceMethod constructor.
mtd.invoke(target);
}
catch (IllegalArgumentException | InvocationTargetException | IllegalAccessException e) {
@@ -278,7 +277,7 @@ public class GridResourceProcessor extends GridProcessorAdapter {
log.debug("Injecting resources: " + job);
// Unwrap Proxy object.
- Object obj = unwrapTarget(unwrapJob(job));
+ Object obj = unwrapTarget(job);
injectToJob(dep, taskCls, obj, ses, jobCtx);
@@ -329,19 +328,6 @@ public class GridResourceProcessor extends GridProcessorAdapter {
}
/**
- * Gets rid of job wrapper, if any.
- *
- * @param job Job to unwrap.
- * @return Unwrapped job.
- */
- private ComputeJob unwrapJob(ComputeJob job) {
- if (job instanceof GridComputeJobWrapper)
- return ((GridComputeJobWrapper)job).wrappedJob();
-
- return job;
- }
-
- /**
* Injects held resources into given grid task.
*
* @param dep Deployed class.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96f0956d/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index cb56650..0932212 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -108,10 +108,13 @@ public abstract class IgniteUtils {
private static final int[] GRID_EVTS;
/** Empty integers array. */
- private static final int[] EMPTY_INTS = new int[0];
+ public static final int[] EMPTY_INTS = new int[0];
/** Empty longs. */
- private static final long[] EMPTY_LONGS = new long[0];
+ public static final long[] EMPTY_LONGS = new long[0];
+
+ /** Empty longs. */
+ public static final Field[] EMPTY_FIELDS = new Field[0];
/** System line separator. */
private static final String NL = System.getProperty("line.separator");
@@ -1529,8 +1532,10 @@ public abstract class IgniteUtils {
return Collections.emptyList();
if (addrs.size() == 1) {
- if (reachable(addrs.get(1), reachTimeout))
- return Collections.singletonList(addrs.get(1));
+ InetAddress addr = addrs.get(0);
+
+ if (reachable(addr, reachTimeout))
+ return Collections.singletonList(addr);
return Collections.emptyList();
}
@@ -8807,6 +8812,21 @@ public abstract class IgniteUtils {
}
/**
+ * Creates new map that limited by size.
+ *
+ * @param limit Limit for size.
+ */
+ public static <K, V> Map<K, V> limitedMap(int limit) {
+ if (limit == 0)
+ return Collections.emptyMap();
+
+ if (limit < 5)
+ return new GridLeanMap<>(limit);
+
+ return new HashMap<>(capacity(limit), 0.75f);
+ }
+
+ /**
* Returns comparator that sorts remote node addresses. If remote node resides on the same host, then put
* loopback addresses first, last otherwise.
*
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96f0956d/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryServerEndpoint.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryServerEndpoint.java b/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryServerEndpoint.java
index 86a0886..5185856 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryServerEndpoint.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryServerEndpoint.java
@@ -592,7 +592,7 @@ public class IpcSharedMemoryServerEndpoint implements IpcServerEndpoint {
if (log.isDebugEnabled())
log.debug("Token directory is being processed concurrently: " + workTokDir.getAbsolutePath());
}
- catch (InterruptedIOException ignored) {
+ catch (FileLockInterruptionException ignored) {
Thread.currentThread().interrupt();
}
catch (IOException e) {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96f0956d/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridComputeJobWrapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridComputeJobWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridComputeJobWrapper.java
deleted file mode 100644
index 82c0078..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridComputeJobWrapper.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.util.lang;
-
-import org.apache.ignite.compute.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.jetbrains.annotations.*;
-
-import java.util.concurrent.*;
-
-/**
- * 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 implements ComputeJob, Callable<Object>,
- GridPeerDeployAware {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** */
- private final ComputeJob job;
-
- /** Peer deploy aware class. */
- private transient volatile GridPeerDeployAware p;
-
- /**
- * Creates a wrapper with given grid {@code job}.
- *
- * @param job Job to wrap.
- */
- public GridComputeJobWrapper(ComputeJob job) {
- A.notNull(job, "job");
-
- this.job = job;
- }
-
- /**
- * Gets wrapped job.
- *
- * @return Wrapped job.
- */
- public ComputeJob wrappedJob() {
- return job;
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public final Object call() throws Exception {
- return execute();
- }
-
- /** {@inheritDoc} */
- @Override public Class<?> deployClass() {
- if (p == null)
- p = U.detectPeerDeployAware(this);
-
- return p.deployClass();
- }
-
- /** {@inheritDoc} */
- @Override public ClassLoader classLoader() {
- if (p == null)
- p = U.detectPeerDeployAware(this);
-
- return p.classLoader();
- }
-
- /** {@inheritDoc} */
- @Override public void cancel() {
- job.cancel();
- }
-
- /** {@inheritDoc} */
- @Override public Object execute() {
- return job.execute();
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(GridComputeJobWrapper.class, this);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96f0956d/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFilteredIterator.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFilteredIterator.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFilteredIterator.java
index b1df224..f3240d7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFilteredIterator.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFilteredIterator.java
@@ -35,7 +35,7 @@ public abstract class GridFilteredIterator<T> implements Iterator<T> {
/**
* @param it Iterator.
*/
- public GridFilteredIterator(Iterator<? extends T> it) {
+ protected GridFilteredIterator(Iterator<? extends T> it) {
assert it != null;
this.it = it;