You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by an...@apache.org on 2015/05/15 05:03:06 UTC
[01/50] incubator-ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-sprint-4' into ignite-sprint-5
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-843 32b52cb98 -> e0b29d6d8
Merge remote-tracking branch 'remotes/origin/ignite-sprint-4' into ignite-sprint-5
Conflicts:
DEVNOTES.txt
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c9cd92ef
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c9cd92ef
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c9cd92ef
Branch: refs/heads/ignite-843
Commit: c9cd92ef29e2387e3290310a04809347808419d4
Parents: 2361640 ecc7a50
Author: avinogradov <av...@gridgain.com>
Authored: Fri May 8 17:50:26 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Fri May 8 17:50:26 2015 +0300
----------------------------------------------------------------------
parent/pom.xml | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
[09/50] incubator-ignite git commit: devlibs should be cleared each
time. even if profile is off
Posted by an...@apache.org.
devlibs should be cleared each time. even if profile is off
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/a4c96535
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/a4c96535
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/a4c96535
Branch: refs/heads/ignite-843
Commit: a4c96535d61b1473ea6967be60bdabc6fec2cd5c
Parents: 7da0df9
Author: avinogradov <av...@gridgain.com>
Authored: Tue May 12 14:03:17 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Tue May 12 14:03:17 2015 +0300
----------------------------------------------------------------------
pom.xml | 44 ++++++++++++++++++++++++--------------------
1 file changed, 24 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a4c96535/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 1b44d5e..451812a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -122,26 +122,6 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-clean-plugin</artifactId>
- <executions>
- <execution>
- <phase>clean</phase>
- <goals>
- <goal>clean</goal>
- </goals>
- <configuration>
- <filesets>
- <fileset>
- <directory>libs</directory>
- </fileset>
- </filesets>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<inherited>false</inherited>
@@ -740,4 +720,28 @@
</build>
</profile>
</profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clean-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>clean</phase>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>libs</directory>
+ </fileset>
+ </filesets>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
[46/50] incubator-ignite git commit: ignite-430 Words count Socket
streamer examples
Posted by an...@apache.org.
ignite-430 Words count Socket streamer examples
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d87efce0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d87efce0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d87efce0
Branch: refs/heads/ignite-843
Commit: d87efce0af1ad269ea1a4182329f441b6ff32122
Parents: 53995dc
Author: agura <ag...@gridgain.com>
Authored: Wed May 13 18:38:48 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Fri May 15 03:44:31 2015 +0300
----------------------------------------------------------------------
.../streaming/socket/SocketStreamerExample.java | 112 +++++++------------
.../socket/ZStringsSocketStreamerExample.java | 76 ++++++-------
.../examples/streaming/socket/package-info.java | 1 +
3 files changed, 75 insertions(+), 114 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87efce0/examples/src/main/java/org/apache/ignite/examples/streaming/socket/SocketStreamerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/SocketStreamerExample.java b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/SocketStreamerExample.java
index 73cb970..487572a 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/SocketStreamerExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/SocketStreamerExample.java
@@ -18,36 +18,30 @@
package org.apache.ignite.examples.streaming.socket;
import org.apache.ignite.*;
+import org.apache.ignite.cache.affinity.*;
import org.apache.ignite.examples.*;
-import org.apache.ignite.examples.streaming.numbers.*;
+import org.apache.ignite.examples.streaming.wordcount.*;
import org.apache.ignite.lang.*;
-import org.apache.ignite.stream.*;
import org.apache.ignite.stream.adapters.*;
import org.apache.ignite.stream.socket.*;
-import javax.cache.processor.*;
import java.io.*;
import java.net.*;
import java.util.*;
/**
- * Streams random numbers into the streaming cache using {@link IgniteSocketStreamer}.
+ * Stream words into Ignite cache through socket using {@link IgniteSocketStreamer} and message size based protocol.
+ * <p>
* To start the example, you should:
* <ul>
- * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
- * <li>Start streaming using {@link SocketStreamerExample}.</li>
- * <li>Start querying popular numbers using {@link QueryPopularNumbers}.</li>
+ * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
+ * <li>Start streaming using {@link SocketStreamerExample}.</li>
+ * <li>Start querying popular numbers using {@link QueryWords}.</li>
* </ul>
* <p>
* You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
*/
public class SocketStreamerExample {
- /** Random number generator. */
- private static final Random RAND = new Random();
-
- /** Range within which to generate numbers. */
- private static final int RANGE = 1000;
-
/** Port. */
private static final int PORT = 5555;
@@ -63,27 +57,13 @@ public class SocketStreamerExample {
return;
// The cache is configured with sliding window holding 1 second of the streaming data.
- IgniteCache<Integer, Long> stmCache = ignite.getOrCreateCache(CacheConfig.randomNumbersCache());
-
- try (IgniteDataStreamer<Integer, Long> stmr = ignite.dataStreamer(stmCache.getName())) {
- // Allow data updates.
- stmr.allowOverwrite(true);
-
- // Configure data transformation to count instances of the same word.
- stmr.receiver(new StreamTransformer<Integer, Long>() {
- @Override public Object process(MutableEntry<Integer, Long> e, Object... objects)
- throws EntryProcessorException {
- Long val = e.getValue();
-
- e.setValue(val == null ? 1L : val + 1);
-
- return null;
- }
- });
+ IgniteCache<AffinityUuid, String> stmCache = ignite.getOrCreateCache(CacheConfig.wordCache());
+ try (IgniteDataStreamer<AffinityUuid, String> stmr = ignite.dataStreamer(stmCache.getName())) {
InetAddress addr = InetAddress.getLocalHost();
- IgniteSocketStreamer<Tuple, Integer, Long> sockStmr = new IgniteSocketStreamer<>();
+ // Configure socket streamer
+ IgniteSocketStreamer<String, AffinityUuid, String> sockStmr = new IgniteSocketStreamer<>();
sockStmr.setAddr(addr);
@@ -93,9 +73,11 @@ public class SocketStreamerExample {
sockStmr.setStreamer(stmr);
- sockStmr.setTupleExtractor(new StreamTupleExtractor<Tuple, Integer, Long>() {
- @Override public Map.Entry<Integer, Long> extract(Tuple tuple) {
- return new IgniteBiTuple<>(tuple.key, tuple.cnt);
+ sockStmr.setTupleExtractor(new StreamTupleExtractor<String, AffinityUuid, String>() {
+ @Override public Map.Entry<AffinityUuid, String> extract(String word) {
+ // By using AffinityUuid we ensure that identical
+ // words are processed on the same cluster node.
+ return new IgniteBiTuple<>(new AffinityUuid(word), word);
}
});
@@ -114,45 +96,33 @@ public class SocketStreamerExample {
try (Socket sock = new Socket(addr, port);
OutputStream oos = new BufferedOutputStream(sock.getOutputStream())) {
while (true) {
- try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(bos)) {
- Tuple tuple = new Tuple(RAND.nextInt(RANGE), 1L);
-
- out.writeObject(tuple);
-
- byte[] arr = bos.toByteArray();
-
- oos.write(arr.length >>> 24);
- oos.write(arr.length >>> 16);
- oos.write(arr.length >>> 8);
- oos.write(arr.length);
-
- oos.write(arr);
+ try (InputStream in = StreamWords.class.getResourceAsStream("../wordcount/alice-in-wonderland.txt");
+ LineNumberReader rdr = new LineNumberReader(new InputStreamReader(in))) {
+ for (String line = rdr.readLine(); line != null; line = rdr.readLine()) {
+ for (String word : line.split(" ")) {
+ if (!word.isEmpty()) {
+ // Stream words into Ignite through socket.
+ try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(bos)) {
+
+ // Write message
+ out.writeObject(word);
+
+ byte[] arr = bos.toByteArray();
+
+ // Write message length
+ oos.write(arr.length >>> 24);
+ oos.write(arr.length >>> 16);
+ oos.write(arr.length >>> 8);
+ oos.write(arr.length);
+
+ oos.write(arr);
+ }
+ }
+ }
+ }
}
}
}
}
-
- /**
- * Tuple.
- */
- private static class Tuple implements Serializable {
- /** Serial version uid. */
- private static final long serialVersionUID = 0;
-
- /** Key. */
- private final int key;
-
- /** Count. */
- private final long cnt;
-
- /**
- * @param key Key.
- * @param cnt Count.
- */
- public Tuple(int key, long cnt) {
- this.key = key;
- this.cnt = cnt;
- }
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87efce0/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZStringsSocketStreamerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZStringsSocketStreamerExample.java b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZStringsSocketStreamerExample.java
index a535c73..fa5aa28 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZStringsSocketStreamerExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZStringsSocketStreamerExample.java
@@ -18,40 +18,34 @@
package org.apache.ignite.examples.streaming.socket;
import org.apache.ignite.*;
+import org.apache.ignite.cache.affinity.*;
import org.apache.ignite.examples.*;
-import org.apache.ignite.examples.streaming.numbers.*;
+import org.apache.ignite.examples.streaming.wordcount.*;
import org.apache.ignite.lang.*;
-import org.apache.ignite.stream.*;
import org.apache.ignite.stream.adapters.*;
import org.apache.ignite.stream.socket.*;
-import javax.cache.processor.*;
import java.io.*;
import java.net.*;
import java.util.*;
/**
- * Stream random numbers into the streaming cache using {@link IgniteSocketStreamer}.
+ * Stream words into Ignite cache through socket using {@link IgniteSocketStreamer} and message delimiter based
+ * protocol.
* <p>
* Example illustrates usage of TCP socket streamer in case of non-Java clients. In this example client streams
* zero-terminated strings.
* <p>
* To start the example, you should:
* <ul>
- * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
- * <li>Start streaming using {@link ZStringsSocketStreamerExample}.</li>
- * <li>Start querying popular numbers using {@link QueryPopularNumbers}.</li>
+ * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
+ * <li>Start streaming using {@link ZStringsSocketStreamerExample}.</li>
+ * <li>Start querying popular numbers using {@link QueryWords}.</li>
* </ul>
* <p>
* You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
*/
public class ZStringsSocketStreamerExample {
- /** Random number generator. */
- private static final Random RAND = new Random();
-
- /** Range within which to generate numbers. */
- private static final int RANGE = 1000;
-
/** Port. */
private static final int PORT = 5555;
@@ -70,27 +64,13 @@ public class ZStringsSocketStreamerExample {
return;
// The cache is configured with sliding window holding 1 second of the streaming data.
- IgniteCache<Integer, Long> stmCache = ignite.getOrCreateCache(CacheConfig.randomNumbersCache());
-
- try (IgniteDataStreamer<Integer, Long> stmr = ignite.dataStreamer(stmCache.getName())) {
- // Allow data updates.
- stmr.allowOverwrite(true);
-
- // Configure data transformation to count instances of the same word.
- stmr.receiver(new StreamTransformer<Integer, Long>() {
- @Override public Object process(MutableEntry<Integer, Long> e, Object... objects)
- throws EntryProcessorException {
- Long val = e.getValue();
-
- e.setValue(val == null ? 1L : val + 1);
-
- return null;
- }
- });
+ IgniteCache<AffinityUuid, String> stmCache = ignite.getOrCreateCache(CacheConfig.wordCache());
+ try (IgniteDataStreamer<AffinityUuid, String> stmr = ignite.dataStreamer(stmCache.getName())) {
InetAddress addr = InetAddress.getLocalHost();
- IgniteSocketStreamer<String, Integer, Long> sockStmr = new IgniteSocketStreamer<>();
+ // Configure socket streamer
+ IgniteSocketStreamer<String, AffinityUuid, String> sockStmr = new IgniteSocketStreamer<>();
sockStmr.setAddr(addr);
@@ -114,10 +94,11 @@ public class ZStringsSocketStreamerExample {
}
});
- sockStmr.setTupleExtractor(new StreamTupleExtractor<String, Integer, Long>() {
- @Override public Map.Entry<Integer, Long> extract(String input) {
- String[] pair = input.split("=");
- return new IgniteBiTuple<>(Integer.parseInt(pair[0]), Long.parseLong(pair[1]));
+ sockStmr.setTupleExtractor(new StreamTupleExtractor<String, AffinityUuid, String>() {
+ @Override public Map.Entry<AffinityUuid, String> extract(String word) {
+ // By using AffinityUuid we ensure that identical
+ // words are processed on the same cluster node.
+ return new IgniteBiTuple<>(new AffinityUuid(word), word);
}
});
@@ -137,14 +118,23 @@ public class ZStringsSocketStreamerExample {
OutputStream oos = new BufferedOutputStream(sock.getOutputStream())) {
while (true) {
- int key = RAND.nextInt(RANGE);
-
- String str = key + "=1";
-
- byte[] arr = str.getBytes("ASCII");
-
- oos.write(arr);
- oos.write(DELIM);
+ try (InputStream in = StreamWords.class.getResourceAsStream("../wordcount/alice-in-wonderland.txt");
+ LineNumberReader rdr = new LineNumberReader(new InputStreamReader(in))) {
+ for (String line = rdr.readLine(); line != null; line = rdr.readLine()) {
+ for (String word : line.split(" ")) {
+ if (!word.isEmpty()) {
+ // Stream words into Ignite through socket.
+ byte[] arr = word.getBytes("ASCII");
+
+ // Write message
+ oos.write(arr);
+
+ // Write message delimiter
+ oos.write(DELIM);
+ }
+ }
+ }
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87efce0/examples/src/main/java/org/apache/ignite/examples/streaming/socket/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/package-info.java b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/package-info.java
index ae7bdf9..d0a480a 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/package-info.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/package-info.java
@@ -16,6 +16,7 @@
*/
/**
+ * <!-- Package description. -->
* Contains {@link org.apache.ignite.stream.socket.IgniteSocketStreamer} usage examples.
*/
package org.apache.ignite.examples.streaming.socket;
\ No newline at end of file
[39/50] incubator-ignite git commit: #ignite-373: Cache is not empty
after removeAll.
Posted by an...@apache.org.
#ignite-373: Cache is not empty after removeAll.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/593e3eee
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/593e3eee
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/593e3eee
Branch: refs/heads/ignite-843
Commit: 593e3eeeb0d4965b1c1a83d4f68a9d18e6615632
Parents: 7c91389
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu May 14 15:35:27 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu May 14 15:35:27 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheAdapter.java | 119 +++++------
.../GridDistributedCacheAdapter.java | 210 ++++++++++++-------
.../cache/CacheRemoveAllSelfTest.java | 81 +++++++
.../near/NoneRebalanceModeSelfTest.java | 67 ++++++
.../testsuites/IgniteCacheTestSuite2.java | 1 +
.../testsuites/IgniteCacheTestSuite4.java | 2 +
6 files changed, 338 insertions(+), 142 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/593e3eee/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 3826bfa..4106cb0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -1133,7 +1133,8 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
ctx.kernalContext().task().setThreadContext(TC_SUBGRID, nodes);
- ctx.kernalContext().task().execute(new ClearTask(ctx, keys), null).get();
+ ctx.kernalContext().task().execute(
+ new ClearTask(ctx.name(), ctx.affinity().affinityTopologyVersion(), keys), null).get();
}
}
@@ -1152,7 +1153,8 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
if (!nodes.isEmpty()) {
ctx.kernalContext().task().setThreadContext(TC_SUBGRID, nodes);
- return ctx.kernalContext().task().execute(new ClearTask(ctx, keys), null);
+ return ctx.kernalContext().task().execute(
+ new ClearTask(ctx.name(), ctx.affinity().affinityTopologyVersion(), keys), null);
}
else
return new GridFinishedFuture<>();
@@ -3571,7 +3573,8 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
ctx.kernalContext().task().setThreadContext(TC_SUBGRID, nodes);
- return ctx.kernalContext().task().execute(new SizeTask(ctx, peekModes), null);
+ return ctx.kernalContext().task().execute(
+ new SizeTask(ctx.name(), ctx.affinity().affinityTopologyVersion(), peekModes), null);
}
/** {@inheritDoc} */
@@ -4827,13 +4830,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
private static final long serialVersionUID = 0L;
/**
- * Empty constructor for serialization.
- */
- public GlobalClearAllJob() {
- // No-op.
- }
-
- /**
* @param cacheName Cache name.
* @param topVer Affinity topology version.
*/
@@ -4859,14 +4855,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
private static final long serialVersionUID = 0L;
/** Keys to remove. */
- private Set<? extends K> keys;
-
- /**
- * Empty constructor for serialization.
- */
- public GlobalClearKeySetJob() {
- // No-op.
- }
+ private final Set<? extends K> keys;
/**
* @param cacheName Cache name.
@@ -4897,14 +4886,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
private static final long serialVersionUID = 0L;
/** Peek modes. */
- private CachePeekMode[] peekModes;
-
- /**
- * Required by {@link Externalizable}.
- */
- public SizeJob() {
- // No-op.
- }
+ private final CachePeekMode[] peekModes;
/**
* @param cacheName Cache name.
@@ -5514,17 +5496,10 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
protected Ignite ignite;
/** Affinity topology version. */
- protected AffinityTopologyVersion topVer;
+ protected final AffinityTopologyVersion topVer;
/** Cache name. */
- protected String cacheName;
-
- /**
- * Empty constructor for serialization.
- */
- public TopologyVersionAwareJob() {
- // No-op.
- }
+ protected final String cacheName;
/**
* @param cacheName Cache name.
@@ -5583,24 +5558,23 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/** */
private static final long serialVersionUID = 0L;
- /** Cache context. */
- private GridCacheContext ctx;
+ /** Cache name. */
+ private final String cacheName;
- /** Peek modes. */
- private CachePeekMode[] peekModes;
+ /** Affinity topology version. */
+ private final AffinityTopologyVersion topVer;
- /**
- * Empty constructor for serialization.
- */
- public SizeTask() {
- // No-op.
- }
+ /** Peek modes. */
+ private final CachePeekMode[] peekModes;
/**
- * @param ctx Cache context.
+ * @param cacheName Cache name.
+ * @param topVer Affinity topology version.
+ * @param peekModes Cache peek modes.
*/
- public SizeTask(GridCacheContext ctx, CachePeekMode[] peekModes) {
- this.ctx = ctx;
+ public SizeTask(String cacheName, AffinityTopologyVersion topVer, CachePeekMode[] peekModes) {
+ this.cacheName = cacheName;
+ this.topVer = topVer;
this.peekModes = peekModes;
}
@@ -5610,13 +5584,22 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
Map<ComputeJob, ClusterNode> jobs = new HashMap();
for (ClusterNode node : subgrid)
- jobs.put(new SizeJob(ctx.name(), ctx.affinity().affinityTopologyVersion(), peekModes), node);
+ jobs.put(new SizeJob(cacheName, topVer, peekModes), node);
return jobs;
}
/** {@inheritDoc} */
@Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd) {
+ IgniteException e = res.getException();
+
+ if (e != null) {
+ if (e instanceof ClusterTopologyException)
+ return ComputeJobResultPolicy.WAIT;
+
+ throw new IgniteException("Remote job threw exception.", e);
+ }
+
return ComputeJobResultPolicy.WAIT;
}
@@ -5640,25 +5623,23 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/** */
private static final long serialVersionUID = 0L;
- /** Cache context. */
- private GridCacheContext ctx;
+ /** Cache name. */
+ private final String cacheName;
- /** Keys to clear. */
- private Set<? extends K> keys;
+ /** Affinity topology version. */
+ private final AffinityTopologyVersion topVer;
- /**
- * Empty constructor for serialization.
- */
- public ClearTask() {
- // No-op.
- }
+ /** Keys to clear. */
+ private final Set<? extends K> keys;
/**
- * @param ctx Cache context.
+ * @param cacheName Cache name.
+ * @param topVer Affinity topology version.
* @param keys Keys to clear.
*/
- public ClearTask(GridCacheContext ctx, Set<? extends K> keys) {
- this.ctx = ctx;
+ public ClearTask(String cacheName, AffinityTopologyVersion topVer, Set<? extends K> keys) {
+ this.cacheName = cacheName;
+ this.topVer = topVer;
this.keys = keys;
}
@@ -5668,9 +5649,8 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
Map<ComputeJob, ClusterNode> jobs = new HashMap();
for (ClusterNode node : subgrid) {
- jobs.put(keys == null ?
- new GlobalClearAllJob(ctx.name(), ctx.affinity().affinityTopologyVersion()) :
- new GlobalClearKeySetJob<K>(ctx.name(), ctx.affinity().affinityTopologyVersion(), keys),
+ jobs.put(keys == null ? new GlobalClearAllJob(cacheName, topVer) :
+ new GlobalClearKeySetJob<K>(cacheName, topVer, keys),
node);
}
@@ -5679,6 +5659,15 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/** {@inheritDoc} */
@Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd) {
+ IgniteException e = res.getException();
+
+ if (e != null) {
+ if (e instanceof ClusterTopologyException)
+ return ComputeJobResultPolicy.WAIT;
+
+ throw new IgniteException("Remote job threw exception.", e);
+ }
+
return ComputeJobResultPolicy.WAIT;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/593e3eee/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java
index 3a685cc..c5ef22f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache.distributed;
import org.apache.ignite.*;
import org.apache.ignite.cluster.*;
+import org.apache.ignite.compute.*;
import org.apache.ignite.internal.*;
import org.apache.ignite.internal.cluster.*;
import org.apache.ignite.internal.processors.affinity.*;
@@ -30,17 +31,17 @@ import org.apache.ignite.internal.processors.cache.version.*;
import org.apache.ignite.internal.processors.datastreamer.*;
import org.apache.ignite.internal.processors.task.*;
import org.apache.ignite.internal.util.future.*;
+import org.apache.ignite.internal.util.lang.*;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.lang.*;
-import org.apache.ignite.resources.*;
import org.apache.ignite.transactions.*;
import org.jetbrains.annotations.*;
import java.io.*;
import java.util.*;
-import java.util.concurrent.*;
-import static org.apache.ignite.internal.GridClosureCallMode.*;
+import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.*;
+import static org.apache.ignite.internal.processors.task.GridTaskThreadContextKey.*;
/**
* Distributed cache implementation.
@@ -142,21 +143,28 @@ public abstract class GridDistributedCacheAdapter<K, V> extends GridCacheAdapter
try {
AffinityTopologyVersion topVer;
+ boolean retry;
+
+ CacheOperationContext opCtx = ctx.operationContextPerCall();
+
+ boolean skipStore = opCtx != null && opCtx.skipStore();
+
do {
+ retry = false;
+
topVer = ctx.affinity().affinityTopologyVersion();
// Send job to all data nodes.
Collection<ClusterNode> nodes = ctx.grid().cluster().forDataNodes(name()).nodes();
if (!nodes.isEmpty()) {
- CacheOperationContext opCtx = ctx.operationContextPerCall();
+ ctx.kernalContext().task().setThreadContext(TC_SUBGRID, nodes);
- ctx.closures().callAsyncNoFailover(BROADCAST,
- new GlobalRemoveAllCallable<>(name(), topVer, opCtx != null && opCtx.skipStore()), nodes,
- true).get();
+ retry = !ctx.kernalContext().task().execute(
+ new RemoveAllTask(ctx.name(), topVer, skipStore), null).get();
}
}
- while (ctx.affinity().affinityTopologyVersion().compareTo(topVer) > 0);
+ while (ctx.affinity().affinityTopologyVersion().compareTo(topVer) != 0 || retry);
}
catch (ClusterGroupEmptyCheckedException ignore) {
if (log.isDebugEnabled())
@@ -170,7 +178,11 @@ public abstract class GridDistributedCacheAdapter<K, V> extends GridCacheAdapter
AffinityTopologyVersion topVer = ctx.affinity().affinityTopologyVersion();
- removeAllAsync(opFut, topVer);
+ CacheOperationContext opCtx = ctx.operationContextPerCall();
+
+ boolean skipStore = opCtx != null && opCtx.skipStore();
+
+ removeAllAsync(opFut, topVer, skipStore);
return opFut;
}
@@ -178,27 +190,29 @@ public abstract class GridDistributedCacheAdapter<K, V> extends GridCacheAdapter
/**
* @param opFut Future.
* @param topVer Topology version.
+ * @param skipStore Skip store flag.
*/
- private void removeAllAsync(final GridFutureAdapter<Void> opFut, final AffinityTopologyVersion topVer) {
+ private void removeAllAsync(final GridFutureAdapter<Void> opFut, final AffinityTopologyVersion topVer,
+ final boolean skipStore) {
Collection<ClusterNode> nodes = ctx.grid().cluster().forDataNodes(name()).nodes();
if (!nodes.isEmpty()) {
- CacheOperationContext opCtx = ctx.operationContextPerCall();
+ ctx.kernalContext().task().setThreadContext(TC_SUBGRID, nodes);
- IgniteInternalFuture<?> rmvFut = ctx.closures().callAsyncNoFailover(BROADCAST,
- new GlobalRemoveAllCallable<>(name(), topVer, opCtx != null && opCtx.skipStore()), nodes, true);
+ IgniteInternalFuture<Boolean> rmvAll = ctx.kernalContext().task().execute(
+ new RemoveAllTask(ctx.name(), topVer, skipStore), null);
- rmvFut.listen(new IgniteInClosure<IgniteInternalFuture<?>>() {
- @Override public void apply(IgniteInternalFuture<?> fut) {
+ rmvAll.listen(new IgniteInClosure<IgniteInternalFuture<Boolean>>() {
+ @Override public void apply(IgniteInternalFuture<Boolean> fut) {
try {
- fut.get();
+ boolean retry = !fut.get();
AffinityTopologyVersion topVer0 = ctx.affinity().affinityTopologyVersion();
- if (topVer0.equals(topVer))
+ if (topVer0.equals(topVer) && !retry)
opFut.onDone();
else
- removeAllAsync(opFut, topVer0);
+ removeAllAsync(opFut, topVer0, skipStore);
}
catch (ClusterGroupEmptyCheckedException ignore) {
if (log.isDebugEnabled())
@@ -227,97 +241,150 @@ public abstract class GridDistributedCacheAdapter<K, V> extends GridCacheAdapter
}
/**
- * Internal callable which performs remove all primary key mappings
- * operation on a cache with the given name.
+ * Remove task.
*/
@GridInternal
- private static class GlobalRemoveAllCallable<K,V> implements Callable<Object>, Externalizable {
+ private static class RemoveAllTask extends ComputeTaskAdapter<Object, Boolean> {
/** */
private static final long serialVersionUID = 0L;
/** Cache name. */
- private String cacheName;
+ private final String cacheName;
- /** Topology version. */
- private AffinityTopologyVersion topVer;
+ /** Affinity topology version. */
+ private final AffinityTopologyVersion topVer;
/** Skip store flag. */
- private boolean skipStore;
-
- /** Injected grid instance. */
- @IgniteInstanceResource
- private Ignite ignite;
+ private final boolean skipStore;
/**
- * Empty constructor for serialization.
+ * @param cacheName Cache name.
+ * @param topVer Affinity topology version.
+ * @param skipStore Skip store flag.
*/
- public GlobalRemoveAllCallable() {
- // No-op.
+ public RemoveAllTask(String cacheName, AffinityTopologyVersion topVer, boolean skipStore) {
+ this.cacheName = cacheName;
+ this.topVer = topVer;
+ this.skipStore = skipStore;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
+ @Nullable Object arg) throws IgniteException {
+ Map<ComputeJob, ClusterNode> jobs = new HashMap();
+
+ for (ClusterNode node : subgrid)
+ jobs.put(new GlobalRemoveAllJob(cacheName, topVer, skipStore), node);
+
+ return jobs;
+ }
+
+ /** {@inheritDoc} */
+ @Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd) {
+ IgniteException e = res.getException();
+
+ if (e != null) {
+ if (e instanceof ClusterTopologyException)
+ return ComputeJobResultPolicy.WAIT;
+
+ throw new IgniteException("Remote job threw exception.", e);
+ }
+
+ return ComputeJobResultPolicy.WAIT;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Boolean reduce(List<ComputeJobResult> results) throws IgniteException {
+ for (ComputeJobResult locRes : results) {
+ if (locRes != null && (locRes.getException() != null || !locRes.<Boolean>getData()))
+ return false;
+ }
+
+ return true;
}
+ }
+ /**
+ * Internal job which performs remove all primary key mappings
+ * operation on a cache with the given name.
+ */
+ @GridInternal
+ private static class GlobalRemoveAllJob<K,V> extends TopologyVersionAwareJob {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Skip store flag. */
+ private final boolean skipStore;
/**
* @param cacheName Cache name.
* @param topVer Topology version.
* @param skipStore Skip store flag.
*/
- private GlobalRemoveAllCallable(String cacheName, @NotNull AffinityTopologyVersion topVer, boolean skipStore) {
- this.cacheName = cacheName;
- this.topVer = topVer;
+ private GlobalRemoveAllJob(String cacheName, @NotNull AffinityTopologyVersion topVer, boolean skipStore) {
+ super(cacheName, topVer);
+
this.skipStore = skipStore;
}
- /**
- * {@inheritDoc}
- */
- @Override public Object call() throws Exception {
- GridCacheAdapter<K, V> cacheAdapter = ((IgniteKernal)ignite).context().cache().internalCache(cacheName);
+ /** {@inheritDoc} */
+ @Nullable @Override public Object localExecute(@Nullable IgniteInternalCache cache0) {
+ GridCacheAdapter cache = ((IgniteKernal) ignite).context().cache().internalCache(cacheName);
- final GridCacheContext<K, V> ctx = cacheAdapter.context();
+ if (cache == null)
+ return true;
- ctx.affinity().affinityReadyFuture(topVer).get();
+ final GridCacheContext<K, V> ctx = cache.context();
ctx.gate().enter();
try {
if (!ctx.affinity().affinityTopologyVersion().equals(topVer))
- return null; // Ignore this remove request because remove request will be sent again.
+ return false; // Ignore this remove request because remove request will be sent again.
GridDhtCacheAdapter<K, V> dht;
GridNearCacheAdapter<K, V> near = null;
- if (cacheAdapter instanceof GridNearCacheAdapter) {
- near = ((GridNearCacheAdapter<K, V>)cacheAdapter);
+ if (cache instanceof GridNearCacheAdapter) {
+ near = ((GridNearCacheAdapter<K, V>) cache);
dht = near.dht();
}
else
- dht = (GridDhtCacheAdapter<K, V>)cacheAdapter;
+ dht = (GridDhtCacheAdapter<K, V>) cache;
try (DataStreamerImpl<KeyCacheObject, Object> dataLdr =
- (DataStreamerImpl)ignite.dataStreamer(cacheName)) {
- ((DataStreamerImpl)dataLdr).maxRemapCount(0);
+ (DataStreamerImpl) ignite.dataStreamer(cacheName)) {
+ ((DataStreamerImpl) dataLdr).maxRemapCount(0);
dataLdr.skipStore(skipStore);
dataLdr.receiver(DataStreamerCacheUpdaters.<KeyCacheObject, Object>batched());
- for (GridDhtLocalPartition locPart : dht.topology().currentLocalPartitions()) {
- if (!locPart.isEmpty() && locPart.primary(topVer)) {
- for (GridDhtCacheEntry o : locPart.entries()) {
- if (!o.obsoleteOrDeleted())
- dataLdr.removeDataInternal(o.key());
- }
- }
- }
+ for (int part : ctx.affinity().primaryPartitions(ctx.localNodeId(), topVer)) {
+ GridDhtLocalPartition locPart = dht.topology().localPartition(part, topVer, false);
- Iterator<KeyCacheObject> it = dht.context().swap().offHeapKeyIterator(true, false, topVer);
+ if (locPart == null || (ctx.rebalanceEnabled() && locPart.state() != OWNING) || !locPart.reserve())
+ return false;
- while (it.hasNext())
- dataLdr.removeDataInternal(it.next());
+ try {
+ if (!locPart.isEmpty()) {
+ for (GridDhtCacheEntry o : locPart.entries()) {
+ if (!o.obsoleteOrDeleted())
+ dataLdr.removeDataInternal(o.key());
+ }
+ }
- it = dht.context().swap().swapKeyIterator(true, false, topVer);
+ GridCloseableIterator<Map.Entry<byte[], GridCacheSwapEntry>> iter =
+ dht.context().swap().iterator(part);
- while (it.hasNext())
- dataLdr.removeDataInternal(it.next());
+ if (iter != null) {
+ for (Map.Entry<byte[], GridCacheSwapEntry> e : iter)
+ dataLdr.removeDataInternal(ctx.toCacheKeyObject(e.getKey()));
+ }
+ }
+ finally {
+ locPart.release();
+ }
+ }
}
if (near != null) {
@@ -329,25 +396,14 @@ public abstract class GridDistributedCacheAdapter<K, V> extends GridCacheAdapter
}
}
}
+ catch (IgniteCheckedException e) {
+ throw U.convertException(e);
+ }
finally {
ctx.gate().leave();
}
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- U.writeString(out, cacheName);
- out.writeObject(topVer);
- out.writeBoolean(skipStore);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- cacheName = U.readString(in);
- topVer = (AffinityTopologyVersion)in.readObject();
- skipStore = in.readBoolean();
+ return true;
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/593e3eee/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java
new file mode 100644
index 0000000..f5de96f
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java
@@ -0,0 +1,81 @@
+/*
+ * 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.processors.cache;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.testframework.*;
+
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+/**
+ * Test remove all method.
+ */
+public class CacheRemoveAllSelfTest extends GridCacheAbstractSelfTest {
+ /** {@inheritDoc} */
+ @Override protected long getTestTimeout() {
+ return 60000;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected int gridCount() {
+ return 4;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRemoveAll() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).cache(null);
+
+ for (int i = 0; i < 10_000; ++i)
+ cache.put(i, "val");
+
+ final AtomicInteger igniteId = new AtomicInteger(gridCount());
+
+ IgniteInternalFuture fut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ for (int i = 0; i < 2; ++i)
+ startGrid(igniteId.getAndIncrement());
+
+ return true;
+ }
+ }, 3, "start-node-thread");
+
+ cache.removeAll();
+
+ fut.get();
+
+ U.sleep(5000);
+
+ for (int i = 0; i < igniteId.get(); ++i) {
+ IgniteCache locCache = grid(i).cache(null);
+
+ assertEquals("Local size: " + locCache.localSize() + "\n" +
+ "On heap: " + locCache.localSize(CachePeekMode.ONHEAP) + "\n" +
+ "Off heap: " + locCache.localSize(CachePeekMode.OFFHEAP) + "\n" +
+ "Swap: " + locCache.localSize(CachePeekMode.SWAP) + "\n" +
+ "Primary: " + locCache.localSize(CachePeekMode.PRIMARY) + "\n" +
+ "Backup: " + locCache.localSize(CachePeekMode.BACKUP),
+ 0, locCache.localSize());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/593e3eee/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NoneRebalanceModeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NoneRebalanceModeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NoneRebalanceModeSelfTest.java
new file mode 100644
index 0000000..d61ddcc
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NoneRebalanceModeSelfTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.processors.cache.distributed.near;
+
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.cache.distributed.dht.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import static org.apache.ignite.cache.CacheRebalanceMode.*;
+import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.*;
+
+/**
+ * Test none rebalance mode.
+ */
+public class NoneRebalanceModeSelfTest extends GridCommonAbstractTest {
+ /** {@inheritDoc} */
+ @SuppressWarnings({"ConstantConditions"})
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration c = super.getConfiguration(gridName);
+
+ CacheConfiguration cc = defaultCacheConfiguration();
+
+ cc.setRebalanceMode(NONE);
+
+ c.setCacheConfiguration(cc);
+
+ return c;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ startGrid(0);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRemoveAll() throws Exception {
+ GridNearTransactionalCache cache = (GridNearTransactionalCache)((IgniteKernal)grid(0)).internalCache(null);
+
+ for (GridDhtLocalPartition part : cache.dht().topology().localPartitions())
+ assertEquals(MOVING, part.state());
+
+ grid(0).cache(null).removeAll();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/593e3eee/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
index dc3a2c0..5738778 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
@@ -58,6 +58,7 @@ public class IgniteCacheTestSuite2 extends TestSuite {
suite.addTestSuite(GridCachePartitionedGetSelfTest.class);
suite.addTest(new TestSuite(GridCachePartitionedBasicApiTest.class));
suite.addTest(new TestSuite(GridCacheNearMultiGetSelfTest.class));
+ suite.addTest(new TestSuite(NoneRebalanceModeSelfTest.class));
suite.addTest(new TestSuite(GridCacheNearJobExecutionSelfTest.class));
suite.addTest(new TestSuite(GridCacheNearOneNodeSelfTest.class));
suite.addTest(new TestSuite(GridCacheNearMultiNodeSelfTest.class));
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/593e3eee/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
index 8eb0688..aaf7e5b 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
@@ -126,6 +126,8 @@ public class IgniteCacheTestSuite4 extends TestSuite {
suite.addTestSuite(CacheNoValueClassOnServerNodeTest.class);
+ suite.addTestSuite(CacheRemoveAllSelfTest.class);
+
suite.addTestSuite(CacheOffheapMapEntrySelfTest.class);
return suite;
[45/50] incubator-ignite git commit: ignite-430 Implement
IgniteSocketStreamer to stream data from TCP socket.
Posted by an...@apache.org.
ignite-430 Implement IgniteSocketStreamer to stream data from TCP socket.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/53995dcb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/53995dcb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/53995dcb
Branch: refs/heads/ignite-843
Commit: 53995dcb3470de07df73d8dfd284da0dbb8df8dd
Parents: b0fbfa0
Author: agura <ag...@gridgain.com>
Authored: Mon Apr 13 18:28:40 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Fri May 15 03:44:27 2015 +0300
----------------------------------------------------------------------
.../streaming/socket/SocketStreamerExample.java | 158 ++++++++++
.../socket/ZStringsSocketStreamerExample.java | 151 +++++++++
.../examples/streaming/socket/package-info.java | 21 ++
.../internal/util/nio/GridBufferedParser.java | 4 -
.../internal/util/nio/GridDelimitedParser.java | 91 ++++++
.../util/nio/GridNioDelimitedBuffer.java | 106 +++++++
.../ignite/stream/adapters/StreamAdapter.java | 17 +
.../stream/socket/IgniteSocketStreamer.java | 217 +++++++++++++
.../stream/socket/SocketMessageConverter.java | 31 ++
.../ignite/stream/socket/package-info.java | 21 ++
.../util/nio/GridNioDelimitedBufferTest.java | 112 +++++++
.../socket/IgniteSocketStreamerSelfTest.java | 315 +++++++++++++++++++
.../ignite/stream/socket/package-info.java | 21 ++
.../testsuites/IgniteStreamTestSuite.java | 39 +++
.../testsuites/IgniteUtilSelfTestSuite.java | 1 +
15 files changed, 1301 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/53995dcb/examples/src/main/java/org/apache/ignite/examples/streaming/socket/SocketStreamerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/SocketStreamerExample.java b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/SocketStreamerExample.java
new file mode 100644
index 0000000..73cb970
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/SocketStreamerExample.java
@@ -0,0 +1,158 @@
+/*
+ * 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.examples.streaming.socket;
+
+import org.apache.ignite.*;
+import org.apache.ignite.examples.*;
+import org.apache.ignite.examples.streaming.numbers.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.stream.*;
+import org.apache.ignite.stream.adapters.*;
+import org.apache.ignite.stream.socket.*;
+
+import javax.cache.processor.*;
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+/**
+ * Streams random numbers into the streaming cache using {@link IgniteSocketStreamer}.
+ * To start the example, you should:
+ * <ul>
+ * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
+ * <li>Start streaming using {@link SocketStreamerExample}.</li>
+ * <li>Start querying popular numbers using {@link QueryPopularNumbers}.</li>
+ * </ul>
+ * <p>
+ * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
+ */
+public class SocketStreamerExample {
+ /** Random number generator. */
+ private static final Random RAND = new Random();
+
+ /** Range within which to generate numbers. */
+ private static final int RANGE = 1000;
+
+ /** Port. */
+ private static final int PORT = 5555;
+
+ /**
+ * @param args Args.
+ */
+ public static void main(String[] args) throws InterruptedException, IOException {
+ // Mark this cluster member as client.
+ Ignition.setClientMode(true);
+
+ try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+ if (!ExamplesUtils.hasServerNodes(ignite))
+ return;
+
+ // The cache is configured with sliding window holding 1 second of the streaming data.
+ IgniteCache<Integer, Long> stmCache = ignite.getOrCreateCache(CacheConfig.randomNumbersCache());
+
+ try (IgniteDataStreamer<Integer, Long> stmr = ignite.dataStreamer(stmCache.getName())) {
+ // Allow data updates.
+ stmr.allowOverwrite(true);
+
+ // Configure data transformation to count instances of the same word.
+ stmr.receiver(new StreamTransformer<Integer, Long>() {
+ @Override public Object process(MutableEntry<Integer, Long> e, Object... objects)
+ throws EntryProcessorException {
+ Long val = e.getValue();
+
+ e.setValue(val == null ? 1L : val + 1);
+
+ return null;
+ }
+ });
+
+ InetAddress addr = InetAddress.getLocalHost();
+
+ IgniteSocketStreamer<Tuple, Integer, Long> sockStmr = new IgniteSocketStreamer<>();
+
+ sockStmr.setAddr(addr);
+
+ sockStmr.setPort(PORT);
+
+ sockStmr.setIgnite(ignite);
+
+ sockStmr.setStreamer(stmr);
+
+ sockStmr.setTupleExtractor(new StreamTupleExtractor<Tuple, Integer, Long>() {
+ @Override public Map.Entry<Integer, Long> extract(Tuple tuple) {
+ return new IgniteBiTuple<>(tuple.key, tuple.cnt);
+ }
+ });
+
+ sockStmr.start();
+
+ sendData(addr, PORT);
+ }
+ }
+ }
+
+ /**
+ * @param addr Address.
+ * @param port Port.
+ */
+ private static void sendData(InetAddress addr, int port) throws IOException, InterruptedException {
+ try (Socket sock = new Socket(addr, port);
+ OutputStream oos = new BufferedOutputStream(sock.getOutputStream())) {
+ while (true) {
+ try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(bos)) {
+ Tuple tuple = new Tuple(RAND.nextInt(RANGE), 1L);
+
+ out.writeObject(tuple);
+
+ byte[] arr = bos.toByteArray();
+
+ oos.write(arr.length >>> 24);
+ oos.write(arr.length >>> 16);
+ oos.write(arr.length >>> 8);
+ oos.write(arr.length);
+
+ oos.write(arr);
+ }
+ }
+ }
+ }
+
+ /**
+ * Tuple.
+ */
+ private static class Tuple implements Serializable {
+ /** Serial version uid. */
+ private static final long serialVersionUID = 0;
+
+ /** Key. */
+ private final int key;
+
+ /** Count. */
+ private final long cnt;
+
+ /**
+ * @param key Key.
+ * @param cnt Count.
+ */
+ public Tuple(int key, long cnt) {
+ this.key = key;
+ this.cnt = cnt;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/53995dcb/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZStringsSocketStreamerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZStringsSocketStreamerExample.java b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZStringsSocketStreamerExample.java
new file mode 100644
index 0000000..a535c73
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZStringsSocketStreamerExample.java
@@ -0,0 +1,151 @@
+/*
+ * 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.examples.streaming.socket;
+
+import org.apache.ignite.*;
+import org.apache.ignite.examples.*;
+import org.apache.ignite.examples.streaming.numbers.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.stream.*;
+import org.apache.ignite.stream.adapters.*;
+import org.apache.ignite.stream.socket.*;
+
+import javax.cache.processor.*;
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+/**
+ * Stream random numbers into the streaming cache using {@link IgniteSocketStreamer}.
+ * <p>
+ * Example illustrates usage of TCP socket streamer in case of non-Java clients. In this example client streams
+ * zero-terminated strings.
+ * <p>
+ * To start the example, you should:
+ * <ul>
+ * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
+ * <li>Start streaming using {@link ZStringsSocketStreamerExample}.</li>
+ * <li>Start querying popular numbers using {@link QueryPopularNumbers}.</li>
+ * </ul>
+ * <p>
+ * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
+ */
+public class ZStringsSocketStreamerExample {
+ /** Random number generator. */
+ private static final Random RAND = new Random();
+
+ /** Range within which to generate numbers. */
+ private static final int RANGE = 1000;
+
+ /** Port. */
+ private static final int PORT = 5555;
+
+ /** Delimiter. */
+ private static final byte[] DELIM = new byte[] {0};
+
+ /**
+ * @param args Args.
+ */
+ public static void main(String[] args) throws InterruptedException, IOException {
+ // Mark this cluster member as client.
+ Ignition.setClientMode(true);
+
+ try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+ if (!ExamplesUtils.hasServerNodes(ignite))
+ return;
+
+ // The cache is configured with sliding window holding 1 second of the streaming data.
+ IgniteCache<Integer, Long> stmCache = ignite.getOrCreateCache(CacheConfig.randomNumbersCache());
+
+ try (IgniteDataStreamer<Integer, Long> stmr = ignite.dataStreamer(stmCache.getName())) {
+ // Allow data updates.
+ stmr.allowOverwrite(true);
+
+ // Configure data transformation to count instances of the same word.
+ stmr.receiver(new StreamTransformer<Integer, Long>() {
+ @Override public Object process(MutableEntry<Integer, Long> e, Object... objects)
+ throws EntryProcessorException {
+ Long val = e.getValue();
+
+ e.setValue(val == null ? 1L : val + 1);
+
+ return null;
+ }
+ });
+
+ InetAddress addr = InetAddress.getLocalHost();
+
+ IgniteSocketStreamer<String, Integer, Long> sockStmr = new IgniteSocketStreamer<>();
+
+ sockStmr.setAddr(addr);
+
+ sockStmr.setPort(PORT);
+
+ sockStmr.setDelimiter(DELIM);
+
+ sockStmr.setIgnite(ignite);
+
+ sockStmr.setStreamer(stmr);
+
+ // Converter from zero-terminated string to Java strings.
+ sockStmr.setConverter(new SocketMessageConverter<String>() {
+ @Override public String convert(byte[] msg) {
+ try {
+ return new String(msg, "ASCII");
+ }
+ catch (UnsupportedEncodingException e) {
+ throw new IgniteException(e);
+ }
+ }
+ });
+
+ sockStmr.setTupleExtractor(new StreamTupleExtractor<String, Integer, Long>() {
+ @Override public Map.Entry<Integer, Long> extract(String input) {
+ String[] pair = input.split("=");
+ return new IgniteBiTuple<>(Integer.parseInt(pair[0]), Long.parseLong(pair[1]));
+ }
+ });
+
+ sockStmr.start();
+
+ sendData(addr, PORT);
+ }
+ }
+ }
+
+ /**
+ * @param addr Address.
+ * @param port Port.
+ */
+ private static void sendData(InetAddress addr, int port) throws IOException, InterruptedException {
+ try (Socket sock = new Socket(addr, port);
+ OutputStream oos = new BufferedOutputStream(sock.getOutputStream())) {
+
+ while (true) {
+ int key = RAND.nextInt(RANGE);
+
+ String str = key + "=1";
+
+ byte[] arr = str.getBytes("ASCII");
+
+ oos.write(arr);
+ oos.write(DELIM);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/53995dcb/examples/src/main/java/org/apache/ignite/examples/streaming/socket/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/package-info.java b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/package-info.java
new file mode 100644
index 0000000..ae7bdf9
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Contains {@link org.apache.ignite.stream.socket.IgniteSocketStreamer} usage examples.
+ */
+package org.apache.ignite.examples.streaming.socket;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/53995dcb/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridBufferedParser.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridBufferedParser.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridBufferedParser.java
index 3f81dc4..a03d2c8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridBufferedParser.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridBufferedParser.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.util.nio;
import org.apache.ignite.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
import java.io.*;
import java.nio.*;
@@ -33,9 +32,6 @@ import java.nio.*;
* | MSG_SIZE | MESSAGE | MSG_SIZE | MESSAGE |
* +--+--+--+--+--+--+...+--+--+--+--+--+--+--+...+--+
* </pre>
- * <p>
- * It expects that first 4 bytes in stream are {@link U#IGNITE_HEADER}. If beginning of a stream,
- * isn't equal to these bytes than exception will be thrown.
*/
public class GridBufferedParser implements GridNioParser {
/** Buffer metadata key. */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/53995dcb/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDelimitedParser.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDelimitedParser.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDelimitedParser.java
new file mode 100644
index 0000000..256597c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDelimitedParser.java
@@ -0,0 +1,91 @@
+/*
+ * 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.nio;
+
+import org.apache.ignite.*;
+
+import java.io.*;
+import java.nio.*;
+
+/**
+ * This class implements stream parser based on {@link GridNioDelimitedBuffer}.
+ * <p>
+ * The rule for this parser is that every message sent over the stream is appended with
+ * delimiter (bytes array). So, the stream structure is as follows:
+ * <pre>
+ * +--+--+...+--+--+--+--+--+--+--+...+--+--+--+--+--+-
+ * | MESSAGE | DELIMITER | MESSAGE | DELIMITER |
+ * +--+--+...+--+--+--+--+--+--+--+...+--+--+--+--+--+-
+ * </pre>
+ */
+public class GridDelimitedParser implements GridNioParser {
+ /** Buffer metadata key. */
+ private static final int BUF_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
+
+ /** Delimiter. */
+ private final byte[] delim;
+
+ /** Direct buffer. */
+ private final boolean directBuf;
+
+ /**
+ * @param delim Delimiter.
+ * @param directBuf Direct buffer.
+ */
+ public GridDelimitedParser(byte[] delim, boolean directBuf) {
+ this.delim = delim;
+ this.directBuf = directBuf;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte[] decode(GridNioSession ses, ByteBuffer buf) throws IOException, IgniteCheckedException {
+ GridNioDelimitedBuffer nioBuf = ses.meta(BUF_META_KEY);
+
+ // Decode for a given session is called per one thread, so there should not be any concurrency issues.
+ // However, we make some additional checks.
+ if (nioBuf == null) {
+ nioBuf = new GridNioDelimitedBuffer(delim);
+
+ GridNioDelimitedBuffer old = ses.addMeta(BUF_META_KEY, nioBuf);
+
+ assert old == null;
+ }
+
+ return nioBuf.read(buf);
+ }
+
+ /** {@inheritDoc} */
+ @Override public ByteBuffer encode(GridNioSession ses, Object msg) throws IOException, IgniteCheckedException {
+ byte[] msg0 = (byte[])msg;
+
+ int cap = msg0.length + delim.length;
+ ByteBuffer res = directBuf ? ByteBuffer.allocateDirect(cap) : ByteBuffer.allocate(cap);
+
+ res.put(msg0);
+ res.put(delim);
+
+ res.flip();
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return this.getClass().getSimpleName();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/53995dcb/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioDelimitedBuffer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioDelimitedBuffer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioDelimitedBuffer.java
new file mode 100644
index 0000000..2b764ec
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioDelimitedBuffer.java
@@ -0,0 +1,106 @@
+/*
+ * 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.nio;
+
+import org.jetbrains.annotations.*;
+
+import java.nio.*;
+import java.util.*;
+
+/**
+ * Buffer with message delimiter support.
+ */
+public class GridNioDelimitedBuffer {
+ /** Delimiter. */
+ private final byte[] delim;
+
+ /** Data. */
+ private byte[] data = new byte[16384];
+
+ /** Count. */
+ private int cnt;
+
+ /** Index. */
+ private int idx;
+
+ /**
+ * @param delim Delimiter.
+ */
+ public GridNioDelimitedBuffer(byte[] delim) {
+ assert delim != null;
+ assert delim.length > 0;
+
+ this.delim = delim;
+
+ reset();
+ }
+
+ /**
+ * Resets buffer state.
+ */
+ private void reset() {
+ cnt = 0;
+ idx = 0;
+ }
+
+ /**
+ * @param buf Buffer.
+ * @return Message bytes or {@code null} if message is not fully read yet.
+ */
+ @Nullable public byte[] read(ByteBuffer buf) {
+ while(buf.hasRemaining()) {
+ if (cnt == data.length)
+ data = Arrays.copyOf(data, data.length * 2);
+
+ byte b = buf.get();
+
+ data[cnt++] = b;
+
+ if (b == delim[idx])
+ idx++;
+ else if (idx > 0) {
+ int pos = cnt - idx;
+
+ idx = 0;
+
+ for (int i = pos; i < cnt; i++) {
+ if (data[pos] == delim[idx]) {
+ pos++;
+
+ idx++;
+ }
+ else {
+ pos = cnt - idx;
+
+ idx = 0;
+ }
+ }
+ }
+
+ if (idx == delim.length) {
+ byte[] bytes = Arrays.copyOfRange(data, 0, cnt - delim.length);
+
+ reset();
+
+ return bytes;
+ }
+ }
+
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/53995dcb/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java b/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java
index c729362..b99521a 100644
--- a/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java
@@ -34,6 +34,9 @@ public abstract class StreamAdapter<T, K, V> {
/** Streamer. */
private IgniteDataStreamer<K, V> stmr;
+ /** Ignite. */
+ private Ignite ignite;
+
/**
* Empty constructor.
*/
@@ -81,6 +84,20 @@ public abstract class StreamAdapter<T, K, V> {
}
/**
+ * @return Provided {@link Ignite} instance.
+ */
+ public Ignite getIgnite() {
+ return ignite;
+ }
+
+ /**
+ * @param ignite {@link Ignite} instance.
+ */
+ public void setIgnite(Ignite ignite) {
+ this.ignite = ignite;
+ }
+
+ /**
* Converts given message to a tuple and adds it to the underlying streamer.
*
* @param msg Message to convert.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/53995dcb/modules/core/src/main/java/org/apache/ignite/stream/socket/IgniteSocketStreamer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/socket/IgniteSocketStreamer.java b/modules/core/src/main/java/org/apache/ignite/stream/socket/IgniteSocketStreamer.java
new file mode 100644
index 0000000..66369ea
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/stream/socket/IgniteSocketStreamer.java
@@ -0,0 +1,217 @@
+/*
+ * 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.stream.socket;
+
+import org.apache.ignite.*;
+import org.apache.ignite.internal.util.nio.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.marshaller.jdk.*;
+import org.apache.ignite.stream.adapters.*;
+import org.jetbrains.annotations.*;
+
+import java.net.*;
+import java.nio.*;
+
+/**
+ * Server that receives data from TCP socket, converts it to key-value pairs using {@link StreamTupleExtractor} and
+ * streams into {@link IgniteDataStreamer} instance.
+ * <p>
+ * By default server uses size-based message processing. That is every message sent over the socket is prepended with
+ * 4-byte integer header containing message size. If message delimiter is defined (see {@link #setDelimiter}) then
+ * delimiter-based message processing will be used. That is every message sent over the socket is appended with
+ * provided delimiter.
+ * <p>
+ * Received messages through socket converts to Java object using standard serialization. Conversion functionality
+ * can be customized via user defined {@link SocketMessageConverter} (e.g. in order to convert messages from
+ * non Java clients).
+ */
+public class IgniteSocketStreamer<T, K, V> extends StreamAdapter<T, K, V> {
+ /** Default threads. */
+ private static final int DFLT_THREADS = Runtime.getRuntime().availableProcessors();
+
+ /** Logger. */
+ private IgniteLogger log;
+
+ /** Address. */
+ private InetAddress addr;
+
+ /** Server port. */
+ private int port;
+
+ /** Threads number. */
+ private int threads = DFLT_THREADS;
+
+ /** Direct mode. */
+ private boolean directMode;
+
+ /** Delimiter. */
+ private byte[] delim;
+
+ /** Converter. */
+ private SocketMessageConverter<T> converter;
+
+ /** Server. */
+ private GridNioServer<byte[]> srv;
+
+ /**
+ * Sets server address.
+ *
+ * @param addr Address.
+ */
+ public void setAddr(InetAddress addr) {
+ this.addr = addr;
+ }
+
+ /**
+ * Sets port number.
+ *
+ * @param port Port.
+ */
+ public void setPort(int port) {
+ this.port = port;
+ }
+
+ /**
+ * Sets threadds amount.
+ *
+ * @param threads Threads.
+ */
+ public void setThreads(int threads) {
+ this.threads = threads;
+ }
+
+ /**
+ * Sets direct mode flag.
+ *
+ * @param directMode Direct mode.
+ */
+ public void setDirectMode(boolean directMode) {
+ this.directMode = directMode;
+ }
+
+ /**
+ * Sets message delimiter.
+ *
+ * @param delim Delimiter.
+ */
+ public void setDelimiter(byte[] delim) {
+ this.delim = delim;
+ }
+
+ /**
+ * Sets message converter.
+ *
+ * @param converter Converter.
+ */
+ public void setConverter(SocketMessageConverter<T> converter) {
+ this.converter = converter;
+ }
+
+ /**
+ * Starts streamer.
+ *
+ * @throws IgniteException If failed.
+ */
+ public void start() {
+ A.notNull(getTupleExtractor(), "tupleExtractor");
+ A.notNull(getStreamer(), "streamer");
+ A.notNull(getIgnite(), "ignite");
+ A.ensure(threads > 0, "threads > 0");
+
+ log = getIgnite().log();
+
+ GridNioServerListener<byte[]> lsnr = new GridNioServerListenerAdapter<byte[]>() {
+ @Override public void onConnected(GridNioSession ses) {
+ assert ses.accepted();
+
+ if (log.isDebugEnabled())
+ log.debug("Accepted connection: " + ses.remoteAddress());
+ }
+
+ @Override public void onDisconnected(GridNioSession ses, @Nullable Exception e) {
+ if (e != null)
+ log.error("Connection failed with exception", e);
+ }
+
+ @Override public void onMessage(GridNioSession ses, byte[] msg) {
+ addMessage(converter.convert(msg));
+ }
+ };
+
+ ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
+
+ GridNioParser parser = F.isEmpty(delim) ? new GridBufferedParser(directMode, byteOrder) :
+ new GridDelimitedParser(delim, directMode);
+
+ if (converter == null)
+ converter = new DefaultConverter<>();
+
+ GridNioFilter codec = new GridNioCodecFilter(parser, log, directMode);
+
+ GridNioFilter[] filters = new GridNioFilter[] {codec};
+
+ try {
+ srv = new GridNioServer.Builder<byte[]>()
+ .address(addr == null ? InetAddress.getLocalHost() : addr)
+ .port(port)
+ .listener(lsnr)
+ .logger(log)
+ .selectorCount(threads)
+ .byteOrder(byteOrder)
+ .filters(filters)
+ .build();
+ }
+ catch (IgniteCheckedException | UnknownHostException e) {
+ throw new IgniteException(e);
+ }
+
+ srv.start();
+
+ if (log.isDebugEnabled())
+ log.debug("Socket streaming server started on " + addr + ':' + port);
+ }
+
+ /**
+ * Stops streamer.
+ */
+ public void stop() {
+ srv.stop();
+
+ if (log.isDebugEnabled())
+ log.debug("Socket streaming server stopped");
+ }
+
+ /**
+ * Converts message to Java object using Jdk marshaller.
+ */
+ private static class DefaultConverter<T> implements SocketMessageConverter<T> {
+ /** Marshaller. */
+ private static final JdkMarshaller MARSH = new JdkMarshaller();
+
+ /** {@inheritDoc} */
+ @Override public T convert(byte[] msg) {
+ try {
+ return MARSH.unmarshal(msg, null);
+ }
+ catch (IgniteCheckedException e) {
+ throw new IgniteException(e);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/53995dcb/modules/core/src/main/java/org/apache/ignite/stream/socket/SocketMessageConverter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/socket/SocketMessageConverter.java b/modules/core/src/main/java/org/apache/ignite/stream/socket/SocketMessageConverter.java
new file mode 100644
index 0000000..8161d86
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/stream/socket/SocketMessageConverter.java
@@ -0,0 +1,31 @@
+/*
+ * 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.stream.socket;
+
+/**
+ * Socket message converter.
+ */
+public interface SocketMessageConverter<T> {
+ /**
+ * Converter message represented by array of bytes to object.
+ *
+ * @param msg Message.
+ * @return Converted object.
+ */
+ public T convert(byte[] msg);
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/53995dcb/modules/core/src/main/java/org/apache/ignite/stream/socket/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/socket/package-info.java b/modules/core/src/main/java/org/apache/ignite/stream/socket/package-info.java
new file mode 100644
index 0000000..e1cef65
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/stream/socket/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Contains socket streamer implementation.
+ */
+package org.apache.ignite.stream.socket;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/53995dcb/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioDelimitedBufferTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioDelimitedBufferTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioDelimitedBufferTest.java
new file mode 100644
index 0000000..a0dd2e5
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioDelimitedBufferTest.java
@@ -0,0 +1,112 @@
+/*
+ * 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.nio;
+
+import junit.framework.TestCase;
+
+import java.nio.*;
+import java.util.*;
+
+/**
+ * Tests for {@link GridNioDelimitedBuffer}.
+ */
+public class GridNioDelimitedBufferTest extends TestCase {
+ /** */
+ private static final String ASCII = "ASCII";
+
+ /**
+ * Tests simple delimiter (excluded from alphabet)
+ */
+ public void testReadZString() throws Exception {
+ Random rnd = new Random();
+
+ int buffSize = 0;
+
+ byte[] delim = new byte[] {0};
+
+ List<String> strs = new ArrayList<>(50);
+
+ for (int i = 0; i < 50; i++) {
+ int len = rnd.nextInt(128) + 1;
+
+ buffSize += len + delim.length;
+
+ StringBuilder sb = new StringBuilder(len);
+
+ for (int j = 0; j < len; j++)
+ sb.append((char)(rnd.nextInt(26) + 'a'));
+
+
+ strs.add(sb.toString());
+ }
+
+ ByteBuffer buff = ByteBuffer.allocate(buffSize);
+
+ for (String str : strs) {
+ buff.put(str.getBytes(ASCII));
+ buff.put(delim);
+ }
+
+ buff.flip();
+
+ byte[] msg;
+
+ GridNioDelimitedBuffer delimBuff = new GridNioDelimitedBuffer(delim);
+
+ List<String> res = new ArrayList<>(strs.size());
+
+ while ((msg = delimBuff.read(buff)) != null)
+ res.add(new String(msg, ASCII));
+
+ assertEquals(strs, res);
+ }
+
+ /**
+ * Tests compound delimiter (included to alphabet)
+ */
+ public void testDelim() throws Exception {
+ byte[] delim = "aabb".getBytes(ASCII);
+
+ List<String> strs = Arrays.asList("za", "zaa", "zaab", "zab", "zaabaababbbbabaab");
+
+ int buffSize = 0;
+
+ for (String str : strs)
+ buffSize += str.length() + delim.length;
+
+ ByteBuffer buff = ByteBuffer.allocate(buffSize);
+
+ for (String str : strs) {
+ buff.put(str.getBytes(ASCII));
+ buff.put(delim);
+ }
+
+ buff.flip();
+
+ byte[] msg;
+
+ GridNioDelimitedBuffer delimBuff = new GridNioDelimitedBuffer(delim);
+
+ List<String> res = new ArrayList<>(strs.size());
+
+ while ((msg = delimBuff.read(buff)) != null)
+ res.add(new String(msg, ASCII));
+
+ assertEquals(strs, res);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/53995dcb/modules/core/src/test/java/org/apache/ignite/stream/socket/IgniteSocketStreamerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/stream/socket/IgniteSocketStreamerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/stream/socket/IgniteSocketStreamerSelfTest.java
new file mode 100644
index 0000000..19852ce
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/stream/socket/IgniteSocketStreamerSelfTest.java
@@ -0,0 +1,315 @@
+/*
+ * 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.stream.socket;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.events.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.marshaller.*;
+import org.apache.ignite.marshaller.jdk.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.stream.adapters.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import org.jetbrains.annotations.*;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.util.concurrent.*;
+
+import static org.apache.ignite.events.EventType.*;
+
+/**
+ * Tests {@link IgniteSocketStreamer}.
+ */
+public class IgniteSocketStreamerSelfTest extends GridCommonAbstractTest {
+ /** IP finder. */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** Grid count. */
+ private final static int GRID_CNT = 3;
+
+ /** Count. */
+ private static final int CNT = 500;
+
+ /** Delimiter. */
+ private static final byte[] DELIM = new byte[] {0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0};
+
+ /** Port. */
+ private static int port;
+
+ /** Ignite. */
+ private static Ignite ignite;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration() throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration();
+
+ CacheConfiguration ccfg = cacheConfiguration(cfg, null);
+
+ cfg.setCacheConfiguration(ccfg);
+
+ TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+
+ discoSpi.setIpFinder(IP_FINDER);
+
+ cfg.setDiscoverySpi(discoSpi);
+
+ return cfg;
+ }
+
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ ignite = startGrids(GRID_CNT);
+ ignite.<Integer, String>getOrCreateCache(defaultCacheConfiguration());
+
+ try (ServerSocket sock = new ServerSocket(0)) {
+ port = sock.getLocalPort();
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ ignite.cache(null).clear();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSizeBasedDefaultConverter() throws Exception {
+ test(null, null, new Runnable() {
+ @Override public void run() {
+ try (Socket sock = new Socket(InetAddress.getLocalHost(), port);
+ OutputStream os = new BufferedOutputStream(sock.getOutputStream())) {
+ Marshaller marsh = new JdkMarshaller();
+
+ for (int i = 0; i < CNT; i++) {
+ byte[] msg = marsh.marshal(new Tuple(i));
+
+ os.write(msg.length >>> 24);
+ os.write(msg.length >>> 16);
+ os.write(msg.length >>> 8);
+ os.write(msg.length);
+
+ os.write(msg);
+ }
+ }
+ catch (IOException | IgniteCheckedException e) {
+ throw new IgniteException(e);
+ }
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSizeBasedCustomConverter() throws Exception {
+ SocketMessageConverter<Tuple> converter = new SocketMessageConverter<Tuple>() {
+ @Override public Tuple convert(byte[] msg) {
+ int i = (msg[0] & 0xFF) << 24;
+ i |= (msg[1] & 0xFF) << 16;
+ i |= (msg[2] & 0xFF) << 8;
+ i |= msg[3] & 0xFF;
+
+ return new Tuple(i);
+ }
+ };
+
+ test(converter, null, new Runnable() {
+ @Override public void run() {
+ try(Socket sock = new Socket(InetAddress.getLocalHost(), port);
+ OutputStream os = new BufferedOutputStream(sock.getOutputStream())) {
+
+ for (int i = 0; i < CNT; i++) {
+ os.write(0);
+ os.write(0);
+ os.write(0);
+ os.write(4);
+
+ os.write(i >>> 24);
+ os.write(i >>> 16);
+ os.write(i >>> 8);
+ os.write(i);
+ }
+ }
+ catch (IOException e) {
+ throw new IgniteException(e);
+ }
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDelimiterBasedDefaultConverter() throws Exception {
+ test(null, DELIM, new Runnable() {
+ @Override public void run() {
+ try(Socket sock = new Socket(InetAddress.getLocalHost(), port);
+ OutputStream os = new BufferedOutputStream(sock.getOutputStream())) {
+ Marshaller marsh = new JdkMarshaller();
+
+ for (int i = 0; i < CNT; i++) {
+ byte[] msg = marsh.marshal(new Tuple(i));
+
+ os.write(msg);
+ os.write(DELIM);
+ }
+ }
+ catch (IOException | IgniteCheckedException e) {
+ throw new IgniteException(e);
+ }
+ }
+ });
+
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDelimiterBasedCustomConverter() throws Exception {
+ SocketMessageConverter<Tuple> converter = new SocketMessageConverter<Tuple>() {
+ @Override public Tuple convert(byte[] msg) {
+ int i = (msg[0] & 0xFF) << 24;
+ i |= (msg[1] & 0xFF) << 16;
+ i |= (msg[2] & 0xFF) << 8;
+ i |= msg[3] & 0xFF;
+
+ return new Tuple(i);
+ }
+ };
+
+ test(converter, DELIM, new Runnable() {
+ @Override public void run() {
+ try(Socket sock = new Socket(InetAddress.getLocalHost(), port);
+ OutputStream os = new BufferedOutputStream(sock.getOutputStream())) {
+
+ for (int i = 0; i < CNT; i++) {
+ os.write(i >>> 24);
+ os.write(i >>> 16);
+ os.write(i >>> 8);
+ os.write(i);
+
+ os.write(DELIM);
+ }
+ }
+ catch (IOException e) {
+ throw new IgniteException(e);
+ }
+ }
+ });
+ }
+
+ /**
+ * @param converter Converter.
+ * @param r Runnable..
+ */
+ private void test(@Nullable SocketMessageConverter<Tuple> converter, @Nullable byte[] delim, Runnable r) throws Exception
+ {
+ IgniteSocketStreamer<Tuple, Integer, String> sockStmr = null;
+
+ try (IgniteDataStreamer<Integer, String> stmr = ignite.dataStreamer(null)) {
+
+ stmr.allowOverwrite(true);
+ stmr.autoFlushFrequency(10);
+
+ sockStmr = new IgniteSocketStreamer<>();
+
+ IgniteCache<Integer, String> cache = ignite.cache(null);
+
+ sockStmr.setIgnite(ignite);
+
+ sockStmr.setStreamer(stmr);
+
+ sockStmr.setPort(port);
+
+ sockStmr.setDelimiter(delim);
+
+ sockStmr.setTupleExtractor(new StreamTupleExtractor<Tuple, Integer, String>() {
+ @Override public Map.Entry<Integer, String> extract(Tuple msg) {
+ return new IgniteBiTuple<>(msg.key, msg.val);
+ }
+ });
+
+ if (converter != null)
+ sockStmr.setConverter(converter);
+
+ final CountDownLatch latch = new CountDownLatch(CNT);
+
+ IgniteBiPredicate<UUID, CacheEvent> locLsnr = new IgniteBiPredicate<UUID, CacheEvent>() {
+ @Override public boolean apply(UUID uuid, CacheEvent evt) {
+ latch.countDown();
+
+ return true;
+ }
+ };
+
+ ignite.events(ignite.cluster().forCacheNodes(null)).remoteListen(locLsnr, null, EVT_CACHE_OBJECT_PUT);
+
+ sockStmr.start();
+
+ r.run();
+
+ latch.await();
+
+ assertEquals(CNT, cache.size(CachePeekMode.PRIMARY));
+
+ for (int i = 0; i < CNT; i++)
+ assertEquals(Integer.toString(i), cache.get(i));
+ }
+ finally {
+ if (sockStmr != null)
+ sockStmr.stop();
+ }
+
+ }
+
+ /**
+ * Tuple.
+ */
+ private static class Tuple implements Serializable {
+ /** Serial version uid. */
+ private static final long serialVersionUID = 0L;
+
+ /** Key. */
+ private final int key;
+
+ /** Value. */
+ private final String val;
+
+ /**
+ * @param key Key.
+ */
+ Tuple(int key) {
+ this.key = key;
+ this.val = Integer.toString(key);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/53995dcb/modules/core/src/test/java/org/apache/ignite/stream/socket/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/stream/socket/package-info.java b/modules/core/src/test/java/org/apache/ignite/stream/socket/package-info.java
new file mode 100644
index 0000000..2e28469
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/stream/socket/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Contains tests for socket streamer.
+ */
+package org.apache.ignite.stream.socket;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/53995dcb/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamTestSuite.java
new file mode 100644
index 0000000..87bbfbb
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamTestSuite.java
@@ -0,0 +1,39 @@
+/*
+ * 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.testsuites;
+
+import org.apache.ignite.stream.socket.*;
+
+import junit.framework.*;
+
+/**
+ * Stream test suite.
+ */
+public class IgniteStreamTestSuite extends TestSuite {
+ /**
+ * @return Stream tests suite.
+ * @throws Exception If failed.
+ */
+ public static TestSuite suite() throws Exception {
+ TestSuite suite = new TestSuite("Ignite Stream Test Suite");
+
+ suite.addTest(new TestSuite(IgniteSocketStreamerSelfTest.class));
+
+ return suite;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/53995dcb/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
index 941b06e..32cd038 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
@@ -67,6 +67,7 @@ public class IgniteUtilSelfTestSuite extends TestSuite {
suite.addTestSuite(GridNioSelfTest.class);
suite.addTestSuite(GridNioFilterChainSelfTest.class);
suite.addTestSuite(GridNioSslSelfTest.class);
+ suite.addTestSuite(GridNioDelimitedBufferTest.class);
return suite;
}
[37/50] incubator-ignite git commit: # ignite-sprint-5 - Fixed
comment.
Posted by an...@apache.org.
# ignite-sprint-5 - Fixed comment.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9e25c2a3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9e25c2a3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9e25c2a3
Branch: refs/heads/ignite-843
Commit: 9e25c2a32f36964c553075e680de4517e34c541a
Parents: 7e599b6
Author: Andrey <an...@gridgain.com>
Authored: Thu May 14 15:14:59 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Thu May 14 15:14:59 2015 +0700
----------------------------------------------------------------------
bin/ignite-schema-import.bat | 2 +-
bin/ignite-schema-import.sh | 2 +-
bin/ignite.bat | 2 +-
bin/ignitevisorcmd.bat | 2 +-
bin/ignitevisorcmd.sh | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9e25c2a3/bin/ignite-schema-import.bat
----------------------------------------------------------------------
diff --git a/bin/ignite-schema-import.bat b/bin/ignite-schema-import.bat
index d48234c..a4ec86b 100644
--- a/bin/ignite-schema-import.bat
+++ b/bin/ignite-schema-import.bat
@@ -91,7 +91,7 @@ if /i "%SCRIPTS_HOME%\" == "%~dp0" goto run
:: Set IGNITE_LIBS
::
call "%SCRIPTS_HOME%\include\setenv.bat"
-call "%SCRIPTS_HOME%\include\build-classpath.bat" &:: Will be removed in release.
+call "%SCRIPTS_HOME%\include\build-classpath.bat" &:: Will be removed in the binary release.
set CP=%JAVA_HOME%\jre\lib\jfxrt.jar;%IGNITE_HOME%\bin\include\schema-import\*;%IGNITE_LIBS%
::
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9e25c2a3/bin/ignite-schema-import.sh
----------------------------------------------------------------------
diff --git a/bin/ignite-schema-import.sh b/bin/ignite-schema-import.sh
index 8f2a8d5..1029882 100755
--- a/bin/ignite-schema-import.sh
+++ b/bin/ignite-schema-import.sh
@@ -57,7 +57,7 @@ setIgniteHome
# Set IGNITE_LIBS.
#
. "${SCRIPTS_HOME}"/include/setenv.sh
-. "${SCRIPTS_HOME}"/include/build-classpath.sh # Will be removed in release.
+. "${SCRIPTS_HOME}"/include/build-classpath.sh # Will be removed in the binary release.
CP="${JAVA_HOME}/jre/lib/jfxrt.jar${SEP}${IGNITE_HOME}/bin/include/schema-import/*${SEP}${IGNITE_LIBS}"
#
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9e25c2a3/bin/ignite.bat
----------------------------------------------------------------------
diff --git a/bin/ignite.bat b/bin/ignite.bat
index 20836c0..1a4a58c 100644
--- a/bin/ignite.bat
+++ b/bin/ignite.bat
@@ -102,7 +102,7 @@ if "%OS%" == "Windows_NT" set PROG_NAME=%~nx0%
:: Set IGNITE_LIBS
::
call "%SCRIPTS_HOME%\include\setenv.bat"
-call "%SCRIPTS_HOME%\include\build-classpath.bat" &:: Will be removed in release.
+call "%SCRIPTS_HOME%\include\build-classpath.bat" &:: Will be removed in the binary release.
set CP=%IGNITE_LIBS%
::
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9e25c2a3/bin/ignitevisorcmd.bat
----------------------------------------------------------------------
diff --git a/bin/ignitevisorcmd.bat b/bin/ignitevisorcmd.bat
index fe06530..4a1aafd 100644
--- a/bin/ignitevisorcmd.bat
+++ b/bin/ignitevisorcmd.bat
@@ -100,7 +100,7 @@ if "%OS%" == "Windows_NT" set PROG_NAME=%~nx0%
:: Set IGNITE_LIBS
::
call "%SCRIPTS_HOME%\include\setenv.bat"
-call "%SCRIPTS_HOME%\include\build-classpath.bat" &:: Will be removed in release.
+call "%SCRIPTS_HOME%\include\build-classpath.bat" &:: Will be removed in the binary release.
set CP=%IGNITE_HOME%\bin\include\visor-common\*;%IGNITE_HOME%\bin\include\visorcmd\*;%IGNITE_LIBS%
::
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9e25c2a3/bin/ignitevisorcmd.sh
----------------------------------------------------------------------
diff --git a/bin/ignitevisorcmd.sh b/bin/ignitevisorcmd.sh
index 91d6c5a..fe74f6a 100755
--- a/bin/ignitevisorcmd.sh
+++ b/bin/ignitevisorcmd.sh
@@ -53,7 +53,7 @@ setIgniteHome
# Set IGNITE_LIBS.
#
. "${SCRIPTS_HOME}"/include/setenv.sh
-. "${SCRIPTS_HOME}"/include/build-classpath.sh # Will be removed in release.
+. "${SCRIPTS_HOME}"/include/build-classpath.sh # Will be removed in the binary release.
CP="${IGNITE_HOME}/bin/include/visor-common/*${SEP}${IGNITE_HOME}/bin/include/visorcmd/*${SEP}${IGNITE_LIBS}"
#
[28/50] incubator-ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-sprint-5' into ignite-894
Posted by an...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-5' into ignite-894
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/34a9b315
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/34a9b315
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/34a9b315
Branch: refs/heads/ignite-843
Commit: 34a9b315b2dc09b771e924e0970ecd9b1696144c
Parents: 9ea2dbd 8246788
Author: sevdokimov <se...@gridgain.com>
Authored: Wed May 13 17:20:26 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed May 13 17:20:26 2015 +0300
----------------------------------------------------------------------
bin/include/functions.sh | 2 +-
.../processors/cache/GridCacheMvccManager.java | 4 +-
.../dht/GridDhtTransactionalCacheAdapter.java | 9 +-
.../cache/distributed/dht/GridDhtTxLocal.java | 32 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 27 +
.../cache/distributed/dht/GridDhtTxMapping.java | 2 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 81 +-
.../colocated/GridDhtColocatedLockFuture.java | 25 +-
.../colocated/GridDhtDetachedCacheEntry.java | 4 +-
.../distributed/near/GridNearCacheEntry.java | 4 +-
.../distributed/near/GridNearLockFuture.java | 5 -
.../near/GridNearOptimisticTxPrepareFuture.java | 779 +++++++++++++
.../GridNearPessimisticTxPrepareFuture.java | 349 ++++++
.../cache/distributed/near/GridNearTxLocal.java | 84 +-
.../near/GridNearTxPrepareFuture.java | 1050 ------------------
.../near/GridNearTxPrepareFutureAdapter.java | 226 ++++
.../cache/transactions/IgniteInternalTx.java | 4 +-
.../cache/transactions/IgniteTxAdapter.java | 2 +-
.../cache/transactions/IgniteTxHandler.java | 68 +-
.../transactions/IgniteTxLocalAdapter.java | 2 +-
.../cache/transactions/IgniteTxManager.java | 12 +-
.../GridCacheAbstractFailoverSelfTest.java | 8 +-
.../GridCacheAbstractNodeRestartSelfTest.java | 11 +-
.../distributed/GridCacheLockAbstractTest.java | 2 -
.../distributed/IgniteTxGetAfterStopTest.java | 131 +++
...achePartitionedNearDisabledLockSelfTest.java | 47 +
...ePrimaryNodeFailureRecoveryAbstractTest.java | 4 +-
...idCacheAtomicReplicatedFailoverSelfTest.java | 6 +
.../GridCachePartitionedTxSalvageSelfTest.java | 25 +-
.../GridCacheReplicatedFailoverSelfTest.java | 6 +
.../GridCacheReplicatedLockSelfTest.java | 5 +
.../GridCacheReplicatedNodeRestartSelfTest.java | 80 ++
.../discovery/tcp/TcpDiscoveryRestartTest.java | 199 ++++
.../IgniteCacheFailoverTestSuite.java | 10 +-
.../testsuites/IgniteCacheRestartTestSuite.java | 8 +-
.../testsuites/IgniteCacheTestSuite2.java | 1 +
.../testsuites/IgniteCacheTestSuite3.java | 2 +
37 files changed, 2029 insertions(+), 1287 deletions(-)
----------------------------------------------------------------------
[21/50] incubator-ignite git commit: # ignite-835
Posted by an...@apache.org.
# ignite-835
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9e670b8f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9e670b8f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9e670b8f
Branch: refs/heads/ignite-843
Commit: 9e670b8f59dc8b758dc8944885adf739d847e9c9
Parents: ade75f9
Author: sboikov <sb...@gridgain.com>
Authored: Wed May 13 11:22:12 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed May 13 11:22:12 2015 +0300
----------------------------------------------------------------------
...achePartitionedNearDisabledLockSelfTest.java | 47 ++++++++++++++++++++
.../GridCacheReplicatedLockSelfTest.java | 5 +++
.../testsuites/IgniteCacheTestSuite2.java | 1 +
3 files changed, 53 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9e670b8f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedNearDisabledLockSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedNearDisabledLockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedNearDisabledLockSelfTest.java
new file mode 100644
index 0000000..69c7909
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedNearDisabledLockSelfTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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.processors.cache.distributed.dht;
+
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ *
+ */
+public class GridCachePartitionedNearDisabledLockSelfTest extends GridCachePartitionedLockSelfTest {
+ /** {@inheritDoc} */
+ @Override protected CacheConfiguration cacheConfiguration() {
+ CacheConfiguration ccfg = super.cacheConfiguration();
+
+ assertNotNull(ccfg.getNearConfiguration());
+
+ ccfg.setNearConfiguration(null);
+
+ return ccfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected boolean isPartitioned() {
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void testLockReentrancy() throws Throwable {
+ fail("https://issues.apache.org/jira/browse/IGNITE-835");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9e670b8f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedLockSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedLockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedLockSelfTest.java
index 97df1f0..510fa0c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedLockSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedLockSelfTest.java
@@ -30,4 +30,9 @@ public class GridCacheReplicatedLockSelfTest extends GridCacheLockAbstractTest {
@Override protected CacheMode cacheMode() {
return REPLICATED;
}
+
+ /** {@inheritDoc} */
+ @Override public void testLockReentrancy() throws Throwable {
+ fail("https://issues.apache.org/jira/browse/IGNITE-835");
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9e670b8f/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
index dfd88a8..dc3a2c0 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
@@ -76,6 +76,7 @@ public class IgniteCacheTestSuite2 extends TestSuite {
suite.addTest(new TestSuite(GridCachePartitionedNearDisabledBasicStoreMultiNodeSelfTest.class));
suite.addTest(new TestSuite(GridCachePartitionedEventSelfTest.class));
suite.addTest(new TestSuite(GridCachePartitionedLockSelfTest.class));
+ suite.addTest(new TestSuite(GridCachePartitionedNearDisabledLockSelfTest.class));
suite.addTest(new TestSuite(GridCachePartitionedMultiNodeLockSelfTest.class));
suite.addTest(new TestSuite(GridCachePartitionedMultiNodeSelfTest.class));
suite.addTest(new TestSuite(GridCachePartitionedMultiThreadedPutGetSelfTest.class));
[35/50] incubator-ignite git commit: Merge branch 'ignite-gg-10151'
into ignite-sprint-5
Posted by an...@apache.org.
Merge branch 'ignite-gg-10151' into ignite-sprint-5
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d21bc307
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d21bc307
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d21bc307
Branch: refs/heads/ignite-843
Commit: d21bc307b33ffa944a2e1a33893f18d10f35347c
Parents: 2b57817 0532017
Author: Andrey <an...@gridgain.com>
Authored: Thu May 14 00:33:18 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Thu May 14 00:33:18 2015 +0700
----------------------------------------------------------------------
.../scalar/tests/ScalarCacheQueriesSpec.scala | 154 +++++++++----------
.../ignite/scalar/tests/ScalarCacheSpec.scala | 23 +--
.../scalar/tests/ScalarConversionsSpec.scala | 43 +++---
.../scalar/tests/ScalarProjectionSpec.scala | 128 ++++++++-------
.../scalar/tests/ScalarReturnableSpec.scala | 41 ++---
modules/visor-console/pom.xml | 2 +-
.../ignite/visor/VisorRuntimeBaseSpec.scala | 2 +-
.../visor/commands/VisorArgListSpec.scala | 60 ++++----
.../commands/VisorFileNameCompleterSpec.scala | 34 ++--
.../commands/ack/VisorAckCommandSpec.scala | 20 +--
.../commands/alert/VisorAlertCommandSpec.scala | 68 ++++----
.../cache/VisorCacheClearCommandSpec.scala | 48 +++---
.../commands/cache/VisorCacheCommandSpec.scala | 66 ++++----
.../config/VisorConfigurationCommandSpec.scala | 8 +-
.../cswap/VisorCacheSwapCommandSpec.scala | 24 +--
.../deploy/VisorDeployCommandSpec.scala | 10 +-
.../disco/VisorDiscoveryCommandSpec.scala | 46 +++---
.../events/VisorEventsCommandSpec.scala | 28 ++--
.../visor/commands/gc/VisorGcCommandSpec.scala | 30 ++--
.../commands/help/VisorHelpCommandSpec.scala | 57 +++----
.../commands/kill/VisorKillCommandSpec.scala | 58 +++----
.../commands/log/VisorLogCommandSpec.scala | 10 +-
.../commands/mem/VisorMemoryCommandSpec.scala | 77 +++++-----
.../commands/node/VisorNodeCommandSpec.scala | 22 +--
.../commands/open/VisorOpenCommandSpec.scala | 16 +-
.../commands/ping/VisorPingCommandSpec.scala | 16 +-
.../commands/start/VisorStartCommandSpec.scala | 126 +++++++--------
.../commands/tasks/VisorTasksCommandSpec.scala | 112 +++++++-------
.../commands/top/VisorTopologyCommandSpec.scala | 52 +++----
.../commands/vvm/VisorVvmCommandSpec.scala | 30 ++--
30 files changed, 724 insertions(+), 687 deletions(-)
----------------------------------------------------------------------
[05/50] incubator-ignite git commit: ignite-877
Posted by an...@apache.org.
ignite-877
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e6ca7570
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e6ca7570
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e6ca7570
Branch: refs/heads/ignite-843
Commit: e6ca75701e6acf7e4fb857530744d5263bc2f962
Parents: c9cd92e
Author: avinogradov <av...@gridgain.com>
Authored: Fri May 8 18:54:33 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Fri May 8 18:54:33 2015 +0300
----------------------------------------------------------------------
pom.xml | 33 ---------------------------------
1 file changed, 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e6ca7570/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index c5a9e5d..e303480 100644
--- a/pom.xml
+++ b/pom.xml
@@ -36,8 +36,6 @@
<packaging>pom</packaging>
<properties>
- <ignite.site>scp://localhost:/home</ignite.site>
- <ignite.site.folder>${project.artifactId}-${project.version}</ignite.site.folder>
<!--fix <attachartifact>...< /> at apache-release profile if changed-->
<ignite.zip.pattern>ignite-${ignite.edition}-${project.version}</ignite.zip.pattern>
</properties>
@@ -49,13 +47,6 @@
<tag>HEAD</tag>
</scm>
- <distributionManagement>
- <site>
- <id>ignite-site</id>
- <url>${ignite.site}/${ignite.site.folder}</url>
- </site>
- </distributionManagement>
-
<modules>
<module>modules/tools</module>
<module>modules/core</module>
@@ -599,30 +590,6 @@
</execution>
</executions>
</plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-site-plugin</artifactId>
- <version>3.4</version>
- <dependencies>
- <dependency>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-ssh</artifactId>
- <version>2.8</version>
- </dependency>
- </dependencies>
- <executions>
- <execution>
- <goals>
- <goal>deploy</goal>
- </goals>
- <phase>deploy</phase>
- <configuration>
- <inputDirectory>${basedir}/target/site</inputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>
</profile>
[44/50] incubator-ignite git commit: # ignite-669 - streaming design.
Posted by an...@apache.org.
# ignite-669 - streaming design.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b0fbfa05
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b0fbfa05
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b0fbfa05
Branch: refs/heads/ignite-843
Commit: b0fbfa05cb1cb712fe217da7166d945c7c2ec597
Parents: 877eb76
Author: Dmitiry Setrakyan <ds...@gridgain.com>
Authored: Thu Apr 2 03:13:04 2015 -0700
Committer: agura <ag...@gridgain.com>
Committed: Fri May 15 03:44:24 2015 +0300
----------------------------------------------------------------------
.../main/java/org/apache/ignite/stream/adapters/StreamAdapter.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b0fbfa05/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java b/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java
index 9d4772f..c729362 100644
--- a/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java
@@ -37,7 +37,7 @@ public abstract class StreamAdapter<T, K, V> {
/**
* Empty constructor.
*/
- public StreamAdapter() {
+ protected StreamAdapter() {
// No-op.
}
[33/50] incubator-ignite git commit: # IGNITE-894 Move
@InjectRecursively to private package.
Posted by an...@apache.org.
# IGNITE-894 Move @InjectRecursively to private package.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/27b559e3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/27b559e3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/27b559e3
Branch: refs/heads/ignite-843
Commit: 27b559e3aace024f19b411a8b377858c9e0456ab
Parents: 3abd25e
Author: sevdokimov <se...@gridgain.com>
Authored: Wed May 13 19:10:03 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed May 13 19:10:03 2015 +0300
----------------------------------------------------------------------
.../internal/processors/igfs/IgfsJobImpl.java | 1 +
.../processors/resource/GridResourceIoc.java | 1 -
.../processors/resource/InjectRecursively.java | 30 ++++++++++++++++++++
.../ignite/resources/InjectRecursively.java | 30 --------------------
4 files changed, 31 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/27b559e3/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
index b5a336e..8f2cfd2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
@@ -21,6 +21,7 @@ import org.apache.ignite.*;
import org.apache.ignite.compute.*;
import org.apache.ignite.igfs.*;
import org.apache.ignite.igfs.mapreduce.*;
+import org.apache.ignite.internal.processors.resource.*;
import org.apache.ignite.resources.*;
import java.io.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/27b559e3/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 55c0d3b..ce19664 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
@@ -22,7 +22,6 @@ 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.apache.ignite.resources.*;
import org.jetbrains.annotations.*;
import org.jsr166.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/27b559e3/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/InjectRecursively.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/InjectRecursively.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/InjectRecursively.java
new file mode 100644
index 0000000..383ee03
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/InjectRecursively.java
@@ -0,0 +1,30 @@
+/*
+ * 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.processors.resource;
+
+import java.lang.annotation.*;
+
+/**
+ * Indicates that resource injection should be performed for field value too.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface InjectRecursively {
+ // No-op.
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/27b559e3/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java b/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
deleted file mode 100644
index 60d1bd7..0000000
--- a/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
+++ /dev/null
@@ -1,30 +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.resources;
-
-import java.lang.annotation.*;
-
-/**
- * Indicates that resource injection should be performed for field value too.
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.FIELD)
-public @interface InjectRecursively {
- // No-op.
-}
[47/50] incubator-ignite git commit: ignite-430 Words count Socket
streamer examples
Posted by an...@apache.org.
ignite-430 Words count Socket streamer examples
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7ee85179
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7ee85179
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7ee85179
Branch: refs/heads/ignite-843
Commit: 7ee85179103df637ba594fab68755dee71b69997
Parents: d87efce
Author: agura <ag...@gridgain.com>
Authored: Wed May 13 20:56:22 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Fri May 15 03:44:34 2015 +0300
----------------------------------------------------------------------
.../ignite/examples/streaming/package-info.java | 1 -
.../streaming/socket/SocketStreamerExample.java | 128 --------
.../socket/WordsSocketStreamerClient.java | 86 +++++
.../socket/WordsSocketStreamerServer.java | 93 ++++++
.../socket/ZStringsSocketStreamerExample.java | 141 ---------
.../socket/ZWordsSocketStreamerClient.java | 81 +++++
.../socket/ZWordsSocketStreamerServer.java | 111 +++++++
.../examples/streaming/socket/package-info.java | 3 +-
.../streaming/wordcount/CacheConfig.java | 2 +-
.../streaming/wordcount/QueryWords.java | 2 +-
.../streaming/wordcount/StreamWords.java | 2 +-
.../streaming/wordcount/package-info.java | 1 -
.../org/apache/ignite/stream/StreamAdapter.java | 111 +++++++
.../ignite/stream/StreamTupleExtractor.java | 33 ++
.../ignite/stream/adapters/StreamAdapter.java | 111 -------
.../stream/adapters/StreamTupleExtractor.java | 33 --
.../ignite/stream/adapters/package-info.java | 21 --
.../stream/socket/IgniteSocketStreamer.java | 217 -------------
.../ignite/stream/socket/SocketStreamer.java | 218 +++++++++++++
.../socket/IgniteSocketStreamerSelfTest.java | 315 -------------------
.../stream/socket/SocketStreamerSelfTest.java | 315 +++++++++++++++++++
.../testsuites/IgniteStreamTestSuite.java | 2 +-
22 files changed, 1053 insertions(+), 974 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7ee85179/examples/src/main/java/org/apache/ignite/examples/streaming/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/package-info.java b/examples/src/main/java/org/apache/ignite/examples/streaming/package-info.java
index 43dea13..43fbab3 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/package-info.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/package-info.java
@@ -16,7 +16,6 @@
*/
/**
- * <!-- Package description. -->
* Demonstrates usage of data streamer.
*/
package org.apache.ignite.examples.streaming;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7ee85179/examples/src/main/java/org/apache/ignite/examples/streaming/socket/SocketStreamerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/SocketStreamerExample.java b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/SocketStreamerExample.java
deleted file mode 100644
index 487572a..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/SocketStreamerExample.java
+++ /dev/null
@@ -1,128 +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.examples.streaming.socket;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.affinity.*;
-import org.apache.ignite.examples.*;
-import org.apache.ignite.examples.streaming.wordcount.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.stream.adapters.*;
-import org.apache.ignite.stream.socket.*;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-/**
- * Stream words into Ignite cache through socket using {@link IgniteSocketStreamer} and message size based protocol.
- * <p>
- * To start the example, you should:
- * <ul>
- * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
- * <li>Start streaming using {@link SocketStreamerExample}.</li>
- * <li>Start querying popular numbers using {@link QueryWords}.</li>
- * </ul>
- * <p>
- * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
- */
-public class SocketStreamerExample {
- /** Port. */
- private static final int PORT = 5555;
-
- /**
- * @param args Args.
- */
- public static void main(String[] args) throws InterruptedException, IOException {
- // Mark this cluster member as client.
- Ignition.setClientMode(true);
-
- try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
- if (!ExamplesUtils.hasServerNodes(ignite))
- return;
-
- // The cache is configured with sliding window holding 1 second of the streaming data.
- IgniteCache<AffinityUuid, String> stmCache = ignite.getOrCreateCache(CacheConfig.wordCache());
-
- try (IgniteDataStreamer<AffinityUuid, String> stmr = ignite.dataStreamer(stmCache.getName())) {
- InetAddress addr = InetAddress.getLocalHost();
-
- // Configure socket streamer
- IgniteSocketStreamer<String, AffinityUuid, String> sockStmr = new IgniteSocketStreamer<>();
-
- sockStmr.setAddr(addr);
-
- sockStmr.setPort(PORT);
-
- sockStmr.setIgnite(ignite);
-
- sockStmr.setStreamer(stmr);
-
- sockStmr.setTupleExtractor(new StreamTupleExtractor<String, AffinityUuid, String>() {
- @Override public Map.Entry<AffinityUuid, String> extract(String word) {
- // By using AffinityUuid we ensure that identical
- // words are processed on the same cluster node.
- return new IgniteBiTuple<>(new AffinityUuid(word), word);
- }
- });
-
- sockStmr.start();
-
- sendData(addr, PORT);
- }
- }
- }
-
- /**
- * @param addr Address.
- * @param port Port.
- */
- private static void sendData(InetAddress addr, int port) throws IOException, InterruptedException {
- try (Socket sock = new Socket(addr, port);
- OutputStream oos = new BufferedOutputStream(sock.getOutputStream())) {
- while (true) {
- try (InputStream in = StreamWords.class.getResourceAsStream("../wordcount/alice-in-wonderland.txt");
- LineNumberReader rdr = new LineNumberReader(new InputStreamReader(in))) {
- for (String line = rdr.readLine(); line != null; line = rdr.readLine()) {
- for (String word : line.split(" ")) {
- if (!word.isEmpty()) {
- // Stream words into Ignite through socket.
- try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(bos)) {
-
- // Write message
- out.writeObject(word);
-
- byte[] arr = bos.toByteArray();
-
- // Write message length
- oos.write(arr.length >>> 24);
- oos.write(arr.length >>> 16);
- oos.write(arr.length >>> 8);
- oos.write(arr.length);
-
- oos.write(arr);
- }
- }
- }
- }
- }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7ee85179/examples/src/main/java/org/apache/ignite/examples/streaming/socket/WordsSocketStreamerClient.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/WordsSocketStreamerClient.java b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/WordsSocketStreamerClient.java
new file mode 100644
index 0000000..c5ec079
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/WordsSocketStreamerClient.java
@@ -0,0 +1,86 @@
+/*
+ * 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.examples.streaming.socket;
+
+import org.apache.ignite.examples.*;
+import org.apache.ignite.examples.streaming.wordcount.*;
+import org.apache.ignite.stream.socket.*;
+
+import java.io.*;
+import java.net.*;
+
+/**
+ * Sends words to socket server based on {@link SocketStreamer} using message size based protocol.
+ * <p>
+ * To start the example, you should:
+ * <ul>
+ * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
+ * <li>Start socket server using {@link WordsSocketStreamerServer}.</li>
+ * <li>Start a few socket clients using {@link WordsSocketStreamerClient}.</li>
+ * <li>Start querying popular words using {@link QueryWords}.</li>
+ * </ul>
+ * <p>
+ * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
+ */
+public class WordsSocketStreamerClient {
+ /** Port. */
+ private static final int PORT = 5555;
+
+ /**
+ * @param args Args.
+ */
+ public static void main(String[] args) throws IOException {
+ InetAddress addr = InetAddress.getLocalHost();
+
+ try (Socket sock = new Socket(addr, PORT);
+ OutputStream oos = new BufferedOutputStream(sock.getOutputStream())) {
+
+ System.out.println("Words streaming started.");
+
+ while (true) {
+ try (InputStream in = StreamWords.class.getResourceAsStream("../wordcount/alice-in-wonderland.txt");
+ LineNumberReader rdr = new LineNumberReader(new InputStreamReader(in))) {
+ for (String line = rdr.readLine(); line != null; line = rdr.readLine()) {
+ for (String word : line.split(" ")) {
+ if (!word.isEmpty()) {
+ // Stream words into Ignite through socket.
+ try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(bos)) {
+
+ // Write message
+ out.writeObject(word);
+
+ byte[] arr = bos.toByteArray();
+
+ // Write message length
+ oos.write(arr.length >>> 24);
+ oos.write(arr.length >>> 16);
+ oos.write(arr.length >>> 8);
+ oos.write(arr.length);
+
+ oos.write(arr);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7ee85179/examples/src/main/java/org/apache/ignite/examples/streaming/socket/WordsSocketStreamerServer.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/WordsSocketStreamerServer.java b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/WordsSocketStreamerServer.java
new file mode 100644
index 0000000..5af746d
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/WordsSocketStreamerServer.java
@@ -0,0 +1,93 @@
+/*
+ * 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.examples.streaming.socket;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.examples.*;
+import org.apache.ignite.examples.streaming.wordcount.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.stream.*;
+import org.apache.ignite.stream.socket.*;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+/**
+ * Receives words through socket using {@link SocketStreamer} and message size based protocol
+ * and streams them into Ignite cache.
+ * <p>
+ * To start the example, you should:
+ * <ul>
+ * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
+ * <li>Start socket server using {@link WordsSocketStreamerServer}.</li>
+ * <li>Start a few socket clients using {@link WordsSocketStreamerClient}.</li>
+ * <li>Start querying popular words using {@link QueryWords}.</li>
+ * </ul>
+ * <p>
+ * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
+ */
+public class WordsSocketStreamerServer {
+ /** Port. */
+ private static final int PORT = 5555;
+
+ /**
+ * @param args Args.
+ */
+ public static void main(String[] args) throws InterruptedException, IOException {
+ // Mark this cluster member as client.
+ Ignition.setClientMode(true);
+
+ Ignite ignite = Ignition.start("examples/config/example-ignite.xml");
+
+ if (!ExamplesUtils.hasServerNodes(ignite)) {
+ ignite.close();
+
+ return;
+ }
+
+ // The cache is configured with sliding window holding 1 second of the streaming data.
+ IgniteCache<AffinityUuid, String> stmCache = ignite.getOrCreateCache(CacheConfig.wordCache());
+
+ IgniteDataStreamer<AffinityUuid, String> stmr = ignite.dataStreamer(stmCache.getName());
+
+ InetAddress addr = InetAddress.getLocalHost();
+
+ // Configure socket streamer
+ SocketStreamer<String, AffinityUuid, String> sockStmr = new SocketStreamer<>();
+
+ sockStmr.setAddr(addr);
+
+ sockStmr.setPort(PORT);
+
+ sockStmr.setIgnite(ignite);
+
+ sockStmr.setStreamer(stmr);
+
+ sockStmr.setTupleExtractor(new StreamTupleExtractor<String, AffinityUuid, String>() {
+ @Override public Map.Entry<AffinityUuid, String> extract(String word) {
+ // By using AffinityUuid we ensure that identical
+ // words are processed on the same cluster node.
+ return new IgniteBiTuple<>(new AffinityUuid(word), word);
+ }
+ });
+
+ sockStmr.start();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7ee85179/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZStringsSocketStreamerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZStringsSocketStreamerExample.java b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZStringsSocketStreamerExample.java
deleted file mode 100644
index fa5aa28..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZStringsSocketStreamerExample.java
+++ /dev/null
@@ -1,141 +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.examples.streaming.socket;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.affinity.*;
-import org.apache.ignite.examples.*;
-import org.apache.ignite.examples.streaming.wordcount.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.stream.adapters.*;
-import org.apache.ignite.stream.socket.*;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-/**
- * Stream words into Ignite cache through socket using {@link IgniteSocketStreamer} and message delimiter based
- * protocol.
- * <p>
- * Example illustrates usage of TCP socket streamer in case of non-Java clients. In this example client streams
- * zero-terminated strings.
- * <p>
- * To start the example, you should:
- * <ul>
- * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
- * <li>Start streaming using {@link ZStringsSocketStreamerExample}.</li>
- * <li>Start querying popular numbers using {@link QueryWords}.</li>
- * </ul>
- * <p>
- * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
- */
-public class ZStringsSocketStreamerExample {
- /** Port. */
- private static final int PORT = 5555;
-
- /** Delimiter. */
- private static final byte[] DELIM = new byte[] {0};
-
- /**
- * @param args Args.
- */
- public static void main(String[] args) throws InterruptedException, IOException {
- // Mark this cluster member as client.
- Ignition.setClientMode(true);
-
- try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
- if (!ExamplesUtils.hasServerNodes(ignite))
- return;
-
- // The cache is configured with sliding window holding 1 second of the streaming data.
- IgniteCache<AffinityUuid, String> stmCache = ignite.getOrCreateCache(CacheConfig.wordCache());
-
- try (IgniteDataStreamer<AffinityUuid, String> stmr = ignite.dataStreamer(stmCache.getName())) {
- InetAddress addr = InetAddress.getLocalHost();
-
- // Configure socket streamer
- IgniteSocketStreamer<String, AffinityUuid, String> sockStmr = new IgniteSocketStreamer<>();
-
- sockStmr.setAddr(addr);
-
- sockStmr.setPort(PORT);
-
- sockStmr.setDelimiter(DELIM);
-
- sockStmr.setIgnite(ignite);
-
- sockStmr.setStreamer(stmr);
-
- // Converter from zero-terminated string to Java strings.
- sockStmr.setConverter(new SocketMessageConverter<String>() {
- @Override public String convert(byte[] msg) {
- try {
- return new String(msg, "ASCII");
- }
- catch (UnsupportedEncodingException e) {
- throw new IgniteException(e);
- }
- }
- });
-
- sockStmr.setTupleExtractor(new StreamTupleExtractor<String, AffinityUuid, String>() {
- @Override public Map.Entry<AffinityUuid, String> extract(String word) {
- // By using AffinityUuid we ensure that identical
- // words are processed on the same cluster node.
- return new IgniteBiTuple<>(new AffinityUuid(word), word);
- }
- });
-
- sockStmr.start();
-
- sendData(addr, PORT);
- }
- }
- }
-
- /**
- * @param addr Address.
- * @param port Port.
- */
- private static void sendData(InetAddress addr, int port) throws IOException, InterruptedException {
- try (Socket sock = new Socket(addr, port);
- OutputStream oos = new BufferedOutputStream(sock.getOutputStream())) {
-
- while (true) {
- try (InputStream in = StreamWords.class.getResourceAsStream("../wordcount/alice-in-wonderland.txt");
- LineNumberReader rdr = new LineNumberReader(new InputStreamReader(in))) {
- for (String line = rdr.readLine(); line != null; line = rdr.readLine()) {
- for (String word : line.split(" ")) {
- if (!word.isEmpty()) {
- // Stream words into Ignite through socket.
- byte[] arr = word.getBytes("ASCII");
-
- // Write message
- oos.write(arr);
-
- // Write message delimiter
- oos.write(DELIM);
- }
- }
- }
- }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7ee85179/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZWordsSocketStreamerClient.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZWordsSocketStreamerClient.java b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZWordsSocketStreamerClient.java
new file mode 100644
index 0000000..c17ccdc
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZWordsSocketStreamerClient.java
@@ -0,0 +1,81 @@
+/*
+ * 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.examples.streaming.socket;
+
+import org.apache.ignite.examples.*;
+import org.apache.ignite.examples.streaming.wordcount.*;
+import org.apache.ignite.stream.socket.*;
+
+import java.io.*;
+import java.net.*;
+
+/**
+ * Sends words to socket server based on {@link SocketStreamer} using message delimiter based protocol.
+ * Example illustrates usage of TCP socket streamer in case of non-Java clients.
+ * In this example words are zero-terminated strings.
+ * <p>
+ * To start the example, you should:
+ * <ul>
+ * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
+ * <li>Start socket server using {@link ZWordsSocketStreamerServer}.</li>
+ * <li>Start a few socket clients using {@link ZWordsSocketStreamerClient}.</li>
+ * <li>Start querying popular words using {@link QueryWords}.</li>
+ * </ul>
+ * <p>
+ * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
+ */
+public class ZWordsSocketStreamerClient {
+ /** Port. */
+ private static final int PORT = 5555;
+
+ /** Delimiter. */
+ private static final byte[] DELIM = new byte[] {0};
+
+ /**
+ * @param args Args.
+ */
+ public static void main(String[] args) throws IOException {
+ InetAddress addr = InetAddress.getLocalHost();
+
+ try (Socket sock = new Socket(addr, PORT);
+ OutputStream oos = new BufferedOutputStream(sock.getOutputStream())) {
+
+ System.out.println("Words streaming started.");
+
+ while (true) {
+ try (InputStream in = StreamWords.class.getResourceAsStream("../wordcount/alice-in-wonderland.txt");
+ LineNumberReader rdr = new LineNumberReader(new InputStreamReader(in))) {
+ for (String line = rdr.readLine(); line != null; line = rdr.readLine()) {
+ for (String word : line.split(" ")) {
+ if (!word.isEmpty()) {
+ // Stream words into Ignite through socket.
+ byte[] arr = word.getBytes("ASCII");
+
+ // Write message
+ oos.write(arr);
+
+ // Write message delimiter
+ oos.write(DELIM);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7ee85179/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZWordsSocketStreamerServer.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZWordsSocketStreamerServer.java b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZWordsSocketStreamerServer.java
new file mode 100644
index 0000000..a0ef9da
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZWordsSocketStreamerServer.java
@@ -0,0 +1,111 @@
+/*
+ * 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.examples.streaming.socket;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.examples.*;
+import org.apache.ignite.examples.streaming.wordcount.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.stream.*;
+import org.apache.ignite.stream.socket.*;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+/**
+ * Receives words through socket using {@link SocketStreamer} and message delimiter based protocol
+ * and streams them into Ignite cache. Example illustrates usage of TCP socket streamer in case of non-Java clients.
+ * In this example words are zero-terminated strings.
+ * <p>
+ * To start the example, you should:
+ * <ul>
+ * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
+ * <li>Start socket server using {@link ZWordsSocketStreamerServer}.</li>
+ * <li>Start a few socket clients using {@link ZWordsSocketStreamerClient}.</li>
+ * <li>Start querying popular words using {@link QueryWords}.</li>
+ * </ul>
+ * <p>
+ * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
+ */
+public class ZWordsSocketStreamerServer {
+ /** Port. */
+ private static final int PORT = 5555;
+
+ /** Delimiter. */
+ private static final byte[] DELIM = new byte[] {0};
+
+ /**
+ * @param args Args.
+ */
+ public static void main(String[] args) throws InterruptedException, IOException {
+ // Mark this cluster member as client.
+ Ignition.setClientMode(true);
+
+ Ignite ignite = Ignition.start("examples/config/example-ignite.xml");
+
+ if (!ExamplesUtils.hasServerNodes(ignite)) {
+ ignite.close();
+
+ return;
+ }
+
+ // The cache is configured with sliding window holding 1 second of the streaming data.
+ IgniteCache<AffinityUuid, String> stmCache = ignite.getOrCreateCache(CacheConfig.wordCache());
+
+ IgniteDataStreamer<AffinityUuid, String> stmr = ignite.dataStreamer(stmCache.getName());
+
+ InetAddress addr = InetAddress.getLocalHost();
+
+ // Configure socket streamer
+ SocketStreamer<String, AffinityUuid, String> sockStmr = new SocketStreamer<>();
+
+ sockStmr.setAddr(addr);
+
+ sockStmr.setPort(PORT);
+
+ sockStmr.setDelimiter(DELIM);
+
+ sockStmr.setIgnite(ignite);
+
+ sockStmr.setStreamer(stmr);
+
+ // Converter from zero-terminated string to Java strings.
+ sockStmr.setConverter(new SocketMessageConverter<String>() {
+ @Override public String convert(byte[] msg) {
+ try {
+ return new String(msg, "ASCII");
+ }
+ catch (UnsupportedEncodingException e) {
+ throw new IgniteException(e);
+ }
+ }
+ });
+
+ sockStmr.setTupleExtractor(new StreamTupleExtractor<String, AffinityUuid, String>() {
+ @Override public Map.Entry<AffinityUuid, String> extract(String word) {
+ // By using AffinityUuid we ensure that identical
+ // words are processed on the same cluster node.
+ return new IgniteBiTuple<>(new AffinityUuid(word), word);
+ }
+ });
+
+ sockStmr.start();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7ee85179/examples/src/main/java/org/apache/ignite/examples/streaming/socket/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/package-info.java b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/package-info.java
index d0a480a..c516ab4 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/package-info.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/package-info.java
@@ -16,7 +16,6 @@
*/
/**
- * <!-- Package description. -->
- * Contains {@link org.apache.ignite.stream.socket.IgniteSocketStreamer} usage examples.
+ * Contains {@link org.apache.ignite.stream.socket.SocketStreamer} usage examples.
*/
package org.apache.ignite.examples.streaming.socket;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7ee85179/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/CacheConfig.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/CacheConfig.java b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/CacheConfig.java
index 58704ca..d17b97d 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/CacheConfig.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/CacheConfig.java
@@ -26,7 +26,7 @@ import javax.cache.expiry.*;
import static java.util.concurrent.TimeUnit.*;
/**
- * Configuration for the streaming cache to store the stream of random numbers.
+ * Configuration for the streaming cache to store the stream of words.
* This cache is configured with sliding window of 1 second, which means that
* data older than 1 second will be automatically removed from the cache.
*/
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7ee85179/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/QueryWords.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/QueryWords.java b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/QueryWords.java
index 3bd9d3d..149aa79 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/QueryWords.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/QueryWords.java
@@ -30,7 +30,7 @@ import java.util.*;
* <ul>
* <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
* <li>Start streaming using {@link StreamWords}.</li>
- * <li>Start querying popular numbers using {@link QueryWords}.</li>
+ * <li>Start querying popular words using {@link QueryWords}.</li>
* </ul>
* <p>
* You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7ee85179/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/StreamWords.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/StreamWords.java b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/StreamWords.java
index c59fa51..cc3c0cb 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/StreamWords.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/StreamWords.java
@@ -29,7 +29,7 @@ import java.io.*;
* <ul>
* <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
* <li>Start streaming using {@link StreamWords}.</li>
- * <li>Start querying popular numbers using {@link QueryWords}.</li>
+ * <li>Start querying popular words using {@link QueryWords}.</li>
* </ul>
* <p>
* You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7ee85179/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/package-info.java b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/package-info.java
index 010f86a..5d48ae3 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/package-info.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/package-info.java
@@ -16,7 +16,6 @@
*/
/**
- * <!-- Package description. -->
* Streaming word count example.
*/
package org.apache.ignite.examples.streaming.wordcount;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7ee85179/modules/core/src/main/java/org/apache/ignite/stream/StreamAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/StreamAdapter.java b/modules/core/src/main/java/org/apache/ignite/stream/StreamAdapter.java
new file mode 100644
index 0000000..0c4e2d1
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/stream/StreamAdapter.java
@@ -0,0 +1,111 @@
+/*
+ * 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.stream;
+
+import org.apache.ignite.*;
+
+import java.util.*;
+
+/**
+ * Convenience adapter for streamers. Adapters are optional components for
+ * streaming from different data sources. The purpose of adapters is to
+ * convert different message formats into Ignite stream key-value tuples
+ * and feed the tuples into the provided {@link org.apache.ignite.IgniteDataStreamer}.
+ */
+public abstract class StreamAdapter<T, K, V> {
+ /** Tuple extractor. */
+ private StreamTupleExtractor<T, K, V> extractor;
+
+ /** Streamer. */
+ private IgniteDataStreamer<K, V> stmr;
+
+ /** Ignite. */
+ private Ignite ignite;
+
+ /**
+ * Empty constructor.
+ */
+ protected StreamAdapter() {
+ // No-op.
+ }
+
+ /**
+ * Stream adapter.
+ *
+ * @param stmr Streamer.
+ * @param extractor Tuple extractor.
+ */
+ protected StreamAdapter(IgniteDataStreamer<K, V> stmr, StreamTupleExtractor<T, K, V> extractor) {
+ this.stmr = stmr;
+ this.extractor = extractor;
+ }
+
+ /**
+ * @return Provided data streamer.
+ */
+ public IgniteDataStreamer<K, V> getStreamer() {
+ return stmr;
+ }
+
+ /**
+ * @param stmr Ignite data streamer.
+ */
+ public void setStreamer(IgniteDataStreamer<K, V> stmr) {
+ this.stmr = stmr;
+ }
+
+ /**
+ * @return Provided tuple extractor.
+ */
+ public StreamTupleExtractor<T, K, V> getTupleExtractor() {
+ return extractor;
+ }
+
+ /**
+ * @param extractor Extractor for key-value tuples from messages.
+ */
+ public void setTupleExtractor(StreamTupleExtractor<T, K, V> extractor) {
+ this.extractor = extractor;
+ }
+
+ /**
+ * @return Provided {@link Ignite} instance.
+ */
+ public Ignite getIgnite() {
+ return ignite;
+ }
+
+ /**
+ * @param ignite {@link Ignite} instance.
+ */
+ public void setIgnite(Ignite ignite) {
+ this.ignite = ignite;
+ }
+
+ /**
+ * Converts given message to a tuple and adds it to the underlying streamer.
+ *
+ * @param msg Message to convert.
+ */
+ protected void addMessage(T msg) {
+ Map.Entry<K, V> e = extractor.extract(msg);
+
+ if (e != null)
+ stmr.addData(e);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7ee85179/modules/core/src/main/java/org/apache/ignite/stream/StreamTupleExtractor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/StreamTupleExtractor.java b/modules/core/src/main/java/org/apache/ignite/stream/StreamTupleExtractor.java
new file mode 100644
index 0000000..d2a4ede
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/stream/StreamTupleExtractor.java
@@ -0,0 +1,33 @@
+/*
+ * 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.stream;
+
+import java.util.*;
+
+/**
+ * Stream tuple extractor to convert messages to Ignite key-value tuples.
+ */
+public interface StreamTupleExtractor<T, K, V> {
+ /**
+ * Extracts a key-value tuple from a message.
+ *
+ * @param msg Message.
+ * @return Key-value tuple.
+ */
+ public Map.Entry<K, V> extract(T msg);
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7ee85179/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java b/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java
deleted file mode 100644
index b99521a..0000000
--- a/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java
+++ /dev/null
@@ -1,111 +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.stream.adapters;
-
-import org.apache.ignite.*;
-
-import java.util.*;
-
-/**
- * Convenience adapter for streamers. Adapters are optional components for
- * streaming from different data sources. The purpose of adapters is to
- * convert different message formats into Ignite stream key-value tuples
- * and feed the tuples into the provided {@link org.apache.ignite.IgniteDataStreamer}.
- */
-public abstract class StreamAdapter<T, K, V> {
- /** Tuple extractor. */
- private StreamTupleExtractor<T, K, V> extractor;
-
- /** Streamer. */
- private IgniteDataStreamer<K, V> stmr;
-
- /** Ignite. */
- private Ignite ignite;
-
- /**
- * Empty constructor.
- */
- protected StreamAdapter() {
- // No-op.
- }
-
- /**
- * Stream adapter.
- *
- * @param stmr Streamer.
- * @param extractor Tuple extractor.
- */
- protected StreamAdapter(IgniteDataStreamer<K, V> stmr, StreamTupleExtractor<T, K, V> extractor) {
- this.stmr = stmr;
- this.extractor = extractor;
- }
-
- /**
- * @return Provided data streamer.
- */
- public IgniteDataStreamer<K, V> getStreamer() {
- return stmr;
- }
-
- /**
- * @param stmr Ignite data streamer.
- */
- public void setStreamer(IgniteDataStreamer<K, V> stmr) {
- this.stmr = stmr;
- }
-
- /**
- * @return Provided tuple extractor.
- */
- public StreamTupleExtractor<T, K, V> getTupleExtractor() {
- return extractor;
- }
-
- /**
- * @param extractor Extractor for key-value tuples from messages.
- */
- public void setTupleExtractor(StreamTupleExtractor<T, K, V> extractor) {
- this.extractor = extractor;
- }
-
- /**
- * @return Provided {@link Ignite} instance.
- */
- public Ignite getIgnite() {
- return ignite;
- }
-
- /**
- * @param ignite {@link Ignite} instance.
- */
- public void setIgnite(Ignite ignite) {
- this.ignite = ignite;
- }
-
- /**
- * Converts given message to a tuple and adds it to the underlying streamer.
- *
- * @param msg Message to convert.
- */
- protected void addMessage(T msg) {
- Map.Entry<K, V> e = extractor.extract(msg);
-
- if (e != null)
- stmr.addData(e);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7ee85179/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamTupleExtractor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamTupleExtractor.java b/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamTupleExtractor.java
deleted file mode 100644
index 9b0c395..0000000
--- a/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamTupleExtractor.java
+++ /dev/null
@@ -1,33 +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.stream.adapters;
-
-import java.util.*;
-
-/**
- * Stream tuple extractor to convert messages to Ignite key-value tuples.
- */
-public interface StreamTupleExtractor<T, K, V> {
- /**
- * Extracts a key-value tuple from a message.
- *
- * @param msg Message.
- * @return Key-value tuple.
- */
- public Map.Entry<K, V> extract(T msg);
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7ee85179/modules/core/src/main/java/org/apache/ignite/stream/adapters/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/adapters/package-info.java b/modules/core/src/main/java/org/apache/ignite/stream/adapters/package-info.java
deleted file mode 100644
index a69ffc0..0000000
--- a/modules/core/src/main/java/org/apache/ignite/stream/adapters/package-info.java
+++ /dev/null
@@ -1,21 +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.
- */
-
-/**
- * Contains Ignite stream adapters.
- */
-package org.apache.ignite.stream.adapters;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7ee85179/modules/core/src/main/java/org/apache/ignite/stream/socket/IgniteSocketStreamer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/socket/IgniteSocketStreamer.java b/modules/core/src/main/java/org/apache/ignite/stream/socket/IgniteSocketStreamer.java
deleted file mode 100644
index 66369ea..0000000
--- a/modules/core/src/main/java/org/apache/ignite/stream/socket/IgniteSocketStreamer.java
+++ /dev/null
@@ -1,217 +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.stream.socket;
-
-import org.apache.ignite.*;
-import org.apache.ignite.internal.util.nio.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.marshaller.jdk.*;
-import org.apache.ignite.stream.adapters.*;
-import org.jetbrains.annotations.*;
-
-import java.net.*;
-import java.nio.*;
-
-/**
- * Server that receives data from TCP socket, converts it to key-value pairs using {@link StreamTupleExtractor} and
- * streams into {@link IgniteDataStreamer} instance.
- * <p>
- * By default server uses size-based message processing. That is every message sent over the socket is prepended with
- * 4-byte integer header containing message size. If message delimiter is defined (see {@link #setDelimiter}) then
- * delimiter-based message processing will be used. That is every message sent over the socket is appended with
- * provided delimiter.
- * <p>
- * Received messages through socket converts to Java object using standard serialization. Conversion functionality
- * can be customized via user defined {@link SocketMessageConverter} (e.g. in order to convert messages from
- * non Java clients).
- */
-public class IgniteSocketStreamer<T, K, V> extends StreamAdapter<T, K, V> {
- /** Default threads. */
- private static final int DFLT_THREADS = Runtime.getRuntime().availableProcessors();
-
- /** Logger. */
- private IgniteLogger log;
-
- /** Address. */
- private InetAddress addr;
-
- /** Server port. */
- private int port;
-
- /** Threads number. */
- private int threads = DFLT_THREADS;
-
- /** Direct mode. */
- private boolean directMode;
-
- /** Delimiter. */
- private byte[] delim;
-
- /** Converter. */
- private SocketMessageConverter<T> converter;
-
- /** Server. */
- private GridNioServer<byte[]> srv;
-
- /**
- * Sets server address.
- *
- * @param addr Address.
- */
- public void setAddr(InetAddress addr) {
- this.addr = addr;
- }
-
- /**
- * Sets port number.
- *
- * @param port Port.
- */
- public void setPort(int port) {
- this.port = port;
- }
-
- /**
- * Sets threadds amount.
- *
- * @param threads Threads.
- */
- public void setThreads(int threads) {
- this.threads = threads;
- }
-
- /**
- * Sets direct mode flag.
- *
- * @param directMode Direct mode.
- */
- public void setDirectMode(boolean directMode) {
- this.directMode = directMode;
- }
-
- /**
- * Sets message delimiter.
- *
- * @param delim Delimiter.
- */
- public void setDelimiter(byte[] delim) {
- this.delim = delim;
- }
-
- /**
- * Sets message converter.
- *
- * @param converter Converter.
- */
- public void setConverter(SocketMessageConverter<T> converter) {
- this.converter = converter;
- }
-
- /**
- * Starts streamer.
- *
- * @throws IgniteException If failed.
- */
- public void start() {
- A.notNull(getTupleExtractor(), "tupleExtractor");
- A.notNull(getStreamer(), "streamer");
- A.notNull(getIgnite(), "ignite");
- A.ensure(threads > 0, "threads > 0");
-
- log = getIgnite().log();
-
- GridNioServerListener<byte[]> lsnr = new GridNioServerListenerAdapter<byte[]>() {
- @Override public void onConnected(GridNioSession ses) {
- assert ses.accepted();
-
- if (log.isDebugEnabled())
- log.debug("Accepted connection: " + ses.remoteAddress());
- }
-
- @Override public void onDisconnected(GridNioSession ses, @Nullable Exception e) {
- if (e != null)
- log.error("Connection failed with exception", e);
- }
-
- @Override public void onMessage(GridNioSession ses, byte[] msg) {
- addMessage(converter.convert(msg));
- }
- };
-
- ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
-
- GridNioParser parser = F.isEmpty(delim) ? new GridBufferedParser(directMode, byteOrder) :
- new GridDelimitedParser(delim, directMode);
-
- if (converter == null)
- converter = new DefaultConverter<>();
-
- GridNioFilter codec = new GridNioCodecFilter(parser, log, directMode);
-
- GridNioFilter[] filters = new GridNioFilter[] {codec};
-
- try {
- srv = new GridNioServer.Builder<byte[]>()
- .address(addr == null ? InetAddress.getLocalHost() : addr)
- .port(port)
- .listener(lsnr)
- .logger(log)
- .selectorCount(threads)
- .byteOrder(byteOrder)
- .filters(filters)
- .build();
- }
- catch (IgniteCheckedException | UnknownHostException e) {
- throw new IgniteException(e);
- }
-
- srv.start();
-
- if (log.isDebugEnabled())
- log.debug("Socket streaming server started on " + addr + ':' + port);
- }
-
- /**
- * Stops streamer.
- */
- public void stop() {
- srv.stop();
-
- if (log.isDebugEnabled())
- log.debug("Socket streaming server stopped");
- }
-
- /**
- * Converts message to Java object using Jdk marshaller.
- */
- private static class DefaultConverter<T> implements SocketMessageConverter<T> {
- /** Marshaller. */
- private static final JdkMarshaller MARSH = new JdkMarshaller();
-
- /** {@inheritDoc} */
- @Override public T convert(byte[] msg) {
- try {
- return MARSH.unmarshal(msg, null);
- }
- catch (IgniteCheckedException e) {
- throw new IgniteException(e);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7ee85179/modules/core/src/main/java/org/apache/ignite/stream/socket/SocketStreamer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/socket/SocketStreamer.java b/modules/core/src/main/java/org/apache/ignite/stream/socket/SocketStreamer.java
new file mode 100644
index 0000000..07ce77e
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/stream/socket/SocketStreamer.java
@@ -0,0 +1,218 @@
+/*
+ * 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.stream.socket;
+
+import org.apache.ignite.*;
+import org.apache.ignite.internal.util.nio.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.marshaller.jdk.*;
+import org.apache.ignite.stream.*;
+
+import org.jetbrains.annotations.*;
+
+import java.net.*;
+import java.nio.*;
+
+/**
+ * Server that receives data from TCP socket, converts it to key-value pairs using {@link StreamTupleExtractor} and
+ * streams into {@link IgniteDataStreamer} instance.
+ * <p>
+ * By default server uses size-based message processing. That is every message sent over the socket is prepended with
+ * 4-byte integer header containing message size. If message delimiter is defined (see {@link #setDelimiter}) then
+ * delimiter-based message processing will be used. That is every message sent over the socket is appended with
+ * provided delimiter.
+ * <p>
+ * Received messages through socket converts to Java object using standard serialization. Conversion functionality
+ * can be customized via user defined {@link SocketMessageConverter} (e.g. in order to convert messages from
+ * non Java clients).
+ */
+public class SocketStreamer<T, K, V> extends StreamAdapter<T, K, V> {
+ /** Default threads. */
+ private static final int DFLT_THREADS = Runtime.getRuntime().availableProcessors();
+
+ /** Logger. */
+ private IgniteLogger log;
+
+ /** Address. */
+ private InetAddress addr;
+
+ /** Server port. */
+ private int port;
+
+ /** Threads number. */
+ private int threads = DFLT_THREADS;
+
+ /** Direct mode. */
+ private boolean directMode;
+
+ /** Delimiter. */
+ private byte[] delim;
+
+ /** Converter. */
+ private SocketMessageConverter<T> converter;
+
+ /** Server. */
+ private GridNioServer<byte[]> srv;
+
+ /**
+ * Sets server address.
+ *
+ * @param addr Address.
+ */
+ public void setAddr(InetAddress addr) {
+ this.addr = addr;
+ }
+
+ /**
+ * Sets port number.
+ *
+ * @param port Port.
+ */
+ public void setPort(int port) {
+ this.port = port;
+ }
+
+ /**
+ * Sets threadds amount.
+ *
+ * @param threads Threads.
+ */
+ public void setThreads(int threads) {
+ this.threads = threads;
+ }
+
+ /**
+ * Sets direct mode flag.
+ *
+ * @param directMode Direct mode.
+ */
+ public void setDirectMode(boolean directMode) {
+ this.directMode = directMode;
+ }
+
+ /**
+ * Sets message delimiter.
+ *
+ * @param delim Delimiter.
+ */
+ public void setDelimiter(byte[] delim) {
+ this.delim = delim;
+ }
+
+ /**
+ * Sets message converter.
+ *
+ * @param converter Converter.
+ */
+ public void setConverter(SocketMessageConverter<T> converter) {
+ this.converter = converter;
+ }
+
+ /**
+ * Starts streamer.
+ *
+ * @throws IgniteException If failed.
+ */
+ public void start() {
+ A.notNull(getTupleExtractor(), "tupleExtractor");
+ A.notNull(getStreamer(), "streamer");
+ A.notNull(getIgnite(), "ignite");
+ A.ensure(threads > 0, "threads > 0");
+
+ log = getIgnite().log();
+
+ GridNioServerListener<byte[]> lsnr = new GridNioServerListenerAdapter<byte[]>() {
+ @Override public void onConnected(GridNioSession ses) {
+ assert ses.accepted();
+
+ if (log.isDebugEnabled())
+ log.debug("Accepted connection: " + ses.remoteAddress());
+ }
+
+ @Override public void onDisconnected(GridNioSession ses, @Nullable Exception e) {
+ if (e != null)
+ log.error("Connection failed with exception", e);
+ }
+
+ @Override public void onMessage(GridNioSession ses, byte[] msg) {
+ addMessage(converter.convert(msg));
+ }
+ };
+
+ ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
+
+ GridNioParser parser = F.isEmpty(delim) ? new GridBufferedParser(directMode, byteOrder) :
+ new GridDelimitedParser(delim, directMode);
+
+ if (converter == null)
+ converter = new DefaultConverter<>();
+
+ GridNioFilter codec = new GridNioCodecFilter(parser, log, directMode);
+
+ GridNioFilter[] filters = new GridNioFilter[] {codec};
+
+ try {
+ srv = new GridNioServer.Builder<byte[]>()
+ .address(addr == null ? InetAddress.getLocalHost() : addr)
+ .port(port)
+ .listener(lsnr)
+ .logger(log)
+ .selectorCount(threads)
+ .byteOrder(byteOrder)
+ .filters(filters)
+ .build();
+ }
+ catch (IgniteCheckedException | UnknownHostException e) {
+ throw new IgniteException(e);
+ }
+
+ srv.start();
+
+ if (log.isDebugEnabled())
+ log.debug("Socket streaming server started on " + addr + ':' + port);
+ }
+
+ /**
+ * Stops streamer.
+ */
+ public void stop() {
+ srv.stop();
+
+ if (log.isDebugEnabled())
+ log.debug("Socket streaming server stopped");
+ }
+
+ /**
+ * Converts message to Java object using Jdk marshaller.
+ */
+ private static class DefaultConverter<T> implements SocketMessageConverter<T> {
+ /** Marshaller. */
+ private static final JdkMarshaller MARSH = new JdkMarshaller();
+
+ /** {@inheritDoc} */
+ @Override public T convert(byte[] msg) {
+ try {
+ return MARSH.unmarshal(msg, null);
+ }
+ catch (IgniteCheckedException e) {
+ throw new IgniteException(e);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7ee85179/modules/core/src/test/java/org/apache/ignite/stream/socket/IgniteSocketStreamerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/stream/socket/IgniteSocketStreamerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/stream/socket/IgniteSocketStreamerSelfTest.java
deleted file mode 100644
index 19852ce..0000000
--- a/modules/core/src/test/java/org/apache/ignite/stream/socket/IgniteSocketStreamerSelfTest.java
+++ /dev/null
@@ -1,315 +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.stream.socket;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.events.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.marshaller.*;
-import org.apache.ignite.marshaller.jdk.*;
-import org.apache.ignite.spi.discovery.tcp.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
-import org.apache.ignite.stream.adapters.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import org.jetbrains.annotations.*;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.util.concurrent.*;
-
-import static org.apache.ignite.events.EventType.*;
-
-/**
- * Tests {@link IgniteSocketStreamer}.
- */
-public class IgniteSocketStreamerSelfTest extends GridCommonAbstractTest {
- /** IP finder. */
- private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
- /** Grid count. */
- private final static int GRID_CNT = 3;
-
- /** Count. */
- private static final int CNT = 500;
-
- /** Delimiter. */
- private static final byte[] DELIM = new byte[] {0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0};
-
- /** Port. */
- private static int port;
-
- /** Ignite. */
- private static Ignite ignite;
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration() throws Exception {
- IgniteConfiguration cfg = super.getConfiguration();
-
- CacheConfiguration ccfg = cacheConfiguration(cfg, null);
-
- cfg.setCacheConfiguration(ccfg);
-
- TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
-
- discoSpi.setIpFinder(IP_FINDER);
-
- cfg.setDiscoverySpi(discoSpi);
-
- return cfg;
- }
-
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- ignite = startGrids(GRID_CNT);
- ignite.<Integer, String>getOrCreateCache(defaultCacheConfiguration());
-
- try (ServerSocket sock = new ServerSocket(0)) {
- port = sock.getLocalPort();
- }
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTestsStopped() throws Exception {
- stopAllGrids();
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- ignite.cache(null).clear();
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testSizeBasedDefaultConverter() throws Exception {
- test(null, null, new Runnable() {
- @Override public void run() {
- try (Socket sock = new Socket(InetAddress.getLocalHost(), port);
- OutputStream os = new BufferedOutputStream(sock.getOutputStream())) {
- Marshaller marsh = new JdkMarshaller();
-
- for (int i = 0; i < CNT; i++) {
- byte[] msg = marsh.marshal(new Tuple(i));
-
- os.write(msg.length >>> 24);
- os.write(msg.length >>> 16);
- os.write(msg.length >>> 8);
- os.write(msg.length);
-
- os.write(msg);
- }
- }
- catch (IOException | IgniteCheckedException e) {
- throw new IgniteException(e);
- }
- }
- });
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testSizeBasedCustomConverter() throws Exception {
- SocketMessageConverter<Tuple> converter = new SocketMessageConverter<Tuple>() {
- @Override public Tuple convert(byte[] msg) {
- int i = (msg[0] & 0xFF) << 24;
- i |= (msg[1] & 0xFF) << 16;
- i |= (msg[2] & 0xFF) << 8;
- i |= msg[3] & 0xFF;
-
- return new Tuple(i);
- }
- };
-
- test(converter, null, new Runnable() {
- @Override public void run() {
- try(Socket sock = new Socket(InetAddress.getLocalHost(), port);
- OutputStream os = new BufferedOutputStream(sock.getOutputStream())) {
-
- for (int i = 0; i < CNT; i++) {
- os.write(0);
- os.write(0);
- os.write(0);
- os.write(4);
-
- os.write(i >>> 24);
- os.write(i >>> 16);
- os.write(i >>> 8);
- os.write(i);
- }
- }
- catch (IOException e) {
- throw new IgniteException(e);
- }
- }
- });
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDelimiterBasedDefaultConverter() throws Exception {
- test(null, DELIM, new Runnable() {
- @Override public void run() {
- try(Socket sock = new Socket(InetAddress.getLocalHost(), port);
- OutputStream os = new BufferedOutputStream(sock.getOutputStream())) {
- Marshaller marsh = new JdkMarshaller();
-
- for (int i = 0; i < CNT; i++) {
- byte[] msg = marsh.marshal(new Tuple(i));
-
- os.write(msg);
- os.write(DELIM);
- }
- }
- catch (IOException | IgniteCheckedException e) {
- throw new IgniteException(e);
- }
- }
- });
-
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDelimiterBasedCustomConverter() throws Exception {
- SocketMessageConverter<Tuple> converter = new SocketMessageConverter<Tuple>() {
- @Override public Tuple convert(byte[] msg) {
- int i = (msg[0] & 0xFF) << 24;
- i |= (msg[1] & 0xFF) << 16;
- i |= (msg[2] & 0xFF) << 8;
- i |= msg[3] & 0xFF;
-
- return new Tuple(i);
- }
- };
-
- test(converter, DELIM, new Runnable() {
- @Override public void run() {
- try(Socket sock = new Socket(InetAddress.getLocalHost(), port);
- OutputStream os = new BufferedOutputStream(sock.getOutputStream())) {
-
- for (int i = 0; i < CNT; i++) {
- os.write(i >>> 24);
- os.write(i >>> 16);
- os.write(i >>> 8);
- os.write(i);
-
- os.write(DELIM);
- }
- }
- catch (IOException e) {
- throw new IgniteException(e);
- }
- }
- });
- }
-
- /**
- * @param converter Converter.
- * @param r Runnable..
- */
- private void test(@Nullable SocketMessageConverter<Tuple> converter, @Nullable byte[] delim, Runnable r) throws Exception
- {
- IgniteSocketStreamer<Tuple, Integer, String> sockStmr = null;
-
- try (IgniteDataStreamer<Integer, String> stmr = ignite.dataStreamer(null)) {
-
- stmr.allowOverwrite(true);
- stmr.autoFlushFrequency(10);
-
- sockStmr = new IgniteSocketStreamer<>();
-
- IgniteCache<Integer, String> cache = ignite.cache(null);
-
- sockStmr.setIgnite(ignite);
-
- sockStmr.setStreamer(stmr);
-
- sockStmr.setPort(port);
-
- sockStmr.setDelimiter(delim);
-
- sockStmr.setTupleExtractor(new StreamTupleExtractor<Tuple, Integer, String>() {
- @Override public Map.Entry<Integer, String> extract(Tuple msg) {
- return new IgniteBiTuple<>(msg.key, msg.val);
- }
- });
-
- if (converter != null)
- sockStmr.setConverter(converter);
-
- final CountDownLatch latch = new CountDownLatch(CNT);
-
- IgniteBiPredicate<UUID, CacheEvent> locLsnr = new IgniteBiPredicate<UUID, CacheEvent>() {
- @Override public boolean apply(UUID uuid, CacheEvent evt) {
- latch.countDown();
-
- return true;
- }
- };
-
- ignite.events(ignite.cluster().forCacheNodes(null)).remoteListen(locLsnr, null, EVT_CACHE_OBJECT_PUT);
-
- sockStmr.start();
-
- r.run();
-
- latch.await();
-
- assertEquals(CNT, cache.size(CachePeekMode.PRIMARY));
-
- for (int i = 0; i < CNT; i++)
- assertEquals(Integer.toString(i), cache.get(i));
- }
- finally {
- if (sockStmr != null)
- sockStmr.stop();
- }
-
- }
-
- /**
- * Tuple.
- */
- private static class Tuple implements Serializable {
- /** Serial version uid. */
- private static final long serialVersionUID = 0L;
-
- /** Key. */
- private final int key;
-
- /** Value. */
- private final String val;
-
- /**
- * @param key Key.
- */
- Tuple(int key) {
- this.key = key;
- this.val = Integer.toString(key);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7ee85179/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java
new file mode 100644
index 0000000..752e43c
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java
@@ -0,0 +1,315 @@
+/*
+ * 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.stream.socket;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.events.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.marshaller.*;
+import org.apache.ignite.marshaller.jdk.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.stream.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import org.jetbrains.annotations.*;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.util.concurrent.*;
+
+import static org.apache.ignite.events.EventType.*;
+
+/**
+ * Tests {@link SocketStreamer}.
+ */
+public class SocketStreamerSelfTest extends GridCommonAbstractTest {
+ /** IP finder. */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** Grid count. */
+ private final static int GRID_CNT = 3;
+
+ /** Count. */
+ private static final int CNT = 500;
+
+ /** Delimiter. */
+ private static final byte[] DELIM = new byte[] {0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0};
+
+ /** Port. */
+ private static int port;
+
+ /** Ignite. */
+ private static Ignite ignite;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration() throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration();
+
+ CacheConfiguration ccfg = cacheConfiguration(cfg, null);
+
+ cfg.setCacheConfiguration(ccfg);
+
+ TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+
+ discoSpi.setIpFinder(IP_FINDER);
+
+ cfg.setDiscoverySpi(discoSpi);
+
+ return cfg;
+ }
+
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ ignite = startGrids(GRID_CNT);
+ ignite.<Integer, String>getOrCreateCache(defaultCacheConfiguration());
+
+ try (ServerSocket sock = new ServerSocket(0)) {
+ port = sock.getLocalPort();
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ ignite.cache(null).clear();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSizeBasedDefaultConverter() throws Exception {
+ test(null, null, new Runnable() {
+ @Override public void run() {
+ try (Socket sock = new Socket(InetAddress.getLocalHost(), port);
+ OutputStream os = new BufferedOutputStream(sock.getOutputStream())) {
+ Marshaller marsh = new JdkMarshaller();
+
+ for (int i = 0; i < CNT; i++) {
+ byte[] msg = marsh.marshal(new Tuple(i));
+
+ os.write(msg.length >>> 24);
+ os.write(msg.length >>> 16);
+ os.write(msg.length >>> 8);
+ os.write(msg.length);
+
+ os.write(msg);
+ }
+ }
+ catch (IOException | IgniteCheckedException e) {
+ throw new IgniteException(e);
+ }
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSizeBasedCustomConverter() throws Exception {
+ SocketMessageConverter<Tuple> converter = new SocketMessageConverter<Tuple>() {
+ @Override public Tuple convert(byte[] msg) {
+ int i = (msg[0] & 0xFF) << 24;
+ i |= (msg[1] & 0xFF) << 16;
+ i |= (msg[2] & 0xFF) << 8;
+ i |= msg[3] & 0xFF;
+
+ return new Tuple(i);
+ }
+ };
+
+ test(converter, null, new Runnable() {
+ @Override public void run() {
+ try(Socket sock = new Socket(InetAddress.getLocalHost(), port);
+ OutputStream os = new BufferedOutputStream(sock.getOutputStream())) {
+
+ for (int i = 0; i < CNT; i++) {
+ os.write(0);
+ os.write(0);
+ os.write(0);
+ os.write(4);
+
+ os.write(i >>> 24);
+ os.write(i >>> 16);
+ os.write(i >>> 8);
+ os.write(i);
+ }
+ }
+ catch (IOException e) {
+ throw new IgniteException(e);
+ }
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDelimiterBasedDefaultConverter() throws Exception {
+ test(null, DELIM, new Runnable() {
+ @Override public void run() {
+ try(Socket sock = new Socket(InetAddress.getLocalHost(), port);
+ OutputStream os = new BufferedOutputStream(sock.getOutputStream())) {
+ Marshaller marsh = new JdkMarshaller();
+
+ for (int i = 0; i < CNT; i++) {
+ byte[] msg = marsh.marshal(new Tuple(i));
+
+ os.write(msg);
+ os.write(DELIM);
+ }
+ }
+ catch (IOException | IgniteCheckedException e) {
+ throw new IgniteException(e);
+ }
+ }
+ });
+
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDelimiterBasedCustomConverter() throws Exception {
+ SocketMessageConverter<Tuple> converter = new SocketMessageConverter<Tuple>() {
+ @Override public Tuple convert(byte[] msg) {
+ int i = (msg[0] & 0xFF) << 24;
+ i |= (msg[1] & 0xFF) << 16;
+ i |= (msg[2] & 0xFF) << 8;
+ i |= msg[3] & 0xFF;
+
+ return new Tuple(i);
+ }
+ };
+
+ test(converter, DELIM, new Runnable() {
+ @Override public void run() {
+ try(Socket sock = new Socket(InetAddress.getLocalHost(), port);
+ OutputStream os = new BufferedOutputStream(sock.getOutputStream())) {
+
+ for (int i = 0; i < CNT; i++) {
+ os.write(i >>> 24);
+ os.write(i >>> 16);
+ os.write(i >>> 8);
+ os.write(i);
+
+ os.write(DELIM);
+ }
+ }
+ catch (IOException e) {
+ throw new IgniteException(e);
+ }
+ }
+ });
+ }
+
+ /**
+ * @param converter Converter.
+ * @param r Runnable..
+ */
+ private void test(@Nullable SocketMessageConverter<Tuple> converter, @Nullable byte[] delim, Runnable r) throws Exception
+ {
+ SocketStreamer<Tuple, Integer, String> sockStmr = null;
+
+ try (IgniteDataStreamer<Integer, String> stmr = ignite.dataStreamer(null)) {
+
+ stmr.allowOverwrite(true);
+ stmr.autoFlushFrequency(10);
+
+ sockStmr = new SocketStreamer<>();
+
+ IgniteCache<Integer, String> cache = ignite.cache(null);
+
+ sockStmr.setIgnite(ignite);
+
+ sockStmr.setStreamer(stmr);
+
+ sockStmr.setPort(port);
+
+ sockStmr.setDelimiter(delim);
+
+ sockStmr.setTupleExtractor(new StreamTupleExtractor<Tuple, Integer, String>() {
+ @Override public Map.Entry<Integer, String> extract(Tuple msg) {
+ return new IgniteBiTuple<>(msg.key, msg.val);
+ }
+ });
+
+ if (converter != null)
+ sockStmr.setConverter(converter);
+
+ final CountDownLatch latch = new CountDownLatch(CNT);
+
+ IgniteBiPredicate<UUID, CacheEvent> locLsnr = new IgniteBiPredicate<UUID, CacheEvent>() {
+ @Override public boolean apply(UUID uuid, CacheEvent evt) {
+ latch.countDown();
+
+ return true;
+ }
+ };
+
+ ignite.events(ignite.cluster().forCacheNodes(null)).remoteListen(locLsnr, null, EVT_CACHE_OBJECT_PUT);
+
+ sockStmr.start();
+
+ r.run();
+
+ latch.await();
+
+ assertEquals(CNT, cache.size(CachePeekMode.PRIMARY));
+
+ for (int i = 0; i < CNT; i++)
+ assertEquals(Integer.toString(i), cache.get(i));
+ }
+ finally {
+ if (sockStmr != null)
+ sockStmr.stop();
+ }
+
+ }
+
+ /**
+ * Tuple.
+ */
+ private static class Tuple implements Serializable {
+ /** Serial version uid. */
+ private static final long serialVersionUID = 0L;
+
+ /** Key. */
+ private final int key;
+
+ /** Value. */
+ private final String val;
+
+ /**
+ * @param key Key.
+ */
+ Tuple(int key) {
+ this.key = key;
+ this.val = Integer.toString(key);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7ee85179/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamTestSuite.java
index 87bbfbb..61be976 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamTestSuite.java
@@ -32,7 +32,7 @@ public class IgniteStreamTestSuite extends TestSuite {
public static TestSuite suite() throws Exception {
TestSuite suite = new TestSuite("Ignite Stream Test Suite");
- suite.addTest(new TestSuite(IgniteSocketStreamerSelfTest.class));
+ suite.addTest(new TestSuite(SocketStreamerSelfTest.class));
return suite;
}
[34/50] incubator-ignite git commit: # IGNITE-777 Bug fix: don't send
message to client twice. (cherry picked from commit cfcd1d9)
Posted by an...@apache.org.
# IGNITE-777 Bug fix: don't send message to client twice.
(cherry picked from commit cfcd1d9)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2b57817a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2b57817a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2b57817a
Branch: refs/heads/ignite-843
Commit: 2b57817a080fc436d81b2c88c2aa437617866ec1
Parents: 27b559e
Author: sevdokimov <se...@gridgain.com>
Authored: Wed May 13 20:12:07 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed May 13 20:13:20 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java | 2 --
1 file changed, 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2b57817a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 0ebb6cd..1dea37a 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -2701,8 +2701,6 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
marshalledMsg = marsh.marshal(msg);
msgClone = marsh.unmarshal(marshalledMsg, null);
-
- clientMsgWorker.addMessage(msgClone);
}
catch (IgniteCheckedException e) {
U.error(log, "Failed to marshal message: " + msg, e);
[03/50] incubator-ignite git commit: # IGNITE-777
(ConcurrentModificationException in TcpDiscoverySpi): Clone message before
send to client.
Posted by an...@apache.org.
# IGNITE-777 (ConcurrentModificationException in TcpDiscoverySpi): Clone message before send to client.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/0dc908bd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0dc908bd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0dc908bd
Branch: refs/heads/ignite-843
Commit: 0dc908bd3d781c30b809d3ba525208d583d8c35d
Parents: c9cd92e
Author: sevdokimov <se...@gridgain.com>
Authored: Wed Apr 22 13:29:40 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Fri May 8 17:58:11 2015 +0300
----------------------------------------------------------------------
.../spi/discovery/tcp/TcpDiscoverySpi.java | 24 ++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0dc908bd/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 46d90b5..3afcd0f 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -2690,8 +2690,28 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
msgLsnr.apply(msg);
if (redirectToClients(msg)) {
- for (ClientMessageWorker clientMsgWorker : clientMsgWorkers.values())
- clientMsgWorker.addMessage(msg);
+ byte[] marshalledMsg = null;
+
+ for (ClientMessageWorker clientMsgWorker : clientMsgWorkers.values()) {
+ // Send a clone to client to avoid ConcurrentModificationException
+ TcpDiscoveryAbstractMessage msgClone;
+
+ try {
+ if (marshalledMsg == null)
+ marshalledMsg = marsh.marshal(msg);
+
+ msgClone = marsh.unmarshal(marshalledMsg, null);
+
+ clientMsgWorker.addMessage(msgClone);
+ }
+ catch (IgniteCheckedException e) {
+ log.error("Failed to marshal message: " + msg, e);
+
+ msgClone = msg;
+ }
+
+ clientMsgWorker.addMessage(msgClone);
+ }
}
Collection<TcpDiscoveryNode> failedNodes;
[40/50] incubator-ignite git commit: # IGNITE-894 Revert adding
@InjectRecursively.
Posted by an...@apache.org.
# IGNITE-894 Revert adding @InjectRecursively.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/56e67e8f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/56e67e8f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/56e67e8f
Branch: refs/heads/ignite-843
Commit: 56e67e8f7ce808c190346d9228987f25b54b4e6f
Parents: 593e3ee
Author: sevdokimov <se...@gridgain.com>
Authored: Thu May 14 16:38:45 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Thu May 14 16:40:00 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/GridInternalWrapper.java | 30 ++++++++++++++++
.../closure/GridClosureProcessor.java | 25 ++++++++++----
.../internal/processors/igfs/IgfsJobImpl.java | 10 ++++--
.../processors/resource/GridResourceIoc.java | 36 ++++++++++----------
.../resource/GridResourceProcessor.java | 8 ++++-
.../processors/resource/GridResourceUtils.java | 15 ++++++++
.../processors/resource/InjectRecursively.java | 30 ----------------
.../resources/META-INF/classnames.properties | 1 -
8 files changed, 96 insertions(+), 59 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/56e67e8f/modules/core/src/main/java/org/apache/ignite/internal/GridInternalWrapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridInternalWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/GridInternalWrapper.java
new file mode 100644
index 0000000..76563e7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridInternalWrapper.java
@@ -0,0 +1,30 @@
+/*
+ * 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;
+
+/**
+ * Internal wrapper interface for custom resource injection logic.
+ */
+public interface GridInternalWrapper<T> {
+ /**
+ * Get user object where resources must be injected.
+ *
+ * @return User object.
+ */
+ public T userObject();
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/56e67e8f/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
index 8f5afbf..658557e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
@@ -1584,12 +1584,12 @@ public class GridClosureProcessor extends GridProcessorAdapter {
/**
*
*/
- private static class C1<T, R> implements ComputeJob, Externalizable {
+ private static class C1<T, R> implements ComputeJob, Externalizable, GridNoImplicitInjection,
+ GridInternalWrapper<IgniteClosure> {
/** */
private static final long serialVersionUID = 0L;
/** */
- @InjectRecursively
protected IgniteClosure<T, R> job;
/** */
@@ -1635,6 +1635,11 @@ public class GridClosureProcessor extends GridProcessorAdapter {
}
/** {@inheritDoc} */
+ @Override public IgniteClosure userObject() {
+ return job;
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(C1.class, this);
}
@@ -1676,12 +1681,11 @@ public class GridClosureProcessor extends GridProcessorAdapter {
/**
*
*/
- private static class C2<R> implements ComputeJob, Externalizable {
+ private static class C2<R> implements ComputeJob, Externalizable, GridNoImplicitInjection, GridInternalWrapper<Callable> {
/** */
private static final long serialVersionUID = 0L;
/** */
- @InjectRecursively
protected Callable<R> c;
/**
@@ -1724,6 +1728,11 @@ public class GridClosureProcessor extends GridProcessorAdapter {
}
/** {@inheritDoc} */
+ @Override public Callable userObject() {
+ return c;
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(C2.class, this);
}
@@ -1763,12 +1772,11 @@ public class GridClosureProcessor extends GridProcessorAdapter {
/**
*/
- private static class C4 implements ComputeJob, Externalizable {
+ private static class C4 implements ComputeJob, Externalizable, GridNoImplicitInjection, GridInternalWrapper<Runnable> {
/** */
private static final long serialVersionUID = 0L;
/** */
- @InjectRecursively
protected Runnable r;
/**
@@ -1808,6 +1816,11 @@ public class GridClosureProcessor extends GridProcessorAdapter {
}
/** {@inheritDoc} */
+ @Override public Runnable userObject() {
+ return r;
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(C4.class, this);
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/56e67e8f/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
index 8f2cfd2..fa90e21 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
@@ -21,7 +21,7 @@ import org.apache.ignite.*;
import org.apache.ignite.compute.*;
import org.apache.ignite.igfs.*;
import org.apache.ignite.igfs.mapreduce.*;
-import org.apache.ignite.internal.processors.resource.*;
+import org.apache.ignite.internal.*;
import org.apache.ignite.resources.*;
import java.io.*;
@@ -29,12 +29,11 @@ import java.io.*;
/**
* IGFS job implementation.
*/
-public class IgfsJobImpl implements ComputeJob {
+public class IgfsJobImpl implements ComputeJob, GridInternalWrapper<IgfsJob> {
/** */
private static final long serialVersionUID = 0L;
/** IGFS job. */
- @InjectRecursively
private IgfsJob job;
/** IGFS name. */
@@ -110,4 +109,9 @@ public class IgfsJobImpl implements ComputeJob {
@Override public void cancel() {
job.cancel();
}
+
+ /** {@inheritDoc} */
+ @Override public IgfsJob userObject() {
+ return job;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/56e67e8f/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 ce19664..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
@@ -272,29 +272,29 @@ class GridResourceIoc {
for (Class cls0 = cls; !cls0.equals(Object.class); cls0 = cls0.getSuperclass()) {
for (Field field : cls0.getDeclaredFields()) {
- InjectRecursively injectRecursively = field.getAnnotation(InjectRecursively.class);
+ Annotation[] fieldAnns = field.getAnnotations();
- if (injectRecursively != null
- || (allowImplicitInjection && field.getName().startsWith("this$")
- || field.getName().startsWith("val$"))) {
- field.setAccessible(true);
+ for (Annotation ann : fieldAnns) {
+ T2<List<GridResourceField>, List<GridResourceMethod>> t2 = annMap.get(ann.annotationType());
- recursiveFieldsList.add(field);
- }
- else {
- for (Annotation ann : field.getAnnotations()) {
- T2<List<GridResourceField>, List<GridResourceMethod>> t2 = annMap.get(ann.annotationType());
+ if (t2 == null) {
+ t2 = new T2<List<GridResourceField>, List<GridResourceMethod>>(
+ new ArrayList<GridResourceField>(),
+ new ArrayList<GridResourceMethod>());
- if (t2 == null) {
- t2 = new T2<List<GridResourceField>, List<GridResourceMethod>>(
- new ArrayList<GridResourceField>(),
- new ArrayList<GridResourceMethod>());
+ annMap.put(ann.annotationType(), t2);
+ }
- annMap.put(ann.annotationType(), t2);
- }
+ t2.get1().add(new GridResourceField(field, ann));
+ }
- t2.get1().add(new GridResourceField(field, ann));
- }
+ if (allowImplicitInjection
+ && fieldAnns.length == 0
+ && GridResourceUtils.mayRequireResources(field)) {
+ field.setAccessible(true);
+
+ // Account for anonymous inner classes.
+ recursiveFieldsList.add(field);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/56e67e8f/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 5b51592..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.*;
@@ -281,6 +280,13 @@ public class GridResourceProcessor extends GridProcessorAdapter {
Object obj = unwrapTarget(job);
injectToJob(dep, taskCls, obj, ses, jobCtx);
+
+ if (obj instanceof GridInternalWrapper) {
+ Object usrObj = ((GridInternalWrapper)obj).userObject();
+
+ if (usrObj != null)
+ injectToJob(dep, taskCls, usrObj, ses, jobCtx);
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/56e67e8f/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java
index 254f171..660d6ba 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java
@@ -88,4 +88,19 @@ final class GridResourceUtils {
", target=" + target + ", rsrc=" + rsrc + ']', e);
}
}
+
+ /**
+ * Checks if specified field requires recursive inspection to find resource annotations.
+ *
+ * @param f Field.
+ * @return {@code true} if requires, {@code false} if doesn't.
+ */
+ static boolean mayRequireResources(Field f) {
+ assert f != null;
+
+ // Need to inspect anonymous classes, callable and runnable instances.
+ return f.getName().startsWith("this$") || f.getName().startsWith("val$") ||
+ Callable.class.isAssignableFrom(f.getType()) || Runnable.class.isAssignableFrom(f.getType()) ||
+ IgniteClosure.class.isAssignableFrom(f.getType());
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/56e67e8f/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/InjectRecursively.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/InjectRecursively.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/InjectRecursively.java
deleted file mode 100644
index 383ee03..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/InjectRecursively.java
+++ /dev/null
@@ -1,30 +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.processors.resource;
-
-import java.lang.annotation.*;
-
-/**
- * Indicates that resource injection should be performed for field value too.
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.FIELD)
-public @interface InjectRecursively {
- // No-op.
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/56e67e8f/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index f130840..b3eed46 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -1140,7 +1140,6 @@ org.apache.ignite.internal.util.lang.GridAbsClosure
org.apache.ignite.internal.util.lang.GridAbsClosureX
org.apache.ignite.internal.util.lang.GridCloseableIterator
org.apache.ignite.internal.util.lang.GridClosureException
-org.apache.ignite.internal.util.lang.GridComputeJobWrapper
org.apache.ignite.internal.util.lang.GridFunc$1
org.apache.ignite.internal.util.lang.GridFunc$10
org.apache.ignite.internal.util.lang.GridFunc$100
[26/50] incubator-ignite git commit: # ignite-sprint-5 added test for
IGNITE-882
Posted by an...@apache.org.
# ignite-sprint-5 added test for IGNITE-882
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/82467880
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/82467880
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/82467880
Branch: refs/heads/ignite-843
Commit: 82467880eb18bbd16a26b92300b5212f37fe3200
Parents: 22341a9
Author: sboikov <sb...@gridgain.com>
Authored: Wed May 13 16:16:12 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed May 13 16:16:12 2015 +0300
----------------------------------------------------------------------
.../discovery/tcp/TcpDiscoveryRestartTest.java | 199 +++++++++++++++++++
1 file changed, 199 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/82467880/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryRestartTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryRestartTest.java
new file mode 100644
index 0000000..e6bee4a
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryRestartTest.java
@@ -0,0 +1,199 @@
+/*
+ * 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.spi.discovery.tcp;
+
+import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.events.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.*;
+import org.apache.ignite.testframework.junits.common.*;
+import org.eclipse.jetty.util.*;
+
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+import static org.apache.ignite.events.EventType.*;
+
+/**
+ *
+ */
+public class TcpDiscoveryRestartTest extends GridCommonAbstractTest {
+ /** */
+ private TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private static AtomicReference<String> err;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ TcpDiscoverySpi spi = new TcpDiscoverySpi();
+
+ spi.setIpFinder(ipFinder);
+
+ cfg.setDiscoverySpi(spi);
+
+ int[] evts = {EVT_NODE_JOINED, EVT_NODE_FAILED, EVT_NODE_LEFT};
+
+ cfg.setIncludeEventTypes(evts);
+
+ Map<IgnitePredicate<? extends Event>, int[]> lsnrs = new HashMap<>();
+
+ lsnrs.put(new TestEventListener(), evts);
+
+ cfg.setLocalEventListeners(lsnrs);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRestart() throws Exception {
+ err = new AtomicReference<>();
+
+ final int NODE_CNT = 3;
+
+ startGrids(NODE_CNT);
+
+ final ConcurrentHashSet<UUID> nodeIds = new ConcurrentHashSet<>();
+
+ final AtomicInteger id = new AtomicInteger(NODE_CNT);
+
+ final IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ int nodeIdx = id.getAndIncrement();
+
+ for (int i = 0; i < 10 && err.get() == null; i++) {
+ Ignite ignite = startGrid(nodeIdx);
+
+ UUID nodeId = ignite.cluster().localNode().id();
+
+ if (!nodeIds.add(nodeId))
+ failed("Duplicated node ID: " + nodeId);
+
+ stopGrid(nodeIdx);
+ }
+
+ return null;
+ }
+ }, 5, "restart-thread");
+
+ IgniteInternalFuture<?> loadFut = GridTestUtils.runMultiThreadedAsync(new Callable<Long>() {
+ @Override public Long call() throws Exception {
+ long dummyRes = 0;
+
+ List<String> list = new ArrayList<>();
+
+ while (!fut.isDone()) {
+ for (int i = 0; i < 100; i++) {
+ String str = new String(new byte[i]);
+
+ list.add(str);
+
+ dummyRes += str.hashCode();
+ }
+
+ if (list.size() > 1000_000) {
+ list = new ArrayList<>();
+
+ System.gc();
+ }
+ }
+
+ return dummyRes;
+ }
+ }, 2, "test-load");
+
+ fut.get();
+
+ loadFut.get();
+
+ assertNull(err.get());
+
+ for (int i = 0; i < NODE_CNT; i++) {
+ Ignite ignite = ignite(i);
+
+ TestEventListener lsnr = (TestEventListener)F.firstKey(ignite.configuration().getLocalEventListeners());
+
+ assertNotNull(lsnr);
+
+ for (UUID nodeId : nodeIds)
+ lsnr.checkEvents(nodeId);
+ }
+ }
+
+
+ /**
+ * @param msg Message.
+ */
+ private void failed(String msg) {
+ info(msg);
+
+ err.compareAndSet(null, msg);
+ }
+
+ /**
+ *
+ */
+ private class TestEventListener implements IgnitePredicate<Event> {
+ /** */
+ private final ConcurrentHashSet<UUID> joinIds = new ConcurrentHashSet<>();
+
+ /** */
+ private final ConcurrentHashSet<UUID> leftIds = new ConcurrentHashSet<>();
+
+ /** {@inheritDoc} */
+ @Override public boolean apply(Event evt) {
+ DiscoveryEvent evt0 = (DiscoveryEvent)evt;
+
+ if (evt.type() == EVT_NODE_FAILED || evt.type() == EVT_NODE_LEFT) {
+ if (!leftIds.add(evt0.eventNode().id()))
+ failed("Duplicated failed node ID: " + evt0.eventNode().id());
+ }
+ else {
+ assertEquals(EVT_NODE_JOINED, evt.type());
+
+ if (!joinIds.add(evt0.eventNode().id()))
+ failed("Duplicated joined node ID: " + evt0.eventNode().id());
+ }
+
+ return true;
+ }
+
+ /**
+ * @param nodeId Node ID.
+ */
+ void checkEvents(UUID nodeId) {
+ assertTrue("No join event: " + nodeId, joinIds.contains(nodeId));
+
+ assertTrue("No left event: " + nodeId, leftIds.contains(nodeId));
+ }
+ }
+}
[38/50] incubator-ignite git commit: # IGNITE-709 Bug fix: partition
exchange timeout occurs many times if no caches are configured. (cherry
picked from commit 816da0a)
Posted by an...@apache.org.
# IGNITE-709 Bug fix: partition exchange timeout occurs many times if no caches are configured.
(cherry picked from commit 816da0a)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7c91389c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7c91389c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7c91389c
Branch: refs/heads/ignite-843
Commit: 7c91389c4927c257d6af0ed54e7489a2d015588e
Parents: 9e25c2a
Author: sevdokimov <se...@gridgain.com>
Authored: Thu May 14 13:18:34 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Thu May 14 13:42:39 2015 +0300
----------------------------------------------------------------------
.../distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c91389c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 45d332c..4b8db00 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -1252,7 +1252,7 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
cctx.kernalContext().timeout().removeTimeoutObject(old);
GridTimeoutObject timeoutObj = new GridTimeoutObjectAdapter(
- cctx.gridConfig().getNetworkTimeout() * cctx.gridConfig().getCacheConfiguration().length) {
+ cctx.gridConfig().getNetworkTimeout() * Math.max(1, cctx.gridConfig().getCacheConfiguration().length)) {
@Override public void onTimeout() {
if (isDone())
return;
[19/50] incubator-ignite git commit: Merge branch 'ignite-sprint-5'
into ignite-gg-10151
Posted by an...@apache.org.
Merge branch 'ignite-sprint-5' into ignite-gg-10151
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/05320174
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/05320174
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/05320174
Branch: refs/heads/ignite-843
Commit: 05320174665e252be94c4e4b984a408f35800075
Parents: b41fbee 3861fbd
Author: Andrey <an...@gridgain.com>
Authored: Wed May 13 13:05:22 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Wed May 13 13:05:22 2015 +0700
----------------------------------------------------------------------
DEVNOTES.txt | 34 +-
assembly/release-base.xml | 6 +-
assembly/release-schema-import.xml | 50 +
bin/ignite-schema-import.bat | 2 +-
bin/ignite-schema-import.sh | 2 +-
bin/ignite.bat | 2 +-
bin/ignite.sh | 2 +-
bin/ignitevisorcmd.bat | 2 +-
bin/ignitevisorcmd.sh | 2 +-
bin/include/build-classpath.bat | 46 +
bin/include/build-classpath.sh | 71 +
bin/include/functions.sh | 2 +-
bin/include/target-classpath.bat | 46 -
bin/include/target-classpath.sh | 71 -
dev-tools/.gitignore | 2 +
dev-tools/build.gradle | 45 +
dev-tools/src/main/groovy/jiraslurp.groovy | 146 +
examples/pom.xml | 2 +-
.../streaming/wordcount/CacheConfig.java | 5 -
modules/aop/pom.xml | 2 +-
modules/aws/pom.xml | 2 +-
.../config/grid-client-config.properties | 50 +-
modules/clients/pom.xml | 2 +-
.../ClientPropertiesConfigurationSelfTest.java | 12 +-
modules/cloud/pom.xml | 4 +-
.../TcpDiscoveryCloudIpFinderSelfTest.java | 2 -
modules/codegen/pom.xml | 2 +-
.../ignite/codegen/MessageCodeGenerator.java | 4 +-
modules/core/pom.xml | 2 +-
.../java/org/apache/ignite/IgniteCache.java | 5 +
.../org/apache/ignite/IgniteJdbcDriver.java | 81 +-
.../client/GridClientConfiguration.java | 2 +-
.../internal/direct/DirectByteBufferStream.java | 4 +-
.../managers/communication/GridIoManager.java | 8 +-
.../communication/GridIoMessageFactory.java | 4 +-
.../eventstorage/GridEventStorageManager.java | 5 +-
.../cache/DynamicCacheDescriptor.java | 16 +-
.../processors/cache/GridCacheAdapter.java | 544 +-
.../cache/GridCacheEvictionManager.java | 2 +-
.../processors/cache/GridCacheIoManager.java | 314 +-
.../processors/cache/GridCacheMapEntry.java | 18 +-
.../processors/cache/GridCacheMessage.java | 8 +-
.../GridCachePartitionExchangeManager.java | 3 +
.../processors/cache/GridCacheProcessor.java | 189 +-
.../processors/cache/GridCacheProxyImpl.java | 24 -
.../processors/cache/GridCacheSwapManager.java | 215 +-
.../processors/cache/GridCacheTtlManager.java | 156 +-
.../processors/cache/GridCacheUtils.java | 6 +-
.../processors/cache/IgniteInternalCache.java | 27 -
...ridCacheOptimisticCheckPreparedTxFuture.java | 434 --
...idCacheOptimisticCheckPreparedTxRequest.java | 232 -
...dCacheOptimisticCheckPreparedTxResponse.java | 179 -
.../distributed/GridCacheTxRecoveryFuture.java | 506 ++
.../distributed/GridCacheTxRecoveryRequest.java | 261 +
.../GridCacheTxRecoveryResponse.java | 182 +
.../GridDistributedTxRemoteAdapter.java | 2 +-
.../distributed/dht/GridDhtLocalPartition.java | 2 +-
.../dht/GridPartitionedGetFuture.java | 2 +-
.../dht/atomic/GridDhtAtomicUpdateResponse.java | 8 +
.../dht/atomic/GridNearAtomicUpdateFuture.java | 2 +-
.../atomic/GridNearAtomicUpdateResponse.java | 18 +-
.../colocated/GridDhtColocatedLockFuture.java | 2 +
.../dht/preloader/GridDhtForceKeysFuture.java | 6 +
.../dht/preloader/GridDhtForceKeysResponse.java | 54 +-
.../distributed/near/GridNearCacheAdapter.java | 10 -
.../distributed/near/GridNearGetResponse.java | 8 +-
.../processors/cache/local/GridLocalCache.java | 8 +-
.../local/atomic/GridLocalAtomicCache.java | 27 +-
.../cache/query/GridCacheQueryManager.java | 21 +-
.../cache/query/GridCacheSqlQuery.java | 2 +-
.../cache/query/GridCacheTwoStepQuery.java | 17 +
.../cache/transactions/IgniteInternalTx.java | 5 +-
.../cache/transactions/IgniteTxAdapter.java | 2 +-
.../cache/transactions/IgniteTxHandler.java | 38 +-
.../transactions/IgniteTxLocalAdapter.java | 14 +-
.../cache/transactions/IgniteTxManager.java | 173 +-
.../datastreamer/DataStreamerImpl.java | 2 +
.../processors/igfs/IgfsDataManager.java | 3 +
.../processors/igfs/IgfsDeleteWorker.java | 4 +
.../processors/igfs/IgfsMetaManager.java | 2 +-
.../internal/processors/igfs/IgfsUtils.java | 11 +-
.../offheap/GridOffHeapProcessor.java | 17 +
.../processors/resource/GridResourceField.java | 11 +
.../processors/resource/GridResourceIoc.java | 387 +-
.../processors/resource/GridResourceMethod.java | 13 +
.../resource/GridResourceProcessor.java | 4 +-
.../ignite/internal/util/IgniteUtils.java | 19 +-
.../util/lang/GridFilteredIterator.java | 2 +-
.../ignite/internal/util/lang/GridFunc.java | 7218 +++++-------------
.../util/offheap/GridOffHeapPartitionedMap.java | 9 +
.../unsafe/GridUnsafePartitionedMap.java | 155 +-
.../internal/visor/query/VisorQueryArg.java | 14 +-
.../internal/visor/query/VisorQueryJob.java | 2 +
.../apache/ignite/lang/IgniteAsyncSupport.java | 4 +-
.../discovery/tcp/TcpClientDiscoverySpi.java | 4 -
.../spi/discovery/tcp/TcpDiscoverySpi.java | 50 +-
.../discovery/tcp/TcpDiscoverySpiAdapter.java | 8 +-
.../resources/META-INF/classnames.properties | 12 +-
.../core/src/main/resources/ignite.properties | 2 +-
.../internal/GridUpdateNotifierSelfTest.java | 21 +-
.../processors/cache/CacheGetFromJobTest.java | 110 +
.../GridCacheAbstractFailoverSelfTest.java | 4 +-
.../cache/GridCacheAbstractFullApiSelfTest.java | 227 +-
.../cache/GridCacheAbstractSelfTest.java | 4 +-
.../cache/GridCacheSwapReloadSelfTest.java | 20 +-
.../IgniteCacheEntryListenerAbstractTest.java | 4 +-
.../IgniteCacheP2pUnmarshallingErrorTest.java | 189 +
...gniteCacheP2pUnmarshallingNearErrorTest.java | 56 +
...CacheP2pUnmarshallingRebalanceErrorTest.java | 80 +
.../IgniteCacheP2pUnmarshallingTxErrorTest.java | 109 +
.../cache/IgniteCachePeekModesAbstractTest.java | 15 +-
.../cache/OffHeapTieredTransactionSelfTest.java | 127 +
...CacheLoadingConcurrentGridStartSelfTest.java | 163 +
.../GridCacheAbstractNodeRestartSelfTest.java | 94 +-
...GridCacheLoadingConcurrentGridStartTest.java | 154 -
...xOriginatingNodeFailureAbstractSelfTest.java | 2 +-
.../dht/GridCacheDhtPreloadSelfTest.java | 2 +-
...icOffHeapTieredMultiNodeFullApiSelfTest.java | 43 +
...ionedNearDisabledOffHeapFullApiSelfTest.java | 8 +-
...DisabledOffHeapMultiNodeFullApiSelfTest.java | 8 +-
...abledOffHeapTieredAtomicFullApiSelfTest.java | 56 +
...earDisabledOffHeapTieredFullApiSelfTest.java | 33 +
...edOffHeapTieredMultiNodeFullApiSelfTest.java | 33 +
...rDisabledPrimaryNodeFailureRecoveryTest.java | 31 +
...rtitionedPrimaryNodeFailureRecoveryTest.java | 31 +
...woBackupsPrimaryNodeFailureRecoveryTest.java | 37 +
...ePrimaryNodeFailureRecoveryAbstractTest.java | 533 ++
...CacheAtomicOffHeapTieredFullApiSelfTest.java | 32 +
...icOffHeapTieredMultiNodeFullApiSelfTest.java | 33 +
...yWriteOrderOffHeapTieredFullApiSelfTest.java | 33 +
...erOffHeapTieredMultiNodeFullApiSelfTest.java | 33 +
...achePartitionedMultiNodeFullApiSelfTest.java | 15 +-
.../GridCachePartitionedNodeRestartTest.java | 4 +-
...dCachePartitionedOffHeapFullApiSelfTest.java | 8 +-
...titionedOffHeapMultiNodeFullApiSelfTest.java | 8 +-
...PartitionedOffHeapTieredFullApiSelfTest.java | 32 +
...edOffHeapTieredMultiNodeFullApiSelfTest.java | 72 +
...ePartitionedOptimisticTxNodeRestartTest.java | 4 +-
.../GridCacheReplicatedNodeRestartSelfTest.java | 2 +
...idCacheReplicatedOffHeapFullApiSelfTest.java | 8 +-
...plicatedOffHeapMultiNodeFullApiSelfTest.java | 8 +-
...eReplicatedOffHeapTieredFullApiSelfTest.java | 33 +
...edOffHeapTieredMultiNodeFullApiSelfTest.java | 33 +
.../IgniteCacheExpiryPolicyAbstractTest.java | 2 +-
.../IgniteCacheExpiryPolicyTestSuite.java | 2 +
.../expiry/IgniteCacheTtlCleanupSelfTest.java | 85 +
...LocalAtomicOffHeapTieredFullApiSelfTest.java | 32 +
.../GridCacheLocalOffHeapFullApiSelfTest.java | 6 +-
...dCacheLocalOffHeapTieredFullApiSelfTest.java | 32 +
.../igfs/IgfsClientCacheSelfTest.java | 132 +
.../processors/igfs/IgfsOneClientNodeTest.java | 133 +
.../processors/igfs/IgfsStreamsSelfTest.java | 2 +-
...idFileSwapSpaceSpiMultithreadedLoadTest.java | 4 +-
.../tcp/TcpClientDiscoverySelfTest.java | 8 +
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 65 +-
.../ignite/testsuites/IgniteBasicTestSuite.java | 2 +
.../IgniteCacheFullApiSelfTestSuite.java | 18 +
...gniteCacheP2pUnmarshallingErrorTestSuit.java | 41 +
.../testsuites/IgniteCacheRestartTestSuite.java | 5 +-
.../ignite/testsuites/IgniteCacheTestSuite.java | 296 -
.../testsuites/IgniteCacheTestSuite2.java | 141 +
.../testsuites/IgniteCacheTestSuite3.java | 140 +
.../testsuites/IgniteCacheTestSuite4.java | 131 +
.../IgniteCacheTxRecoverySelfTestSuite.java | 4 +
.../ignite/testsuites/IgniteIgfsTestSuite.java | 3 +
modules/extdata/p2p/pom.xml | 2 +-
modules/extdata/uri/pom.xml | 2 +-
modules/gce/pom.xml | 4 +-
modules/geospatial/pom.xml | 2 +-
modules/hadoop/pom.xml | 2 +-
modules/hibernate/pom.xml | 2 +-
modules/indexing/pom.xml | 2 +-
.../processors/query/h2/IgniteH2Indexing.java | 4 +
.../processors/query/h2/sql/GridSqlQuery.java | 20 +
.../query/h2/sql/GridSqlQueryParser.java | 10 +-
.../query/h2/sql/GridSqlQuerySplitter.java | 11 +-
.../processors/query/h2/sql/GridSqlSelect.java | 2 +-
.../processors/query/h2/sql/GridSqlUnion.java | 2 +-
.../query/h2/twostep/GridMapQueryExecutor.java | 3 +
.../h2/twostep/GridReduceQueryExecutor.java | 119 +-
.../cache/GridCacheOffHeapAndSwapSelfTest.java | 11 +-
.../cache/GridCacheOffHeapSelfTest.java | 11 +-
.../cache/GridCacheOffheapIndexGetSelfTest.java | 111 +
.../IgniteCacheAbstractFieldsQuerySelfTest.java | 21 +
...niteCacheP2pUnmarshallingQueryErrorTest.java | 56 +
...eQueryMultiThreadedOffHeapTiredSelfTest.java | 37 +
.../IgniteCacheQueryMultiThreadedSelfTest.java | 29 +-
.../IgniteCacheQuerySelfTestSuite.java | 4 +
.../IgniteCacheWithIndexingTestSuite.java | 2 +
modules/jcl/pom.xml | 2 +-
modules/jta/pom.xml | 2 +-
modules/log4j/pom.xml | 2 +-
modules/rest-http/pom.xml | 2 +-
modules/scalar/pom.xml | 2 +-
.../ignite/scalar/ScalarConversions.scala | 8 -
modules/schedule/pom.xml | 2 +-
modules/schema-import/pom.xml | 8 +-
.../ignite/schema/generator/CodeGenerator.java | 47 +-
modules/slf4j/pom.xml | 2 +-
modules/spring/pom.xml | 2 +-
modules/ssh/pom.xml | 2 +-
modules/tools/pom.xml | 2 +-
modules/urideploy/pom.xml | 2 +-
modules/visor-console/pom.xml | 2 +-
.../commands/cache/VisorCacheScanCommand.scala | 2 +-
modules/visor-plugins/pom.xml | 2 +-
modules/web/pom.xml | 2 +-
modules/yardstick/pom.xml | 2 +-
parent/pom.xml | 2 +
pom.xml | 286 +-
210 files changed, 8627 insertions(+), 8480 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/05320174/modules/visor-console/pom.xml
----------------------------------------------------------------------
[17/50] incubator-ignite git commit: IGNITE-894 Add
@InjectRecursively.
Posted by an...@apache.org.
IGNITE-894 Add @InjectRecursively.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/a1ce1ce4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/a1ce1ce4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/a1ce1ce4
Branch: refs/heads/ignite-843
Commit: a1ce1ce4b749f2fc12a803052bf0df21eb42f675
Parents: 96ad5a8
Author: sevdokimov <se...@gridgain.com>
Authored: Tue May 12 19:15:56 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Tue May 12 19:15:56 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/GridInternalWrapper.java | 30 ------
.../closure/GridClosureProcessor.java | 25 ++---
.../internal/processors/igfs/IgfsJobImpl.java | 9 +-
.../processors/resource/GridResourceIoc.java | 34 +++----
.../resource/GridResourceProcessor.java | 22 +----
.../processors/resource/GridResourceUtils.java | 15 ---
.../util/lang/GridComputeJobWrapper.java | 96 --------------------
.../ignite/resources/InjectRecursively.java | 22 +++++
8 files changed, 48 insertions(+), 205 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1ce1ce4/modules/core/src/main/java/org/apache/ignite/internal/GridInternalWrapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridInternalWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/GridInternalWrapper.java
deleted file mode 100644
index 76563e7..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridInternalWrapper.java
+++ /dev/null
@@ -1,30 +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;
-
-/**
- * Internal wrapper interface for custom resource injection logic.
- */
-public interface GridInternalWrapper<T> {
- /**
- * Get user object where resources must be injected.
- *
- * @return User object.
- */
- public T userObject();
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1ce1ce4/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
index 658557e..8f5afbf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
@@ -1584,12 +1584,12 @@ public class GridClosureProcessor extends GridProcessorAdapter {
/**
*
*/
- private static class C1<T, R> implements ComputeJob, Externalizable, GridNoImplicitInjection,
- GridInternalWrapper<IgniteClosure> {
+ private static class C1<T, R> implements ComputeJob, Externalizable {
/** */
private static final long serialVersionUID = 0L;
/** */
+ @InjectRecursively
protected IgniteClosure<T, R> job;
/** */
@@ -1635,11 +1635,6 @@ public class GridClosureProcessor extends GridProcessorAdapter {
}
/** {@inheritDoc} */
- @Override public IgniteClosure userObject() {
- return job;
- }
-
- /** {@inheritDoc} */
@Override public String toString() {
return S.toString(C1.class, this);
}
@@ -1681,11 +1676,12 @@ public class GridClosureProcessor extends GridProcessorAdapter {
/**
*
*/
- private static class C2<R> implements ComputeJob, Externalizable, GridNoImplicitInjection, GridInternalWrapper<Callable> {
+ private static class C2<R> implements ComputeJob, Externalizable {
/** */
private static final long serialVersionUID = 0L;
/** */
+ @InjectRecursively
protected Callable<R> c;
/**
@@ -1728,11 +1724,6 @@ public class GridClosureProcessor extends GridProcessorAdapter {
}
/** {@inheritDoc} */
- @Override public Callable userObject() {
- return c;
- }
-
- /** {@inheritDoc} */
@Override public String toString() {
return S.toString(C2.class, this);
}
@@ -1772,11 +1763,12 @@ public class GridClosureProcessor extends GridProcessorAdapter {
/**
*/
- private static class C4 implements ComputeJob, Externalizable, GridNoImplicitInjection, GridInternalWrapper<Runnable> {
+ private static class C4 implements ComputeJob, Externalizable {
/** */
private static final long serialVersionUID = 0L;
/** */
+ @InjectRecursively
protected Runnable r;
/**
@@ -1816,11 +1808,6 @@ public class GridClosureProcessor extends GridProcessorAdapter {
}
/** {@inheritDoc} */
- @Override public Runnable userObject() {
- return r;
- }
-
- /** {@inheritDoc} */
@Override public String toString() {
return S.toString(C4.class, this);
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1ce1ce4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
index fa90e21..b5a336e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
@@ -21,7 +21,6 @@ import org.apache.ignite.*;
import org.apache.ignite.compute.*;
import org.apache.ignite.igfs.*;
import org.apache.ignite.igfs.mapreduce.*;
-import org.apache.ignite.internal.*;
import org.apache.ignite.resources.*;
import java.io.*;
@@ -29,11 +28,12 @@ import java.io.*;
/**
* IGFS job implementation.
*/
-public class IgfsJobImpl implements ComputeJob, GridInternalWrapper<IgfsJob> {
+public class IgfsJobImpl implements ComputeJob {
/** */
private static final long serialVersionUID = 0L;
/** IGFS job. */
+ @InjectRecursively
private IgfsJob job;
/** IGFS name. */
@@ -109,9 +109,4 @@ public class IgfsJobImpl implements ComputeJob, GridInternalWrapper<IgfsJob> {
@Override public void cancel() {
job.cancel();
}
-
- /** {@inheritDoc} */
- @Override public IgfsJob userObject() {
- return job;
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1ce1ce4/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 3d853d6..a2ffa55 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
@@ -22,6 +22,7 @@ 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.apache.ignite.resources.*;
import org.jetbrains.annotations.*;
import org.jsr166.*;
@@ -272,27 +273,26 @@ class GridResourceIoc {
for (Class cls0 = cls; !cls0.equals(Object.class); cls0 = cls0.getSuperclass()) {
for (Field field : cls0.getDeclaredFields()) {
- Annotation[] fieldAnns = field.getAnnotations();
+ InjectRecursively injectRecursively = field.getAnnotation(InjectRecursively.class);
- for (Annotation ann : fieldAnns) {
- T2<List<GridResourceField>, List<GridResourceMethod>> t2 = annMap.get(ann.annotationType());
-
- if (t2 == null) {
- t2 = new T2<List<GridResourceField>, List<GridResourceMethod>>(
- new ArrayList<GridResourceField>(),
- new ArrayList<GridResourceMethod>());
+ if (injectRecursively != null
+ || (allowImplicitInjection && field.getName().startsWith("this$")
+ || field.getName().startsWith("val$")))
+ recursiveFieldsList.add(field);
+ else {
+ for (Annotation ann : field.getAnnotations()) {
+ T2<List<GridResourceField>, List<GridResourceMethod>> t2 = annMap.get(ann.annotationType());
- annMap.put(ann.annotationType(), t2);
- }
+ if (t2 == null) {
+ t2 = new T2<List<GridResourceField>, List<GridResourceMethod>>(
+ new ArrayList<GridResourceField>(),
+ new ArrayList<GridResourceMethod>());
- t2.get1().add(new GridResourceField(field, ann));
- }
+ annMap.put(ann.annotationType(), t2);
+ }
- if (allowImplicitInjection
- && fieldAnns.length == 0
- && GridResourceUtils.mayRequireResources(field)) {
- // Account for anonymous inner classes.
- recursiveFieldsList.add(field);
+ t2.get1().add(new GridResourceField(field, ann));
+ }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1ce1ce4/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 cb4149b..5b51592 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
@@ -278,16 +278,9 @@ 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);
-
- if (obj instanceof GridInternalWrapper) {
- Object usrObj = ((GridInternalWrapper)obj).userObject();
-
- if (usrObj != null)
- injectToJob(dep, taskCls, usrObj, ses, jobCtx);
- }
}
/**
@@ -329,19 +322,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/a1ce1ce4/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java
index 660d6ba..254f171 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java
@@ -88,19 +88,4 @@ final class GridResourceUtils {
", target=" + target + ", rsrc=" + rsrc + ']', e);
}
}
-
- /**
- * Checks if specified field requires recursive inspection to find resource annotations.
- *
- * @param f Field.
- * @return {@code true} if requires, {@code false} if doesn't.
- */
- static boolean mayRequireResources(Field f) {
- assert f != null;
-
- // Need to inspect anonymous classes, callable and runnable instances.
- return f.getName().startsWith("this$") || f.getName().startsWith("val$") ||
- Callable.class.isAssignableFrom(f.getType()) || Runnable.class.isAssignableFrom(f.getType()) ||
- IgniteClosure.class.isAssignableFrom(f.getType());
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1ce1ce4/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/a1ce1ce4/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java b/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
new file mode 100644
index 0000000..6cf8c8a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
@@ -0,0 +1,22 @@
+/* @java.file.header */
+
+/* _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.resources;
+
+import java.lang.annotation.*;
+
+/**
+ * Indicates that resource injection should be performed for field value too.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface InjectRecursively {
+ // No-op.
+}
[11/50] incubator-ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-sprint-4' into ignite-sprint-5
Posted by an...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-4' into ignite-sprint-5
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c2357116
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c2357116
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c2357116
Branch: refs/heads/ignite-843
Commit: c235711673fcfaf1cb01bbee82e124d08544d875
Parents: f6012f1 b95d2ae
Author: avinogradov <av...@gridgain.com>
Authored: Tue May 12 15:35:58 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Tue May 12 15:35:58 2015 +0300
----------------------------------------------------------------------
assembly/release-base.xml | 4 +-
bin/ignite-schema-import.bat | 2 +-
bin/ignite-schema-import.sh | 2 +-
bin/ignite.bat | 2 +-
bin/ignite.sh | 2 +-
bin/ignitevisorcmd.bat | 2 +-
bin/ignitevisorcmd.sh | 2 +-
bin/include/build-classpath.bat | 46 +++++++++++++++++++++++
bin/include/build-classpath.sh | 71 +++++++++++++++++++++++++++++++++++
bin/include/target-classpath.bat | 46 -----------------------
bin/include/target-classpath.sh | 71 -----------------------------------
pom.xml | 50 ++++++++++++------------
12 files changed, 152 insertions(+), 148 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c2357116/pom.xml
----------------------------------------------------------------------
[27/50] incubator-ignite git commit: IGNITE-894 Add missing
field.setAccessible(true);
Posted by an...@apache.org.
IGNITE-894 Add missing field.setAccessible(true);
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9ea2dbdd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9ea2dbdd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9ea2dbdd
Branch: refs/heads/ignite-843
Commit: 9ea2dbdd9c5d89e3da3950ac40bf2aa2a16e283b
Parents: 3e59d23
Author: sevdokimov <se...@gridgain.com>
Authored: Wed May 13 17:16:19 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed May 13 17:16:19 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/processors/resource/GridResourceIoc.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9ea2dbdd/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 a2ffa55..55c0d3b 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
@@ -277,8 +277,11 @@ class GridResourceIoc {
if (injectRecursively != null
|| (allowImplicitInjection && field.getName().startsWith("this$")
- || field.getName().startsWith("val$")))
+ || field.getName().startsWith("val$"))) {
+ field.setAccessible(true);
+
recursiveFieldsList.add(field);
+ }
else {
for (Annotation ann : field.getAnnotations()) {
T2<List<GridResourceField>, List<GridResourceMethod>> t2 = annMap.get(ann.annotationType());
[32/50] incubator-ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-894' into ignite-sprint-5
Posted by an...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-894' into ignite-sprint-5
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3abd25e4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3abd25e4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3abd25e4
Branch: refs/heads/ignite-843
Commit: 3abd25e4e46a3fe8a77bd84570ff41fcdacb1e82
Parents: ba0caa1 34a9b31
Author: sevdokimov <se...@gridgain.com>
Authored: Wed May 13 19:03:47 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed May 13 19:03:47 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/GridInternalWrapper.java | 30 ------
.../closure/GridClosureProcessor.java | 25 ++---
.../internal/processors/igfs/IgfsJobImpl.java | 9 +-
.../processors/resource/GridResourceField.java | 5 +-
.../processors/resource/GridResourceIoc.java | 51 ++++++-----
.../resource/GridResourceProcessor.java | 22 +----
.../processors/resource/GridResourceUtils.java | 15 ---
.../ignite/internal/util/IgniteUtils.java | 3 +
.../util/lang/GridComputeJobWrapper.java | 96 --------------------
.../ignite/resources/InjectRecursively.java | 30 ++++++
10 files changed, 71 insertions(+), 215 deletions(-)
----------------------------------------------------------------------
[07/50] incubator-ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-sprint-5' into ignite-157
Posted by an...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-5' into ignite-157
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ab1f9dd2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ab1f9dd2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ab1f9dd2
Branch: refs/heads/ignite-843
Commit: ab1f9dd278a1c1e42cf36b21a2bedcd2f7e4129e
Parents: 250dd8e f6012f1
Author: sboikov <sb...@gridgain.com>
Authored: Tue May 12 09:05:47 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue May 12 09:05:47 2015 +0300
----------------------------------------------------------------------
.../processors/resource/GridResourceField.java | 11 +
.../processors/resource/GridResourceIoc.java | 387 ++++++-------------
.../processors/resource/GridResourceMethod.java | 13 +
.../resource/GridResourceProcessor.java | 4 +-
.../ignite/internal/util/IgniteUtils.java | 15 +
.../spi/discovery/tcp/TcpDiscoverySpi.java | 24 +-
parent/pom.xml | 2 +
pom.xml | 33 --
8 files changed, 193 insertions(+), 296 deletions(-)
----------------------------------------------------------------------
[29/50] incubator-ignite git commit: #ignite-460: Remove valPtr field
from GridCacheMapEntry.
Posted by an...@apache.org.
#ignite-460: Remove valPtr field from GridCacheMapEntry.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d87f6d61
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d87f6d61
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d87f6d61
Branch: refs/heads/ignite-843
Commit: d87f6d61b343e95f90624fb7bf382c58a1f7ff1e
Parents: 8246788
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed May 13 17:45:24 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed May 13 17:45:24 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheContext.java | 7 +
.../processors/cache/GridCacheMapEntry.java | 70 +++++---
.../distributed/dht/GridDhtCacheAdapter.java | 16 +-
.../dht/GridDhtOffHeapCacheEntry.java | 63 +++++++
.../distributed/dht/GridNoStorageCacheMap.java | 4 +-
.../dht/atomic/GridDhtAtomicCache.java | 3 +
.../atomic/GridDhtAtomicOffHeapCacheEntry.java | 63 +++++++
.../dht/colocated/GridDhtColocatedCache.java | 5 +-
.../GridDhtColocatedOffHeapCacheEntry.java | 63 +++++++
.../distributed/near/GridNearCacheAdapter.java | 3 +
.../near/GridNearOffHeapCacheEntry.java | 60 +++++++
.../cache/local/GridLocalCacheEntry.java | 18 ++
.../cache/CacheOffheapMapEntrySelfTest.java | 168 +++++++++++++++++++
.../testsuites/IgniteCacheTestSuite4.java | 2 +
14 files changed, 514 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index 48dcee7..2eeaed6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -1655,6 +1655,13 @@ public class GridCacheContext<K, V> implements Externalizable {
}
/**
+ * @return {@code True} if should use entry with offheap value pointer.
+ */
+ public boolean useOffheapEntry() {
+ return cacheCfg.getMemoryMode() == OFFHEAP_TIERED || cacheCfg.getMemoryMode() == OFFHEAP_VALUES;
+ }
+
+ /**
* Converts temporary offheap object to heap-based.
*
* @param obj Object.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 71858d1..86ed57a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -115,9 +115,6 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
@GridToStringInclude
private final int hash;
- /** Off-heap value pointer. */
- protected long valPtr;
-
/** Extras */
@GridToStringInclude
private GridCacheEntryExtras extras;
@@ -188,7 +185,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
if (cctx.cache().isIgfsDataCache() &&
cctx.kernalContext().igfsHelper().isIgfsBlockKey(key.value(cctx.cacheObjectContext(), false))) {
int newSize = valueLength0(val, null);
- int oldSize = valueLength0(this.val, (this.val == null && valPtr != 0) ? valueBytes0() : null);
+ int oldSize = valueLength0(this.val, (this.val == null && hasOffHeapPointer()) ? valueBytes0() : null);
int delta = newSize - oldSize;
@@ -199,7 +196,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
if (!isOffHeapValuesOnly()) {
this.val = val;
- valPtr = 0;
+ offHeapPointer(0);
}
else {
try {
@@ -227,12 +224,12 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
if (val != null) {
byte type = val.type();
- valPtr = mem.putOffHeap(valPtr, val.valueBytes(cctx.cacheObjectContext()), type);
+ offHeapPointer(mem.putOffHeap(offHeapPointer(), val.valueBytes(cctx.cacheObjectContext()), type));
}
else {
- mem.removeOffHeap(valPtr);
+ mem.removeOffHeap(offHeapPointer());
- valPtr = 0;
+ offHeapPointer(0);
}
}
catch (IgniteCheckedException e) {
@@ -270,7 +267,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
CacheObject val0 = val;
- if (val0 == null && valPtr != 0) {
+ if (val0 == null && hasOffHeapPointer()) {
IgniteBiTuple<byte[], Byte> t = valueBytes0();
return cctx.cacheObjects().toCacheObject(cctx.cacheObjectContext(), t.get2(), t.get1());
@@ -434,16 +431,16 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
if (e != null) {
if (e.offheapPointer() > 0) {
- valPtr = e.offheapPointer();
+ offHeapPointer(e.offheapPointer());
if (needVal) {
- CacheObject val = cctx.fromOffheap(valPtr, false);
+ CacheObject val = cctx.fromOffheap(offHeapPointer(), false);
e.value(val);
}
}
else // Read from swap.
- valPtr = 0;
+ offHeapPointer(0);
}
}
else
@@ -468,7 +465,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
// Must update valPtr again since update() will reset it.
if (cctx.offheapTiered() && e.offheapPointer() > 0)
- valPtr = e.offheapPointer();
+ offHeapPointer(e.offheapPointer());
return val;
}
@@ -495,13 +492,13 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
if (cctx.offheapTiered()) {
cctx.swap().removeOffheap(key);
- valPtr = 0;
+ offHeapPointer(0);
}
return;
}
- if (val == null && cctx.offheapTiered() && valPtr != 0) {
+ if (val == null && cctx.offheapTiered() && hasOffHeapPointer()) {
if (log.isDebugEnabled())
log.debug("Value did not change, skip write swap entry: " + this);
@@ -540,10 +537,10 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
protected IgniteBiTuple<byte[], Byte> valueBytes0() {
assert Thread.holdsLock(this);
- if (valPtr != 0) {
+ if (hasOffHeapPointer()) {
assert isOffHeapValuesOnly() || cctx.offheapTiered();
- return cctx.unsafeMemory().get(valPtr);
+ return cctx.unsafeMemory().get(offHeapPointer());
}
else {
assert val != null;
@@ -672,7 +669,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
CacheObject val = this.val;
- hasOldBytes = valPtr != 0;
+ hasOldBytes = hasOffHeapPointer();
if ((unmarshal || isOffHeapValuesOnly()) && !expired && val == null && hasOldBytes)
val = rawGetOrUnmarshalUnlocked(tmp);
@@ -816,7 +813,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
// Update indexes before actual write to entry.
updateIndex(ret, expTime, nextVer, prevVal);
- boolean hadValPtr = valPtr != 0;
+ boolean hadValPtr = hasOffHeapPointer();
// Don't change version for read-through.
update(ret, expTime, ttl, nextVer);
@@ -1164,7 +1161,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
// can be updated without actually holding entry lock.
clearIndex(old);
- boolean hadValPtr = valPtr != 0;
+ boolean hadValPtr = hasOffHeapPointer();
update(null, 0, 0, newVer);
@@ -1521,7 +1518,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
// Must persist inside synchronization in non-tx mode.
cctx.store().remove(null, keyValue(false));
- boolean hasValPtr = valPtr != 0;
+ boolean hasValPtr = hasOffHeapPointer();
// Update index inside synchronization since it can be updated
// in load methods without actually holding entry lock.
@@ -2122,7 +2119,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
enqueueVer = newVer;
- boolean hasValPtr = valPtr != 0;
+ boolean hasValPtr = hasOffHeapPointer();
// Clear value on backup. Entry will be removed from cache when it got evicted from queue.
update(null, CU.TTL_ETERNAL, CU.EXPIRE_TIME_ETERNAL, newVer);
@@ -2929,8 +2926,8 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
if (val != null)
return val;
- if (valPtr != 0) {
- CacheObject val0 = cctx.fromOffheap(valPtr, tmp);
+ if (hasOffHeapPointer()) {
+ CacheObject val0 = cctx.fromOffheap(offHeapPointer(), tmp);
if (!tmp && cctx.kernalContext().config().isPeerClassLoadingEnabled())
val0.finishUnmarshal(cctx.cacheObjectContext(), cctx.deploy().globalLoader());
@@ -2952,7 +2949,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
protected boolean hasValueUnlocked() {
assert Thread.holdsLock(this);
- return val != null || valPtr != 0;
+ return val != null || hasOffHeapPointer();
}
/** {@inheritDoc} */
@@ -3298,7 +3295,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
synchronized (this) {
CacheObject expiredVal = saveValueForIndexUnlocked();
- boolean hasOldBytes = valPtr != 0;
+ boolean hasOldBytes = hasOffHeapPointer();
boolean expired = checkExpired();
@@ -4102,6 +4099,27 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
}
/**
+ * @return True if entry has off-heap value pointer.
+ */
+ protected boolean hasOffHeapPointer() {
+ return false;
+ }
+
+ /**
+ * @return Off-heap value pointer.
+ */
+ protected long offHeapPointer() {
+ return 0;
+ }
+
+ /**
+ * @param valPtr Off-heap value pointer.
+ */
+ protected void offHeapPointer(long valPtr) {
+ // No-op.
+ }
+
+ /**
* @return Size of extras object.
*/
private int extrasSize() {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index 1c46fd0..23060e6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -102,6 +102,9 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
GridCacheMapEntry next,
int hdrId)
{
+ if (ctx.useOffheapEntry())
+ return new GridDhtOffHeapCacheEntry(ctx, topVer, key, hash, val, next, hdrId);
+
return new GridDhtCacheEntry(ctx, topVer, key, hash, val, next, hdrId);
}
});
@@ -343,17 +346,24 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
public GridCacheEntryEx entryExx(KeyCacheObject key, AffinityTopologyVersion topVer, boolean allowDetached, boolean touch) {
try {
return allowDetached && !ctx.affinity().localNode(key, topVer) ?
- new GridDhtDetachedCacheEntry(ctx, key, key.hashCode(), null, null, 0) :
- entryEx(key, touch);
+ createEntry(key) : entryEx(key, touch);
}
catch (GridDhtInvalidPartitionException e) {
if (!allowDetached)
throw e;
- return new GridDhtDetachedCacheEntry(ctx, key, key.hashCode(), null, null, 0);
+ return createEntry(key);
}
}
+ /**
+ * @param key Key for which entry should be returned.
+ * @return Cache entry.
+ */
+ protected GridDistributedCacheEntry createEntry(KeyCacheObject key) {
+ return new GridDhtDetachedCacheEntry(ctx, key, key.hashCode(), null, null, 0);
+ }
+
/** {@inheritDoc} */
@Override public void localLoad(Collection<? extends K> keys, final ExpiryPolicy plc)
throws IgniteCheckedException {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtOffHeapCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtOffHeapCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtOffHeapCacheEntry.java
new file mode 100644
index 0000000..1191d83
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtOffHeapCacheEntry.java
@@ -0,0 +1,63 @@
+/*
+ * 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.processors.cache.distributed.dht;
+
+import org.apache.ignite.internal.processors.affinity.*;
+import org.apache.ignite.internal.processors.cache.*;
+
+/**
+ * Replicated cache entry for off-heap tiered or off-heap values modes.
+ */
+public class GridDhtOffHeapCacheEntry extends GridDhtCacheEntry {
+ /** Off-heap value pointer. */
+ private long valPtr;
+
+ /**
+ * @param ctx Cache context.
+ * @param topVer Topology version at the time of creation (if negative, then latest topology is assumed).
+ * @param key Cache key.
+ * @param hash Key hash value.
+ * @param val Entry value.
+ * @param next Next entry in the linked list.
+ * @param hdrId Header id.
+ */
+ public GridDhtOffHeapCacheEntry(GridCacheContext ctx,
+ AffinityTopologyVersion topVer,
+ KeyCacheObject key,
+ int hash,
+ CacheObject val,
+ GridCacheMapEntry next,
+ int hdrId) {
+ super(ctx, topVer, key, hash, val, next, hdrId);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected boolean hasOffHeapPointer() {
+ return valPtr != 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected long offHeapPointer() {
+ return valPtr;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void offHeapPointer(long valPtr) {
+ this.valPtr = valPtr;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java
index 8da4da5..098ec97 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java
@@ -86,7 +86,9 @@ public class GridNoStorageCacheMap extends GridCacheConcurrentMap {
boolean create)
{
if (create) {
- GridCacheMapEntry entry = new GridDhtCacheEntry(ctx, topVer, key, hash(key.hashCode()), val, null, 0);
+ GridCacheMapEntry entry = ctx.useOffheapEntry() ?
+ new GridDhtOffHeapCacheEntry(ctx, topVer, key, hash(key.hashCode()), val, null, 0) :
+ new GridDhtCacheEntry(ctx, topVer, key, hash(key.hashCode()), val, null, 0);
return new GridTriple<>(entry, null, null);
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 905f7bf..19d88e0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -124,6 +124,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
GridCacheMapEntry next,
int hdrId)
{
+ if (ctx.useOffheapEntry())
+ return new GridDhtAtomicOffHeapCacheEntry(ctx, topVer, key, hash, val, next, hdrId);
+
return new GridDhtAtomicCacheEntry(ctx, topVer, key, hash, val, next, hdrId);
}
});
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicOffHeapCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicOffHeapCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicOffHeapCacheEntry.java
new file mode 100644
index 0000000..91a8e65
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicOffHeapCacheEntry.java
@@ -0,0 +1,63 @@
+/*
+ * 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.processors.cache.distributed.dht.atomic;
+
+import org.apache.ignite.internal.processors.affinity.*;
+import org.apache.ignite.internal.processors.cache.*;
+
+/**
+ * DHT atomic cache entry for off-heap tiered or off-heap values modes.
+ */
+public class GridDhtAtomicOffHeapCacheEntry extends GridDhtAtomicCacheEntry {
+ /** Off-heap value pointer. */
+ private long valPtr;
+
+ /**
+ * @param ctx Cache context.
+ * @param topVer Topology version at the time of creation (if negative, then latest topology is assumed).
+ * @param key Cache key.
+ * @param hash Key hash value.
+ * @param val Entry value.
+ * @param next Next entry in the linked list.
+ * @param hdrId Header id.
+ */
+ public GridDhtAtomicOffHeapCacheEntry(GridCacheContext ctx,
+ AffinityTopologyVersion topVer,
+ KeyCacheObject key,
+ int hash,
+ CacheObject val,
+ GridCacheMapEntry next,
+ int hdrId) {
+ super(ctx, topVer, key, hash, val, next, hdrId);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected boolean hasOffHeapPointer() {
+ return valPtr != 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected long offHeapPointer() {
+ return valPtr;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void offHeapPointer(long valPtr) {
+ this.valPtr = valPtr;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
index c92d9ce..05b3c7b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
@@ -86,6 +86,9 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
GridCacheMapEntry next,
int hdrId)
{
+ if (ctx.useOffheapEntry())
+ return new GridDhtColocatedOffHeapCacheEntry(ctx, topVer, key, hash, val, next, hdrId);
+
return new GridDhtColocatedCacheEntry(ctx, topVer, key, hash, val, next, hdrId);
}
});
@@ -126,7 +129,7 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
boolean allowDetached
) {
return allowDetached && !ctx.affinity().primary(ctx.localNode(), key, topVer) ?
- new GridDhtDetachedCacheEntry(ctx, key, key.hashCode(), null, null, 0) : entryExx(key, topVer);
+ createEntry(key) : entryExx(key, topVer);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedOffHeapCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedOffHeapCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedOffHeapCacheEntry.java
new file mode 100644
index 0000000..ed842ad
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedOffHeapCacheEntry.java
@@ -0,0 +1,63 @@
+/*
+ * 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.processors.cache.distributed.dht.colocated;
+
+import org.apache.ignite.internal.processors.affinity.*;
+import org.apache.ignite.internal.processors.cache.*;
+
+/**
+ * Cache entry for colocated cache for off-heap tiered or off-heap values modes.
+ */
+public class GridDhtColocatedOffHeapCacheEntry extends GridDhtColocatedCacheEntry {
+ /** Off-heap value pointer. */
+ private long valPtr;
+
+ /**
+ * @param ctx Cache context.
+ * @param topVer Topology version at the time of creation (if negative, then latest topology is assumed).
+ * @param key Cache key.
+ * @param hash Key hash value.
+ * @param val Entry value.
+ * @param next Next entry in the linked list.
+ * @param hdrId Header id.
+ */
+ public GridDhtColocatedOffHeapCacheEntry(GridCacheContext ctx,
+ AffinityTopologyVersion topVer,
+ KeyCacheObject key,
+ int hash,
+ CacheObject val,
+ GridCacheMapEntry next,
+ int hdrId) {
+ super(ctx, topVer, key, hash, val, next, hdrId);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected boolean hasOffHeapPointer() {
+ return valPtr != 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected long offHeapPointer() {
+ return valPtr;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void offHeapPointer(long valPtr) {
+ this.valPtr = valPtr;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
index 145e980..8258b14 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
@@ -76,6 +76,9 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
) {
// Can't hold any locks here - this method is invoked when
// holding write-lock on the whole cache map.
+ if (ctx.useOffheapEntry())
+ return new GridNearOffHeapCacheEntry(ctx, key, hash, val, next, hdrId);
+
return new GridNearCacheEntry(ctx, key, hash, val, next, hdrId);
}
});
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOffHeapCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOffHeapCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOffHeapCacheEntry.java
new file mode 100644
index 0000000..25eb869
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOffHeapCacheEntry.java
@@ -0,0 +1,60 @@
+/*
+ * 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.processors.cache.distributed.near;
+
+import org.apache.ignite.internal.processors.cache.*;
+
+/**
+ * Near cache entry for off-heap tiered or off-heap values modes.
+ */
+public class GridNearOffHeapCacheEntry extends GridNearCacheEntry {
+ /** Off-heap value pointer. */
+ private long valPtr;
+
+ /**
+ * @param ctx Cache context.
+ * @param key Cache key.
+ * @param hash Key hash value.
+ * @param val Entry value.
+ * @param next Next entry in the linked list.
+ * @param hdrId Header id.
+ */
+ public GridNearOffHeapCacheEntry(GridCacheContext ctx,
+ KeyCacheObject key,
+ int hash,
+ CacheObject val,
+ GridCacheMapEntry next,
+ int hdrId) {
+ super(ctx, key, hash, val, next, hdrId);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected boolean hasOffHeapPointer() {
+ return valPtr != 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected long offHeapPointer() {
+ return valPtr;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void offHeapPointer(long valPtr) {
+ this.valPtr = valPtr;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
index 84d4c90..ea59f1f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
@@ -29,6 +29,9 @@ import static org.apache.ignite.events.EventType.*;
*/
@SuppressWarnings({"NonPrivateFieldAccessedInSynchronizedContext", "TooBroadScope"})
public class GridLocalCacheEntry extends GridCacheMapEntry {
+ /** Off-heap value pointer. */
+ private long valPtr;
+
/**
* @param ctx Cache registry.
* @param key Cache key.
@@ -384,4 +387,19 @@ public class GridLocalCacheEntry extends GridCacheMapEntry {
return doomed != null;
}
+
+ /** {@inheritDoc} */
+ @Override protected boolean hasOffHeapPointer() {
+ return valPtr != 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected long offHeapPointer() {
+ return valPtr;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void offHeapPointer(long valPtr) {
+ this.valPtr = valPtr;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java
new file mode 100644
index 0000000..8c7d33d
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java
@@ -0,0 +1,168 @@
+/*
+ * 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.processors.cache;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.*;
+import org.apache.ignite.internal.processors.cache.distributed.dht.colocated.*;
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+import org.apache.ignite.internal.processors.cache.local.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.cache.CacheMemoryMode.*;
+import static org.apache.ignite.cache.CacheMode.*;
+
+/**
+ * Cache map entry self test.
+ */
+public class CacheOffheapMapEntrySelfTest extends GridCacheAbstractSelfTest {
+ /** {@inheritDoc} */
+ @Override protected int gridCount() {
+ return 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ startGrids(1);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ // No-op.
+ }
+
+ /**
+ * @param gridName Grid name.
+ * @param memoryMode Memory mode.
+ * @param atomicityMode Atomicity mode.
+ * @param cacheMode Cache mode.
+ * @param cacheName Cache name.
+ * @return Cache configuration.
+ * @throws Exception If failed.
+ */
+ private CacheConfiguration cacheConfiguration(String gridName,
+ CacheMemoryMode memoryMode,
+ CacheAtomicityMode atomicityMode,
+ CacheMode cacheMode,
+ String cacheName)
+ throws Exception
+ {
+ CacheConfiguration cfg = super.cacheConfiguration(gridName);
+
+ cfg.setCacheMode(cacheMode);
+ cfg.setAtomicityMode(atomicityMode);
+ cfg.setMemoryMode(memoryMode);
+ cfg.setName(cacheName);
+
+ return cfg;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testCacheMapEntry() throws Exception {
+ checkCacheMapEntry(ONHEAP_TIERED, ATOMIC, LOCAL, GridLocalCacheEntry.class);
+
+ checkCacheMapEntry(OFFHEAP_TIERED, ATOMIC, LOCAL, GridLocalCacheEntry.class);
+
+ checkCacheMapEntry(OFFHEAP_VALUES, ATOMIC, LOCAL, GridLocalCacheEntry.class);
+
+ checkCacheMapEntry(ONHEAP_TIERED, TRANSACTIONAL, LOCAL, GridLocalCacheEntry.class);
+
+ checkCacheMapEntry(OFFHEAP_TIERED, TRANSACTIONAL, LOCAL, GridLocalCacheEntry.class);
+
+ checkCacheMapEntry(OFFHEAP_VALUES, TRANSACTIONAL, LOCAL, GridLocalCacheEntry.class);
+
+ checkCacheMapEntry(ONHEAP_TIERED, ATOMIC, PARTITIONED, GridNearCacheEntry.class);
+
+ checkCacheMapEntry(OFFHEAP_TIERED, ATOMIC, PARTITIONED, GridNearOffHeapCacheEntry.class);
+
+ checkCacheMapEntry(OFFHEAP_VALUES, ATOMIC, PARTITIONED, GridNearOffHeapCacheEntry.class);
+
+ checkCacheMapEntry(ONHEAP_TIERED, TRANSACTIONAL, PARTITIONED, GridNearCacheEntry.class);
+
+ checkCacheMapEntry(OFFHEAP_TIERED, TRANSACTIONAL, PARTITIONED, GridNearOffHeapCacheEntry.class);
+
+ checkCacheMapEntry(OFFHEAP_VALUES, TRANSACTIONAL, PARTITIONED, GridNearOffHeapCacheEntry.class);
+
+ checkCacheMapEntry(ONHEAP_TIERED, ATOMIC, REPLICATED, GridDhtAtomicCacheEntry.class);
+
+ checkCacheMapEntry(OFFHEAP_TIERED, ATOMIC, REPLICATED, GridDhtAtomicOffHeapCacheEntry.class);
+
+ checkCacheMapEntry(OFFHEAP_VALUES, ATOMIC, REPLICATED, GridDhtAtomicOffHeapCacheEntry.class);
+
+ checkCacheMapEntry(ONHEAP_TIERED, TRANSACTIONAL, REPLICATED, GridDhtColocatedCacheEntry.class);
+
+ checkCacheMapEntry(OFFHEAP_TIERED, TRANSACTIONAL, REPLICATED, GridDhtColocatedOffHeapCacheEntry.class);
+
+ checkCacheMapEntry(OFFHEAP_VALUES, TRANSACTIONAL, REPLICATED, GridDhtColocatedOffHeapCacheEntry.class);
+ }
+
+ /**
+ * @param memoryMode Cache memory mode.
+ * @param atomicityMode Cache atomicity mode.
+ * @param cacheMode Cache mode.
+ * @param entryCls Class of cache map entry.
+ * @throws Exception If failed.
+ */
+ private void checkCacheMapEntry(CacheMemoryMode memoryMode,
+ CacheAtomicityMode atomicityMode,
+ CacheMode cacheMode,
+ Class<?> entryCls)
+ throws Exception
+ {
+ log.info("Test cache [memMode=" + memoryMode +
+ ", atomicityMode=" + atomicityMode +
+ ", cacheMode=" + cacheMode + ']');
+
+ CacheConfiguration cfg = cacheConfiguration(grid(0).name(),
+ memoryMode,
+ atomicityMode,
+ cacheMode,
+ "Cache");
+
+ try (IgniteCache jcache = grid(0).getOrCreateCache(cfg)) {
+ GridCacheAdapter<Integer, String> cache = ((IgniteKernal)grid(0)).internalCache(jcache.getName());
+
+ Integer key = primaryKey(grid(0).cache(null));
+
+ cache.put(key, "val");
+
+ GridCacheEntryEx entry = cache.entryEx(key);
+
+ entry.unswap(true);
+
+ assertNotNull(entry);
+
+ assertEquals(entry.getClass(), entryCls);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
index f7272d4..8eb0688 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
@@ -126,6 +126,8 @@ public class IgniteCacheTestSuite4 extends TestSuite {
suite.addTestSuite(CacheNoValueClassOnServerNodeTest.class);
+ suite.addTestSuite(CacheOffheapMapEntrySelfTest.class);
+
return suite;
}
}
[49/50] incubator-ignite git commit: ignite-430 Words count Socket
streamer examples
Posted by an...@apache.org.
ignite-430 Words count Socket streamer examples
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/896b426b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/896b426b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/896b426b
Branch: refs/heads/ignite-843
Commit: 896b426bff3e37aeebbb00f54e179492543f1a1d
Parents: fe78d42
Author: agura <ag...@gridgain.com>
Authored: Thu May 14 20:29:33 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Fri May 15 03:44:40 2015 +0300
----------------------------------------------------------------------
.../streaming/StreamTransformerExample.java | 4 +-
.../streaming/StreamVisitorExample.java | 4 +-
.../socket/WordsSocketStreamerServer.java | 93 --------------------
.../streaming/wordcount/QueryWords.java | 4 +-
.../streaming/wordcount/StreamWords.java | 4 +-
.../socket/WordsSocketStreamerClient.java | 14 +--
.../socket/WordsSocketStreamerServer.java | 27 ++++--
7 files changed, 31 insertions(+), 119 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/896b426b/examples/src/main/java/org/apache/ignite/examples/streaming/StreamTransformerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/StreamTransformerExample.java b/examples/src/main/java/org/apache/ignite/examples/streaming/StreamTransformerExample.java
index 5e95892..966fce2 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/StreamTransformerExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/StreamTransformerExample.java
@@ -30,11 +30,9 @@ import java.util.*;
* Stream random numbers into the streaming cache.
* To start the example, you should:
* <ul>
- * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
+ * <li>Start a few nodes using {@link ExampleNodeStartup}.</li>
* <li>Start streaming using {@link StreamTransformerExample}.</li>
* </ul>
- * <p>
- * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
*/
public class StreamTransformerExample {
/** Random number generator. */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/896b426b/examples/src/main/java/org/apache/ignite/examples/streaming/StreamVisitorExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/StreamVisitorExample.java b/examples/src/main/java/org/apache/ignite/examples/streaming/StreamVisitorExample.java
index 0fbce68..baae5af 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/StreamVisitorExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/StreamVisitorExample.java
@@ -31,11 +31,9 @@ import java.util.*;
* Stream random numbers into the streaming cache.
* To start the example, you should:
* <ul>
- * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
+ * <li>Start a few nodes using {@link ExampleNodeStartup}.</li>
* <li>Start streaming using {@link StreamVisitorExample}.</li>
* </ul>
- * <p>
- * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
*/
public class StreamVisitorExample {
/** Random number generator. */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/896b426b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/WordsSocketStreamerServer.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/WordsSocketStreamerServer.java b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/WordsSocketStreamerServer.java
deleted file mode 100644
index 5af746d..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/WordsSocketStreamerServer.java
+++ /dev/null
@@ -1,93 +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.examples.streaming.socket;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.affinity.*;
-import org.apache.ignite.examples.*;
-import org.apache.ignite.examples.streaming.wordcount.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.stream.*;
-import org.apache.ignite.stream.socket.*;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-/**
- * Receives words through socket using {@link SocketStreamer} and message size based protocol
- * and streams them into Ignite cache.
- * <p>
- * To start the example, you should:
- * <ul>
- * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
- * <li>Start socket server using {@link WordsSocketStreamerServer}.</li>
- * <li>Start a few socket clients using {@link WordsSocketStreamerClient}.</li>
- * <li>Start querying popular words using {@link QueryWords}.</li>
- * </ul>
- * <p>
- * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
- */
-public class WordsSocketStreamerServer {
- /** Port. */
- private static final int PORT = 5555;
-
- /**
- * @param args Args.
- */
- public static void main(String[] args) throws InterruptedException, IOException {
- // Mark this cluster member as client.
- Ignition.setClientMode(true);
-
- Ignite ignite = Ignition.start("examples/config/example-ignite.xml");
-
- if (!ExamplesUtils.hasServerNodes(ignite)) {
- ignite.close();
-
- return;
- }
-
- // The cache is configured with sliding window holding 1 second of the streaming data.
- IgniteCache<AffinityUuid, String> stmCache = ignite.getOrCreateCache(CacheConfig.wordCache());
-
- IgniteDataStreamer<AffinityUuid, String> stmr = ignite.dataStreamer(stmCache.getName());
-
- InetAddress addr = InetAddress.getLocalHost();
-
- // Configure socket streamer
- SocketStreamer<String, AffinityUuid, String> sockStmr = new SocketStreamer<>();
-
- sockStmr.setAddr(addr);
-
- sockStmr.setPort(PORT);
-
- sockStmr.setIgnite(ignite);
-
- sockStmr.setStreamer(stmr);
-
- sockStmr.setTupleExtractor(new StreamTupleExtractor<String, AffinityUuid, String>() {
- @Override public Map.Entry<AffinityUuid, String> extract(String word) {
- // By using AffinityUuid we ensure that identical
- // words are processed on the same cluster node.
- return new IgniteBiTuple<>(new AffinityUuid(word), word);
- }
- });
-
- sockStmr.start();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/896b426b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/QueryWords.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/QueryWords.java b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/QueryWords.java
index faf8b51..58c6ef2 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/QueryWords.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/QueryWords.java
@@ -28,12 +28,10 @@ import java.util.*;
* Periodically query popular numbers from the streaming cache.
* To start the example, you should:
* <ul>
- * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
+ * <li>Start a few nodes using {@link ExampleNodeStartup}.</li>
* <li>Start streaming using {@link StreamWords}.</li>
* <li>Start querying popular words using {@link QueryWords}.</li>
* </ul>
- * <p>
- * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
*/
public class QueryWords {
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/896b426b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/StreamWords.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/StreamWords.java b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/StreamWords.java
index 26be178..6024c4b 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/StreamWords.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/StreamWords.java
@@ -27,12 +27,10 @@ import java.io.*;
* Stream words into Ignite cache.
* To start the example, you should:
* <ul>
- * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
+ * <li>Start a few nodes using {@link ExampleNodeStartup}.</li>
* <li>Start streaming using {@link StreamWords}.</li>
* <li>Start querying popular words using {@link QueryWords}.</li>
* </ul>
- * <p>
- * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
*/
public class StreamWords {
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/896b426b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerClient.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerClient.java b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerClient.java
index ea3beaa..c4d7b8c 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerClient.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerClient.java
@@ -25,19 +25,19 @@ import java.io.*;
import java.net.*;
/**
- * Sends words to socket server based on {@link SocketStreamer} using message delimiter based protocol.
- * Example illustrates usage of TCP socket streamer in case of non-Java clients.
- * In this example words are zero-terminated strings.
+ * Example demonstrates streaming of data from external components into Ignite cache.
+ * <p>
+ * {@code WordsSocketStreamerClient} is simple socket streaming client implementation that sends words to socket server
+ * based on {@link SocketStreamer} using message delimiter based protocol. Example illustrates usage of TCP socket
+ * streamer in case of non-Java clients. In this example words are zero-terminated strings.
* <p>
* To start the example, you should:
* <ul>
- * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
+ * <li>Start a few nodes using {@link ExampleNodeStartup}.</li>
* <li>Start socket server using {@link WordsSocketStreamerServer}.</li>
* <li>Start a few socket clients using {@link WordsSocketStreamerClient}.</li>
* <li>Start querying popular words using {@link QueryWords}.</li>
* </ul>
- * <p>
- * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
*/
public class WordsSocketStreamerClient {
/** Port. */
@@ -59,7 +59,7 @@ public class WordsSocketStreamerClient {
System.out.println("Words streaming started.");
while (true) {
- try (InputStream in = StreamWords.class.getResourceAsStream("../wordcount/alice-in-wonderland.txt");
+ try (InputStream in = WordsSocketStreamerClient.class.getResourceAsStream("../alice-in-wonderland.txt");
LineNumberReader rdr = new LineNumberReader(new InputStreamReader(in))) {
for (String line = rdr.readLine(); line != null; line = rdr.readLine()) {
for (String word : line.split(" ")) {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/896b426b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerServer.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerServer.java b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerServer.java
index 259c925..6a8911c 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerServer.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerServer.java
@@ -30,19 +30,20 @@ import java.net.*;
import java.util.*;
/**
- * Receives words through socket using {@link SocketStreamer} and message delimiter based protocol
+ * Example demonstrates streaming of data from external components into Ignite cache.
+ * <p>
+ * {@code WordsSocketStreamerServer} is simple socket streaming server implementation that
+ * receives words from socket using {@link SocketStreamer} and message delimiter based protocol
* and streams them into Ignite cache. Example illustrates usage of TCP socket streamer in case of non-Java clients.
* In this example words are zero-terminated strings.
* <p>
* To start the example, you should:
* <ul>
- * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
+ * <li>Start a few nodes using {@link ExampleNodeStartup}.</li>
* <li>Start socket server using {@link WordsSocketStreamerServer}.</li>
* <li>Start a few socket clients using {@link WordsSocketStreamerClient}.</li>
* <li>Start querying popular words using {@link QueryWords}.</li>
* </ul>
- * <p>
- * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
*/
public class WordsSocketStreamerServer {
/** Port. */
@@ -52,9 +53,12 @@ public class WordsSocketStreamerServer {
private static final byte[] DELIM = new byte[] {0};
/**
- * @param args Args.
+ * Starts socket streaming server.
+ *
+ * @param args Command line arguments (none required).
+ * @throws Exception If failed.
*/
- public static void main(String[] args) throws InterruptedException, IOException {
+ public static void main(String[] args) throws Exception {
// Mark this cluster member as client.
Ignition.setClientMode(true);
@@ -106,6 +110,15 @@ public class WordsSocketStreamerServer {
}
});
- sockStmr.start();
+ try {
+ sockStmr.start();
+ }
+ catch (IgniteException e) {
+ System.out.println("Streaming server didn't start due to an error: ");
+
+ e.printStackTrace();
+
+ ignite.close();
+ }
}
}
[12/50] incubator-ignite git commit: # ignite-sprint-5 added test
Posted by an...@apache.org.
# ignite-sprint-5 added test
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6395b434
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6395b434
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6395b434
Branch: refs/heads/ignite-843
Commit: 6395b434e37b93f025c7b81802a77aa4f1aebf4c
Parents: f6012f1
Author: sboikov <sb...@gridgain.com>
Authored: Tue May 12 16:02:45 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue May 12 16:02:45 2015 +0300
----------------------------------------------------------------------
.../cache/GridCacheOffheapIndexGetSelfTest.java | 111 +++++++++++++++++++
.../IgniteCacheWithIndexingTestSuite.java | 2 +
2 files changed, 113 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6395b434/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapIndexGetSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapIndexGetSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapIndexGetSelfTest.java
new file mode 100644
index 0000000..4e40040
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapIndexGetSelfTest.java
@@ -0,0 +1,111 @@
+/*
+ * 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.processors.cache;
+
+import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.spi.swapspace.file.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.cache.CacheMemoryMode.*;
+import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
+import static org.apache.ignite.configuration.DeploymentMode.*;
+
+/**
+ * Tests off heap storage when both offheaped and swapped entries exists.
+ */
+public class GridCacheOffheapIndexGetSelfTest extends GridCommonAbstractTest {
+ /** */
+ private static final long OFFHEAP_MEM = 10L * 1024L;
+
+ /** */
+ private final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+ disco.setIpFinder(ipFinder);
+
+ cfg.setDiscoverySpi(disco);
+
+ cfg.setNetworkTimeout(2000);
+
+ cfg.setSwapSpaceSpi(new FileSwapSpaceSpi());
+
+ CacheConfiguration cacheCfg = defaultCacheConfiguration();
+
+ cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
+ cacheCfg.setSwapEnabled(true);
+ cacheCfg.setCacheMode(PARTITIONED);
+ cacheCfg.setBackups(1);
+ cacheCfg.setOffHeapMaxMemory(OFFHEAP_MEM);
+ cacheCfg.setEvictSynchronized(true);
+ cacheCfg.setEvictSynchronizedKeyBufferSize(1);
+ cacheCfg.setAtomicityMode(TRANSACTIONAL);
+ cacheCfg.setMemoryMode(OFFHEAP_TIERED);
+ cacheCfg.setEvictionPolicy(null);
+ cacheCfg.setOffHeapMaxMemory(OFFHEAP_MEM);
+ cacheCfg.setIndexedTypes(Long.class, Long.class);
+
+ cfg.setCacheConfiguration(cacheCfg);
+
+ cfg.setDeploymentMode(SHARED);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ startGrids(2);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ grid(0).cache(null).clear();
+ }
+
+ /**
+ * Tests behavior on offheaped entries.
+ *
+ * @throws Exception If failed.
+ */
+ public void testGet() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-873");
+
+ IgniteCache<Long, Long> cache = grid(0).cache(null);
+
+ for (long i = 0; i < 100; i++)
+ cache.put(i, i);
+
+ for (long i = 0; i < 100; i++)
+ assertEquals((Long)i, cache.get(i));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6395b434/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
index a2ccc82..ae45120 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
@@ -46,6 +46,8 @@ public class IgniteCacheWithIndexingTestSuite extends TestSuite {
suite.addTestSuite(CacheTtlOnheapAtomicLocalSelfTest.class);
suite.addTestSuite(CacheTtlOnheapAtomicPartitionedSelfTest.class);
+ suite.addTestSuite(GridCacheOffheapIndexGetSelfTest.class);
+
suite.addTestSuite(CacheConfigurationP2PTest.class);
return suite;
[50/50] incubator-ignite git commit: # Merge ignite-sprint-5 into
ignite-843
Posted by an...@apache.org.
# Merge ignite-sprint-5 into ignite-843
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e0b29d6d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e0b29d6d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e0b29d6d
Branch: refs/heads/ignite-843
Commit: e0b29d6d8aa104b8ccaed1f9c196ed9e7198b6bd
Parents: 32b52cb 896b426
Author: Andrey <an...@gridgain.com>
Authored: Fri May 15 09:49:48 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Fri May 15 09:49:48 2015 +0700
----------------------------------------------------------------------
DEVNOTES.txt | 34 +-
assembly/release-base.xml | 6 +-
assembly/release-schema-import.xml | 50 +
bin/ignite-schema-import.bat | 2 +-
bin/ignite-schema-import.sh | 2 +-
bin/ignite.bat | 2 +-
bin/ignite.sh | 2 +-
bin/ignitevisorcmd.bat | 2 +-
bin/ignitevisorcmd.sh | 2 +-
bin/include/build-classpath.bat | 46 +
bin/include/build-classpath.sh | 71 +
bin/include/functions.sh | 2 +-
bin/include/target-classpath.bat | 46 -
bin/include/target-classpath.sh | 71 -
dev-tools/.gitignore | 2 +
dev-tools/build.gradle | 45 +
dev-tools/src/main/groovy/jiraslurp.groovy | 146 +
examples/pom.xml | 2 +-
.../streaming/StreamTransformerExample.java | 4 +-
.../streaming/StreamVisitorExample.java | 4 +-
.../ignite/examples/streaming/package-info.java | 1 -
.../streaming/wordcount/CacheConfig.java | 7 +-
.../streaming/wordcount/QueryWords.java | 12 +-
.../streaming/wordcount/StreamWords.java | 12 +-
.../streaming/wordcount/package-info.java | 1 -
.../socket/WordsSocketStreamerClient.java | 82 +
.../socket/WordsSocketStreamerServer.java | 124 +
.../wordcount/socket/package-info.java | 21 +
modules/aop/pom.xml | 2 +-
modules/aws/pom.xml | 2 +-
.../config/grid-client-config.properties | 50 +-
modules/clients/pom.xml | 2 +-
.../ClientPropertiesConfigurationSelfTest.java | 12 +-
modules/cloud/pom.xml | 4 +-
.../TcpDiscoveryCloudIpFinderSelfTest.java | 2 -
modules/codegen/pom.xml | 2 +-
.../ignite/codegen/MessageCodeGenerator.java | 4 +-
modules/core/pom.xml | 2 +-
.../java/org/apache/ignite/IgniteCache.java | 5 +
.../org/apache/ignite/IgniteJdbcDriver.java | 81 +-
.../ignite/internal/GridUpdateNotifier.java | 66 +-
.../apache/ignite/internal/IgniteKernal.java | 83 +-
.../org/apache/ignite/internal/IgnitionEx.java | 15 +-
.../client/GridClientConfiguration.java | 2 +-
.../internal/direct/DirectByteBufferStream.java | 4 +-
.../managers/communication/GridIoManager.java | 8 +-
.../communication/GridIoMessageFactory.java | 4 +-
.../eventstorage/GridEventStorageManager.java | 5 +-
.../cache/DynamicCacheDescriptor.java | 16 +-
.../processors/cache/GridCacheAdapter.java | 573 +-
.../processors/cache/GridCacheContext.java | 7 +
.../cache/GridCacheEvictionManager.java | 2 +-
.../processors/cache/GridCacheIoManager.java | 314 +-
.../processors/cache/GridCacheMapEntry.java | 88 +-
.../processors/cache/GridCacheMessage.java | 8 +-
.../processors/cache/GridCacheMvccManager.java | 4 +-
.../GridCachePartitionExchangeManager.java | 3 +
.../processors/cache/GridCacheProcessor.java | 189 +-
.../processors/cache/GridCacheProxyImpl.java | 24 -
.../processors/cache/GridCacheSwapManager.java | 215 +-
.../processors/cache/GridCacheTtlManager.java | 156 +-
.../processors/cache/GridCacheUtils.java | 6 +-
.../processors/cache/IgniteInternalCache.java | 27 -
...ridCacheOptimisticCheckPreparedTxFuture.java | 434 --
...idCacheOptimisticCheckPreparedTxRequest.java | 232 -
...dCacheOptimisticCheckPreparedTxResponse.java | 179 -
.../distributed/GridCacheTxRecoveryFuture.java | 506 ++
.../distributed/GridCacheTxRecoveryRequest.java | 261 +
.../GridCacheTxRecoveryResponse.java | 182 +
.../GridDistributedCacheAdapter.java | 210 +-
.../GridDistributedTxRemoteAdapter.java | 2 +-
.../distributed/dht/GridDhtCacheAdapter.java | 16 +-
.../distributed/dht/GridDhtLocalPartition.java | 2 +-
.../dht/GridDhtOffHeapCacheEntry.java | 63 +
.../dht/GridDhtTransactionalCacheAdapter.java | 9 +-
.../cache/distributed/dht/GridDhtTxLocal.java | 32 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 27 +
.../cache/distributed/dht/GridDhtTxMapping.java | 2 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 81 +-
.../distributed/dht/GridNoStorageCacheMap.java | 4 +-
.../dht/GridPartitionedGetFuture.java | 2 +-
.../dht/atomic/GridDhtAtomicCache.java | 3 +
.../atomic/GridDhtAtomicOffHeapCacheEntry.java | 63 +
.../dht/atomic/GridDhtAtomicUpdateResponse.java | 8 +
.../dht/atomic/GridNearAtomicUpdateFuture.java | 2 +-
.../atomic/GridNearAtomicUpdateResponse.java | 18 +-
.../dht/colocated/GridDhtColocatedCache.java | 5 +-
.../colocated/GridDhtColocatedLockFuture.java | 27 +-
.../GridDhtColocatedOffHeapCacheEntry.java | 63 +
.../colocated/GridDhtDetachedCacheEntry.java | 4 +-
.../dht/preloader/GridDhtForceKeysFuture.java | 6 +
.../dht/preloader/GridDhtForceKeysResponse.java | 54 +-
.../GridDhtPartitionsExchangeFuture.java | 2 +-
.../distributed/near/GridNearCacheAdapter.java | 13 +-
.../distributed/near/GridNearCacheEntry.java | 4 +-
.../distributed/near/GridNearGetResponse.java | 8 +-
.../distributed/near/GridNearLockFuture.java | 5 -
.../near/GridNearOffHeapCacheEntry.java | 60 +
.../near/GridNearOptimisticTxPrepareFuture.java | 779 ++
.../GridNearPessimisticTxPrepareFuture.java | 349 +
.../cache/distributed/near/GridNearTxLocal.java | 84 +-
.../near/GridNearTxPrepareFuture.java | 1050 ---
.../near/GridNearTxPrepareFutureAdapter.java | 226 +
.../processors/cache/local/GridLocalCache.java | 8 +-
.../cache/local/GridLocalCacheEntry.java | 18 +
.../local/atomic/GridLocalAtomicCache.java | 27 +-
.../cache/query/GridCacheQueryManager.java | 21 +-
.../cache/query/GridCacheSqlQuery.java | 2 +-
.../cache/query/GridCacheTwoStepQuery.java | 17 +
.../cache/transactions/IgniteInternalTx.java | 9 +-
.../cache/transactions/IgniteTxAdapter.java | 4 +-
.../cache/transactions/IgniteTxHandler.java | 100 +-
.../transactions/IgniteTxLocalAdapter.java | 16 +-
.../cache/transactions/IgniteTxManager.java | 185 +-
.../datastreamer/DataStreamerImpl.java | 2 +
.../processors/igfs/IgfsDataManager.java | 3 +
.../processors/igfs/IgfsDeleteWorker.java | 4 +
.../processors/igfs/IgfsMetaManager.java | 2 +-
.../internal/processors/igfs/IgfsUtils.java | 11 +-
.../offheap/GridOffHeapProcessor.java | 17 +
.../processors/resource/GridResourceField.java | 16 +-
.../processors/resource/GridResourceIoc.java | 389 +-
.../processors/resource/GridResourceMethod.java | 13 +
.../resource/GridResourceProcessor.java | 20 +-
.../ignite/internal/util/IgniteUtils.java | 22 +-
.../util/lang/GridComputeJobWrapper.java | 96 -
.../util/lang/GridFilteredIterator.java | 2 +-
.../ignite/internal/util/lang/GridFunc.java | 7218 +++++-------------
.../internal/util/nio/GridBufferedParser.java | 4 -
.../internal/util/nio/GridDelimitedParser.java | 91 +
.../util/nio/GridNioDelimitedBuffer.java | 106 +
.../util/offheap/GridOffHeapPartitionedMap.java | 9 +
.../unsafe/GridUnsafePartitionedMap.java | 155 +-
.../internal/visor/query/VisorQueryArg.java | 14 +-
.../internal/visor/query/VisorQueryJob.java | 2 +
.../apache/ignite/lang/IgniteAsyncSupport.java | 4 +-
.../org/apache/ignite/spi/IgniteSpiAdapter.java | 19 +-
.../discovery/tcp/TcpClientDiscoverySpi.java | 4 -
.../spi/discovery/tcp/TcpDiscoverySpi.java | 48 +-
.../discovery/tcp/TcpDiscoverySpiAdapter.java | 8 +-
.../org/apache/ignite/stream/StreamAdapter.java | 111 +
.../ignite/stream/StreamTupleExtractor.java | 33 +
.../stream/socket/SocketMessageConverter.java | 31 +
.../ignite/stream/socket/SocketStreamer.java | 218 +
.../ignite/stream/socket/package-info.java | 21 +
.../resources/META-INF/classnames.properties | 13 +-
.../core/src/main/resources/ignite.properties | 2 +-
.../internal/GridUpdateNotifierSelfTest.java | 30 +-
.../processors/cache/CacheGetFromJobTest.java | 110 +
.../cache/CacheOffheapMapEntrySelfTest.java | 168 +
.../cache/CacheRemoveAllSelfTest.java | 81 +
.../GridCacheAbstractFailoverSelfTest.java | 12 +-
.../cache/GridCacheAbstractFullApiSelfTest.java | 227 +-
.../cache/GridCacheAbstractSelfTest.java | 4 +-
.../cache/GridCacheSwapReloadSelfTest.java | 20 +-
.../IgniteCacheEntryListenerAbstractTest.java | 4 +-
.../IgniteCacheP2pUnmarshallingErrorTest.java | 189 +
...gniteCacheP2pUnmarshallingNearErrorTest.java | 56 +
...CacheP2pUnmarshallingRebalanceErrorTest.java | 80 +
.../IgniteCacheP2pUnmarshallingTxErrorTest.java | 109 +
.../cache/IgniteCachePeekModesAbstractTest.java | 15 +-
.../cache/OffHeapTieredTransactionSelfTest.java | 127 +
...CacheLoadingConcurrentGridStartSelfTest.java | 163 +
.../GridCacheAbstractNodeRestartSelfTest.java | 101 +-
...GridCacheLoadingConcurrentGridStartTest.java | 154 -
.../distributed/GridCacheLockAbstractTest.java | 2 -
.../distributed/IgniteTxGetAfterStopTest.java | 131 +
...xOriginatingNodeFailureAbstractSelfTest.java | 2 +-
.../dht/GridCacheDhtPreloadSelfTest.java | 2 +-
...icOffHeapTieredMultiNodeFullApiSelfTest.java | 43 +
...achePartitionedNearDisabledLockSelfTest.java | 47 +
...ionedNearDisabledOffHeapFullApiSelfTest.java | 8 +-
...DisabledOffHeapMultiNodeFullApiSelfTest.java | 8 +-
...abledOffHeapTieredAtomicFullApiSelfTest.java | 56 +
...earDisabledOffHeapTieredFullApiSelfTest.java | 33 +
...edOffHeapTieredMultiNodeFullApiSelfTest.java | 33 +
...rDisabledPrimaryNodeFailureRecoveryTest.java | 31 +
...rtitionedPrimaryNodeFailureRecoveryTest.java | 31 +
...woBackupsPrimaryNodeFailureRecoveryTest.java | 37 +
...ePrimaryNodeFailureRecoveryAbstractTest.java | 533 ++
...idCacheAtomicReplicatedFailoverSelfTest.java | 6 +
...CacheAtomicOffHeapTieredFullApiSelfTest.java | 32 +
...icOffHeapTieredMultiNodeFullApiSelfTest.java | 33 +
...yWriteOrderOffHeapTieredFullApiSelfTest.java | 33 +
...erOffHeapTieredMultiNodeFullApiSelfTest.java | 33 +
...achePartitionedMultiNodeFullApiSelfTest.java | 15 +-
.../GridCachePartitionedNodeRestartTest.java | 4 +-
...dCachePartitionedOffHeapFullApiSelfTest.java | 8 +-
...titionedOffHeapMultiNodeFullApiSelfTest.java | 8 +-
...PartitionedOffHeapTieredFullApiSelfTest.java | 32 +
...edOffHeapTieredMultiNodeFullApiSelfTest.java | 72 +
...ePartitionedOptimisticTxNodeRestartTest.java | 4 +-
.../GridCachePartitionedTxSalvageSelfTest.java | 25 +-
.../near/NoneRebalanceModeSelfTest.java | 67 +
.../GridCacheReplicatedFailoverSelfTest.java | 6 +
.../GridCacheReplicatedLockSelfTest.java | 5 +
.../GridCacheReplicatedNodeRestartSelfTest.java | 82 +
...idCacheReplicatedOffHeapFullApiSelfTest.java | 8 +-
...plicatedOffHeapMultiNodeFullApiSelfTest.java | 8 +-
...eReplicatedOffHeapTieredFullApiSelfTest.java | 33 +
...edOffHeapTieredMultiNodeFullApiSelfTest.java | 33 +
.../IgniteCacheExpiryPolicyAbstractTest.java | 2 +-
.../IgniteCacheExpiryPolicyTestSuite.java | 2 +
.../expiry/IgniteCacheTtlCleanupSelfTest.java | 85 +
...LocalAtomicOffHeapTieredFullApiSelfTest.java | 32 +
.../GridCacheLocalIsolatedNodesSelfTest.java | 18 +-
.../GridCacheLocalOffHeapFullApiSelfTest.java | 6 +-
...dCacheLocalOffHeapTieredFullApiSelfTest.java | 32 +
.../igfs/IgfsClientCacheSelfTest.java | 132 +
.../processors/igfs/IgfsOneClientNodeTest.java | 133 +
.../processors/igfs/IgfsStreamsSelfTest.java | 2 +-
.../util/nio/GridNioDelimitedBufferTest.java | 112 +
...idFileSwapSpaceSpiMultithreadedLoadTest.java | 4 +-
.../tcp/TcpClientDiscoverySelfTest.java | 8 +
.../discovery/tcp/TcpDiscoveryRestartTest.java | 199 +
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 65 +-
.../stream/socket/SocketStreamerSelfTest.java | 315 +
.../ignite/stream/socket/package-info.java | 21 +
.../ignite/testsuites/IgniteBasicTestSuite.java | 2 +
.../IgniteCacheFailoverTestSuite.java | 10 +-
.../IgniteCacheFullApiSelfTestSuite.java | 18 +
...gniteCacheP2pUnmarshallingErrorTestSuit.java | 41 +
.../testsuites/IgniteCacheRestartTestSuite.java | 11 +-
.../ignite/testsuites/IgniteCacheTestSuite.java | 296 -
.../testsuites/IgniteCacheTestSuite2.java | 143 +
.../testsuites/IgniteCacheTestSuite3.java | 142 +
.../testsuites/IgniteCacheTestSuite4.java | 135 +
.../IgniteCacheTxRecoverySelfTestSuite.java | 4 +
.../ignite/testsuites/IgniteIgfsTestSuite.java | 3 +
.../testsuites/IgniteStreamTestSuite.java | 39 +
.../testsuites/IgniteUtilSelfTestSuite.java | 1 +
modules/extdata/p2p/pom.xml | 2 +-
modules/extdata/uri/pom.xml | 2 +-
modules/gce/pom.xml | 4 +-
modules/geospatial/pom.xml | 2 +-
modules/hadoop/pom.xml | 2 +-
modules/hibernate/pom.xml | 2 +-
modules/indexing/pom.xml | 2 +-
.../processors/query/h2/IgniteH2Indexing.java | 4 +
.../processors/query/h2/sql/GridSqlQuery.java | 20 +
.../query/h2/sql/GridSqlQueryParser.java | 10 +-
.../query/h2/sql/GridSqlQuerySplitter.java | 11 +-
.../processors/query/h2/sql/GridSqlSelect.java | 2 +-
.../processors/query/h2/sql/GridSqlUnion.java | 2 +-
.../query/h2/twostep/GridMapQueryExecutor.java | 3 +
.../h2/twostep/GridReduceQueryExecutor.java | 119 +-
.../cache/GridCacheOffHeapAndSwapSelfTest.java | 11 +-
.../cache/GridCacheOffHeapSelfTest.java | 11 +-
.../cache/GridCacheOffheapIndexGetSelfTest.java | 111 +
.../IgniteCacheAbstractFieldsQuerySelfTest.java | 21 +
...niteCacheP2pUnmarshallingQueryErrorTest.java | 56 +
...eQueryMultiThreadedOffHeapTiredSelfTest.java | 37 +
.../IgniteCacheQueryMultiThreadedSelfTest.java | 29 +-
.../IgniteCacheQuerySelfTestSuite.java | 4 +
.../IgniteCacheWithIndexingTestSuite.java | 2 +
modules/jcl/pom.xml | 2 +-
modules/jta/pom.xml | 2 +-
modules/log4j/pom.xml | 2 +-
modules/rest-http/pom.xml | 2 +-
modules/scalar/pom.xml | 2 +-
.../ignite/scalar/ScalarConversions.scala | 8 -
.../scalar/tests/ScalarCacheQueriesSpec.scala | 154 +-
.../ignite/scalar/tests/ScalarCacheSpec.scala | 23 +-
.../scalar/tests/ScalarConversionsSpec.scala | 43 +-
.../scalar/tests/ScalarProjectionSpec.scala | 128 +-
.../scalar/tests/ScalarReturnableSpec.scala | 41 +-
modules/schedule/pom.xml | 2 +-
modules/schema-import/pom.xml | 8 +-
.../ignite/schema/generator/CodeGenerator.java | 47 +-
modules/slf4j/pom.xml | 2 +-
modules/spring/pom.xml | 2 +-
modules/ssh/pom.xml | 2 +-
modules/tools/pom.xml | 2 +-
modules/urideploy/pom.xml | 2 +-
modules/visor-console/pom.xml | 4 +-
.../commands/cache/VisorCacheScanCommand.scala | 2 +-
.../ignite/visor/VisorRuntimeBaseSpec.scala | 2 +-
.../visor/commands/VisorArgListSpec.scala | 60 +-
.../commands/VisorFileNameCompleterSpec.scala | 34 +-
.../commands/ack/VisorAckCommandSpec.scala | 20 +-
.../commands/alert/VisorAlertCommandSpec.scala | 68 +-
.../cache/VisorCacheClearCommandSpec.scala | 48 +-
.../commands/cache/VisorCacheCommandSpec.scala | 66 +-
.../config/VisorConfigurationCommandSpec.scala | 8 +-
.../cswap/VisorCacheSwapCommandSpec.scala | 24 +-
.../deploy/VisorDeployCommandSpec.scala | 10 +-
.../disco/VisorDiscoveryCommandSpec.scala | 46 +-
.../events/VisorEventsCommandSpec.scala | 28 +-
.../visor/commands/gc/VisorGcCommandSpec.scala | 30 +-
.../commands/help/VisorHelpCommandSpec.scala | 57 +-
.../commands/kill/VisorKillCommandSpec.scala | 58 +-
.../commands/log/VisorLogCommandSpec.scala | 10 +-
.../commands/mem/VisorMemoryCommandSpec.scala | 77 +-
.../commands/node/VisorNodeCommandSpec.scala | 22 +-
.../commands/open/VisorOpenCommandSpec.scala | 16 +-
.../commands/ping/VisorPingCommandSpec.scala | 16 +-
.../commands/start/VisorStartCommandSpec.scala | 126 +-
.../commands/tasks/VisorTasksCommandSpec.scala | 112 +-
.../commands/top/VisorTopologyCommandSpec.scala | 52 +-
.../commands/vvm/VisorVvmCommandSpec.scala | 30 +-
modules/visor-plugins/pom.xml | 2 +-
modules/web/pom.xml | 2 +-
modules/yardstick/pom.xml | 2 +-
parent/pom.xml | 2 +
pom.xml | 286 +-
305 files changed, 13665 insertions(+), 10785 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e0b29d6d/pom.xml
----------------------------------------------------------------------
diff --cc pom.xml
index 8635f8f,7ad83f0..23cc70c
--- a/pom.xml
+++ b/pom.xml
@@@ -73,8 -66,6 +66,7 @@@
<module>modules/log4j</module>
<module>modules/slf4j</module>
<module>modules/jcl</module>
- <module>modules/schema-import</module>
+ <module>modules/webconfig</module>
<module>modules/codegen</module>
<module>modules/gce</module>
<module>modules/cloud</module>
[15/50] incubator-ignite git commit: # Make IgniteUtils.EMPTY_INTS
public and use it in other classes.
Posted by an...@apache.org.
# Make IgniteUtils.EMPTY_INTS public and use it in other classes.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f027ac54
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f027ac54
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f027ac54
Branch: refs/heads/ignite-843
Commit: f027ac54a8f679ea09727f526a47352ac5e3cb4f
Parents: 08360c9
Author: sevdokimov <se...@gridgain.com>
Authored: Tue May 12 18:31:26 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Tue May 12 18:31:26 2015 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/direct/DirectByteBufferStream.java | 4 ++--
.../internal/managers/eventstorage/GridEventStorageManager.java | 5 +----
.../main/java/org/apache/ignite/internal/util/IgniteUtils.java | 4 ++--
3 files changed, 5 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f027ac54/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectByteBufferStream.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectByteBufferStream.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectByteBufferStream.java
index 528de10..120350b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectByteBufferStream.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectByteBufferStream.java
@@ -66,10 +66,10 @@ public class DirectByteBufferStream {
private static final short[] SHORT_ARR_EMPTY = new short[0];
/** */
- private static final int[] INT_ARR_EMPTY = new int[0];
+ private static final int[] INT_ARR_EMPTY = U.EMPTY_INTS;
/** */
- private static final long[] LONG_ARR_EMPTY = new long[0];
+ private static final long[] LONG_ARR_EMPTY = U.EMPTY_LONGS;
/** */
private static final float[] FLOAT_ARR_EMPTY = new float[0];
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f027ac54/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java
index 6ebe480..10cc99a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java
@@ -50,9 +50,6 @@ import static org.apache.ignite.internal.managers.communication.GridIoPolicy.*;
* Grid event storage SPI manager.
*/
public class GridEventStorageManager extends GridManagerAdapter<EventStorageSpi> {
- /** */
- private static final int[] EMPTY = new int[0];
-
/** Local event listeners. */
private final ConcurrentMap<Integer, Set<GridLocalEventListener>> lsnrs = new ConcurrentHashMap8<>();
@@ -106,7 +103,7 @@ public class GridEventStorageManager extends GridManagerAdapter<EventStorageSpi>
int[] cfgInclEvtTypes0 = ctx.config().getIncludeEventTypes();
if (F.isEmpty(cfgInclEvtTypes0))
- cfgInclEvtTypes = EMPTY;
+ cfgInclEvtTypes = U.EMPTY_INTS;
else {
cfgInclEvtTypes0 = copy(cfgInclEvtTypes0);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f027ac54/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 06887d2..ffb4e99 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,10 @@ 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];
/** System line separator. */
private static final String NL = System.getProperty("line.separator");
[42/50] incubator-ignite git commit: # ignite-669 - streaming design.
Posted by an...@apache.org.
# ignite-669 - streaming design.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/be64e1dd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/be64e1dd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/be64e1dd
Branch: refs/heads/ignite-843
Commit: be64e1dd1f7aba02b664c4be6f2753cdafbbdba6
Parents: 0cbe3c6
Author: Dmitiry Setrakyan <ds...@gridgain.com>
Authored: Thu Apr 2 03:10:54 2015 -0700
Committer: agura <ag...@gridgain.com>
Committed: Fri May 15 03:44:18 2015 +0300
----------------------------------------------------------------------
.../ignite/stream/adapters/StreamAdapter.java | 29 +++++++++++++++++---
1 file changed, 25 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be64e1dd/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java b/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java
index 02ae795..f2e0da9 100644
--- a/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java
@@ -29,10 +29,17 @@ import java.util.*;
*/
public abstract class StreamAdapter<T, K, V> {
/** Tuple extractor. */
- private final StreamTupleExtractor<T, K, V> extractor;
+ private StreamTupleExtractor<T, K, V> extractor;
/** Streamer. */
- private final IgniteDataStreamer<K, V> stmr;
+ private IgniteDataStreamer<K, V> stmr;
+
+ /**
+ * Empty constructor.
+ */
+ public StreamAdapter() {
+ // No-op.
+ }
/**
* Stream adapter.
@@ -48,18 +55,32 @@ public abstract class StreamAdapter<T, K, V> {
/**
* @return Provided data streamer.
*/
- public IgniteDataStreamer<K, V> streamer() {
+ public IgniteDataStreamer<K, V> getStreamer() {
return stmr;
}
/**
+ * @param stmr Ignite data streamer.
+ */
+ public void setStreamer(IgniteDataStreamer<K, V> stmr) {
+ this.stmr = stmr;
+ }
+
+ /**
* @return Provided tuple extractor.
*/
- public StreamTupleExtractor<T, K, V> converter() {
+ public StreamTupleExtractor<T, K, V> getConverter() {
return extractor;
}
/**
+ * @param extractor Extractor for key-value tuples from messages.
+ */
+ public void setExtractor(StreamTupleExtractor<T, K, V> extractor) {
+ this.extractor = extractor;
+ }
+
+ /**
* Converts given message to a tuple and adds it to the underlying streamer.
*
* @param msg Message to convert.
[41/50] incubator-ignite git commit: # ignite-669 - streaming design.
Posted by an...@apache.org.
# ignite-669 - streaming design.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/0cbe3c68
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0cbe3c68
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0cbe3c68
Branch: refs/heads/ignite-843
Commit: 0cbe3c68dcea09a39fd0e97909bbbaa6b1091a6b
Parents: 56e67e8
Author: Dmitiry Setrakyan <ds...@gridgain.com>
Authored: Thu Apr 2 02:45:48 2015 -0700
Committer: agura <ag...@gridgain.com>
Committed: Fri May 15 03:44:15 2015 +0300
----------------------------------------------------------------------
.../ignite/stream/adapters/StreamAdapter.java | 73 ++++++++++++++++++++
.../stream/adapters/StreamTupleExtractor.java | 33 +++++++++
.../ignite/stream/adapters/package-info.java | 21 ++++++
3 files changed, 127 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0cbe3c68/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java b/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java
new file mode 100644
index 0000000..02ae795
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java
@@ -0,0 +1,73 @@
+/*
+ * 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.stream.adapters;
+
+import org.apache.ignite.*;
+
+import java.util.*;
+
+/**
+ * Convenience adapter for streamers. Adapters are optional components for
+ * streaming from different data sources. The purpose of adapters is to
+ * convert different message formats into Ignite stream key-value tuples
+ * and feed the tuples into the provided {@link org.apache.ignite.IgniteDataStreamer}.
+ */
+public abstract class StreamAdapter<T, K, V> {
+ /** Tuple extractor. */
+ private final StreamTupleExtractor<T, K, V> extractor;
+
+ /** Streamer. */
+ private final IgniteDataStreamer<K, V> stmr;
+
+ /**
+ * Stream adapter.
+ *
+ * @param stmr Streamer.
+ * @param extractor Tuple extractor.
+ */
+ protected StreamAdapter(IgniteDataStreamer<K, V> stmr, StreamTupleExtractor<T, K, V> extractor) {
+ this.stmr = stmr;
+ this.extractor = extractor;
+ }
+
+ /**
+ * @return Provided data streamer.
+ */
+ public IgniteDataStreamer<K, V> streamer() {
+ return stmr;
+ }
+
+ /**
+ * @return Provided tuple extractor.
+ */
+ public StreamTupleExtractor<T, K, V> converter() {
+ return extractor;
+ }
+
+ /**
+ * Converts given message to a tuple and adds it to the underlying streamer.
+ *
+ * @param msg Message to convert.
+ */
+ protected void addMessage(T msg) {
+ Map.Entry<K, V> e = extractor.extract(msg);
+
+ if (e != null)
+ stmr.addData(e);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0cbe3c68/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamTupleExtractor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamTupleExtractor.java b/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamTupleExtractor.java
new file mode 100644
index 0000000..9b0c395
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamTupleExtractor.java
@@ -0,0 +1,33 @@
+/*
+ * 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.stream.adapters;
+
+import java.util.*;
+
+/**
+ * Stream tuple extractor to convert messages to Ignite key-value tuples.
+ */
+public interface StreamTupleExtractor<T, K, V> {
+ /**
+ * Extracts a key-value tuple from a message.
+ *
+ * @param msg Message.
+ * @return Key-value tuple.
+ */
+ public Map.Entry<K, V> extract(T msg);
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0cbe3c68/modules/core/src/main/java/org/apache/ignite/stream/adapters/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/adapters/package-info.java b/modules/core/src/main/java/org/apache/ignite/stream/adapters/package-info.java
new file mode 100644
index 0000000..a69ffc0
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/stream/adapters/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Contains Ignite stream adapters.
+ */
+package org.apache.ignite.stream.adapters;
[20/50] incubator-ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-157' into ignite-sprint-5
Posted by an...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-157' into ignite-sprint-5
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/bbc21a6a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/bbc21a6a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/bbc21a6a
Branch: refs/heads/ignite-843
Commit: bbc21a6acba0193695e8b924b540bae4a647f3b8
Parents: 3861fbd ab1f9dd
Author: sboikov <sb...@gridgain.com>
Authored: Wed May 13 10:04:14 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed May 13 10:04:14 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheMvccManager.java | 4 +-
.../cache/distributed/dht/GridDhtTxLocal.java | 32 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 27 +
.../cache/distributed/dht/GridDhtTxMapping.java | 2 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 81 +-
.../colocated/GridDhtColocatedLockFuture.java | 25 +-
.../colocated/GridDhtDetachedCacheEntry.java | 4 +-
.../distributed/near/GridNearCacheEntry.java | 4 +-
.../distributed/near/GridNearLockFuture.java | 5 -
.../near/GridNearOptimisticTxPrepareFuture.java | 779 +++++++++++++
.../GridNearPessimisticTxPrepareFuture.java | 349 ++++++
.../cache/distributed/near/GridNearTxLocal.java | 84 +-
.../near/GridNearTxPrepareFuture.java | 1050 ------------------
.../near/GridNearTxPrepareFutureAdapter.java | 226 ++++
.../cache/transactions/IgniteInternalTx.java | 4 +-
.../cache/transactions/IgniteTxAdapter.java | 2 +-
.../cache/transactions/IgniteTxHandler.java | 68 +-
.../transactions/IgniteTxLocalAdapter.java | 2 +-
.../cache/transactions/IgniteTxManager.java | 12 +-
.../GridCacheAbstractFailoverSelfTest.java | 8 +-
.../GridCacheAbstractNodeRestartSelfTest.java | 11 +-
.../distributed/IgniteTxGetAfterStopTest.java | 131 +++
...ePrimaryNodeFailureRecoveryAbstractTest.java | 4 +-
...idCacheAtomicReplicatedFailoverSelfTest.java | 6 +
.../GridCacheReplicatedFailoverSelfTest.java | 6 +
.../GridCacheReplicatedNodeRestartSelfTest.java | 80 ++
.../IgniteCacheFailoverTestSuite.java | 10 +-
.../testsuites/IgniteCacheRestartTestSuite.java | 8 +-
.../testsuites/IgniteCacheTestSuite3.java | 2 +
29 files changed, 1759 insertions(+), 1267 deletions(-)
----------------------------------------------------------------------
[23/50] incubator-ignite git commit: # ignite-sprint-5 minor test
change
Posted by an...@apache.org.
# ignite-sprint-5 minor test change
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5f8925be
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5f8925be
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5f8925be
Branch: refs/heads/ignite-843
Commit: 5f8925be6d6e1360ff56ff3c1dfff49811caef82
Parents: bbc21a6
Author: sboikov <sb...@gridgain.com>
Authored: Wed May 13 12:38:49 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed May 13 12:38:49 2015 +0300
----------------------------------------------------------------------
.../GridCachePartitionedTxSalvageSelfTest.java | 25 ++++++++++----------
1 file changed, 13 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5f8925be/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxSalvageSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxSalvageSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxSalvageSelfTest.java
index 5072642..6192f39 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxSalvageSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxSalvageSelfTest.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.processors.cache.distributed.near;
import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
import org.apache.ignite.cache.affinity.rendezvous.*;
import org.apache.ignite.configuration.*;
import org.apache.ignite.internal.*;
@@ -35,6 +34,8 @@ import org.apache.ignite.transactions.*;
import java.util.*;
import static org.apache.ignite.IgniteSystemProperties.*;
+import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.cache.CacheRebalanceMode.*;
import static org.apache.ignite.transactions.TransactionConcurrency.*;
import static org.apache.ignite.transactions.TransactionIsolation.*;
@@ -76,10 +77,10 @@ public class GridCachePartitionedTxSalvageSelfTest extends GridCommonAbstractTes
CacheConfiguration cc = defaultCacheConfiguration();
- cc.setCacheMode(CacheMode.PARTITIONED);
+ cc.setCacheMode(PARTITIONED);
cc.setAffinity(new RendezvousAffinityFunction(false, 18));
cc.setBackups(1);
- cc.setRebalanceMode(CacheRebalanceMode.SYNC);
+ cc.setRebalanceMode(SYNC);
c.setCacheConfiguration(cc);
@@ -109,8 +110,9 @@ public class GridCachePartitionedTxSalvageSelfTest extends GridCommonAbstractTes
/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
- // Shutwodn the gird.
stopAllGrids();
+
+ System.gc();
}
/**
@@ -145,8 +147,8 @@ public class GridCachePartitionedTxSalvageSelfTest extends GridCommonAbstractTes
* Check whether caches has no transactions after salvage timeout.
*
* @param mode Transaction mode (PESSIMISTIC, OPTIMISTIC).
- * @param prepare Whether to preapre transaction state
- * (i.e. call {@link org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx#prepare()}).
+ * @param prepare Whether to prepare transaction state
+ * (i.e. call {@link IgniteInternalTx#prepare()}).
* @throws Exception If failed.
*/
private void checkSalvageAfterTimeout(TransactionConcurrency mode, boolean prepare) throws Exception {
@@ -164,8 +166,8 @@ public class GridCachePartitionedTxSalvageSelfTest extends GridCommonAbstractTes
* Check whether caches still has all transactions before salvage timeout.
*
* @param mode Transaction mode (PESSIMISTIC, OPTIMISTIC).
- * @param prepare Whether to preapre transaction state
- * (i.e. call {@link org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx#prepare()}).
+ * @param prepare Whether to prepare transaction state
+ * (i.e. call {@link IgniteInternalTx#prepare()}).
* @throws Exception If failed.
*/
private void checkSalvageBeforeTimeout(TransactionConcurrency mode, boolean prepare) throws Exception {
@@ -191,8 +193,8 @@ public class GridCachePartitionedTxSalvageSelfTest extends GridCommonAbstractTes
* Start new transaction on the grid(0) and put some keys to it.
*
* @param mode Transaction mode (PESSIMISTIC, OPTIMISTIC).
- * @param prepare Whether to preapre transaction state
- * (i.e. call {@link org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx#prepare()}).
+ * @param prepare Whether to prepare transaction state
+ * (i.e. call {@link IgniteInternalTx#prepare()}).
* @throws Exception If failed.
*/
private void startTxAndPutKeys(final TransactionConcurrency mode, final boolean prepare) throws Exception {
@@ -210,9 +212,8 @@ public class GridCachePartitionedTxSalvageSelfTest extends GridCommonAbstractTes
for (Integer key : keys)
c.put(key, "val" + key);
- // Unproxy.
if (prepare)
- U.<IgniteInternalTx>field(tx, "tx").prepare();
+ ((TransactionProxyImpl)tx).tx().prepare();
}
catch (IgniteCheckedException e) {
info("Failed to put keys to cache: " + e.getMessage());
[48/50] incubator-ignite git commit: ignite-430 review
Posted by an...@apache.org.
ignite-430 review
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/fe78d42c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/fe78d42c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/fe78d42c
Branch: refs/heads/ignite-843
Commit: fe78d42cfe77626b7250875e0c3f608b27dc9367
Parents: 7ee8517
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu May 14 16:36:06 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Fri May 15 03:44:37 2015 +0300
----------------------------------------------------------------------
.../socket/WordsSocketStreamerClient.java | 86 --------------
.../socket/ZWordsSocketStreamerClient.java | 81 --------------
.../socket/ZWordsSocketStreamerServer.java | 111 -------------------
.../examples/streaming/socket/package-info.java | 21 ----
.../streaming/wordcount/QueryWords.java | 6 +
.../streaming/wordcount/StreamWords.java | 6 +
.../socket/WordsSocketStreamerClient.java | 82 ++++++++++++++
.../socket/WordsSocketStreamerServer.java | 111 +++++++++++++++++++
.../wordcount/socket/package-info.java | 21 ++++
9 files changed, 226 insertions(+), 299 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe78d42c/examples/src/main/java/org/apache/ignite/examples/streaming/socket/WordsSocketStreamerClient.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/WordsSocketStreamerClient.java b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/WordsSocketStreamerClient.java
deleted file mode 100644
index c5ec079..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/WordsSocketStreamerClient.java
+++ /dev/null
@@ -1,86 +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.examples.streaming.socket;
-
-import org.apache.ignite.examples.*;
-import org.apache.ignite.examples.streaming.wordcount.*;
-import org.apache.ignite.stream.socket.*;
-
-import java.io.*;
-import java.net.*;
-
-/**
- * Sends words to socket server based on {@link SocketStreamer} using message size based protocol.
- * <p>
- * To start the example, you should:
- * <ul>
- * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
- * <li>Start socket server using {@link WordsSocketStreamerServer}.</li>
- * <li>Start a few socket clients using {@link WordsSocketStreamerClient}.</li>
- * <li>Start querying popular words using {@link QueryWords}.</li>
- * </ul>
- * <p>
- * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
- */
-public class WordsSocketStreamerClient {
- /** Port. */
- private static final int PORT = 5555;
-
- /**
- * @param args Args.
- */
- public static void main(String[] args) throws IOException {
- InetAddress addr = InetAddress.getLocalHost();
-
- try (Socket sock = new Socket(addr, PORT);
- OutputStream oos = new BufferedOutputStream(sock.getOutputStream())) {
-
- System.out.println("Words streaming started.");
-
- while (true) {
- try (InputStream in = StreamWords.class.getResourceAsStream("../wordcount/alice-in-wonderland.txt");
- LineNumberReader rdr = new LineNumberReader(new InputStreamReader(in))) {
- for (String line = rdr.readLine(); line != null; line = rdr.readLine()) {
- for (String word : line.split(" ")) {
- if (!word.isEmpty()) {
- // Stream words into Ignite through socket.
- try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(bos)) {
-
- // Write message
- out.writeObject(word);
-
- byte[] arr = bos.toByteArray();
-
- // Write message length
- oos.write(arr.length >>> 24);
- oos.write(arr.length >>> 16);
- oos.write(arr.length >>> 8);
- oos.write(arr.length);
-
- oos.write(arr);
- }
- }
- }
- }
- }
- }
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe78d42c/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZWordsSocketStreamerClient.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZWordsSocketStreamerClient.java b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZWordsSocketStreamerClient.java
deleted file mode 100644
index c17ccdc..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZWordsSocketStreamerClient.java
+++ /dev/null
@@ -1,81 +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.examples.streaming.socket;
-
-import org.apache.ignite.examples.*;
-import org.apache.ignite.examples.streaming.wordcount.*;
-import org.apache.ignite.stream.socket.*;
-
-import java.io.*;
-import java.net.*;
-
-/**
- * Sends words to socket server based on {@link SocketStreamer} using message delimiter based protocol.
- * Example illustrates usage of TCP socket streamer in case of non-Java clients.
- * In this example words are zero-terminated strings.
- * <p>
- * To start the example, you should:
- * <ul>
- * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
- * <li>Start socket server using {@link ZWordsSocketStreamerServer}.</li>
- * <li>Start a few socket clients using {@link ZWordsSocketStreamerClient}.</li>
- * <li>Start querying popular words using {@link QueryWords}.</li>
- * </ul>
- * <p>
- * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
- */
-public class ZWordsSocketStreamerClient {
- /** Port. */
- private static final int PORT = 5555;
-
- /** Delimiter. */
- private static final byte[] DELIM = new byte[] {0};
-
- /**
- * @param args Args.
- */
- public static void main(String[] args) throws IOException {
- InetAddress addr = InetAddress.getLocalHost();
-
- try (Socket sock = new Socket(addr, PORT);
- OutputStream oos = new BufferedOutputStream(sock.getOutputStream())) {
-
- System.out.println("Words streaming started.");
-
- while (true) {
- try (InputStream in = StreamWords.class.getResourceAsStream("../wordcount/alice-in-wonderland.txt");
- LineNumberReader rdr = new LineNumberReader(new InputStreamReader(in))) {
- for (String line = rdr.readLine(); line != null; line = rdr.readLine()) {
- for (String word : line.split(" ")) {
- if (!word.isEmpty()) {
- // Stream words into Ignite through socket.
- byte[] arr = word.getBytes("ASCII");
-
- // Write message
- oos.write(arr);
-
- // Write message delimiter
- oos.write(DELIM);
- }
- }
- }
- }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe78d42c/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZWordsSocketStreamerServer.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZWordsSocketStreamerServer.java b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZWordsSocketStreamerServer.java
deleted file mode 100644
index a0ef9da..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/ZWordsSocketStreamerServer.java
+++ /dev/null
@@ -1,111 +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.examples.streaming.socket;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.affinity.*;
-import org.apache.ignite.examples.*;
-import org.apache.ignite.examples.streaming.wordcount.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.stream.*;
-import org.apache.ignite.stream.socket.*;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-/**
- * Receives words through socket using {@link SocketStreamer} and message delimiter based protocol
- * and streams them into Ignite cache. Example illustrates usage of TCP socket streamer in case of non-Java clients.
- * In this example words are zero-terminated strings.
- * <p>
- * To start the example, you should:
- * <ul>
- * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
- * <li>Start socket server using {@link ZWordsSocketStreamerServer}.</li>
- * <li>Start a few socket clients using {@link ZWordsSocketStreamerClient}.</li>
- * <li>Start querying popular words using {@link QueryWords}.</li>
- * </ul>
- * <p>
- * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
- */
-public class ZWordsSocketStreamerServer {
- /** Port. */
- private static final int PORT = 5555;
-
- /** Delimiter. */
- private static final byte[] DELIM = new byte[] {0};
-
- /**
- * @param args Args.
- */
- public static void main(String[] args) throws InterruptedException, IOException {
- // Mark this cluster member as client.
- Ignition.setClientMode(true);
-
- Ignite ignite = Ignition.start("examples/config/example-ignite.xml");
-
- if (!ExamplesUtils.hasServerNodes(ignite)) {
- ignite.close();
-
- return;
- }
-
- // The cache is configured with sliding window holding 1 second of the streaming data.
- IgniteCache<AffinityUuid, String> stmCache = ignite.getOrCreateCache(CacheConfig.wordCache());
-
- IgniteDataStreamer<AffinityUuid, String> stmr = ignite.dataStreamer(stmCache.getName());
-
- InetAddress addr = InetAddress.getLocalHost();
-
- // Configure socket streamer
- SocketStreamer<String, AffinityUuid, String> sockStmr = new SocketStreamer<>();
-
- sockStmr.setAddr(addr);
-
- sockStmr.setPort(PORT);
-
- sockStmr.setDelimiter(DELIM);
-
- sockStmr.setIgnite(ignite);
-
- sockStmr.setStreamer(stmr);
-
- // Converter from zero-terminated string to Java strings.
- sockStmr.setConverter(new SocketMessageConverter<String>() {
- @Override public String convert(byte[] msg) {
- try {
- return new String(msg, "ASCII");
- }
- catch (UnsupportedEncodingException e) {
- throw new IgniteException(e);
- }
- }
- });
-
- sockStmr.setTupleExtractor(new StreamTupleExtractor<String, AffinityUuid, String>() {
- @Override public Map.Entry<AffinityUuid, String> extract(String word) {
- // By using AffinityUuid we ensure that identical
- // words are processed on the same cluster node.
- return new IgniteBiTuple<>(new AffinityUuid(word), word);
- }
- });
-
- sockStmr.start();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe78d42c/examples/src/main/java/org/apache/ignite/examples/streaming/socket/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/package-info.java b/examples/src/main/java/org/apache/ignite/examples/streaming/socket/package-info.java
deleted file mode 100644
index c516ab4..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/socket/package-info.java
+++ /dev/null
@@ -1,21 +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.
- */
-
-/**
- * Contains {@link org.apache.ignite.stream.socket.SocketStreamer} usage examples.
- */
-package org.apache.ignite.examples.streaming.socket;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe78d42c/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/QueryWords.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/QueryWords.java b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/QueryWords.java
index 149aa79..faf8b51 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/QueryWords.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/QueryWords.java
@@ -36,6 +36,12 @@ import java.util.*;
* You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
*/
public class QueryWords {
+ /**
+ * Schedules words query execution.
+ *
+ * @param args Command line arguments (none required).
+ * @throws Exception If failed.
+ */
public static void main(String[] args) throws Exception {
// Mark this cluster member as client.
Ignition.setClientMode(true);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe78d42c/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/StreamWords.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/StreamWords.java b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/StreamWords.java
index cc3c0cb..26be178 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/StreamWords.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/StreamWords.java
@@ -35,6 +35,12 @@ import java.io.*;
* You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
*/
public class StreamWords {
+ /**
+ * Starts words streaming.
+ *
+ * @param args Command line arguments (none required).
+ * @throws Exception If failed.
+ */
public static void main(String[] args) throws Exception {
// Mark this cluster member as client.
Ignition.setClientMode(true);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe78d42c/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerClient.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerClient.java b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerClient.java
new file mode 100644
index 0000000..ea3beaa
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerClient.java
@@ -0,0 +1,82 @@
+/*
+ * 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.examples.streaming.wordcount.socket;
+
+import org.apache.ignite.examples.*;
+import org.apache.ignite.examples.streaming.wordcount.*;
+import org.apache.ignite.stream.socket.*;
+
+import java.io.*;
+import java.net.*;
+
+/**
+ * Sends words to socket server based on {@link SocketStreamer} using message delimiter based protocol.
+ * Example illustrates usage of TCP socket streamer in case of non-Java clients.
+ * In this example words are zero-terminated strings.
+ * <p>
+ * To start the example, you should:
+ * <ul>
+ * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
+ * <li>Start socket server using {@link WordsSocketStreamerServer}.</li>
+ * <li>Start a few socket clients using {@link WordsSocketStreamerClient}.</li>
+ * <li>Start querying popular words using {@link QueryWords}.</li>
+ * </ul>
+ * <p>
+ * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
+ */
+public class WordsSocketStreamerClient {
+ /** Port. */
+ private static final int PORT = 5555;
+
+ /** Delimiter. */
+ private static final byte[] DELIM = new byte[] {0};
+
+ /**
+ * @param args Args.
+ */
+ public static void main(String[] args) throws IOException {
+ InetAddress addr = InetAddress.getLocalHost();
+
+ try (
+ Socket sock = new Socket(addr, PORT);
+ OutputStream oos = new BufferedOutputStream(sock.getOutputStream())
+ ) {
+ System.out.println("Words streaming started.");
+
+ while (true) {
+ try (InputStream in = StreamWords.class.getResourceAsStream("../wordcount/alice-in-wonderland.txt");
+ LineNumberReader rdr = new LineNumberReader(new InputStreamReader(in))) {
+ for (String line = rdr.readLine(); line != null; line = rdr.readLine()) {
+ for (String word : line.split(" ")) {
+ if (!word.isEmpty()) {
+ // Stream words into Ignite through socket.
+ byte[] arr = word.getBytes("ASCII");
+
+ // Write message
+ oos.write(arr);
+
+ // Write message delimiter
+ oos.write(DELIM);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe78d42c/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerServer.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerServer.java b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerServer.java
new file mode 100644
index 0000000..259c925
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerServer.java
@@ -0,0 +1,111 @@
+/*
+ * 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.examples.streaming.wordcount.socket;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.examples.*;
+import org.apache.ignite.examples.streaming.wordcount.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.stream.*;
+import org.apache.ignite.stream.socket.*;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+/**
+ * Receives words through socket using {@link SocketStreamer} and message delimiter based protocol
+ * and streams them into Ignite cache. Example illustrates usage of TCP socket streamer in case of non-Java clients.
+ * In this example words are zero-terminated strings.
+ * <p>
+ * To start the example, you should:
+ * <ul>
+ * <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
+ * <li>Start socket server using {@link WordsSocketStreamerServer}.</li>
+ * <li>Start a few socket clients using {@link WordsSocketStreamerClient}.</li>
+ * <li>Start querying popular words using {@link QueryWords}.</li>
+ * </ul>
+ * <p>
+ * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
+ */
+public class WordsSocketStreamerServer {
+ /** Port. */
+ private static final int PORT = 5555;
+
+ /** Delimiter. */
+ private static final byte[] DELIM = new byte[] {0};
+
+ /**
+ * @param args Args.
+ */
+ public static void main(String[] args) throws InterruptedException, IOException {
+ // Mark this cluster member as client.
+ Ignition.setClientMode(true);
+
+ Ignite ignite = Ignition.start("examples/config/example-ignite.xml");
+
+ if (!ExamplesUtils.hasServerNodes(ignite)) {
+ ignite.close();
+
+ return;
+ }
+
+ // The cache is configured with sliding window holding 1 second of the streaming data.
+ IgniteCache<AffinityUuid, String> stmCache = ignite.getOrCreateCache(CacheConfig.wordCache());
+
+ IgniteDataStreamer<AffinityUuid, String> stmr = ignite.dataStreamer(stmCache.getName());
+
+ InetAddress addr = InetAddress.getLocalHost();
+
+ // Configure socket streamer
+ SocketStreamer<String, AffinityUuid, String> sockStmr = new SocketStreamer<>();
+
+ sockStmr.setAddr(addr);
+
+ sockStmr.setPort(PORT);
+
+ sockStmr.setDelimiter(DELIM);
+
+ sockStmr.setIgnite(ignite);
+
+ sockStmr.setStreamer(stmr);
+
+ // Converter from zero-terminated string to Java strings.
+ sockStmr.setConverter(new SocketMessageConverter<String>() {
+ @Override public String convert(byte[] msg) {
+ try {
+ return new String(msg, "ASCII");
+ }
+ catch (UnsupportedEncodingException e) {
+ throw new IgniteException(e);
+ }
+ }
+ });
+
+ sockStmr.setTupleExtractor(new StreamTupleExtractor<String, AffinityUuid, String>() {
+ @Override public Map.Entry<AffinityUuid, String> extract(String word) {
+ // By using AffinityUuid we ensure that identical
+ // words are processed on the same cluster node.
+ return new IgniteBiTuple<>(new AffinityUuid(word), word);
+ }
+ });
+
+ sockStmr.start();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe78d42c/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/package-info.java b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/package-info.java
new file mode 100644
index 0000000..048299f
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Contains {@link org.apache.ignite.stream.socket.SocketStreamer} usage examples.
+ */
+package org.apache.ignite.examples.streaming.wordcount.socket;
[43/50] incubator-ignite git commit: # ignite-669 - streaming design.
Posted by an...@apache.org.
# ignite-669 - streaming design.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/877eb764
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/877eb764
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/877eb764
Branch: refs/heads/ignite-843
Commit: 877eb7649e61ca53765c42b4244a7d46a39d1179
Parents: be64e1d
Author: Dmitiry Setrakyan <ds...@gridgain.com>
Authored: Thu Apr 2 03:11:54 2015 -0700
Committer: agura <ag...@gridgain.com>
Committed: Fri May 15 03:44:21 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/stream/adapters/StreamAdapter.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/877eb764/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java b/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java
index f2e0da9..9d4772f 100644
--- a/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/stream/adapters/StreamAdapter.java
@@ -69,14 +69,14 @@ public abstract class StreamAdapter<T, K, V> {
/**
* @return Provided tuple extractor.
*/
- public StreamTupleExtractor<T, K, V> getConverter() {
+ public StreamTupleExtractor<T, K, V> getTupleExtractor() {
return extractor;
}
/**
* @param extractor Extractor for key-value tuples from messages.
*/
- public void setExtractor(StreamTupleExtractor<T, K, V> extractor) {
+ public void setTupleExtractor(StreamTupleExtractor<T, K, V> extractor) {
this.extractor = extractor;
}
[10/50] incubator-ignite git commit: KEYS file is optional since this
moment
Posted by an...@apache.org.
KEYS file is optional since this moment
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b95d2ae6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b95d2ae6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b95d2ae6
Branch: refs/heads/ignite-843
Commit: b95d2ae6c40faa45a68f2566df8e4ebb8b25d4fe
Parents: a4c9653
Author: avinogradov <av...@gridgain.com>
Authored: Tue May 12 15:32:51 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Tue May 12 15:32:51 2015 +0300
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b95d2ae6/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 451812a..0643227 100644
--- a/pom.xml
+++ b/pom.xml
@@ -573,7 +573,7 @@
<include name="**/*" />
</fileset>
</copy>
- <copy file="${basedir}/KEYS" todir="${basedir}/target/site" />
+ <copy file="${basedir}/KEYS" todir="${basedir}/target/site" failonerror="false"/>
</target>
</configuration>
</execution>
[06/50] incubator-ignite git commit: Merge remote-tracking branch
'origin/ignite-sprint-5' into ignite-sprint-5
Posted by an...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-5' into ignite-sprint-5
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f6012f1e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f6012f1e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f6012f1e
Branch: refs/heads/ignite-843
Commit: f6012f1e802be3ade9efd53d79ec6b85df5a4c8c
Parents: e6ca757 f4a3591
Author: avinogradov <av...@gridgain.com>
Authored: Fri May 8 18:54:49 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Fri May 8 18:54:49 2015 +0300
----------------------------------------------------------------------
.../processors/resource/GridResourceField.java | 11 +
.../processors/resource/GridResourceIoc.java | 387 ++++++-------------
.../processors/resource/GridResourceMethod.java | 13 +
.../resource/GridResourceProcessor.java | 4 +-
.../ignite/internal/util/IgniteUtils.java | 15 +
.../spi/discovery/tcp/TcpDiscoverySpi.java | 24 +-
6 files changed, 191 insertions(+), 263 deletions(-)
----------------------------------------------------------------------
[16/50] incubator-ignite git commit: # IGNITE-894 Code cleanup.
Posted by an...@apache.org.
# IGNITE-894 Code cleanup.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/96ad5a86
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/96ad5a86
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/96ad5a86
Branch: refs/heads/ignite-843
Commit: 96ad5a8605b54e02057253ad7d330f2726ddd687
Parents: f027ac5
Author: sevdokimov <se...@gridgain.com>
Authored: Tue May 12 18:39:37 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Tue May 12 18:39:37 2015 +0300
----------------------------------------------------------------------
.../processors/resource/GridResourceField.java | 5 +----
.../processors/resource/GridResourceIoc.java | 18 ++++++++++--------
.../apache/ignite/internal/util/IgniteUtils.java | 3 +++
3 files changed, 14 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96ad5a86/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 162de1c..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
@@ -44,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;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96ad5a86/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 c2ef116..3d853d6 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.*;
@@ -142,9 +143,9 @@ class GridResourceIoc {
boolean injected = false;
- for (GridResourceField field : descr.recursiveFields()) {
+ for (Field field : descr.recursiveFields()) {
try {
- Object obj = field.getField().get(target);
+ Object obj = field.get(target);
if (obj != null) {
assert checkedObjs != null;
@@ -153,7 +154,7 @@ class GridResourceIoc {
}
}
catch (IllegalAccessException e) {
- throw new IgniteCheckedException("Failed to inject resource [field=" + field.getField().getName() +
+ throw new IgniteCheckedException("Failed to inject resource [field=" + field.getName() +
", target=" + target + ']', e);
}
}
@@ -253,7 +254,7 @@ class GridResourceIoc {
*/
private static class ClassDescriptor {
/** */
- private final GridResourceField[] recursiveFields;
+ private final Field[] recursiveFields;
/** */
private final Map<Class<? extends Annotation>, T2<GridResourceField[], GridResourceMethod[]>> annMap;
@@ -265,7 +266,7 @@ class GridResourceIoc {
Map<Class<? extends Annotation>, T2<List<GridResourceField>, List<GridResourceMethod>>> annMap
= new HashMap<>();
- Collection<GridResourceField> recursiveFieldsList = new ArrayList<>();
+ List<Field> recursiveFieldsList = new ArrayList<>();
boolean allowImplicitInjection = !GridNoImplicitInjection.class.isAssignableFrom(cls);
@@ -291,7 +292,7 @@ class GridResourceIoc {
&& fieldAnns.length == 0
&& GridResourceUtils.mayRequireResources(field)) {
// Account for anonymous inner classes.
- recursiveFieldsList.add(new GridResourceField(field, null));
+ recursiveFieldsList.add(field);
}
}
@@ -312,7 +313,8 @@ class GridResourceIoc {
}
}
- recursiveFields = GridResourceField.toArray(recursiveFieldsList);
+ recursiveFields = recursiveFieldsList.isEmpty() ? U.EMPTY_FIELDS
+ : recursiveFieldsList.toArray(new Field[recursiveFieldsList.size()]);
this.annMap = IgniteUtils.limitedMap(annMap.size());
@@ -328,7 +330,7 @@ class GridResourceIoc {
/**
* @return Recursive fields.
*/
- public GridResourceField[] recursiveFields() {
+ public Field[] recursiveFields() {
return recursiveFields;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96ad5a86/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 ffb4e99..673287d 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
@@ -113,6 +113,9 @@ public abstract class IgniteUtils {
/** Empty longs. */
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");
[02/50] incubator-ignite git commit: # IGNITE-777 Review: Replace
log.error() with U.error()
Posted by an...@apache.org.
# IGNITE-777 Review: Replace log.error() with U.error()
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f059be62
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f059be62
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f059be62
Branch: refs/heads/ignite-843
Commit: f059be626b0a66e81b5ce3961d53a20d89526bc8
Parents: 0dc908b
Author: sevdokimov <se...@gridgain.com>
Authored: Fri May 8 17:57:00 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Fri May 8 17:58:11 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f059be62/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 3afcd0f..0ebb6cd 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -2705,7 +2705,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
clientMsgWorker.addMessage(msgClone);
}
catch (IgniteCheckedException e) {
- log.error("Failed to marshal message: " + msg, e);
+ U.error(log, "Failed to marshal message: " + msg, e);
msgClone = msg;
}
[04/50] incubator-ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-478' into ignite-sprint-5
Posted by an...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-478' into ignite-sprint-5
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f4a3591b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f4a3591b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f4a3591b
Branch: refs/heads/ignite-843
Commit: f4a3591b35b707aa1cf2643d4d9db99a5bd0afc8
Parents: f059be6 995b608
Author: sevdokimov <se...@gridgain.com>
Authored: Fri May 8 18:01:46 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Fri May 8 18:01:46 2015 +0300
----------------------------------------------------------------------
.../processors/resource/GridResourceField.java | 11 +
.../processors/resource/GridResourceIoc.java | 387 ++++++-------------
.../processors/resource/GridResourceMethod.java | 13 +
.../resource/GridResourceProcessor.java | 4 +-
.../ignite/internal/util/IgniteUtils.java | 15 +
5 files changed, 169 insertions(+), 261 deletions(-)
----------------------------------------------------------------------
[13/50] incubator-ignite git commit: Merge remote-tracking branch
'origin/ignite-sprint-5' into ignite-sprint-5
Posted by an...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-5' into ignite-sprint-5
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/08360c99
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/08360c99
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/08360c99
Branch: refs/heads/ignite-843
Commit: 08360c999a73173aceef8eb7500d656ea5b386c0
Parents: 6395b43 c235711
Author: sboikov <sb...@gridgain.com>
Authored: Tue May 12 16:03:05 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue May 12 16:03:05 2015 +0300
----------------------------------------------------------------------
assembly/release-base.xml | 4 +-
bin/ignite-schema-import.bat | 2 +-
bin/ignite-schema-import.sh | 2 +-
bin/ignite.bat | 2 +-
bin/ignite.sh | 2 +-
bin/ignitevisorcmd.bat | 2 +-
bin/ignitevisorcmd.sh | 2 +-
bin/include/build-classpath.bat | 46 +++++++++++++++++++++++
bin/include/build-classpath.sh | 71 +++++++++++++++++++++++++++++++++++
bin/include/target-classpath.bat | 46 -----------------------
bin/include/target-classpath.sh | 71 -----------------------------------
pom.xml | 50 ++++++++++++------------
12 files changed, 152 insertions(+), 148 deletions(-)
----------------------------------------------------------------------
[25/50] incubator-ignite git commit: IGNITE-894 Fix file header.
Posted by an...@apache.org.
IGNITE-894 Fix file header.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3e59d23c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3e59d23c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3e59d23c
Branch: refs/heads/ignite-843
Commit: 3e59d23c18facc9be0663dc494d58de2fd94ac54
Parents: a1ce1ce
Author: sevdokimov <se...@gridgain.com>
Authored: Wed May 13 14:54:15 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed May 13 14:54:15 2015 +0300
----------------------------------------------------------------------
.../ignite/resources/InjectRecursively.java | 22 +++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3e59d23c/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java b/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
index 6cf8c8a..60d1bd7 100644
--- a/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
+++ b/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
@@ -1,10 +1,18 @@
-/* @java.file.header */
-
-/* _________ _____ __________________ _____
- * __ ____/___________(_)______ /__ ____/______ ____(_)_______
- * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
- * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
- * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+/*
+ * 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.resources;
[24/50] incubator-ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-835' into ignite-sprint-5
Posted by an...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-835' into ignite-sprint-5
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/22341a9a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/22341a9a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/22341a9a
Branch: refs/heads/ignite-843
Commit: 22341a9ad6e0c7627ffab26ba63c3f8ed3ace9c0
Parents: 5f8925b 96ff8f2
Author: sboikov <sb...@gridgain.com>
Authored: Wed May 13 13:50:48 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed May 13 13:50:48 2015 +0300
----------------------------------------------------------------------
.../dht/GridDhtTransactionalCacheAdapter.java | 9 ++--
.../distributed/GridCacheLockAbstractTest.java | 2 -
...achePartitionedNearDisabledLockSelfTest.java | 47 ++++++++++++++++++++
.../GridCacheReplicatedLockSelfTest.java | 5 +++
.../testsuites/IgniteCacheTestSuite2.java | 1 +
5 files changed, 57 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
[08/50] incubator-ignite git commit: ignite source-pack fix
Posted by an...@apache.org.
ignite source-pack fix
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7da0df9d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7da0df9d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7da0df9d
Branch: refs/heads/ignite-843
Commit: 7da0df9dffca55e4153bbdcfc02bb0c2fb417989
Parents: ecc7a50
Author: avinogradov <av...@gridgain.com>
Authored: Tue May 12 13:56:02 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Tue May 12 13:56:02 2015 +0300
----------------------------------------------------------------------
assembly/release-base.xml | 4 +-
bin/ignite-schema-import.bat | 2 +-
bin/ignite-schema-import.sh | 2 +-
bin/ignite.bat | 2 +-
bin/ignite.sh | 2 +-
bin/ignitevisorcmd.bat | 2 +-
bin/ignitevisorcmd.sh | 2 +-
bin/include/build-classpath.bat | 46 +++++++++++++++++++++++
bin/include/build-classpath.sh | 71 +++++++++++++++++++++++++++++++++++
bin/include/target-classpath.bat | 46 -----------------------
bin/include/target-classpath.sh | 71 -----------------------------------
pom.xml | 4 +-
12 files changed, 127 insertions(+), 127 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7da0df9d/assembly/release-base.xml
----------------------------------------------------------------------
diff --git a/assembly/release-base.xml b/assembly/release-base.xml
index 6d6465e..88f1d10 100644
--- a/assembly/release-base.xml
+++ b/assembly/release-base.xml
@@ -71,7 +71,7 @@
<excludes>
<exclude>**/*hadoop*.bat</exclude>
<exclude>igniterouter.bat</exclude>
- <exclude>**/target-classpath.bat</exclude>
+ <exclude>**/build-classpath.bat</exclude>
<exclude>ignitevisorcmd.bat</exclude>
<exclude>ignite-schema-import.bat</exclude>
</excludes>
@@ -87,7 +87,7 @@
<excludes>
<exclude>**/*hadoop*.sh</exclude>
<exclude>igniterouter.sh</exclude>
- <exclude>**/target-classpath.sh</exclude>
+ <exclude>**/build-classpath.sh</exclude>
<exclude>**/service.sh</exclude>
<exclude>ignitevisorcmd.sh</exclude>
<exclude>ignite-schema-import.sh</exclude>
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7da0df9d/bin/ignite-schema-import.bat
----------------------------------------------------------------------
diff --git a/bin/ignite-schema-import.bat b/bin/ignite-schema-import.bat
index 4731105..d48234c 100644
--- a/bin/ignite-schema-import.bat
+++ b/bin/ignite-schema-import.bat
@@ -91,7 +91,7 @@ if /i "%SCRIPTS_HOME%\" == "%~dp0" goto run
:: Set IGNITE_LIBS
::
call "%SCRIPTS_HOME%\include\setenv.bat"
-call "%SCRIPTS_HOME%\include\target-classpath.bat" &:: Will be removed in release.
+call "%SCRIPTS_HOME%\include\build-classpath.bat" &:: Will be removed in release.
set CP=%JAVA_HOME%\jre\lib\jfxrt.jar;%IGNITE_HOME%\bin\include\schema-import\*;%IGNITE_LIBS%
::
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7da0df9d/bin/ignite-schema-import.sh
----------------------------------------------------------------------
diff --git a/bin/ignite-schema-import.sh b/bin/ignite-schema-import.sh
index 0a70d54..8f2a8d5 100755
--- a/bin/ignite-schema-import.sh
+++ b/bin/ignite-schema-import.sh
@@ -57,7 +57,7 @@ setIgniteHome
# Set IGNITE_LIBS.
#
. "${SCRIPTS_HOME}"/include/setenv.sh
-. "${SCRIPTS_HOME}"/include/target-classpath.sh # Will be removed in release.
+. "${SCRIPTS_HOME}"/include/build-classpath.sh # Will be removed in release.
CP="${JAVA_HOME}/jre/lib/jfxrt.jar${SEP}${IGNITE_HOME}/bin/include/schema-import/*${SEP}${IGNITE_LIBS}"
#
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7da0df9d/bin/ignite.bat
----------------------------------------------------------------------
diff --git a/bin/ignite.bat b/bin/ignite.bat
index 687db60..20836c0 100644
--- a/bin/ignite.bat
+++ b/bin/ignite.bat
@@ -102,7 +102,7 @@ if "%OS%" == "Windows_NT" set PROG_NAME=%~nx0%
:: Set IGNITE_LIBS
::
call "%SCRIPTS_HOME%\include\setenv.bat"
-call "%SCRIPTS_HOME%\include\target-classpath.bat" &:: Will be removed in release.
+call "%SCRIPTS_HOME%\include\build-classpath.bat" &:: Will be removed in release.
set CP=%IGNITE_LIBS%
::
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7da0df9d/bin/ignite.sh
----------------------------------------------------------------------
diff --git a/bin/ignite.sh b/bin/ignite.sh
index a246613..ee92d27 100755
--- a/bin/ignite.sh
+++ b/bin/ignite.sh
@@ -58,7 +58,7 @@ fi
# Set IGNITE_LIBS.
#
. "${SCRIPTS_HOME}"/include/setenv.sh
-. "${SCRIPTS_HOME}"/include/target-classpath.sh # Will be removed in release.
+. "${SCRIPTS_HOME}"/include/build-classpath.sh # Will be removed in release.
CP="${IGNITE_LIBS}"
RANDOM_NUMBER=$("$JAVA" -cp "${CP}" org.apache.ignite.startup.cmdline.CommandLineRandomNumberGenerator)
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7da0df9d/bin/ignitevisorcmd.bat
----------------------------------------------------------------------
diff --git a/bin/ignitevisorcmd.bat b/bin/ignitevisorcmd.bat
index 1cf2b26..fe06530 100644
--- a/bin/ignitevisorcmd.bat
+++ b/bin/ignitevisorcmd.bat
@@ -100,7 +100,7 @@ if "%OS%" == "Windows_NT" set PROG_NAME=%~nx0%
:: Set IGNITE_LIBS
::
call "%SCRIPTS_HOME%\include\setenv.bat"
-call "%SCRIPTS_HOME%\include\target-classpath.bat" &:: Will be removed in release.
+call "%SCRIPTS_HOME%\include\build-classpath.bat" &:: Will be removed in release.
set CP=%IGNITE_HOME%\bin\include\visor-common\*;%IGNITE_HOME%\bin\include\visorcmd\*;%IGNITE_LIBS%
::
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7da0df9d/bin/ignitevisorcmd.sh
----------------------------------------------------------------------
diff --git a/bin/ignitevisorcmd.sh b/bin/ignitevisorcmd.sh
index 6118560..91d6c5a 100755
--- a/bin/ignitevisorcmd.sh
+++ b/bin/ignitevisorcmd.sh
@@ -53,7 +53,7 @@ setIgniteHome
# Set IGNITE_LIBS.
#
. "${SCRIPTS_HOME}"/include/setenv.sh
-. "${SCRIPTS_HOME}"/include/target-classpath.sh # Will be removed in release.
+. "${SCRIPTS_HOME}"/include/build-classpath.sh # Will be removed in release.
CP="${IGNITE_HOME}/bin/include/visor-common/*${SEP}${IGNITE_HOME}/bin/include/visorcmd/*${SEP}${IGNITE_LIBS}"
#
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7da0df9d/bin/include/build-classpath.bat
----------------------------------------------------------------------
diff --git a/bin/include/build-classpath.bat b/bin/include/build-classpath.bat
new file mode 100644
index 0000000..5f932d3
--- /dev/null
+++ b/bin/include/build-classpath.bat
@@ -0,0 +1,46 @@
+::
+:: 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.
+::
+
+:: Target class path resolver.
+::
+:: Can be used like:
+:: call "%IGNITE_HOME%\bin\include\build-classpath.bat"
+:: in other scripts to set classpath using libs from target folder.
+::
+:: Will be excluded in release.
+
+@echo off
+
+for /D %%F in (modules\*) do if not %%F == "modules" call :includeToClassPath %%F
+
+for /D %%F in (%IGNITE_HOME%\modules\*) do if not %%F == "%IGNITE_HOME%\modules" call :includeToClassPath %%F
+
+goto :eof
+
+:includeToClassPath
+if exist "%1\target\" (
+ if exist "%1\target\classes\" call :concat %1\target\classes
+
+ if exist "%1\target\test-classes\" call :concat %1\target\test-classes
+
+ if exist "%1\target\libs\" call :concat %1\target\libs\*
+)
+goto :eof
+
+:concat
+set IGNITE_LIBS=%IGNITE_LIBS%;%1
+goto :eof
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7da0df9d/bin/include/build-classpath.sh
----------------------------------------------------------------------
diff --git a/bin/include/build-classpath.sh b/bin/include/build-classpath.sh
new file mode 100644
index 0000000..9f0c878
--- /dev/null
+++ b/bin/include/build-classpath.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+#
+# 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.
+#
+
+# Target class path resolver.
+#
+# Can be used like:
+# . "${IGNITE_HOME}"/bin/include/build-classpath.sh
+# in other scripts to set classpath using libs from target folder.
+#
+# Will be excluded in release.
+
+
+#
+# OS specific support.
+#
+SEP=":";
+
+case "`uname`" in
+ MINGW*)
+ SEP=";";
+ export IGNITE_HOME=`echo $IGNITE_HOME | sed -e 's/^\/\([a-zA-Z]\)/\1:/'`
+ ;;
+ CYGWIN*)
+ SEP=";";
+ export IGNITE_HOME=`echo $IGNITE_HOME | sed -e 's/^\/\([a-zA-Z]\)/\1:/'`
+ ;;
+esac
+
+includeToClassPath() {
+ for file in $1/*
+ do
+ if [ -d ${file} ] && [ -d "${file}/target" ]; then
+ if [ -d "${file}/target/classes" ]; then
+ IGNITE_LIBS=${IGNITE_LIBS}${SEP}${file}/target/classes
+ fi
+
+ if [ -d "${file}/target/test-classes" ]; then
+ IGNITE_LIBS=${IGNITE_LIBS}${SEP}${file}/target/test-classes
+ fi
+
+ if [ -d "${file}/target/libs" ]; then
+ IGNITE_LIBS=${IGNITE_LIBS}${SEP}${file}/target/libs/*
+ fi
+ fi
+ done
+}
+
+#
+# Include target libraries for enterprise modules to classpath.
+#
+includeToClassPath modules
+
+#
+# Include target libraries for opensourse modules to classpath.
+#
+includeToClassPath ${IGNITE_HOME}/modules
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7da0df9d/bin/include/target-classpath.bat
----------------------------------------------------------------------
diff --git a/bin/include/target-classpath.bat b/bin/include/target-classpath.bat
deleted file mode 100644
index 4416557..0000000
--- a/bin/include/target-classpath.bat
+++ /dev/null
@@ -1,46 +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.
-::
-
-:: Target class path resolver.
-::
-:: Can be used like:
-:: call "%IGNITE_HOME%\bin\include\target-classpath.bat"
-:: in other scripts to set classpath using libs from target folder.
-::
-:: Will be excluded in release.
-
-@echo off
-
-for /D %%F in (modules\*) do if not %%F == "modules" call :includeToClassPath %%F
-
-for /D %%F in (%IGNITE_HOME%\modules\*) do if not %%F == "%IGNITE_HOME%\modules" call :includeToClassPath %%F
-
-goto :eof
-
-:includeToClassPath
-if exist "%1\target\" (
- if exist "%1\target\classes\" call :concat %1\target\classes
-
- if exist "%1\target\test-classes\" call :concat %1\target\test-classes
-
- if exist "%1\target\libs\" call :concat %1\target\libs\*
-)
-goto :eof
-
-:concat
-set IGNITE_LIBS=%IGNITE_LIBS%;%1
-goto :eof
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7da0df9d/bin/include/target-classpath.sh
----------------------------------------------------------------------
diff --git a/bin/include/target-classpath.sh b/bin/include/target-classpath.sh
deleted file mode 100644
index 871d517..0000000
--- a/bin/include/target-classpath.sh
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/bin/sh
-#
-# 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.
-#
-
-# Target class path resolver.
-#
-# Can be used like:
-# . "${IGNITE_HOME}"/bin/include/target-classpath.sh
-# in other scripts to set classpath using libs from target folder.
-#
-# Will be excluded in release.
-
-
-#
-# OS specific support.
-#
-SEP=":";
-
-case "`uname`" in
- MINGW*)
- SEP=";";
- export IGNITE_HOME=`echo $IGNITE_HOME | sed -e 's/^\/\([a-zA-Z]\)/\1:/'`
- ;;
- CYGWIN*)
- SEP=";";
- export IGNITE_HOME=`echo $IGNITE_HOME | sed -e 's/^\/\([a-zA-Z]\)/\1:/'`
- ;;
-esac
-
-includeToClassPath() {
- for file in $1/*
- do
- if [ -d ${file} ] && [ -d "${file}/target" ]; then
- if [ -d "${file}/target/classes" ]; then
- IGNITE_LIBS=${IGNITE_LIBS}${SEP}${file}/target/classes
- fi
-
- if [ -d "${file}/target/test-classes" ]; then
- IGNITE_LIBS=${IGNITE_LIBS}${SEP}${file}/target/test-classes
- fi
-
- if [ -d "${file}/target/libs" ]; then
- IGNITE_LIBS=${IGNITE_LIBS}${SEP}${file}/target/libs/*
- fi
- fi
- done
-}
-
-#
-# Include target libraries for enterprise modules to classpath.
-#
-includeToClassPath modules
-
-#
-# Include target libraries for opensourse modules to classpath.
-#
-includeToClassPath ${IGNITE_HOME}/modules
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7da0df9d/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index c445fd3..1b44d5e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -275,7 +275,7 @@
</replaceregexp>
<replaceregexp byline="true">
- <regexp pattern="\. "\$\{SCRIPTS_HOME\}"/include/target-classpath.sh(\s*#.*)?" />
+ <regexp pattern="\. "\$\{SCRIPTS_HOME\}"/include/build-classpath.sh(\s*#.*)?" />
<substitution expression="" />
<fileset dir="${basedir}/target/release-package/bin">
<include name="**/*.sh" />
@@ -283,7 +283,7 @@
</replaceregexp>
<replaceregexp byline="true">
- <regexp pattern="call "%SCRIPTS_HOME%\\include\\target-classpath.bat"(\s*&::.*)?" />
+ <regexp pattern="call "%SCRIPTS_HOME%\\include\\build-classpath.bat"(\s*&::.*)?" />
<substitution expression="" />
<fileset dir="${basedir}/target/release-package/bin">
<include name="**/*.bat" />
[22/50] incubator-ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-sprint-5' into ignite-835
Posted by an...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-5' into ignite-835
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/96ff8f2f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/96ff8f2f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/96ff8f2f
Branch: refs/heads/ignite-843
Commit: 96ff8f2fc6521f55300ab634584f8f25c6edfdf2
Parents: 9e670b8 bbc21a6
Author: sboikov <sb...@gridgain.com>
Authored: Wed May 13 11:23:20 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed May 13 11:23:20 2015 +0300
----------------------------------------------------------------------
bin/include/functions.sh | 2 +-
.../internal/direct/DirectByteBufferStream.java | 4 +-
.../eventstorage/GridEventStorageManager.java | 5 +-
.../processors/cache/GridCacheMvccManager.java | 4 +-
.../cache/distributed/dht/GridDhtTxLocal.java | 32 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 27 +
.../cache/distributed/dht/GridDhtTxMapping.java | 2 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 81 +-
.../colocated/GridDhtColocatedLockFuture.java | 25 +-
.../colocated/GridDhtDetachedCacheEntry.java | 4 +-
.../distributed/near/GridNearCacheEntry.java | 4 +-
.../distributed/near/GridNearLockFuture.java | 5 -
.../near/GridNearOptimisticTxPrepareFuture.java | 779 +++++++++++++
.../GridNearPessimisticTxPrepareFuture.java | 349 ++++++
.../cache/distributed/near/GridNearTxLocal.java | 84 +-
.../near/GridNearTxPrepareFuture.java | 1050 ------------------
.../near/GridNearTxPrepareFutureAdapter.java | 226 ++++
.../cache/transactions/IgniteInternalTx.java | 4 +-
.../cache/transactions/IgniteTxAdapter.java | 2 +-
.../cache/transactions/IgniteTxHandler.java | 68 +-
.../transactions/IgniteTxLocalAdapter.java | 2 +-
.../cache/transactions/IgniteTxManager.java | 12 +-
.../ignite/internal/util/IgniteUtils.java | 4 +-
.../GridCacheAbstractFailoverSelfTest.java | 8 +-
.../GridCacheAbstractNodeRestartSelfTest.java | 11 +-
.../distributed/IgniteTxGetAfterStopTest.java | 131 +++
...ePrimaryNodeFailureRecoveryAbstractTest.java | 4 +-
...idCacheAtomicReplicatedFailoverSelfTest.java | 6 +
.../GridCacheReplicatedFailoverSelfTest.java | 6 +
.../GridCacheReplicatedNodeRestartSelfTest.java | 80 ++
.../IgniteCacheFailoverTestSuite.java | 10 +-
.../testsuites/IgniteCacheRestartTestSuite.java | 8 +-
.../testsuites/IgniteCacheTestSuite3.java | 2 +
33 files changed, 1765 insertions(+), 1276 deletions(-)
----------------------------------------------------------------------
[14/50] incubator-ignite git commit: # ignite-835
Posted by an...@apache.org.
# ignite-835
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ade75f94
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ade75f94
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ade75f94
Branch: refs/heads/ignite-843
Commit: ade75f94f1bb63b13cd3cb997cc7820541994858
Parents: 08360c9
Author: sboikov <sb...@gridgain.com>
Authored: Tue May 12 16:55:43 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue May 12 16:55:43 2015 +0300
----------------------------------------------------------------------
.../distributed/dht/GridDhtTransactionalCacheAdapter.java | 9 ++++-----
.../cache/distributed/GridCacheLockAbstractTest.java | 2 --
2 files changed, 4 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ade75f94/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
index 87026f3..068e8b2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
@@ -174,7 +174,7 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
// Invalidate key in near cache, if any.
if (isNearEnabled(cacheCfg))
- obsoleteNearEntry(key, req.version());
+ obsoleteNearEntry(key);
break;
}
@@ -291,7 +291,7 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
// Invalidate key in near cache, if any.
if (isNearEnabled(cacheCfg))
- obsoleteNearEntry(key, req.version());
+ obsoleteNearEntry(key);
if (tx != null) {
tx.clearEntry(txKey);
@@ -1481,12 +1481,11 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
/**
* @param key Key
- * @param ver Version.
*/
- private void obsoleteNearEntry(KeyCacheObject key, GridCacheVersion ver) {
+ private void obsoleteNearEntry(KeyCacheObject key) {
GridCacheEntryEx nearEntry = near().peekEx(key);
if (nearEntry != null)
- nearEntry.markObsolete(ver);
+ nearEntry.markObsolete(ctx.versions().next());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ade75f94/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java
index ab0f7d0..2fe76e7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java
@@ -501,8 +501,6 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
* @throws Throwable If failed.
*/
public void testLockReentrancy() throws Throwable {
- fail("https://issues.apache.org/jira/browse/IGNITE-835");
-
Affinity<Integer> aff = ignite1.affinity(null);
for (int i = 10; i < 100; i++) {
[36/50] incubator-ignite git commit: # ignite-sprint-5 - fixed
comment.
Posted by an...@apache.org.
# ignite-sprint-5 - fixed comment.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7e599b61
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7e599b61
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7e599b61
Branch: refs/heads/ignite-843
Commit: 7e599b61d57754623de46aa4dd8407871a36f08c
Parents: d21bc30
Author: Dmitiry Setrakyan <ds...@gridgain.com>
Authored: Wed May 13 16:55:45 2015 -0700
Committer: Dmitiry Setrakyan <ds...@gridgain.com>
Committed: Wed May 13 16:55:45 2015 -0700
----------------------------------------------------------------------
bin/ignite.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e599b61/bin/ignite.sh
----------------------------------------------------------------------
diff --git a/bin/ignite.sh b/bin/ignite.sh
index ee92d27..660a80f 100755
--- a/bin/ignite.sh
+++ b/bin/ignite.sh
@@ -58,7 +58,7 @@ fi
# Set IGNITE_LIBS.
#
. "${SCRIPTS_HOME}"/include/setenv.sh
-. "${SCRIPTS_HOME}"/include/build-classpath.sh # Will be removed in release.
+. "${SCRIPTS_HOME}"/include/build-classpath.sh # Will be removed in the binary release.
CP="${IGNITE_LIBS}"
RANDOM_NUMBER=$("$JAVA" -cp "${CP}" org.apache.ignite.startup.cmdline.CommandLineRandomNumberGenerator)
[31/50] incubator-ignite git commit: Merge remote-tracking branch
'origin/ignite-sprint-5' into ignite-sprint-5
Posted by an...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-5' into ignite-sprint-5
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ba0caa1f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ba0caa1f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ba0caa1f
Branch: refs/heads/ignite-843
Commit: ba0caa1fcf032c0a6c8690043c3508bef05ef72d
Parents: 87e5a3f d87f6d6
Author: avinogradov <av...@gridgain.com>
Authored: Wed May 13 18:56:39 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Wed May 13 18:56:39 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheContext.java | 7 +
.../processors/cache/GridCacheMapEntry.java | 70 ++++---
.../distributed/dht/GridDhtCacheAdapter.java | 16 +-
.../dht/GridDhtOffHeapCacheEntry.java | 63 ++++++
.../dht/GridDhtTransactionalCacheAdapter.java | 9 +-
.../distributed/dht/GridNoStorageCacheMap.java | 4 +-
.../dht/atomic/GridDhtAtomicCache.java | 3 +
.../atomic/GridDhtAtomicOffHeapCacheEntry.java | 63 ++++++
.../dht/colocated/GridDhtColocatedCache.java | 5 +-
.../GridDhtColocatedOffHeapCacheEntry.java | 63 ++++++
.../distributed/near/GridNearCacheAdapter.java | 3 +
.../near/GridNearOffHeapCacheEntry.java | 60 ++++++
.../cache/local/GridLocalCacheEntry.java | 18 ++
.../cache/CacheOffheapMapEntrySelfTest.java | 168 ++++++++++++++++
.../distributed/GridCacheLockAbstractTest.java | 2 -
...achePartitionedNearDisabledLockSelfTest.java | 47 +++++
.../GridCacheReplicatedLockSelfTest.java | 5 +
.../discovery/tcp/TcpDiscoveryRestartTest.java | 199 +++++++++++++++++++
.../testsuites/IgniteCacheTestSuite2.java | 1 +
.../testsuites/IgniteCacheTestSuite4.java | 2 +
20 files changed, 770 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
[30/50] incubator-ignite git commit: ignite-768 to be fixed test
improved
Posted by an...@apache.org.
ignite-768 to be fixed test improved
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/87e5a3f9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/87e5a3f9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/87e5a3f9
Branch: refs/heads/ignite-843
Commit: 87e5a3f9f81f5c06abaca66dce33c9f83e632f4d
Parents: 5f8925b
Author: avinogradov <av...@gridgain.com>
Authored: Wed May 13 18:56:08 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Wed May 13 18:56:08 2015 +0300
----------------------------------------------------------------------
.../GridCacheLocalIsolatedNodesSelfTest.java | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/87e5a3f9/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalIsolatedNodesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalIsolatedNodesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalIsolatedNodesSelfTest.java
index dbfdc86..ee42ddb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalIsolatedNodesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalIsolatedNodesSelfTest.java
@@ -40,7 +40,7 @@ public class GridCacheLocalIsolatedNodesSelfTest extends GridCommonAbstractTest
/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
- startGrids(2);
+ startGrids(3);
}
/** {@inheritDoc} */
@@ -59,7 +59,11 @@ public class GridCacheLocalIsolatedNodesSelfTest extends GridCommonAbstractTest
Ignite g2 = grid(1);
UUID nid2 = g2.cluster().localNode().id();
+ Ignite g3 = grid(2);
+ UUID nid3 = g3.cluster().localNode().id();
+
assert !nid1.equals(nid2);
+ assert !nid1.equals(nid3);
// Local cache on first node only.
CacheConfiguration<String, String> ccfg1 = new CacheConfiguration<>("A");
@@ -77,8 +81,20 @@ public class GridCacheLocalIsolatedNodesSelfTest extends GridCommonAbstractTest
IgniteCache<String, String> c2 = g2.createCache(ccfg2);
c2.put("g2", "c2");
+ // Local cache on third node only.
+ CacheConfiguration<String, String> ccfg3 = new CacheConfiguration<>("A");
+ ccfg3.setCacheMode(LOCAL);
+ ccfg3.setNodeFilter(new NodeIdFilter(nid3));
+
+ IgniteCache<String, String> c3 = g3.createCache(ccfg3);
+ c3.put("g3", "c3");
+
assertNull(c1.get("g2"));
+ assertNull(c1.get("g3"));
assertNull(c2.get("g1"));
+ assertNull(c2.get("g3"));
+ assertNull(c3.get("g1"));
+ assertNull(c3.get("g2"));
}
/** Filter by node ID. */
[18/50] incubator-ignite git commit: ignite-676: Fix ignite Start
Nodes on public TC
Posted by an...@apache.org.
ignite-676: Fix ignite Start Nodes on public TC
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3861fbda
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3861fbda
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3861fbda
Branch: refs/heads/ignite-843
Commit: 3861fbda0e54be505edc6dc5993edc4d70f16d59
Parents: f027ac5
Author: Artem Shutak <as...@gridgain.com>
Authored: Tue May 12 20:32:46 2015 +0300
Committer: Artem Shutak <as...@gridgain.com>
Committed: Tue May 12 20:32:46 2015 +0300
----------------------------------------------------------------------
bin/include/functions.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3861fbda/bin/include/functions.sh
----------------------------------------------------------------------
diff --git a/bin/include/functions.sh b/bin/include/functions.sh
index f0430c1..b18b150 100755
--- a/bin/include/functions.sh
+++ b/bin/include/functions.sh
@@ -34,7 +34,7 @@
checkJava() {
# Check JAVA_HOME.
if [ "$JAVA_HOME" = "" ]; then
- JAVA=`which java`
+ JAVA=`type -p java`
RETCODE=$?
if [ $RETCODE -ne 0 ]; then