Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/sprint-1' into ignite-59
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Evdokimov committed Jan 25, 2015
2 parents b9c6f3b + 8970463 commit 6accb8c
Show file tree
Hide file tree
Showing 15 changed files with 620 additions and 209 deletions.
76 changes: 76 additions & 0 deletions NOTICE.txt
@@ -0,0 +1,76 @@
Apache Ignite (incubating)
Copyright [2014-2015] The Apache Software Foundation

Source Code Dependencies
========================

This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).

This software has a dependency on Java port of a concurrent trie hash
map implementation from the Scala collections library, licensed
under Apache 2.0: https://github.com/romix/java-concurrent-hash-trie-map

This software has a dependency on JetBrains Annotations licensed under
Apache 2.0 license.

This software has a dependency on Persistent Collections library,
licensed under MIT license: https://github.com/blackdrag/pcollections



Optional Runtime Dependencies
=============================

Apache 2.0
----------
This software has an optional runtime dependency on Spring software
licensed under Apache 2.0 license: https://spring.io/

This software has an optional runtime dependency on AWS Java SDK
licensed under Apache 2.0 license: http://aws.amazon.com/sdk-for-java/

This software has an optional runtime dependency on Jetty Servlet
Engine licensed under Apache 2.0: http://eclipse.org/jetty/


Eclipse Public License
----------------------
This software has an optional runtime dependency on H2 database
licensed under Eclipse Public License: http://www.h2database.com/

This software has an optional runtime dependency on AspectJ 1.7
licensed under Eclipse Public License: https://eclipse.org/aspectj/


MIT License
-----------
This software has an optional runtime dependency on SLF4J licensed
under MIT license: http://www.slf4j.org/


New BSD License
---------------
This software has an optional runtime dependency on Snaptree library
licensed under New BSD License: https://github.com/nbronson/snaptree/

This software has an optional runtime dependency on Scala licensed
under New BSD license: http://www.scala-lang.org/

This software has an optional runtime dependency on Java Secure Channel
library licensed under New BSD license: http://www.jcraft.com/jsch/


LGPL
----
This software has an optional runtime dependency on Hibernate ORM
licensed under LGPL: http://hibernate.org/orm/

This software has an optional runtime dependency on edtFTPj library
licensed under LGPL: http://enterprisedt.com/products/edtftpj/

This software has an optional runtime dependency on Cron4j library
licensed under LGPL: http://www.sauronsoftware.it/projects/cron4j/

This software has an optional runtime dependency on JTS Topology Suite
licensed under LGPL: http://www.vividsolutions.com/jts/JTSHome.htm
32 changes: 16 additions & 16 deletions examples/pom-standalone.xml
Expand Up @@ -32,50 +32,50 @@
<src.dir>src/main/java</src.dir>
</properties>

<groupId>org.gridgain</groupId>
<artifactId>gridgain-examples</artifactId>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-examples</artifactId>
<version>${ignite.version}</version>

<dependencies>
<dependency>
<groupId>org.gridgain</groupId>
<artifactId>gridgain-core</artifactId>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-core</artifactId>
<version>${ignite.version}</version>
</dependency>

<dependency>
<groupId>org.gridgain</groupId>
<artifactId>gridgain-hibernate</artifactId>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-hibernate</artifactId>
<version>${ignite.version}</version>
</dependency>

<dependency>
<groupId>org.gridgain</groupId>
<artifactId>gridgain-scalar</artifactId>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-scalar</artifactId>
<version>${ignite.version}</version>
</dependency>

<dependency>
<groupId>org.gridgain</groupId>
<artifactId>gridgain-spring</artifactId>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-spring</artifactId>
<version>${ignite.version}</version>
</dependency>

<dependency>
<groupId>org.gridgain</groupId>
<artifactId>gridgain-log4j</artifactId>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-log4j</artifactId>
<version>${ignite.version}</version>
</dependency>

<dependency>
<groupId>org.gridgain</groupId>
<artifactId>gridgain-indexing</artifactId>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-indexing</artifactId>
<version>${ignite.version}</version>
</dependency>

<dependency>
<groupId>org.gridgain</groupId>
<artifactId>gridgain-schedule</artifactId>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-schedule</artifactId>
<version>${ignite.version}</version>
</dependency>

Expand Down
Expand Up @@ -42,11 +42,12 @@ public class IgniteCachingProvider implements CachingProvider {

try {
URL dfltCfgURL = U.resolveGridGainUrl(GridGainEx.DFLT_CFG);

if (dfltCfgURL != null)
uri = dfltCfgURL.toURI();
}
catch (URISyntaxException ignored) {

// No-op.
}

if (uri == null)
Expand Down
Expand Up @@ -49,8 +49,12 @@ public CacheEntryImpl(K key, V val) {
}

/** {@inheritDoc} */
@Override public <T> T unwrap(Class<T> clazz) {
throw new IllegalArgumentException();
@SuppressWarnings("unchecked")
@Override public <T> T unwrap(Class<T> cls) {
if (!cls.equals(getClass()))
throw new IllegalArgumentException("Unwrapping to class is not supported: " + cls);

return (T)this;
}

/** {@inheritDoc} */
Expand Down
Expand Up @@ -46,9 +46,11 @@
import org.apache.ignite.internal.util.tostring.*;
import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.gridgain.grid.kernal.processors.cache.*;
import org.jdk8.backport.*;
import org.jetbrains.annotations.*;

import javax.cache.*;
import javax.cache.expiry.*;
import javax.cache.processor.*;
import java.io.*;
Expand Down Expand Up @@ -3615,6 +3617,36 @@ public void localLoad(Collection<? extends K> keys) throws IgniteCheckedExceptio
return entrySet().iterator();
}

/**
* @param prj Projection.
* @return Distributed ignite cache iterator.
*/
public Iterator<Cache.Entry<K, V>> igniteIterator(final GridCacheProjectionImpl<K, V> prj) {
CacheQueryFuture<Map.Entry<K, V>> fut = queries().createScanQuery(null)
.keepAll(false)
.execute();

return ctx.itHolder().iterator(fut, new CacheIteratorConverter<Cache.Entry<K, V>, Map.Entry<K, V>>() {
@Override protected Cache.Entry<K, V> convert(Map.Entry<K, V> e) {
return new CacheEntryImpl<>(e.getKey(), e.getValue());
}

@Override protected void remove(Cache.Entry<K, V> item) {
GridCacheProjectionImpl<K, V> prev = ctx.gate().enter(prj);

try {
GridCacheAdapter.this.removex(item.getKey());
}
catch (IgniteCheckedException e) {
throw new CacheException(e);
}
finally {
ctx.gate().leave(prev);
}
}
});
}

/** {@inheritDoc} */
@Nullable @Override public V promote(K key) throws IgniteCheckedException {
return promote(key, true);
Expand Down
Expand Up @@ -52,6 +52,7 @@
import org.apache.ignite.internal.util.lang.*;
import org.apache.ignite.internal.util.offheap.unsafe.*;
import org.apache.ignite.internal.util.tostring.*;
import org.gridgain.grid.kernal.processors.cache.*;
import org.jetbrains.annotations.*;

import javax.cache.configuration.*;
Expand Down Expand Up @@ -186,6 +187,9 @@ public class GridCacheContext<K, V> implements Externalizable {
/** Default expiry policy. */
private ExpiryPolicy expiryPlc;

/** Cache weak query iterator holder. */
private CacheWeakQueryIteratorsHolder<Map.Entry<K, V>> itHolder;

/**
* Empty constructor required for {@link Externalizable}.
*/
Expand Down Expand Up @@ -300,6 +304,8 @@ public GridCacheContext(

if (expiryPlc instanceof EternalExpiryPolicy)
expiryPlc = null;

itHolder = new CacheWeakQueryIteratorsHolder(log);
}

/**
Expand Down Expand Up @@ -836,6 +842,13 @@ public GridCacheContinuousQueryManager<K, V> continuousQueries() {
return contQryMgr;
}

/**
* @return Iterators Holder.
*/
public CacheWeakQueryIteratorsHolder<Map.Entry<K, V>> itHolder() {
return itHolder;
}

/**
* @return Swap manager.
*/
Expand Down
Expand Up @@ -87,6 +87,8 @@ public void leave() {
*/
@Nullable public GridCacheProjectionImpl<K, V> enter(@Nullable GridCacheProjectionImpl<K, V> prj) {
try {
ctx.itHolder().checkWeakQueue();

GridCacheAdapter<K, V> cache = ctx.cache();

GridCachePreloader<K, V> preldr = cache != null ? cache.preloader() : null;
Expand Down
Expand Up @@ -809,27 +809,10 @@ else if (clazz.equals(Ignite.class))

/** {@inheritDoc} */
@Override public Iterator<Cache.Entry<K, V>> iterator() {
// TODO IGNITE-1.
GridCacheProjectionImpl<K, V> prev = gate.enter(prj);

try {
return F.iterator(delegate, new C1<CacheEntry<K, V>, Entry<K, V>>() {
@Override public Entry<K, V> apply(final CacheEntry<K, V> e) {
return new Entry<K, V>() {
@Override public K getKey() {
return e.getKey();
}

@Override public V getValue() {
return e.getValue();
}

@Override public <T> T unwrap(Class<T> clazz) {
throw new IllegalArgumentException();
}
};
}
}, false);
return ((GridCacheAdapter)delegate).igniteIterator(prj);
}
finally {
gate.leave(prev);
Expand Down

0 comments on commit 6accb8c

Please sign in to comment.