You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/04/07 10:45:13 UTC
[01/50] [abbrv] incubator-ignite git commit: # IGNITE-593 WIP.
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-665 e16c671e4 -> dfd748ba1
# IGNITE-593 WIP.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b6c605c1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b6c605c1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b6c605c1
Branch: refs/heads/ignite-665
Commit: b6c605c118b511f4191fd70825013c842a1d3a8c
Parents: 903bbdd
Author: AKuznetsov <ak...@gridgain.com>
Authored: Mon Apr 6 17:39:16 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Mon Apr 6 17:39:16 2015 +0700
----------------------------------------------------------------------
.../VisorCacheConfigurationCollectorJob.java | 8 +++--
.../VisorCacheConfigurationCollectorTask.java | 26 ++------------
.../visor/node/VisorGridConfiguration.java | 38 --------------------
.../commands/cache/VisorCacheCommand.scala | 25 +++++++------
4 files changed, 22 insertions(+), 75 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b6c605c1/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorJob.java
index aee75f6..ef12424 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorJob.java
@@ -28,8 +28,8 @@ import java.util.*;
/**
* Job that collect cache metrics from node.
*/
-public class VisorCacheConfigurationCollectorJob extends VisorJob<Collection<IgniteUuid>,
- Map<IgniteUuid, VisorCacheConfiguration>> {
+public class VisorCacheConfigurationCollectorJob
+ extends VisorJob<Collection<IgniteUuid>, Map<IgniteUuid, VisorCacheConfiguration>> {
/** */
private static final long serialVersionUID = 0L;
@@ -47,12 +47,14 @@ public class VisorCacheConfigurationCollectorJob extends VisorJob<Collection<Ign
@Override protected Map<IgniteUuid, VisorCacheConfiguration> run(Collection<IgniteUuid> arg) {
Collection<GridCacheAdapter<?, ?>> caches = ignite.context().cache().internalCaches();
+ boolean all = arg == null || arg.isEmpty();
+
Map<IgniteUuid, VisorCacheConfiguration> res = U.newHashMap(caches.size());
for (GridCacheAdapter<?, ?> cache : caches) {
IgniteUuid deploymentId = cache.context().dynamicDeploymentId();
- if (arg.contains(deploymentId))
+ if (all || arg.contains(deploymentId))
res.put(deploymentId, config(cache.configuration()));
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b6c605c1/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorTask.java
index 9552c86..53d1105 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorTask.java
@@ -17,13 +17,9 @@
package org.apache.ignite.internal.visor.cache;
-import org.apache.ignite.*;
-import org.apache.ignite.compute.*;
import org.apache.ignite.internal.processors.task.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.internal.visor.*;
import org.apache.ignite.lang.*;
-import org.jetbrains.annotations.*;
import java.util.*;
@@ -31,8 +27,8 @@ import java.util.*;
* Task that collect cache metrics from all nodes.
*/
@GridInternal
-public class VisorCacheConfigurationCollectorTask extends VisorMultiNodeTask<Collection<IgniteUuid>,
- Map<UUID, Map<IgniteUuid, VisorCacheConfiguration>>, Map<IgniteUuid, VisorCacheConfiguration>> {
+public class VisorCacheConfigurationCollectorTask
+ extends VisorOneNodeTask<Collection<IgniteUuid>, Collection<VisorCacheConfiguration>> {
/** */
private static final long serialVersionUID = 0L;
@@ -40,22 +36,4 @@ public class VisorCacheConfigurationCollectorTask extends VisorMultiNodeTask<Col
@Override protected VisorCacheConfigurationCollectorJob job(Collection<IgniteUuid> arg) {
return new VisorCacheConfigurationCollectorJob(arg, debug);
}
-
- /** {@inheritDoc} */
- @Nullable @Override protected Map<UUID, Map<IgniteUuid, VisorCacheConfiguration>> reduce0(
- List<ComputeJobResult> results)
- throws IgniteException {
- Map<UUID, Map<IgniteUuid, VisorCacheConfiguration>> taskRes = U.newHashMap(results.size());
-
- for (ComputeJobResult jobRes : results) {
- if (jobRes.getException() != null)
- throw jobRes.getException();
-
- Map<IgniteUuid, VisorCacheConfiguration> ccfgs = jobRes.getData();
-
- taskRes.put(jobRes.getNode().id(), ccfgs);
- }
-
- return taskRes;
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b6c605c1/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
index 6548d07..002596b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
@@ -21,7 +21,6 @@ import org.apache.ignite.*;
import org.apache.ignite.configuration.*;
import org.apache.ignite.internal.*;
import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.internal.visor.cache.*;
import java.io.*;
import java.util.*;
@@ -68,9 +67,6 @@ public class VisorGridConfiguration implements Serializable {
/** User attributes. */
private Map<String, ?> userAttrs;
- /** Caches. */
- private Iterable<VisorCacheConfiguration> caches;
-
/** Igfss. */
private Iterable<VisorIgfsConfiguration> igfss;
@@ -106,7 +102,6 @@ public class VisorGridConfiguration implements Serializable {
inclEvtTypes = c.getIncludeEventTypes();
rest = VisorRestConfiguration.from(c);
userAttrs = c.getUserAttributes();
- caches = collectCaches(ignite, c.getCacheConfiguration());
igfss = VisorIgfsConfiguration.list(c.getFileSystemConfiguration());
env = new HashMap<>(System.getenv());
sysProps = IgniteSystemProperties.snapshot();
@@ -194,39 +189,6 @@ public class VisorGridConfiguration implements Serializable {
}
/**
- * @return List of data transfer objects for caches.
- */
- private Iterable<VisorCacheConfiguration> collectCaches(IgniteEx ignite, CacheConfiguration[] ccfgs) {
- if (ccfgs == null)
- return Collections.emptyList();
-
- final Collection<VisorCacheConfiguration> res = new ArrayList<>(ccfgs.length);
-
- for (CacheConfiguration ccfg : ccfgs)
- res.add(collectCache(ignite, ccfg));
-
- return res;
- }
-
- /**
- * Create data transfer object for cache configuration.
- *
- * @param ignite Ignite instance.
- * @param ccfg Cache configuration.
- * @return Data transfer objects for cache
- */
- protected VisorCacheConfiguration collectCache(IgniteEx ignite, CacheConfiguration ccfg) {
- return new VisorCacheConfiguration().from(ignite, ccfg);
- }
-
- /**
- * @return Caches.
- */
- public Iterable<VisorCacheConfiguration> caches() {
- return caches;
- }
-
- /**
* @return Igfss.
*/
public Iterable<VisorIgfsConfiguration> igfss() {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b6c605c1/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
index 539d3d2..2d7e14b 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
@@ -20,14 +20,15 @@ package org.apache.ignite.visor.commands.cache
import org.apache.ignite._
import org.apache.ignite.cluster.ClusterNode
import org.apache.ignite.internal.util.typedef._
+import java.util
+
import org.apache.ignite.internal.visor.cache._
-import org.apache.ignite.internal.visor.node.{VisorGridConfiguration, VisorNodeConfigurationCollectorTask}
import org.apache.ignite.internal.visor.util.VisorTaskUtils._
-import org.apache.ignite.lang.IgniteBiTuple
+import org.apache.ignite.lang.{IgniteUuid, IgniteBiTuple}
import org.jetbrains.annotations._
import java.lang.{Boolean => JavaBoolean}
-import java.util.UUID
+import java.util.{Collections, UUID}
import org.apache.ignite.visor.VisorTag
import org.apache.ignite.visor.commands.cache.VisorCacheCommand._
@@ -385,13 +386,13 @@ class VisorCacheCommand {
println(" Total number of executions: " + ad.execsQuery)
println(" Total number of failures: " + ad.failsQuery)
- gCfg.foreach(_.caches().find(_.name() == ad.cacheName()).foreach(cfg => {
- nl()
+ gCfg.foreach(ccfgs => ccfgs.find(ccfg => safeEquals(ccfg.name(), ad.cacheName()))
+ .foreach(cfg => {
+ nl()
- showCacheConfiguration("Cache configuration:", cfg)
+ showCacheConfiguration("Cache configuration:", cfg)
}))
})
-
}
else
println("\nUse \"-a\" flag to see detailed statistics.")
@@ -464,10 +465,14 @@ class VisorCacheCommand {
* @param node Specified node.
* @return Grid configuration for specified node.
*/
- private def config(node: ClusterNode): VisorGridConfiguration = {
- try
+ private def config(node: ClusterNode) = {
+ try {
+ val z = Collections.emptySet()[IgniteUuid]
+
ignite.compute(ignite.cluster.forNode(node)).withNoFailover()
- .execute(classOf[VisorNodeConfigurationCollectorTask], emptyTaskArgument(node.id()))
+ .execute(classOf[VisorCacheConfigurationCollectorTask],
+ toTaskArgument(node.id(), z.asInstanceOf[util.Collection[IgniteUuid]]))
+ }
catch {
case e: IgniteException =>
scold(e.getMessage)
[18/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'origin/ignite-sprint-3' into ignite-sprint-3
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-3' into ignite-sprint-3
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7e6d1934
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7e6d1934
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7e6d1934
Branch: refs/heads/ignite-665
Commit: 7e6d1934dbe25d501bd6023ec875bb0bf9e53745
Parents: 2f34c46 888cff5
Author: S.Vladykin <sv...@gridgain.com>
Authored: Mon Apr 6 17:41:35 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Mon Apr 6 17:41:35 2015 +0300
----------------------------------------------------------------------
pom.xml | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
[04/50] [abbrv] incubator-ignite git commit: ignite-678
Posted by sb...@apache.org.
ignite-678
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5c575f6f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5c575f6f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5c575f6f
Branch: refs/heads/ignite-665
Commit: 5c575f6fdfeae91e075c9b7f74d46850bbf1b8b5
Parents: ec153ea
Author: avinogradov <av...@gridgain.com>
Authored: Mon Apr 6 14:02:27 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Mon Apr 6 14:02:27 2015 +0300
----------------------------------------------------------------------
pom.xml | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c575f6f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 5390fe5..cd2d723 100644
--- a/pom.xml
+++ b/pom.xml
@@ -100,6 +100,9 @@
<profile>
<id>dev-libs</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
<build>
<plugins>
<plugin>
[15/50] [abbrv] incubator-ignite git commit: ignite-678 fix
Posted by sb...@apache.org.
ignite-678 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/5e84cda6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5e84cda6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5e84cda6
Branch: refs/heads/ignite-665
Commit: 5e84cda6cdc82c0471e991a2e2154d947341ba0e
Parents: af5c9d3
Author: avinogradov <av...@gridgain.com>
Authored: Mon Apr 6 17:26:15 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Mon Apr 6 17:26:15 2015 +0300
----------------------------------------------------------------------
pom.xml | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5e84cda6/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index cd2d723..bc58e04 100644
--- a/pom.xml
+++ b/pom.xml
@@ -494,6 +494,7 @@
</execution>
</executions>
<configuration>
+ <failOnError>false</failOnError>
<fileSets>
<fileSet>
<directory>target</directory>
@@ -522,6 +523,7 @@
</goals>
<phase>deploy</phase>
<configuration>
+ <failOnError>false</failOnError>
<target>
<zip destfile="${basedir}/target/sources-pack-${project.version}.zip" encoding="UTF-8">
<zipfileset dir="${basedir}/target" prefix="sources-pack-${project.version}">
[28/50] [abbrv] incubator-ignite git commit: Merge branches
'ignite-593' and 'ignite-sprint-3' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-593
Posted by sb...@apache.org.
Merge branches 'ignite-593' and 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-593
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f7cfc366
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f7cfc366
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f7cfc366
Branch: refs/heads/ignite-665
Commit: f7cfc366044ac91f3a264138ce132cc9e3d9ec39
Parents: 5397a41 f2b40c1
Author: AKuznetsov <ak...@gridgain.com>
Authored: Mon Apr 6 23:12:45 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Mon Apr 6 23:12:45 2015 +0700
----------------------------------------------------------------------
.../ignite/internal/util/IgniteUtils.java | 46 ++++++++++++++++++--
pom.xml | 2 +-
2 files changed, 43 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
[07/50] [abbrv] incubator-ignite git commit: ignite-667
Posted by sb...@apache.org.
ignite-667
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/aae951e7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/aae951e7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/aae951e7
Branch: refs/heads/ignite-665
Commit: aae951e7703a559685fc1d1f26d841b40eacb29c
Parents: 5c575f6
Author: avinogradov <av...@gridgain.com>
Authored: Mon Apr 6 14:52:31 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Mon Apr 6 14:52:31 2015 +0300
----------------------------------------------------------------------
parent/pom.xml | 49 +++++++++++++++++++------------------------------
1 file changed, 19 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aae951e7/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 8affeef..5ba2437 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -535,6 +535,25 @@
</execution>
</executions>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>module-javadoc</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <phase>install</phase>
+ <configuration>
+ <stylesheetfile>
+ ${project.basedir}/${project.parent.relativePath}/../assembly/docfiles/javadoc.css
+ </stylesheetfile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
@@ -644,36 +663,6 @@
</profile>
<profile>
- <id>release</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- <jdk>[1.8,)</jdk>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <executions>
- <execution>
- <id>module-javadoc</id>
- <goals>
- <goal>jar</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <stylesheetfile>
- ${project.basedir}/${project.parent.relativePath}/../assembly/docfiles/javadoc.css
- </stylesheetfile>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <profile>
<id>surefire-fork-count-1</id>
<activation>
<property>
[35/50] [abbrv] incubator-ignite git commit: Merge branches
'ignite-564' and 'ignite-sprint-3' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-564
Posted by sb...@apache.org.
Merge branches 'ignite-564' and 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-564
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/975b47c4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/975b47c4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/975b47c4
Branch: refs/heads/ignite-665
Commit: 975b47c4e9b6543649f00e0d1a30b860ffa793f1
Parents: f14e0f2 5a2b46c
Author: Andrey Novikov <an...@gridgain.com>
Authored: Tue Apr 7 10:15:57 2015 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Tue Apr 7 10:15:57 2015 +0700
----------------------------------------------------------------------
.../cache/eviction/fifo/FifoEvictionPolicy.java | 58 ++-
.../eviction/fifo/FifoEvictionPolicyMBean.java | 16 +
.../org/apache/ignite/stream/StreamVisitor.java | 2 +-
.../eviction/GridCacheEvictionAbstractTest.java | 5 +-
...ridCacheFifoBatchEvictionPolicySelfTest.java | 385 +++++++++++++++++++
pom.xml | 59 ++-
6 files changed, 508 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
[13/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'remotes/origin/ignite-gg-9966' into ignite-sprint-3
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-gg-9966' into ignite-sprint-3
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/60aaaaa0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/60aaaaa0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/60aaaaa0
Branch: refs/heads/ignite-665
Commit: 60aaaaa08b1b6b7a15de11e533081dc444b5226e
Parents: 5421701 2f1ecc5
Author: ivasilinets <iv...@gridgain.com>
Authored: Mon Apr 6 16:31:26 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Mon Apr 6 16:31:26 2015 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/GridComponent.java | 2 +-
.../ignite/internal/GridKernalContextImpl.java | 3 +-
.../ignite/internal/GridPluginComponent.java | 4 +-
.../org/apache/ignite/internal/IgniteEx.java | 7 --
.../apache/ignite/internal/IgniteKernal.java | 25 +----
.../ignite/internal/IgniteNodeAttributes.java | 3 -
.../internal/managers/GridManagerAdapter.java | 6 +-
.../processors/GridProcessorAdapter.java | 2 +-
.../processors/cache/GridCacheProcessor.java | 6 +-
.../DiscoveryNodeValidationProcessor.java | 27 +++++
.../OsDiscoveryNodeValidationProcessor.java | 72 +++++++++++++
.../ignite/spi/IgniteNodeValidationResult.java | 66 ++++++++++++
.../org/apache/ignite/spi/IgniteSpiAdapter.java | 2 +-
.../org/apache/ignite/spi/IgniteSpiContext.java | 2 +-
.../spi/IgniteSpiNodeValidationResult.java | 66 ------------
.../spi/discovery/tcp/TcpDiscoverySpi.java | 106 +------------------
.../testframework/GridSpiTestContext.java | 2 +-
.../HadoopDefaultMapReducePlannerSelfTest.java | 5 -
18 files changed, 186 insertions(+), 220 deletions(-)
----------------------------------------------------------------------
[48/50] [abbrv] incubator-ignite git commit: # sprint-3 - Updated
streaming examples.
Posted by sb...@apache.org.
# sprint-3 - Updated streaming 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/bfcba3b8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/bfcba3b8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/bfcba3b8
Branch: refs/heads/ignite-665
Commit: bfcba3b8a9325250baec2b977245a7e052c983ae
Parents: f76dc00
Author: Dmitiry Setrakyan <ds...@gridgain.com>
Authored: Tue Apr 7 00:59:37 2015 -0700
Committer: Dmitiry Setrakyan <ds...@gridgain.com>
Committed: Tue Apr 7 00:59:37 2015 -0700
----------------------------------------------------------------------
.../org/apache/ignite/examples/streaming/StreamVisitorExample.java | 2 +-
.../ignite/examples/java8/streaming/StreamVisitorExample.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bfcba3b8/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 9d22e7c..01259ff 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
@@ -157,7 +157,7 @@ public class StreamVisitorExample {
}
/**
- * Updates this instrument based on the latest price.
+ * Updates this instrument based on the latest market tick price.
*
* @param price Latest price.
*/
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bfcba3b8/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java
index 454fb6e..3e161dd 100644
--- a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java
@@ -154,7 +154,7 @@ public class StreamVisitorExample {
}
/**
- * Updates this instrument based on the latest price.
+ * Updates this instrument based on the latest market tick price.
*
* @param price Latest price.
*/
[26/50] [abbrv] incubator-ignite git commit: ignite-678
Posted by sb...@apache.org.
ignite-678
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ddaede6a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ddaede6a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ddaede6a
Branch: refs/heads/ignite-665
Commit: ddaede6a1d34dc71a4ffb6a31786e0bef67e97be
Parents: 7e07b90
Author: avinogradov <av...@gridgain.com>
Authored: Mon Apr 6 19:08:10 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Mon Apr 6 19:08:10 2015 +0300
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ddaede6a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index bc58e04..92a85a7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -497,7 +497,7 @@
<failOnError>false</failOnError>
<fileSets>
<fileSet>
- <directory>target</directory>
+ <directory>${basedir}/target</directory>
<includes>
<include>ignite-${project.version}-source-release.zip</include>
</includes>
[19/50] [abbrv] incubator-ignite git commit: sprint-3 dependency fix
Posted by sb...@apache.org.
sprint-3 dependency 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/7e07b908
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7e07b908
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7e07b908
Branch: refs/heads/ignite-665
Commit: 7e07b90825a4a95789c87033023a77084ba0dcd2
Parents: 7e6d193
Author: avinogradov <av...@gridgain.com>
Authored: Mon Apr 6 18:26:36 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Mon Apr 6 18:26:36 2015 +0300
----------------------------------------------------------------------
modules/schedule/pom.xml | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e07b908/modules/schedule/pom.xml
----------------------------------------------------------------------
diff --git a/modules/schedule/pom.xml b/modules/schedule/pom.xml
index af1f000..fe11f3f 100644
--- a/modules/schedule/pom.xml
+++ b/modules/schedule/pom.xml
@@ -53,5 +53,25 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>${spring.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${spring.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
[22/50] [abbrv] incubator-ignite git commit: merging ignite-479
Posted by sb...@apache.org.
merging ignite-479
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/1aaa0b09
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/1aaa0b09
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/1aaa0b09
Branch: refs/heads/ignite-665
Commit: 1aaa0b09698d24380160e200fa03ab36feea1f34
Parents: 7e6d193
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Mon Apr 6 18:53:18 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Mon Apr 6 18:53:18 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/util/IgniteUtils.java | 41 +++++++++++++++++++-
.../hadoop/HadoopCommandLineTest.java | 3 +-
2 files changed, 41 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1aaa0b09/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 8aebac2..8a982bc 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
@@ -964,6 +964,14 @@ public abstract class IgniteUtils {
public static void dumpThreads(@Nullable IgniteLogger log) {
ThreadMXBean mxBean = ManagementFactory.getThreadMXBean();
+ final Set<Long> deadlockedThreadsIds = getDeadlockedThreadIds(mxBean);
+
+ if (deadlockedThreadsIds.size() == 0)
+ warn(log, "No deadlocked threads detected.");
+ else
+ warn(log, "Deadlocked threads detected (see thread dump below) " +
+ "[deadlockedThreadsCnt=" + deadlockedThreadsIds.size() + ']');
+
ThreadInfo[] threadInfos =
mxBean.dumpAllThreads(mxBean.isObjectMonitorUsageSupported(), mxBean.isSynchronizerUsageSupported());
@@ -971,7 +979,7 @@ public abstract class IgniteUtils {
.a(new SimpleDateFormat("yyyy/MM/dd HH:mm:ss z").format(new Date(U.currentTimeMillis()))).a(NL);
for (ThreadInfo info : threadInfos) {
- printThreadInfo(info, sb);
+ printThreadInfo(info, sb, deadlockedThreadsIds);
sb.a(NL);
@@ -988,12 +996,41 @@ public abstract class IgniteUtils {
}
/**
+ * Get deadlocks from the thread bean.
+ * @param mxBean the bean
+ * @return the set of deadlocked threads (may be empty Set, but never null).
+ */
+ private static Set<Long> getDeadlockedThreadIds(ThreadMXBean mxBean) {
+ final long[] deadlockedIds = mxBean.findDeadlockedThreads();
+
+ final Set<Long> deadlockedThreadsIds;
+
+ if (!F.isEmpty(deadlockedIds)) {
+ Set<Long> set = new HashSet<>();
+
+ for (long id : deadlockedIds)
+ set.add(id);
+
+ deadlockedThreadsIds = Collections.unmodifiableSet(set);
+ }
+ else
+ deadlockedThreadsIds = Collections.emptySet();
+
+ return deadlockedThreadsIds;
+ }
+
+ /**
* Prints single thread info to a buffer.
*
* @param threadInfo Thread info.
* @param sb Buffer.
*/
- private static void printThreadInfo(ThreadInfo threadInfo, GridStringBuilder sb) {
+ private static void printThreadInfo(ThreadInfo threadInfo, GridStringBuilder sb, Set<Long> deadlockedIdSet) {
+ final long id = threadInfo.getThreadId();
+
+ if (deadlockedIdSet.contains(id))
+ sb.a("##### DEADLOCKED ");
+
sb.a("Thread [name=\"").a(threadInfo.getThreadName())
.a("\", id=").a(threadInfo.getThreadId())
.a(", state=").a(threadInfo.getThreadState())
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1aaa0b09/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopCommandLineTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopCommandLineTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopCommandLineTest.java
index d10ee5c..f6f7a01 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopCommandLineTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopCommandLineTest.java
@@ -200,7 +200,8 @@ public class HadoopCommandLineTest extends GridCommonAbstractTest {
@Override protected void afterTestsStopped() throws Exception {
super.afterTestsStopped();
- U.delete(testWorkDir);
+ if (testWorkDir != null)
+ U.delete(testWorkDir);
}
/** {@inheritDoc} */
[44/50] [abbrv] incubator-ignite git commit: sprint-3 - Updated
streaming examples.
Posted by sb...@apache.org.
sprint-3 - Updated streaming 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/3c3931f5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3c3931f5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3c3931f5
Branch: refs/heads/ignite-665
Commit: 3c3931f5097c6779e7c3304f81dddb113848b0eb
Parents: 060ccf2
Author: Dmitiry Setrakyan <ds...@gridgain.com>
Authored: Mon Apr 6 23:52:07 2015 -0700
Committer: Dmitiry Setrakyan <ds...@gridgain.com>
Committed: Mon Apr 6 23:52:07 2015 -0700
----------------------------------------------------------------------
DEVNOTES.txt | 2 +-
parent/pom.xml | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3c3931f5/DEVNOTES.txt
----------------------------------------------------------------------
diff --git a/DEVNOTES.txt b/DEVNOTES.txt
index 3726774..041026d 100644
--- a/DEVNOTES.txt
+++ b/DEVNOTES.txt
@@ -35,7 +35,7 @@ To check license headers use:
mvn clean validate -Pcheck-licenses
-For more information (e.g. exclude list) see "check-licenses" profile in pom.xml.
+For more information (e.g. exclude list) see "check-licenses" profile in "parent/pom.xml".
Useful Release Commands
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3c3931f5/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 5ba2437..f24f4ae 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -628,6 +628,7 @@
<exclude>src/test/java/org/apache/ignite/spi/deployment/uri/META-INF/ignite.empty</exclude><!--should be empty-->
<exclude>src/test/java/org/apache/ignite/spi/deployment/uri/META-INF/ignite.brokenxml</exclude><!--test resource-->
<exclude>src/test/java/org/apache/ignite/internal/processors/hadoop/books/*.txt</exclude><!--books examples-->
+ <exclude>examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/*.txt</exclude><!--books examples-->
<exclude>src/main/java/META-INF/services/javax.cache.spi.CachingProvider</exclude><!--cannot be changed-->
<exclude>src/main/java/org/jetbrains/annotations/*.java</exclude><!--copyright-->
<exclude>src/main/resources/META-INF/services/org.apache.hadoop.mapreduce.protocol.ClientProtocolProvider</exclude><!--cannot be changed-->
[25/50] [abbrv] incubator-ignite git commit: Merge branch
'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite
into ignite-665
Posted by sb...@apache.org.
Merge branch 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-665
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/4f492748
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4f492748
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4f492748
Branch: refs/heads/ignite-665
Commit: 4f4927483265d0ee394aabafb00b9809f15edfb5
Parents: e16c671 369a36d
Author: iveselovskiy <iv...@gridgain.com>
Authored: Mon Apr 6 19:03:18 2015 +0300
Committer: iveselovskiy <iv...@gridgain.com>
Committed: Mon Apr 6 19:03:18 2015 +0300
----------------------------------------------------------------------
.gitignore | 2 +-
assembly/release-fabric.xml | 5 -
examples/schema-import/bin/db-init.sql | 17 ++
.../streaming/numbers/StreamRandomNumbers.java | 2 +-
.../streaming/numbers/StreamRandomNumbers.java | 2 +-
modules/clients/readme.md | 2 -
.../configuration/CacheConfiguration.java | 2 +-
.../ignite/events/CacheQueryExecutedEvent.java | 11 +-
.../ignite/events/CacheQueryReadEvent.java | 11 +-
.../ignite/internal/GridCachePluginContext.java | 6 +
.../apache/ignite/internal/GridComponent.java | 2 +-
.../ignite/internal/GridKernalContextImpl.java | 3 +-
.../ignite/internal/GridPluginComponent.java | 4 +-
.../org/apache/ignite/internal/IgniteEx.java | 7 -
.../apache/ignite/internal/IgniteKernal.java | 27 +--
.../ignite/internal/IgniteNodeAttributes.java | 3 -
.../internal/cluster/ClusterGroupAdapter.java | 3 +-
.../internal/managers/GridManagerAdapter.java | 6 +-
.../processors/GridProcessorAdapter.java | 2 +-
.../processors/cache/CacheDistributionMode.java | 67 -------
.../internal/processors/cache/CacheType.java | 77 ++++++++
.../cache/DynamicCacheChangeRequest.java | 17 ++
.../cache/DynamicCacheDescriptor.java | 15 +-
.../processors/cache/GridCacheAdapter.java | 6 +-
.../processors/cache/GridCacheContext.java | 26 ++-
.../cache/GridCacheDeploymentManager.java | 2 +-
.../processors/cache/GridCacheEventManager.java | 4 +-
.../processors/cache/GridCacheMapEntry.java | 4 +-
.../processors/cache/GridCacheProcessor.java | 195 +++++++++++++------
.../cache/GridCacheSharedContext.java | 4 +-
.../dht/GridDhtTransactionalCacheAdapter.java | 4 +-
.../near/GridNearTransactionalCache.java | 2 +-
.../cache/query/GridCacheQueryManager.java | 18 +-
.../continuous/CacheContinuousQueryHandler.java | 4 +-
.../continuous/CacheContinuousQueryManager.java | 2 +-
.../transactions/IgniteTransactionsImpl.java | 19 +-
.../transactions/IgniteTxLocalAdapter.java | 2 +-
.../cache/transactions/IgniteTxManager.java | 8 +-
.../DiscoveryNodeValidationProcessor.java | 27 +++
.../OsDiscoveryNodeValidationProcessor.java | 72 +++++++
.../processors/plugin/CachePluginManager.java | 51 +++--
.../processors/query/GridQueryProcessor.java | 12 +-
.../processors/task/GridTaskProcessor.java | 24 ++-
.../ignite/internal/util/IgniteUtils.java | 46 ++++-
.../internal/visor/util/VisorTaskUtils.java | 18 +-
.../ignite/plugin/CachePluginContext.java | 11 ++
.../ignite/plugin/CachePluginProvider.java | 4 +-
.../org/apache/ignite/plugin/PluginContext.java | 9 +-
.../ignite/spi/IgniteNodeValidationResult.java | 66 +++++++
.../org/apache/ignite/spi/IgniteSpiAdapter.java | 9 +-
.../org/apache/ignite/spi/IgniteSpiContext.java | 2 +-
.../spi/IgniteSpiNodeValidationResult.java | 66 -------
.../communication/tcp/TcpCommunicationSpi.java | 6 +-
.../spi/discovery/tcp/TcpDiscoverySpi.java | 113 +----------
.../cache/IgniteDynamicCacheStartSelfTest.java | 47 ++---
.../cache/IgniteInternalCacheTypesTest.java | 159 +++++++++++++++
.../IgniteCollectionAbstractTest.java | 23 ---
.../IgniteCacheSystemTransactionsSelfTest.java | 3 +-
...GridCacheDhtEvictionNearReadersSelfTest.java | 2 +-
...eAtomicInvalidPartitionHandlingSelfTest.java | 5 +
.../near/GridCacheNearEvictionSelfTest.java | 2 +-
.../near/GridCacheNearReadersSelfTest.java | 2 +-
...ePartitionedBasicStoreMultiNodeSelfTest.java | 8 +-
...NearDisabledBasicStoreMultiNodeSelfTest.java | 8 +-
...ridCacheContinuousQueryAbstractSelfTest.java | 4 +-
.../processors/igfs/IgfsStartCacheTest.java | 158 +++++++++++++++
.../processors/igfs/IgsfStartCacheTest.java | 115 -----------
.../loadtests/hashmap/GridCacheTestContext.java | 1 +
.../ignite/messaging/GridMessagingSelfTest.java | 50 +++++
.../testframework/GridSpiTestContext.java | 2 +-
.../ignite/testsuites/IgniteCacheTestSuite.java | 2 +
.../ignite/testsuites/IgniteIgfsTestSuite.java | 2 +
.../HadoopDefaultMapReducePlannerSelfTest.java | 5 -
.../query/h2/sql/GridSqlQuerySplitter.java | 22 ++-
.../query/h2/twostep/GridMapQueryExecutor.java | 4 +-
.../h2/twostep/GridReduceQueryExecutor.java | 13 +-
.../cache/IgniteCacheAbstractQuerySelfTest.java | 14 +-
...niteCacheAtomicNearEnabledQuerySelfTest.java | 7 +-
.../near/IgniteCacheAtomicQuerySelfTest.java | 7 +-
.../query/h2/sql/GridQueryParsingTest.java | 1 +
.../query/h2/sql/IgniteVsH2QueryTest.java | 7 +
modules/schedule/pom.xml | 20 ++
modules/yardstick/README.md | 3 +-
.../yardstick/IgniteAbstractBenchmark.java | 5 +-
.../yardstick/IgniteBenchmarkArguments.java | 22 ++-
.../org/apache/ignite/yardstick/IgniteNode.java | 11 +-
parent/pom.xml | 50 ++---
pom.xml | 94 ++++++++-
scripts/git-apply-patch.sh | 94 +++++++++
scripts/git-format-patch.sh | 87 +++++++++
scripts/git-patch-functions.sh | 171 ++++++++++++++++
scripts/git-patch-prop.sh | 24 +++
92 files changed, 1674 insertions(+), 709 deletions(-)
----------------------------------------------------------------------
[49/50] [abbrv] incubator-ignite git commit: # ignite-sprint-3 Fixed
build: added missing serialVersionUID.
Posted by sb...@apache.org.
# ignite-sprint-3 Fixed build: added missing serialVersionUID.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d20d29b5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d20d29b5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d20d29b5
Branch: refs/heads/ignite-665
Commit: d20d29b56a085dc61d88ae0792b5b78f4cf98015
Parents: bfcba3b
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Apr 7 15:40:05 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Apr 7 15:40:05 2015 +0700
----------------------------------------------------------------------
.../main/java/org/apache/ignite/cache/affinity/AffinityUuid.java | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d20d29b5/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityUuid.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityUuid.java b/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityUuid.java
index 45f05f0..79ed803 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityUuid.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityUuid.java
@@ -24,6 +24,9 @@ import org.apache.ignite.lang.*;
* Guaranteed unique affinity-based key.
*/
public class AffinityUuid extends AffinityKey<IgniteUuid> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
/**
* Empty constructor.
*/
[34/50] [abbrv] incubator-ignite git commit: # sprint-3 - comment
update
Posted by sb...@apache.org.
# sprint-3 - comment update
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5a2b46c2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5a2b46c2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5a2b46c2
Branch: refs/heads/ignite-665
Commit: 5a2b46c29771a81b04ba2992cdc1a38e2cc31a89
Parents: 8242c15
Author: Dmitiry Setrakyan <ds...@gridgain.com>
Authored: Mon Apr 6 12:49:34 2015 -0700
Committer: Dmitiry Setrakyan <ds...@gridgain.com>
Committed: Mon Apr 6 12:49:34 2015 -0700
----------------------------------------------------------------------
.../core/src/main/java/org/apache/ignite/stream/StreamVisitor.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5a2b46c2/modules/core/src/main/java/org/apache/ignite/stream/StreamVisitor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/StreamVisitor.java b/modules/core/src/main/java/org/apache/ignite/stream/StreamVisitor.java
index b97263f..a87ac94 100644
--- a/modules/core/src/main/java/org/apache/ignite/stream/StreamVisitor.java
+++ b/modules/core/src/main/java/org/apache/ignite/stream/StreamVisitor.java
@@ -25,7 +25,7 @@ import java.util.*;
/**
* Convenience adapter to visit every key-value tuple in the stream. Note, that the visitor
* does not update the cache. If the tuple needs to be stored in the cache,
- * then {@code cache.put(...)} should be called explicitely.
+ * then {@code cache.put(...)} should be called explicitly.
*/
public abstract class StreamVisitor<K, V> implements StreamReceiver<K, V>, IgniteBiInClosure<IgniteCache<K, V>, Map.Entry<K, V>> {
/** */
[32/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'origin/ignite-sprint-3' into ignite-sprint-3
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-3' into ignite-sprint-3
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e6a6b64c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e6a6b64c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e6a6b64c
Branch: refs/heads/ignite-665
Commit: e6a6b64c6731ba6568e74bf1534d64200c46e80e
Parents: 0a8378c f2b40c1
Author: avinogradov <av...@gridgain.com>
Authored: Mon Apr 6 20:20:41 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Mon Apr 6 20:20:41 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/util/IgniteUtils.java | 46 ++++++++++++++++++--
modules/schedule/pom.xml | 20 +++++++++
pom.xml | 2 +-
3 files changed, 63 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e6a6b64c/pom.xml
----------------------------------------------------------------------
diff --cc pom.xml
index 16a2cb0,92a85a7..e1e292c
--- a/pom.xml
+++ b/pom.xml
@@@ -508,9 -497,9 +508,9 @@@
<failOnError>false</failOnError>
<fileSets>
<fileSet>
- <directory>target</directory>
+ <directory>${basedir}/target</directory>
<includes>
- <include>ignite-${project.version}-source-release.zip</include>
+ <include>${project.artifactId}-${project.version}-source-release.zip</include>
</includes>
</fileSet>
</fileSets>
[06/50] [abbrv] incubator-ignite git commit: # IGNITE-540 Remove
temporary code.
Posted by sb...@apache.org.
# IGNITE-540 Remove temporary code.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/39ee7171
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/39ee7171
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/39ee7171
Branch: refs/heads/ignite-665
Commit: 39ee71715228a2fe1557617adc4dee5289b0c221
Parents: 8a5180c
Author: sevdokimov <se...@gridgain.com>
Authored: Mon Apr 6 14:43:08 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Mon Apr 6 14:43:08 2015 +0300
----------------------------------------------------------------------
.../processors/query/h2/twostep/GridReduceQueryExecutor.java | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/39ee7171/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index 7941f12..acdc1bf 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -463,9 +463,6 @@ public class GridReduceQueryExecutor implements GridMessageListener {
if (scale > precision)
precision = scale;
}
- else {
- System.out.println("1");
- }
Column col = new Column(name, type, precision, scale, displaySize);
cols.add(col);
@@ -492,7 +489,7 @@ public class GridReduceQueryExecutor implements GridMessageListener {
Query prepare = (Query)ses.prepare(qry.query(), false);
- ArrayList<Parameter> parsedParams = prepare.getParameters();
+ List<Parameter> parsedParams = prepare.getParameters();
for (int i = Math.min(parsedParams.size(), qry.parameters().length); --i >= 0; ) {
Object val = qry.parameters()[i];
[47/50] [abbrv] incubator-ignite git commit: # sprint-3 - Updated
streaming examples.
Posted by sb...@apache.org.
# sprint-3 - Updated streaming 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/f76dc007
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f76dc007
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f76dc007
Branch: refs/heads/ignite-665
Commit: f76dc007bc9f0ae53f34640b0c1cc66301a04121
Parents: eadb5d5
Author: Dmitiry Setrakyan <ds...@gridgain.com>
Authored: Tue Apr 7 00:58:37 2015 -0700
Committer: Dmitiry Setrakyan <ds...@gridgain.com>
Committed: Tue Apr 7 00:58:37 2015 -0700
----------------------------------------------------------------------
.../ignite/examples/streaming/StreamVisitorExample.java | 7 +------
.../ignite/examples/java8/streaming/StreamVisitorExample.java | 7 +------
2 files changed, 2 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f76dc007/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 16fbf3d..9d22e7c 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
@@ -152,7 +152,7 @@ public class StreamVisitorExample {
/**
* @param symbol Symbol.
*/
- Instrument(String symbol) {
+ public Instrument(String symbol) {
this.symbol = symbol;
}
@@ -167,10 +167,5 @@ public class StreamVisitorExample {
this.latest = price;
}
-
- /** {@inheritDoc} */
- @Override public synchronized String toString() {
- return "Instrument [symbol=" + symbol + ", latest=" + latest + ", change=" + (latest - open) + ']';
- }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f76dc007/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java
index 704c249..454fb6e 100644
--- a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java
@@ -149,7 +149,7 @@ public class StreamVisitorExample {
/**
* @param symbol Symbol.
*/
- Instrument(String symbol) {
+ public Instrument(String symbol) {
this.symbol = symbol;
}
@@ -164,10 +164,5 @@ public class StreamVisitorExample {
this.latest = price;
}
-
- /** {@inheritDoc} */
- @Override public synchronized String toString() {
- return "Instrument [symbol=" + symbol + ", latest=" + latest + ", change=" + (latest - open) + ']';
- }
}
}
[38/50] [abbrv] incubator-ignite git commit: # sprint-3 - Updated
streaming examples.
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/marketdata/CacheConfig.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/marketdata/CacheConfig.java b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/marketdata/CacheConfig.java
deleted file mode 100644
index 5a36838..0000000
--- a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/marketdata/CacheConfig.java
+++ /dev/null
@@ -1,44 +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.java8.streaming.marketdata;
-
-import org.apache.ignite.configuration.*;
-
-/**
- * Configuration for the streaming caches for market data and financial instruments.
- */
-public class CacheConfig {
- /**
- * Configure streaming cache for market ticks.
- */
- public static CacheConfiguration<String, Double> marketTicksCache() {
- return new CacheConfiguration<>("marketTicks");
- }
-
- /**
- * Configure cache for financial instruments.
- */
- public static CacheConfiguration<String, Instrument> instrumentCache() {
- CacheConfiguration<String, Instrument> instCache = new CacheConfiguration<>("instCache");
-
- // Index some fields for querying portfolio positions.
- instCache.setIndexedTypes(String.class, Instrument.class);
-
- return instCache;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/marketdata/Instrument.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/marketdata/Instrument.java b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/marketdata/Instrument.java
deleted file mode 100644
index af9d0bf..0000000
--- a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/marketdata/Instrument.java
+++ /dev/null
@@ -1,106 +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.java8.streaming.marketdata;
-
-import org.apache.ignite.cache.query.annotations.*;
-
-import java.io.*;
-
-/**
- * Financial instrument.
- */
-public class Instrument implements Serializable {
- /** Instrument symbol. */
- @QuerySqlField(index = true)
- private final String symbol;
-
- /** Open price. */
- @QuerySqlField(index = true)
- private double open;
-
- /** High price. */
- private double high;
-
- /** Low price. */
- private double low = Long.MAX_VALUE;
-
- /** Close price. */
- @QuerySqlField(index = true)
- private double latest;
-
- /**
- * @param symbol Symbol.
- */
- Instrument(String symbol) {
- this.symbol = symbol;
- }
-
- /**
- * Updates this instrument based on the latest price.
- *
- * @param price Latest price.
- */
- public void update(double price) {
- if (open == 0)
- open = price;
-
- high = Math.max(high, price);
- low = Math.min(low, price);
- this.latest = price;
- }
-
- /**
- * @return Symbol.
- */
- public String symbol() {
- return symbol;
- }
-
- /**
- * @return Open price.
- */
- public double open() {
- return open;
- }
-
- /**
- * @return High price.
- */
- public double high() {
- return high;
- }
-
- /**
- * @return Low price.
- */
- public double low() {
- return low;
- }
-
- /**
- * @return Close price.
- */
- public double latest() {
- return latest;
- }
-
- /** {@inheritDoc} */
- @Override public synchronized String toString() {
- return "Instrument [symbol=" + symbol + ", latest=" + latest + ", change=" + (latest - open) + ']';
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/marketdata/QueryTopInstruments.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/marketdata/QueryTopInstruments.java b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/marketdata/QueryTopInstruments.java
deleted file mode 100644
index 402e19e..0000000
--- a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/marketdata/QueryTopInstruments.java
+++ /dev/null
@@ -1,73 +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.java8.streaming.marketdata;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.query.*;
-import org.apache.ignite.examples.*;
-
-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 streaming using {@link StreamMarketData}.</li>
- * <li>Start querying top performing instruments using {@link QueryTopInstruments}.</li>
- * </ul>
- * <p>
- * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
- */
-public class QueryTopInstruments {
- public static void main(String[] args) throws Exception {
- // Mark this cluster member as client.
- Ignition.setClientMode(true);
-
- try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
- if (!ExamplesUtils.hasServerNodes(ignite))
- return;
-
- IgniteCache<String, Instrument> instCache = ignite.getOrCreateCache(CacheConfig.instrumentCache());
-
- // Select top 3 instruments.
- SqlFieldsQuery top3qry = new SqlFieldsQuery(
- "select symbol, (latest - open) from Instrument order by (latest - open) desc limit 3");
-
- // Select total profit.
- SqlFieldsQuery profitQry = new SqlFieldsQuery("select sum(latest - open) from Instrument");
-
- // Query top 3 best performing instruments every 5 seconds.
- while (true) {
- // Execute queries.
- List<List<?>> top3 = instCache.query(top3qry).getAll();
- List<List<?>> profit = instCache.query(profitQry).getAll();
-
- List<?> row = profit.get(0);
-
- if (row.get(0) != null)
- System.out.printf("Total profit: %.2f%n", row.get(0));
-
- // Print top 10 words.
- ExamplesUtils.printQueryResults(top3);
-
- Thread.sleep(5000);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/marketdata/StreamMarketData.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/marketdata/StreamMarketData.java b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/marketdata/StreamMarketData.java
deleted file mode 100644
index 1eabfb3..0000000
--- a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/marketdata/StreamMarketData.java
+++ /dev/null
@@ -1,101 +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.java8.streaming.marketdata;
-
-import org.apache.ignite.*;
-import org.apache.ignite.examples.*;
-import org.apache.ignite.stream.*;
-
-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 streaming using {@link StreamMarketData}.</li>
- * <li>Start querying top performing instruments using {@link QueryTopInstruments}.</li>
- * </ul>
- * <p>
- * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
- */
-public class StreamMarketData {
- /** Random number generator. */
- private static final Random RAND = new Random();
-
- /** The list of instruments. */
- private static final String[] INSTRUMENTS = {"IBM", "GOOG", "MSFT", "GE", "EBAY", "YHOO", "ORCL", "CSCO", "AMZN", "RHT"};
-
- /** The list of initial instrument prices. */
- private static final double[] INITIAL_PRICES = {194.9, 893.49, 34.21, 23.24, 57.93, 45.03, 44.41, 28.44, 378.49, 69.50};
-
- public static void main(String[] args) throws Exception {
- // 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<String, Double> mktCache = ignite.getOrCreateCache(CacheConfig.marketTicksCache());
- IgniteCache<String, Instrument> instCache = ignite.getOrCreateCache(CacheConfig.instrumentCache());
-
- try (IgniteDataStreamer<String, Double> mktStmr = ignite.dataStreamer(mktCache.getName())) {
- // Note that we receive market data, but do not populate 'mktCache' (it remains empty).
- // Instead we update the instruments in the 'instCache'.
- mktStmr.receiver(StreamVisitor.from((cache, e) -> {
- String symbol = e.getKey();
- Double tick = e.getValue();
-
- Instrument inst = instCache.get(symbol);
-
- if (inst == null)
- inst = new Instrument(symbol);
-
- // Don't populate market cache, as we don't use it for querying.
- // Update cached instrument based on the latest market tick.
- inst.update(tick);
-
- instCache.put(symbol, inst);
- }));
-
- // Stream market data into market data stream cache.
- while (true) {
- for (int j = 0; j < INSTRUMENTS.length; j++) {
- // Use gaussian distribution to ensure that
- // numbers closer to 0 have higher probability.
- double price = round2(INITIAL_PRICES[j] + RAND.nextGaussian());
-
- mktStmr.addData(INSTRUMENTS[j], price);
- }
- }
- }
- }
- }
-
- /**
- * Rounds double value to two significant signs.
- *
- * @param val value to be rounded.
- * @return rounded double value.
- */
- private static double round2(double val) {
- return Math.floor(100 * val + 0.5) / 100;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/numbers/CacheConfig.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/numbers/CacheConfig.java b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/numbers/CacheConfig.java
deleted file mode 100644
index 4de5fb6..0000000
--- a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/numbers/CacheConfig.java
+++ /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.
- */
-
-package org.apache.ignite.examples.java8.streaming.numbers;
-
-import org.apache.ignite.configuration.*;
-
-import javax.cache.configuration.*;
-import javax.cache.expiry.*;
-
-import static java.util.concurrent.TimeUnit.*;
-
-/**
- * Configuration for the streaming cache to store the stream of random numbers.
- * 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.
- */
-public class CacheConfig {
- /**
- * Configure streaming cache.
- */
- public static CacheConfiguration<Integer, Long> randomNumbersCache() {
- CacheConfiguration<Integer, Long> cfg = new CacheConfiguration<>("randomNumbers");
-
- cfg.setIndexedTypes(Integer.class, Long.class);
-
- // Sliding window of 1 seconds.
- cfg.setExpiryPolicyFactory(FactoryBuilder.factoryOf(new CreatedExpiryPolicy(new Duration(SECONDS, 1))));
-
- return cfg;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/numbers/QueryPopularNumbers.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/numbers/QueryPopularNumbers.java b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/numbers/QueryPopularNumbers.java
deleted file mode 100644
index 98fa410..0000000
--- a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/numbers/QueryPopularNumbers.java
+++ /dev/null
@@ -1,74 +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.java8.streaming.numbers;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.query.*;
-import org.apache.ignite.examples.*;
-
-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 streaming using {@link StreamRandomNumbers}.</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 QueryPopularNumbers {
- public static void main(String[] args) throws Exception {
- // 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());
-
- // Select top 10 words.
- SqlFieldsQuery top10Qry = new SqlFieldsQuery("select _key, _val from Long order by _val desc limit 10");
-
- // Select average, min, and max counts among all the words.
- SqlFieldsQuery statsQry = new SqlFieldsQuery("select avg(_val), min(_val), max(_val) from Long");
-
- // Query top 10 popular numbers every 5 seconds.
- while (true) {
- // Execute queries.
- List<List<?>> top10 = stmCache.query(top10Qry).getAll();
- List<List<?>> stats = stmCache.query(statsQry).getAll();
-
- // Print average count.
- List<?> row = stats.get(0);
-
- if (row.get(0) != null)
- System.out.printf("Query results [avg=%.2f, min=%d, max=%d]%n", row.get(0), row.get(1), row.get(2));
-
- // Print top 10 words.
- ExamplesUtils.printQueryResults(top10);
-
- Thread.sleep(5000);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/numbers/StreamRandomNumbers.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/numbers/StreamRandomNumbers.java b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/numbers/StreamRandomNumbers.java
deleted file mode 100644
index e52b674..0000000
--- a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/numbers/StreamRandomNumbers.java
+++ /dev/null
@@ -1,74 +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.java8.streaming.numbers;
-
-import org.apache.ignite.*;
-import org.apache.ignite.examples.*;
-import org.apache.ignite.stream.*;
-
-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 streaming using {@link StreamRandomNumbers}.</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 StreamRandomNumbers {
- /** Random number generator. */
- private static final Random RAND = new Random();
-
- /** Range within which to generate numbers. */
- private static final int RANGE = 1000;
-
- public static void main(String[] args) throws Exception {
- // 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 number.
- stmr.receiver(StreamTransformer.from((e, arg) -> {
- Long val = e.getValue();
-
- e.setValue(val == null ? 1L : val + 1);
-
- return null;
- }));
-
- // Stream random numbers into the streamer cache.
- while (true)
- stmr.addData(RAND.nextInt(RANGE), 1L);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/transformers/StreamTransformerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/transformers/StreamTransformerExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/transformers/StreamTransformerExample.java
new file mode 100644
index 0000000..4ea1245
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/transformers/StreamTransformerExample.java
@@ -0,0 +1,97 @@
+/*
+ * 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.java8.streaming.transformers;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.examples.*;
+import org.apache.ignite.stream.*;
+
+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 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. */
+ private static final Random RAND = new Random();
+
+ /** Range within which to generate numbers. */
+ private static final int RANGE = 1000;
+
+ public static void main(String[] args) throws Exception {
+ // Mark this cluster member as client.
+ Ignition.setClientMode(true);
+
+ try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+ if (!ExamplesUtils.hasServerNodes(ignite))
+ return;
+
+ CacheConfiguration<Integer, Long> cfg = new CacheConfiguration<>("randomNumbers");
+
+ // Index key and value.
+ cfg.setIndexedTypes(Integer.class, Long.class);
+
+ // Auto-close cache at the end of the example.
+ try (IgniteCache<Integer, Long> stmCache = ignite.getOrCreateCache(cfg)) {
+ try (IgniteDataStreamer<Integer, Long> stmr = ignite.dataStreamer(stmCache.getName())) {
+ // Allow data updates.
+ stmr.allowOverwrite(true);
+
+ // Configure data transformation to count instances of the same number.
+ stmr.receiver(StreamTransformer.from((e, arg) -> {
+ // Get current count.
+ Long val = e.getValue();
+
+ // Increment count by 1.
+ e.setValue(val == null ? 1L : val + 1);
+
+ return null;
+ }));
+
+ // Stream 10 million of random numbers into the streamer cache.
+ for (int i = 1; i <= 10_000_000; i++) {
+ stmr.addData(RAND.nextInt(RANGE), 1L);
+
+ if (i % 500_000 == 0)
+ System.out.println("Number of tuples streamed into Ignite: " + i);
+ }
+ }
+
+ // Query top 10 most popular numbers every.
+ SqlFieldsQuery top10Qry = new SqlFieldsQuery("select _key, _val from Long order by _val desc limit 10");
+
+ // Execute queries.
+ List<List<?>> top10 = stmCache.query(top10Qry).getAll();
+
+ System.out.println("Top 10 most popular numbers:");
+
+ // Print top 10 words.
+ ExamplesUtils.printQueryResults(top10);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/visitors/StreamVisitorExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/visitors/StreamVisitorExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/visitors/StreamVisitorExample.java
new file mode 100644
index 0000000..009a7c3
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/visitors/StreamVisitorExample.java
@@ -0,0 +1,173 @@
+/*
+ * 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.java8.streaming.visitors;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.cache.query.annotations.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.examples.*;
+import org.apache.ignite.stream.*;
+
+import java.io.*;
+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 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. */
+ private static final Random RAND = new Random();
+
+ /** The list of instruments. */
+ private static final String[] INSTRUMENTS = {"IBM", "GOOG", "MSFT", "GE", "EBAY", "YHOO", "ORCL", "CSCO", "AMZN", "RHT"};
+
+ /** The list of initial instrument prices. */
+ private static final double[] INITIAL_PRICES = {194.9, 893.49, 34.21, 23.24, 57.93, 45.03, 44.41, 28.44, 378.49, 69.50};
+
+ public static void main(String[] args) throws Exception {
+ // Mark this cluster member as client.
+ Ignition.setClientMode(true);
+
+ try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+ if (!ExamplesUtils.hasServerNodes(ignite))
+ return;
+
+ // Market data cache with default configuration.
+ CacheConfiguration<String, Double> mktDataCfg = new CacheConfiguration<String, Double>("marketTicks");
+
+ // Financial instrument cache configuration.
+ CacheConfiguration<String, Instrument> instCfg = new CacheConfiguration<>("instCache");
+
+ // Index key and value for querying financial instruments.
+ // Note that Instrument class has @QuerySqlField annotation for secondary field indexing.
+ instCfg.setIndexedTypes(String.class, Instrument.class);
+
+ // Auto-close caches at the end of the example.
+ try (
+ IgniteCache<String, Double> mktCache = ignite.getOrCreateCache(mktDataCfg);
+ IgniteCache<String, Instrument> instCache = ignite.getOrCreateCache(instCfg)
+ ) {
+ try (IgniteDataStreamer<String, Double> mktStmr = ignite.dataStreamer(mktCache.getName())) {
+ // Note that we receive market data, but do not populate 'mktCache' (it remains empty).
+ // Instead we update the instruments in the 'instCache'.
+ // Since both, 'instCache' and 'mktCache' use the same key, updates are collocated.
+ mktStmr.receiver(StreamVisitor.from((cache, e) -> {
+ String symbol = e.getKey();
+ Double tick = e.getValue();
+
+ Instrument inst = instCache.get(symbol);
+
+ if (inst == null)
+ inst = new Instrument(symbol);
+
+ // Don't populate market cache, as we don't use it for querying.
+ // Update cached instrument based on the latest market tick.
+ inst.update(tick);
+
+ instCache.put(symbol, inst);
+ }));
+
+ // Stream 10 million market data ticks into the system.
+ for (int i = 1; i <= 10_000_000; i++) {
+ int idx = RAND.nextInt(INSTRUMENTS.length);
+
+ // Use gaussian distribution to ensure that
+ // numbers closer to 0 have higher probability.
+ double price = round2(INITIAL_PRICES[idx] + RAND.nextGaussian());
+
+ mktStmr.addData(INSTRUMENTS[idx], price);
+
+ if (i % 500_000 == 0)
+ System.out.println("Number of tuples streamed into Ignite: " + i);
+ }
+ }
+
+ // Select top 3 best performing instruments.
+ SqlFieldsQuery top3qry = new SqlFieldsQuery(
+ "select symbol, (latest - open) from Instrument order by (latest - open) desc limit 3");
+
+ // Execute queries.
+ List<List<?>> top3 = instCache.query(top3qry).getAll();
+
+ System.out.println("Top performing financial instruments: ");
+
+ // Print top 10 words.
+ ExamplesUtils.printQueryResults(top3);
+ }
+ }
+ }
+
+ /**
+ * Rounds double value to two significant signs.
+ *
+ * @param val value to be rounded.
+ * @return rounded double value.
+ */
+ private static double round2(double val) {
+ return Math.floor(100 * val + 0.5) / 100;
+ }
+
+ /**
+ * Financial instrument.
+ */
+ public static class Instrument implements Serializable {
+ /** Instrument symbol. */
+ @QuerySqlField(index = true)
+ private final String symbol;
+
+ /** Open price. */
+ @QuerySqlField(index = true)
+ private double open;
+
+ /** Close price. */
+ @QuerySqlField(index = true)
+ private double latest;
+
+ /**
+ * @param symbol Symbol.
+ */
+ Instrument(String symbol) {
+ this.symbol = symbol;
+ }
+
+ /**
+ * Updates this instrument based on the latest price.
+ *
+ * @param price Latest price.
+ */
+ public void update(double price) {
+ if (open == 0)
+ open = price;
+
+ this.latest = price;
+ }
+
+ /** {@inheritDoc} */
+ @Override public synchronized String toString() {
+ return "Instrument [symbol=" + symbol + ", latest=" + latest + ", change=" + (latest - open) + ']';
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityUuid.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityUuid.java b/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityUuid.java
new file mode 100644
index 0000000..45f05f0
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityUuid.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.cache.affinity;
+
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.lang.*;
+
+/**
+ * Guaranteed unique affinity-based key.
+ */
+public class AffinityUuid extends AffinityKey<IgniteUuid> {
+ /**
+ * Empty constructor.
+ */
+ public AffinityUuid() {
+ // No-op.
+ }
+
+ /**
+ * Constructs unique affinity UUID based on affinity key.
+ *
+ * @param affKey Affinity key to use for collocation.
+ */
+ public AffinityUuid(Object affKey) {
+ super(IgniteUuid.randomUuid(), affKey);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(AffinityUuid.class, this);
+ }
+}
[37/50] [abbrv] incubator-ignite git commit: Merge branches
'ignite-593' and 'ignite-sprint-3' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-593
Posted by sb...@apache.org.
Merge branches 'ignite-593' and 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-593
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e144a68f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e144a68f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e144a68f
Branch: refs/heads/ignite-665
Commit: e144a68f89e156098e05c75b20d0f182cc5c47e0
Parents: d49c0d3 3629cee
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Apr 7 10:38:07 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Apr 7 10:38:07 2015 +0700
----------------------------------------------------------------------
.../cache/eviction/fifo/FifoEvictionPolicy.java | 58 ++-
.../eviction/fifo/FifoEvictionPolicyMBean.java | 16 +
.../store/jdbc/CacheAbstractJdbcStore.java | 104 +++--
.../org/apache/ignite/stream/StreamVisitor.java | 2 +-
.../eviction/GridCacheEvictionAbstractTest.java | 5 +-
...ridCacheFifoBatchEvictionPolicySelfTest.java | 385 +++++++++++++++++++
.../yardstick/config/benchmark-store.properties | 5 +-
pom.xml | 59 ++-
8 files changed, 588 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
[09/50] [abbrv] incubator-ignite git commit: Merge branches
'ignite-593' and 'ignite-sprint-3' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-593
Posted by sb...@apache.org.
Merge branches 'ignite-593' and 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-593
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c0d6e892
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c0d6e892
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c0d6e892
Branch: refs/heads/ignite-665
Commit: c0d6e8928e8bd66207ad70b79d72b10a06bbd921
Parents: b6c605c aae951e
Author: AKuznetsov <ak...@gridgain.com>
Authored: Mon Apr 6 19:01:15 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Mon Apr 6 19:01:15 2015 +0700
----------------------------------------------------------------------
assembly/release-fabric.xml | 5 -
modules/clients/readme.md | 2 -
.../apache/ignite/internal/IgniteKernal.java | 2 +-
.../processors/cache/CacheDistributionMode.java | 67 --------
.../internal/processors/cache/CacheType.java | 77 +++++++++
.../cache/DynamicCacheChangeRequest.java | 17 ++
.../cache/DynamicCacheDescriptor.java | 15 +-
.../processors/cache/GridCacheAdapter.java | 6 +-
.../processors/cache/GridCacheContext.java | 26 ++-
.../cache/GridCacheDeploymentManager.java | 2 +-
.../processors/cache/GridCacheEventManager.java | 4 +-
.../processors/cache/GridCacheProcessor.java | 133 +++++++++++-----
.../cache/GridCacheSharedContext.java | 4 +-
.../dht/GridDhtTransactionalCacheAdapter.java | 4 +-
.../near/GridNearTransactionalCache.java | 2 +-
.../continuous/CacheContinuousQueryManager.java | 2 +-
.../transactions/IgniteTransactionsImpl.java | 19 ++-
.../transactions/IgniteTxLocalAdapter.java | 2 +-
.../cache/transactions/IgniteTxManager.java | 8 +-
.../processors/task/GridTaskProcessor.java | 24 ++-
.../internal/visor/util/VisorTaskUtils.java | 18 ++-
.../cache/IgniteDynamicCacheStartSelfTest.java | 47 +++---
.../cache/IgniteInternalCacheTypesTest.java | 159 +++++++++++++++++++
.../IgniteCollectionAbstractTest.java | 23 ---
.../IgniteCacheSystemTransactionsSelfTest.java | 3 +-
...GridCacheDhtEvictionNearReadersSelfTest.java | 2 +-
.../near/GridCacheNearEvictionSelfTest.java | 2 +-
...ePartitionedBasicStoreMultiNodeSelfTest.java | 8 +-
...NearDisabledBasicStoreMultiNodeSelfTest.java | 8 +-
.../processors/igfs/IgfsStartCacheTest.java | 158 ++++++++++++++++++
.../processors/igfs/IgsfStartCacheTest.java | 115 --------------
.../loadtests/hashmap/GridCacheTestContext.java | 1 +
.../ignite/testsuites/IgniteCacheTestSuite.java | 2 +
.../ignite/testsuites/IgniteIgfsTestSuite.java | 2 +
.../cache/IgniteCacheAbstractQuerySelfTest.java | 6 +-
...niteCacheAtomicNearEnabledQuerySelfTest.java | 7 +-
.../near/IgniteCacheAtomicQuerySelfTest.java | 7 +-
modules/yardstick/README.md | 3 +-
.../yardstick/IgniteAbstractBenchmark.java | 5 +-
.../yardstick/IgniteBenchmarkArguments.java | 22 ++-
.../org/apache/ignite/yardstick/IgniteNode.java | 11 +-
parent/pom.xml | 49 +++---
pom.xml | 92 ++++++++++-
43 files changed, 781 insertions(+), 390 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c0d6e892/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
----------------------------------------------------------------------
[23/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'origin/ignite-sprint-3' into ignite-sprint-3
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-3' into ignite-sprint-3
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/15cebfc4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/15cebfc4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/15cebfc4
Branch: refs/heads/ignite-665
Commit: 15cebfc417176a47244b66ffa686cded2ebc9460
Parents: 1aaa0b0 7e07b90
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Mon Apr 6 18:53:30 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Mon Apr 6 18:53:30 2015 +0300
----------------------------------------------------------------------
modules/schedule/pom.xml | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
----------------------------------------------------------------------
[11/50] [abbrv] incubator-ignite git commit: ignite-sprint-3 -
portable class fix
Posted by sb...@apache.org.
ignite-sprint-3 - portable class 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/a7ba0bea
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/a7ba0bea
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/a7ba0bea
Branch: refs/heads/ignite-665
Commit: a7ba0bea463648031bb7b2afb626a63ef2215f96
Parents: 5421701
Author: S.Vladykin <sv...@gridgain.com>
Authored: Mon Apr 6 15:55:21 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Mon Apr 6 15:55:21 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/processors/query/GridQueryProcessor.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a7ba0bea/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index ba8479f..0ea0b99 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -402,7 +402,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
TypeId id;
- if (ctx.cacheObjects().isPortableObject(val)) {
+ boolean portableVal = ctx.cacheObjects().isPortableObject(val);
+
+ if (portableVal) {
int typeId = ctx.cacheObjects().typeId(val);
id = new TypeId(space, typeId);
@@ -415,12 +417,12 @@ public class GridQueryProcessor extends GridProcessorAdapter {
if (desc == null || !desc.registered())
return;
- if (!desc.valueClass().isAssignableFrom(valCls))
+ if (!portableVal && !desc.valueClass().isAssignableFrom(valCls))
throw new IgniteCheckedException("Failed to update index due to class name conflict" +
"(multiple classes with same simple name are stored in the same cache) " +
"[expCls=" + desc.valueClass().getName() + ", actualCls=" + valCls.getName() + ']');
- if (!desc.keyClass().isAssignableFrom(key.getClass()))
+ if (!ctx.cacheObjects().isPortableObject(key) && !desc.keyClass().isAssignableFrom(key.getClass()))
throw new IgniteCheckedException("Failed to update index, incorrect key class [expCls=" +
desc.keyClass().getName() + ", actualCls=" + key.getClass().getName() + "]");
[17/50] [abbrv] incubator-ignite git commit: ignite-sprint-3 - map
query sort limit fix (IGNITE-682)
Posted by sb...@apache.org.
ignite-sprint-3 - map query sort limit fix (IGNITE-682)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2f34c46a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2f34c46a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2f34c46a
Branch: refs/heads/ignite-665
Commit: 2f34c46a695ed93f39cbc9f32b790f443fe0596b
Parents: 88268bf
Author: S.Vladykin <sv...@gridgain.com>
Authored: Mon Apr 6 17:41:17 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Mon Apr 6 17:41:17 2015 +0300
----------------------------------------------------------------------
.../query/h2/sql/GridSqlQuerySplitter.java | 22 ++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2f34c46a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
index 77e0cc8..b3deea3 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
@@ -77,8 +77,10 @@ public class GridSqlQuerySplitter {
Set<String> colNames = new HashSet<>();
+ boolean aggregateFound = false;
+
for (int i = 0, len = mapExps.size(); i < len; i++) // Remember len because mapExps list can grow.
- splitSelectExpression(mapExps, rdcExps, colNames, i);
+ aggregateFound |= splitSelectExpression(mapExps, rdcExps, colNames, i);
// Fill select expressions.
mapQry.clearSelect();
@@ -110,15 +112,20 @@ public class GridSqlQuerySplitter {
// -- ORDER BY
if (!srcQry.sort().isEmpty()) {
- mapQry.clearSort();
+ if (aggregateFound) // Ordering over aggregates does not make sense.
+ mapQry.clearSort(); // Otherwise map sort will be used by offset-limit.
for (GridSqlSortColumn sortCol : srcQry.sort().values())
rdcQry.addSort(column(((GridSqlAlias)mapExps.get(sortCol.column())).alias()), sortCol);
}
// -- LIMIT
- if (srcQry.limit() != null)
+ if (srcQry.limit() != null) {
+ if (aggregateFound)
+ mapQry.limit(null);
+
rdcQry.limit(srcQry.limit());
+ }
// -- OFFSET
if (srcQry.offset() != null) {
@@ -209,19 +216,24 @@ public class GridSqlQuerySplitter {
* @param rdcSelect Selects for reduce query.
* @param colNames Set of unique top level column names.
* @param idx Index.
+ * @return {@code true} If aggregate was found.
*/
- private static void splitSelectExpression(List<GridSqlElement> mapSelect, GridSqlElement[] rdcSelect,
+ private static boolean splitSelectExpression(List<GridSqlElement> mapSelect, GridSqlElement[] rdcSelect,
Set<String> colNames, int idx) {
GridSqlElement el = mapSelect.get(idx);
GridSqlAlias alias = null;
+ boolean aggregateFound = false;
+
if (el instanceof GridSqlAlias) { // Unwrap from alias.
alias = (GridSqlAlias)el;
el = alias.child();
}
if (el instanceof GridSqlAggregateFunction) {
+ aggregateFound = true;
+
GridSqlAggregateFunction agg = (GridSqlAggregateFunction)el;
GridSqlElement mapAgg, rdcAgg;
@@ -322,6 +334,8 @@ public class GridSqlQuerySplitter {
rdcSelect[idx] = rdcEl;
}
}
+
+ return aggregateFound;
}
/**
[21/50] [abbrv] incubator-ignite git commit: Merge branches
'ignite-593' and 'ignite-sprint-3' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-593
Posted by sb...@apache.org.
Merge branches 'ignite-593' and 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-593
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5397a415
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5397a415
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5397a415
Branch: refs/heads/ignite-665
Commit: 5397a4159d6f31740dd1c47971cb3856e9c29c48
Parents: fe57a53 7e07b90
Author: AKuznetsov <ak...@gridgain.com>
Authored: Mon Apr 6 22:45:36 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Mon Apr 6 22:45:36 2015 +0700
----------------------------------------------------------------------
.../apache/ignite/internal/GridComponent.java | 2 +-
.../ignite/internal/GridKernalContextImpl.java | 3 +-
.../ignite/internal/GridPluginComponent.java | 4 +-
.../org/apache/ignite/internal/IgniteEx.java | 7 --
.../apache/ignite/internal/IgniteKernal.java | 25 +----
.../ignite/internal/IgniteNodeAttributes.java | 3 -
.../internal/managers/GridManagerAdapter.java | 6 +-
.../processors/GridProcessorAdapter.java | 2 +-
.../processors/cache/GridCacheProcessor.java | 6 +-
.../DiscoveryNodeValidationProcessor.java | 27 +++++
.../OsDiscoveryNodeValidationProcessor.java | 72 +++++++++++++
.../processors/query/GridQueryProcessor.java | 8 +-
.../ignite/spi/IgniteNodeValidationResult.java | 66 ++++++++++++
.../org/apache/ignite/spi/IgniteSpiAdapter.java | 2 +-
.../org/apache/ignite/spi/IgniteSpiContext.java | 2 +-
.../spi/IgniteSpiNodeValidationResult.java | 66 ------------
.../spi/discovery/tcp/TcpDiscoverySpi.java | 106 +------------------
.../testframework/GridSpiTestContext.java | 2 +-
.../HadoopDefaultMapReducePlannerSelfTest.java | 5 -
.../query/h2/sql/GridSqlQuerySplitter.java | 22 +++-
.../h2/twostep/GridReduceQueryExecutor.java | 13 ++-
.../query/h2/sql/GridQueryParsingTest.java | 1 +
.../query/h2/sql/IgniteVsH2QueryTest.java | 7 ++
modules/schedule/pom.xml | 20 ++++
pom.xml | 2 +
25 files changed, 252 insertions(+), 227 deletions(-)
----------------------------------------------------------------------
[03/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'origin/ignite-sprint-3' into ignite-sprint-3
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-3' into ignite-sprint-3
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ec153eae
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ec153eae
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ec153eae
Branch: refs/heads/ignite-665
Commit: ec153eae19050e309cafe7cc894311abd0d51d17
Parents: 9a3373f 9e9a5c9
Author: avinogradov <av...@gridgain.com>
Authored: Mon Apr 6 13:55:32 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Mon Apr 6 13:55:32 2015 +0300
----------------------------------------------------------------------
modules/clients/readme.md | 2 -
.../processors/cache/CacheDistributionMode.java | 67 --------------------
.../IgniteCollectionAbstractTest.java | 23 -------
...GridCacheDhtEvictionNearReadersSelfTest.java | 2 +-
.../near/GridCacheNearEvictionSelfTest.java | 2 +-
...ePartitionedBasicStoreMultiNodeSelfTest.java | 8 +--
...NearDisabledBasicStoreMultiNodeSelfTest.java | 8 +--
.../cache/IgniteCacheAbstractQuerySelfTest.java | 6 +-
...niteCacheAtomicNearEnabledQuerySelfTest.java | 7 +-
.../near/IgniteCacheAtomicQuerySelfTest.java | 7 +-
modules/yardstick/README.md | 3 +-
.../yardstick/IgniteAbstractBenchmark.java | 5 +-
.../yardstick/IgniteBenchmarkArguments.java | 22 +++++--
.../org/apache/ignite/yardstick/IgniteNode.java | 11 ++--
14 files changed, 44 insertions(+), 129 deletions(-)
----------------------------------------------------------------------
[16/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'origin/ignite-sprint-3' into ignite-sprint-3
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-3' into ignite-sprint-3
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/888cff5f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/888cff5f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/888cff5f
Branch: refs/heads/ignite-665
Commit: 888cff5fd74f0f84db7c09a879c26131f096455c
Parents: 5e84cda 88268bf
Author: avinogradov <av...@gridgain.com>
Authored: Mon Apr 6 17:26:39 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Mon Apr 6 17:26:39 2015 +0300
----------------------------------------------------------------------
.../processors/query/h2/sql/GridSqlQuerySplitter.java | 2 ++
.../processors/query/h2/sql/GridQueryParsingTest.java | 1 +
.../internal/processors/query/h2/sql/IgniteVsH2QueryTest.java | 7 +++++++
3 files changed, 10 insertions(+)
----------------------------------------------------------------------
[31/50] [abbrv] incubator-ignite git commit: ignite-678 site deploy
Posted by sb...@apache.org.
ignite-678 site deploy
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/0a8378c7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0a8378c7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0a8378c7
Branch: refs/heads/ignite-665
Commit: 0a8378c72f54c9dbc6a27850e7787b4c61c9f2b1
Parents: 7e6d193
Author: avinogradov <av...@gridgain.com>
Authored: Mon Apr 6 20:20:18 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Mon Apr 6 20:20:18 2015 +0300
----------------------------------------------------------------------
pom.xml | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 53 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0a8378c7/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index bc58e04..16a2cb0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,10 +31,14 @@
</parent>
<groupId>org.apache.ignite</groupId>
- <artifactId>ignite</artifactId>
+ <artifactId>incubator-ignite</artifactId>
<version>1.0.1-RC1-SNAPSHOT</version>
<packaging>pom</packaging>
+ <properties>
+ <ignite.site>scp://localhost:/home</ignite.site>
+ </properties>
+
<scm>
<url>https://git-wip-us.apache.org/repos/asf/incubator-ignite</url>
<connection>scm:git:git://git-wip-us.apache.org/repos/asf/incubator-ignite</connection>
@@ -42,6 +46,13 @@
<tag>HEAD</tag>
</scm>
+ <distributionManagement>
+ <site>
+ <id>ignite-site</id>
+ <url>${ignite.site}/${project.artifactId}-${project.version}</url>
+ </site>
+ </distributionManagement>
+
<modules>
<module>modules/tools</module>
<module>modules/core</module>
@@ -499,7 +510,7 @@
<fileSet>
<directory>target</directory>
<includes>
- <include>ignite-${project.version}-source-release.zip</include>
+ <include>${project.artifactId}-${project.version}-source-release.zip</include>
</includes>
</fileSet>
</fileSets>
@@ -527,12 +538,17 @@
<target>
<zip destfile="${basedir}/target/sources-pack-${project.version}.zip" encoding="UTF-8">
<zipfileset dir="${basedir}/target" prefix="sources-pack-${project.version}">
- <include name="ignite-${project.version}-source-release.zip" />
- <include name="ignite-${project.version}-source-release.zip.asc" />
- <include name="ignite-${project.version}-source-release.zip.md5" />
- <include name="ignite-${project.version}-source-release.zip.sha1" />
+ <include name="${project.artifactId}-${project.version}-source-release.zip" />
+ <include name="${project.artifactId}-${project.version}-source-release.zip.asc" />
+ <include name="${project.artifactId}-${project.version}-source-release.zip.md5" />
+ <include name="${project.artifactId}-${project.version}-source-release.zip.sha1" />
</zipfileset>
</zip>
+ <mkdir dir="${basedir}/target/site"/>
+ <copy file="${basedir}/target/${project.artifactId}-${project.version}-source-release.zip" todir="${basedir}/target/site"/>
+ <copy file="${basedir}/target/${project.artifactId}-${project.version}-source-release.zip.asc" todir="${basedir}/target/site"/>
+ <copy file="${basedir}/target/${project.artifactId}-${project.version}-source-release.zip.md5" todir="${basedir}/target/site"/>
+ <copy file="${basedir}/target/${project.artifactId}-${project.version}-source-release.zip.sha1" todir="${basedir}/target/site"/>
</target>
</configuration>
</execution>
@@ -541,5 +557,36 @@
</plugins>
</build>
</profile>
+
+ <profile>
+ <id>deploy-site</id>
+ <build>
+ <plugins>
+ <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>
</profiles>
</project>
[10/50] [abbrv] incubator-ignite git commit: Merge branch
'ignite-540' into ignite-sprint-3
Posted by sb...@apache.org.
Merge branch 'ignite-540' into ignite-sprint-3
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5421701a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5421701a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5421701a
Branch: refs/heads/ignite-665
Commit: 5421701acaa5c7d92f39fdc234df165d7ec5459b
Parents: aae951e e1db407
Author: sevdokimov <se...@gridgain.com>
Authored: Mon Apr 6 15:01:15 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Mon Apr 6 15:01:15 2015 +0300
----------------------------------------------------------------------
.../query/h2/twostep/GridReduceQueryExecutor.java | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
[20/50] [abbrv] incubator-ignite git commit: # Ignite-593 Reworked
cache configurations collect and process.
Posted by sb...@apache.org.
# Ignite-593 Reworked cache configurations collect and process.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/fe57a53c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/fe57a53c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/fe57a53c
Branch: refs/heads/ignite-665
Commit: fe57a53c3b4fca401969dba6acd85f5726ea1101
Parents: c0d6e89
Author: AKuznetsov <ak...@gridgain.com>
Authored: Mon Apr 6 22:43:43 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Mon Apr 6 22:43:43 2015 +0700
----------------------------------------------------------------------
.../VisorCacheConfigurationCollectorTask.java | 2 +-
.../commands/cache/VisorCacheCommand.scala | 19 ++++-------
.../config/VisorConfigurationCommand.scala | 15 +++++----
.../visor/commands/gc/VisorGcCommand.scala | 15 +++++----
.../scala/org/apache/ignite/visor/visor.scala | 34 ++++++++++++++++----
5 files changed, 52 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe57a53c/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorTask.java
index 53d1105..a92dd3c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorTask.java
@@ -28,7 +28,7 @@ import java.util.*;
*/
@GridInternal
public class VisorCacheConfigurationCollectorTask
- extends VisorOneNodeTask<Collection<IgniteUuid>, Collection<VisorCacheConfiguration>> {
+ extends VisorOneNodeTask<Collection<IgniteUuid>, Map<IgniteUuid, VisorCacheConfiguration>> {
/** */
private static final long serialVersionUID = 0L;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe57a53c/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
index 2d7e14b..91317c9 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
@@ -20,7 +20,6 @@ package org.apache.ignite.visor.commands.cache
import org.apache.ignite._
import org.apache.ignite.cluster.ClusterNode
import org.apache.ignite.internal.util.typedef._
-import java.util
import org.apache.ignite.internal.visor.cache._
import org.apache.ignite.internal.visor.util.VisorTaskUtils._
@@ -28,7 +27,7 @@ import org.apache.ignite.lang.{IgniteUuid, IgniteBiTuple}
import org.jetbrains.annotations._
import java.lang.{Boolean => JavaBoolean}
-import java.util.{Collections, UUID}
+import java.util.{Collection => JavaCollection, Collections, UUID}
import org.apache.ignite.visor.VisorTag
import org.apache.ignite.visor.commands.cache.VisorCacheCommand._
@@ -387,10 +386,10 @@ class VisorCacheCommand {
println(" Total number of failures: " + ad.failsQuery)
gCfg.foreach(ccfgs => ccfgs.find(ccfg => safeEquals(ccfg.name(), ad.cacheName()))
- .foreach(cfg => {
+ .foreach(ccfg => {
nl()
- showCacheConfiguration("Cache configuration:", cfg)
+ showCacheConfiguration("Cache configuration:", ccfg)
}))
})
}
@@ -463,21 +462,17 @@ class VisorCacheCommand {
* Gets configuration of grid from specified node for callecting of node cache's configuration.
*
* @param node Specified node.
- * @return Grid configuration for specified node.
+ * @return Cache configurations for specified node.
*/
- private def config(node: ClusterNode) = {
+ private def config(node: ClusterNode): JavaCollection[VisorCacheConfiguration] = {
try {
- val z = Collections.emptySet()[IgniteUuid]
-
- ignite.compute(ignite.cluster.forNode(node)).withNoFailover()
- .execute(classOf[VisorCacheConfigurationCollectorTask],
- toTaskArgument(node.id(), z.asInstanceOf[util.Collection[IgniteUuid]]))
+ cacheConfigurations(node.id())
}
catch {
case e: IgniteException =>
scold(e.getMessage)
- null
+ Collections.emptyList()
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe57a53c/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala
index c4ac1c0..447667a 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala
@@ -20,7 +20,6 @@ package org.apache.ignite.visor.commands.config
import org.apache.ignite._
import org.apache.ignite.cluster.ClusterNode
import org.apache.ignite.internal.util.{IgniteUtils => U}
-import org.apache.ignite.internal.visor.node.VisorNodeConfigurationCollectorTask
import org.apache.ignite.internal.visor.util.VisorTaskUtils._
import org.apache.ignite.lang.IgniteBiTuple
@@ -184,9 +183,7 @@ class VisorConfigurationCommand {
assert(node != null)
val cfg = try
- ignite.compute(ignite.cluster.forNode(node))
- .withNoFailover()
- .execute(classOf[VisorNodeConfigurationCollectorTask], emptyTaskArgument(node.id()))
+ nodeConfiguration(node.id())
catch {
case e: IgniteException =>
scold(e.getMessage)
@@ -392,9 +389,13 @@ class VisorConfigurationCommand {
} else
println("\nNo system properties defined.")
- cfg.caches().foreach(cacheCfg => {
- VisorCacheCommand.showCacheConfiguration("\nCache '" + escapeName(cacheCfg.name()) + "':", cacheCfg)
- })
+ try
+ cacheConfigurations(node.id).foreach(cacheCfg =>
+ VisorCacheCommand.showCacheConfiguration("\nCache '" + escapeName(cacheCfg.name()) + "':", cacheCfg))
+ catch {
+ case e: IgniteException =>
+ scold(e.getMessage)
+ }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe57a53c/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala
index 446f07c..5ec85a7 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala
@@ -148,16 +148,17 @@ class VisorGcCommand {
val NULL: Void = null
ignite.compute(prj).withNoFailover().execute(classOf[VisorNodeGcTask],
- toTaskArgument(nids, NULL)).foreach { case (nid, stat) =>
- val roundHb = stat.get1() / (1024L * 1024L)
- val roundHa = stat.get2() / (1024L * 1024L)
+ toTaskArgument(nids, NULL)).foreach {
+ case (nid, stat) =>
+ val roundHb = stat.get1() / (1024L * 1024L)
+ val roundHa = stat.get2() / (1024L * 1024L)
- val sign = if (roundHa > roundHb) "+" else ""
+ val sign = if (roundHa > roundHb) "+" else ""
- val deltaPercent = math.round(roundHa * 100d / roundHb - 100)
+ val deltaPercent = math.round(roundHa * 100d / roundHb - 100)
- t += (nodeId8(nid), roundHb + "mb", roundHa + "mb", sign + deltaPercent + "%")
- }
+ t += (nodeId8(nid), roundHb + "mb", roundHa + "mb", sign + deltaPercent + "%")
+ }
println("Garbage collector procedure results:")
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe57a53c/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
index 7b6d1b4..5710458 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
@@ -32,10 +32,11 @@ import org.apache.ignite.internal.util.lang.{GridFunc => F}
import org.apache.ignite.internal.util.typedef._
import org.apache.ignite.internal.util.{GridConfigurationFinder, IgniteUtils => U}
import org.apache.ignite.internal.visor.VisorTaskArgument
-import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask
+import org.apache.ignite.internal.visor.cache._
+import org.apache.ignite.internal.visor.node._
import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask.VisorNodeEventsCollectorTaskArg
import org.apache.ignite.internal.visor.util.VisorTaskUtils._
-import org.apache.ignite.lang.{IgniteNotPeerDeployable, IgnitePredicate}
+import org.apache.ignite.lang._
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi
import org.apache.ignite.thread.IgniteThreadPoolExecutor
import org.apache.ignite.visor.commands.VisorConsole.consoleReader
@@ -46,7 +47,7 @@ import java.io._
import java.net._
import java.text._
import java.util.concurrent._
-import java.util.{HashSet => JHashSet, _}
+import java.util.{Collection => JavaCollection, HashSet => JavaHashSet, _}
import scala.collection.JavaConversions._
import scala.collection.immutable
@@ -836,7 +837,7 @@ object visor extends VisorTag {
* Extract node from command arguments.
*
* @param argLst Command arguments.
- * @return error message or node ref.
+ * @return Error message or node ref.
*/
def parseNode(argLst: ArgList) = {
val id8 = argValue("id8", argLst)
@@ -1827,7 +1828,7 @@ object visor extends VisorTag {
/** Convert to task argument. */
def emptyTaskArgument[A](nid: UUID): VisorTaskArgument[Void] = new VisorTaskArgument(nid, false)
- def emptyTaskArgument[A](nids: Iterable[UUID]): VisorTaskArgument[Void] = new VisorTaskArgument(new JHashSet(nids),
+ def emptyTaskArgument[A](nids: Iterable[UUID]): VisorTaskArgument[Void] = new VisorTaskArgument(new JavaHashSet(nids),
false)
/** Convert to task argument. */
@@ -1835,7 +1836,28 @@ object visor extends VisorTag {
/** Convert to task argument. */
def toTaskArgument[A](nids: Iterable[UUID], arg: A): VisorTaskArgument[A] = new VisorTaskArgument(
- new JHashSet(nids), arg, false)
+ new JavaHashSet(nids), arg, false)
+
+ def compute(nid: UUID): IgniteCompute = ignite.compute(ignite.cluster.forNodeId(nid)).withNoFailover()
+
+ /**
+ * Gets configuration from specified node.
+ *
+ * @param nid Node ID to collect configuration from.
+ * @return Grid configuration.
+ */
+ def nodeConfiguration(nid: UUID): VisorGridConfiguration =
+ compute(nid).execute(classOf[VisorNodeConfigurationCollectorTask], emptyTaskArgument(nid))
+
+ /**
+ * Gets caches configurations from specified node.
+ *
+ * @param nid Node ID to collect configuration from.
+ * @return Collection of cache configurations.
+ */
+ def cacheConfigurations(nid: UUID): JavaCollection[VisorCacheConfiguration] =
+ compute(nid).execute(classOf[VisorCacheConfigurationCollectorTask],
+ toTaskArgument(nid, null.asInstanceOf[JavaCollection[IgniteUuid]])).values()
/**
* Asks user to select a node from the list.
[36/50] [abbrv] incubator-ignite git commit: # ignite-564 Add debug
output.
Posted by sb...@apache.org.
# ignite-564 Add debug output.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3629cee2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3629cee2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3629cee2
Branch: refs/heads/ignite-665
Commit: 3629cee2e79eba9581e8a3f79d6f05aba0538711
Parents: 975b47c
Author: Andrey Novikov <an...@gridgain.com>
Authored: Tue Apr 7 10:27:20 2015 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Tue Apr 7 10:27:20 2015 +0700
----------------------------------------------------------------------
.../store/jdbc/CacheAbstractJdbcStore.java | 34 ++++++++++----------
1 file changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3629cee2/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
index df5345b..22d6d7a 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
@@ -619,9 +619,9 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
throws CacheLoaderException {
ExecutorService pool = null;
- try {
- String cacheName = session().cacheName();
+ String cacheName = session().cacheName();
+ try {
pool = Executors.newFixedThreadPool(maxPoolSz);
Collection<Future<?>> futs = new ArrayList<>();
@@ -648,7 +648,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
for (EntryMapping em : entryMappings) {
if (parallelLoadCacheMinThreshold > 0) {
- log.debug("Start parallel loading entries of one type from db [cache name=" + cacheName +
+ log.debug("Multithread loading entries from db [cache name=" + cacheName +
", key type=" + em.keyType() + " ]");
Connection conn = null;
@@ -697,7 +697,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
}
else {
if (log.isDebugEnabled())
- log.debug("Start loading entries of one type from db [cache name=" + cacheName +
+ log.debug("Single thread loading entries from db [cache name=" + cacheName +
", key type=" + em.keyType() + " ]");
futs.add(pool.submit(loadCacheFull(em, clo)));
@@ -709,10 +709,10 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
U.get(fut);
if (log.isDebugEnabled())
- log.debug("Finished load cache: " + cacheName + " from db");
+ log.debug("Cache loaded from db: " + cacheName);
}
catch (IgniteCheckedException e) {
- throw new CacheLoaderException("Failed to load cache", e.getCause());
+ throw new CacheLoaderException("Failed to load cache: " + cacheName, e.getCause());
}
finally {
U.shutdownNow(getClass(), pool, log);
@@ -726,7 +726,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
EntryMapping em = entryMapping(session().cacheName(), keyTypeId(key), key);
if (log.isDebugEnabled())
- log.debug("Start load value from database [table= " + em.fullTableName() + ", key=" + key + "]");
+ log.debug("Load value from db [table= " + em.fullTableName() + ", key=" + key + "]");
Connection conn = null;
@@ -976,7 +976,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
if (currKeyTypeId == null || !currKeyTypeId.equals(keyTypeId)) {
if (mergeStmt != null) {
if (log.isDebugEnabled())
- log.debug("Start write entries to database [cache name=" + cacheName +
+ log.debug("Write entries to db [cache name=" + cacheName +
", key type=" + em.keyType() + ", count=" + prepared + "]");
executeBatch(em, mergeStmt, "writeAll", fromIdx, prepared, lazyEntries);
@@ -1001,7 +1001,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
if (++prepared % batchSz == 0) {
if (log.isDebugEnabled())
- log.debug("Start write entries to database [cache name=" + cacheName +
+ log.debug("Write entries to db [cache name=" + cacheName +
", key type=" + em.keyType() + ", count=" + prepared + "]");
executeBatch(em, mergeStmt, "writeAll", fromIdx, prepared, lazyEntries);
@@ -1014,7 +1014,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
if (mergeStmt != null && prepared % batchSz != 0) {
if (log.isDebugEnabled())
- log.debug("Start write entries to database [cache name=" + cacheName +
+ log.debug("Write entries to db [cache name=" + cacheName +
", key type=" + em.keyType() + ", count=" + prepared + "]");
executeBatch(em, mergeStmt, "writeAll", fromIdx, prepared, lazyEntries);
@@ -1026,7 +1026,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
}
}
else {
- log.debug("Start write entries to database by one using update and insert statement [cache name=" +
+ log.debug("Write entries to db one by one using update and insert statements [cache name=" +
cacheName + ", count=" + entries.size() + "]");
PreparedStatement insStmt = null;
@@ -1078,7 +1078,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
EntryMapping em = entryMapping(session().cacheName(), keyTypeId(key), key);
if (log.isDebugEnabled())
- log.debug("Start remove value from database [table=" + em.fullTableName() + ", key=" + key + "]");
+ log.debug("Remove value from db [table=" + em.fullTableName() + ", key=" + key + "]");
Connection conn = null;
@@ -1191,7 +1191,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
if (!currKeyTypeId.equals(keyTypeId)) {
if (log.isDebugEnabled())
- log.debug("Start delete entries to database [cache name=" + cacheName +
+ log.debug("Delete entries from db [cache name=" + cacheName +
", key type=" + em.keyType() + ", count=" + prepared + "]");
executeBatch(em, delStmt, "deleteAll", fromIdx, prepared, lazyKeys);
@@ -1209,7 +1209,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
if (++prepared % batchSz == 0) {
if (log.isDebugEnabled())
- log.debug("Start delete entries to database [cache name=" + cacheName +
+ log.debug("Delete entries from db [cache name=" + cacheName +
", key type=" + em.keyType() + ", count=" + prepared + "]");
executeBatch(em, delStmt, "deleteAll", fromIdx, prepared, lazyKeys);
@@ -1222,7 +1222,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
if (delStmt != null && prepared % batchSz != 0) {
if (log.isDebugEnabled())
- log.debug("Start delete entries to database [cache name=" + cacheName +
+ log.debug("Delete entries from db [cache name=" + cacheName +
", key type=" + em.keyType() + ", count=" + prepared + "]");
executeBatch(em, delStmt, "deleteAll", fromIdx, prepared, lazyKeys);
@@ -1647,7 +1647,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
/** {@inheritDoc} */
@Override public Void call() throws Exception {
if (log.isDebugEnabled())
- log.debug("Start load cache using custom query [cache name= " + em.cacheName +
+ log.debug("Load cache using custom query [cache name= " + em.cacheName +
", key type=" + em.keyType() + ", query=" + qry + "]");
Connection conn = null;
@@ -1743,7 +1743,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
/** {@inheritDoc} */
@Override public Map<K1, V1> call() throws Exception {
if (log.isDebugEnabled())
- log.debug("Start load values from database [table= " + em.fullTableName() +
+ log.debug("Load values from db [table= " + em.fullTableName() +
", key count=" + keys.size() + "]");
PreparedStatement stmt = null;
[33/50] [abbrv] incubator-ignite git commit: ignite-396 Batch
eviction support added to CacheFifoEvictionPolicy
Posted by sb...@apache.org.
ignite-396 Batch eviction support added to CacheFifoEvictionPolicy
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/8242c151
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8242c151
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8242c151
Branch: refs/heads/ignite-665
Commit: 8242c1512657dbbb0efe9a3e0238c88d2aac447a
Parents: e6a6b64
Author: Andrey Gura <ag...@gridgain.com>
Authored: Mon Apr 6 15:18:54 2015 +0300
Committer: Andrey Gura <ag...@gridgain.com>
Committed: Mon Apr 6 21:17:21 2015 +0300
----------------------------------------------------------------------
.../cache/eviction/fifo/FifoEvictionPolicy.java | 58 ++-
.../eviction/fifo/FifoEvictionPolicyMBean.java | 16 +
.../eviction/GridCacheEvictionAbstractTest.java | 5 +-
...ridCacheFifoBatchEvictionPolicySelfTest.java | 385 +++++++++++++++++++
4 files changed, 454 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8242c151/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java
index d32c746..ca3cc1b 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java
@@ -27,8 +27,12 @@ import java.io.*;
import java.util.*;
/**
- * Eviction policy based on {@code First In First Out (FIFO)} algorithm. This
- * implementation is very efficient since it does not create any additional
+ * Eviction policy based on {@code First In First Out (FIFO)} algorithm and supports batch eviction.
+ * <p>
+ * The eviction starts when the cache size becomes {@code batchSize} elements greater than the maximum size.
+ * {@code batchSize} elements will be evicted in this case. The default {@code batchSize} value is {@code 1}.
+ * <p>
+ * This implementation is very efficient since it does not create any additional
* table-like data structures. The {@code FIFO} ordering information is
* maintained by attaching ordering metadata to cache entries.
*/
@@ -39,6 +43,9 @@ public class FifoEvictionPolicy<K, V> implements EvictionPolicy<K, V>, FifoEvict
/** Maximum size. */
private volatile int max = CacheConfiguration.DFLT_CACHE_SIZE;
+ /** Batch size. */
+ private volatile int batchSize = 1;
+
/** FIFO queue. */
private final ConcurrentLinkedDeque8<EvictableEntry<K, V>> queue =
new ConcurrentLinkedDeque8<>();
@@ -62,6 +69,20 @@ public class FifoEvictionPolicy<K, V> implements EvictionPolicy<K, V>, FifoEvict
}
/**
+ * Constructs FIFO eviction policy with maximum size and given batch size. Empty entries are allowed.
+ *
+ * @param max Maximum allowed size of cache before entry will start getting evicted.
+ * @param batchSize Maximum size of batch.
+ */
+ public FifoEvictionPolicy(int max, int batchSize) {
+ A.ensure(max > 0, "max > 0");
+ A.ensure(batchSize > 0, "batchSize > 0");
+
+ this.max = max;
+ this.batchSize = batchSize;
+ }
+
+ /**
* Gets maximum allowed size of cache before entry will start getting evicted.
*
* @return Maximum allowed size of cache before entry will start getting evicted.
@@ -82,6 +103,18 @@ public class FifoEvictionPolicy<K, V> implements EvictionPolicy<K, V>, FifoEvict
}
/** {@inheritDoc} */
+ @Override public int getBatchSize() {
+ return batchSize;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void setBatchSize(int batchSize) {
+ A.ensure(batchSize > 0, "batchSize > 0");
+
+ this.batchSize = batchSize;
+ }
+
+ /** {@inheritDoc} */
@Override public int getCurrentSize() {
return queue.size();
}
@@ -158,18 +191,23 @@ public class FifoEvictionPolicy<K, V> implements EvictionPolicy<K, V>, FifoEvict
private void shrink() {
int max = this.max;
+ int batchSize = this.batchSize;
+
int startSize = queue.sizex();
- for (int i = 0; i < startSize && queue.sizex() > max; i++) {
- EvictableEntry<K, V> entry = queue.poll();
+ // Shrink only if queue is full.
+ if (startSize >= max + batchSize) {
+ for (int i = max; i < startSize && queue.sizex() > max; i++) {
+ EvictableEntry<K, V> entry = queue.poll();
- if (entry == null)
- break;
+ if (entry == null)
+ break;
- if (!entry.evict()) {
- entry.removeMeta();
+ if (!entry.evict()) {
+ entry.removeMeta();
- touch(entry);
+ touch(entry);
+ }
}
}
}
@@ -177,11 +215,13 @@ public class FifoEvictionPolicy<K, V> implements EvictionPolicy<K, V>, FifoEvict
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
out.writeInt(max);
+ out.writeInt(batchSize);
}
/** {@inheritDoc} */
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
max = in.readInt();
+ batchSize = in.readInt();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8242c151/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicyMBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicyMBean.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicyMBean.java
index 4827e95..63a413e 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicyMBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicyMBean.java
@@ -41,6 +41,22 @@ public interface FifoEvictionPolicyMBean {
public void setMaxSize(int max);
/**
+ * Gets batch size.
+ *
+ * @return batch size.
+ */
+ @MXBeanDescription("Batch size.")
+ public int getBatchSize();
+
+ /**
+ * Sets batch size.
+ *
+ * @param batchSize Batch size.
+ */
+ @MXBeanDescription("Set batch size.")
+ public void setBatchSize(int batchSize);
+
+ /**
* Gets current queue size.
*
* @return Current queue size.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8242c151/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionAbstractTest.java
index 2081bfd..e0dab7d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionAbstractTest.java
@@ -63,6 +63,9 @@ public abstract class GridCacheEvictionAbstractTest<T extends EvictionPolicy<?,
/** Evict near sync. */
protected boolean evictNearSync = true;
+ /** Policy batch size. */
+ protected int plcBatchSize = 0;
+
/** Policy max. */
protected int plcMax = 10;
@@ -338,7 +341,7 @@ public abstract class GridCacheEvictionAbstractTest<T extends EvictionPolicy<?,
int actual = colocated(i).size();
assertTrue("Cache size is greater then policy size [expected=" + endSize + ", actual=" + actual + ']',
- actual <= endSize);
+ actual <= endSize + plcBatchSize);
}
checkPolicies(endPlcSize);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8242c151/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/fifo/GridCacheFifoBatchEvictionPolicySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/fifo/GridCacheFifoBatchEvictionPolicySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/fifo/GridCacheFifoBatchEvictionPolicySelfTest.java
new file mode 100644
index 0000000..7a9f4f4
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/fifo/GridCacheFifoBatchEvictionPolicySelfTest.java
@@ -0,0 +1,385 @@
+/*
+ * 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.eviction.fifo;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.eviction.*;
+import org.apache.ignite.cache.eviction.fifo.*;
+import org.apache.ignite.internal.processors.cache.eviction.*;
+
+import java.util.*;
+
+import static org.apache.ignite.cache.CacheMode.*;
+
+/**
+ * FIFO batch eviction test.
+ */
+public class GridCacheFifoBatchEvictionPolicySelfTest extends
+ GridCacheEvictionAbstractTest<FifoEvictionPolicy<String, String>> {
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPolicy() throws Exception {
+ try {
+ startGrid();
+
+ MockEntry e1 = new MockEntry("1", "1");
+ MockEntry e2 = new MockEntry("2", "2");
+ MockEntry e3 = new MockEntry("3", "3");
+ MockEntry e4 = new MockEntry("4", "4");
+ MockEntry e5 = new MockEntry("5", "5");
+
+ FifoEvictionPolicy<String, String> p = policy();
+
+ p.setMaxSize(3);
+
+ p.setBatchSize(2);
+
+ p.onEntryAccessed(false, e1);
+
+ check(p.queue(), e1);
+
+ p.onEntryAccessed(false, e2);
+
+ check(p.queue(), e1, e2);
+
+ p.onEntryAccessed(false, e3);
+
+ check(p.queue(), e1, e2, e3);
+
+ p.onEntryAccessed(false, e4);
+
+ check(p.queue(), e1, e2, e3, e4);
+
+ assertFalse(e1.isEvicted());
+ assertFalse(e2.isEvicted());
+ assertFalse(e3.isEvicted());
+ assertFalse(e4.isEvicted());
+
+ assertEquals(4, p.getCurrentSize());
+
+ p.onEntryAccessed(false, e5);
+
+ // Batch evicted.
+ check(p.queue(), e3, e4, e5);
+
+ assertEquals(3, p.getCurrentSize());
+
+ assertTrue(e1.isEvicted());
+ assertTrue(e2.isEvicted());
+ assertFalse(e3.isEvicted());
+ assertFalse(e4.isEvicted());
+ assertFalse(e5.isEvicted());
+
+ p.onEntryAccessed(false, e1 = new MockEntry("1", "1"));
+
+ check(p.queue(), e3, e4, e5, e1);
+
+ assertEquals(4, p.getCurrentSize());
+
+ assertFalse(e3.isEvicted());
+ assertFalse(e4.isEvicted());
+ assertFalse(e5.isEvicted());
+ assertFalse(e1.isEvicted());
+
+ p.onEntryAccessed(false, e5);
+
+ check(p.queue(), e3, e4, e5, e1);
+
+ assertFalse(e3.isEvicted());
+ assertFalse(e4.isEvicted());
+ assertFalse(e5.isEvicted());
+ assertFalse(e1.isEvicted());
+
+ p.onEntryAccessed(false, e1);
+
+ assertEquals(4, p.getCurrentSize());
+
+ check(p.queue(), e3, e4, e5, e1);
+
+ assertFalse(e3.isEvicted());
+ assertFalse(e4.isEvicted());
+ assertFalse(e5.isEvicted());
+ assertFalse(e1.isEvicted());
+
+ p.onEntryAccessed(true, e1);
+
+ assertEquals(3, p.getCurrentSize());
+
+ assertFalse(e3.isEvicted());
+ assertFalse(e4.isEvicted());
+ assertFalse(e5.isEvicted());
+
+ p.onEntryAccessed(true, e4);
+
+ assertEquals(2, p.getCurrentSize());
+
+ assertFalse(e3.isEvicted());
+ assertFalse(e5.isEvicted());
+
+ p.onEntryAccessed(true, e5);
+
+ assertEquals(1, p.getCurrentSize());
+
+ assertFalse(e3.isEvicted());
+
+ p.onEntryAccessed(true, e3);
+
+ assertEquals(0, p.getCurrentSize());
+
+ assertFalse(e3.isEvicted());
+
+ info(p);
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMemory() throws Exception {
+ try {
+ startGrid();
+
+ FifoEvictionPolicy<String, String> p = policy();
+
+ int max = 10;
+
+ int batchSize = 2;
+
+ p.setMaxSize(max);
+ p.setBatchSize(batchSize);
+
+ int cnt = max + batchSize;
+
+ for (int i = 0; i < cnt; i++)
+ p.onEntryAccessed(false, new MockEntry(Integer.toString(i), Integer.toString(i)));
+
+ info(p);
+
+ assertEquals(cnt - batchSize, p.getCurrentSize());
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRandom() throws Exception {
+ try {
+ startGrid();
+
+ FifoEvictionPolicy<String, String> p = policy();
+
+ int max = 10;
+
+ int batchSize = 2;
+
+ p.setMaxSize(max);
+
+ p.setBatchSize(batchSize);
+
+ Random rand = new Random();
+
+ int keys = 31;
+
+ MockEntry[] fifos = new MockEntry[keys];
+
+ for (int i = 0; i < fifos.length; i++)
+ fifos[i] = new MockEntry(Integer.toString(i));
+
+ int runs = 5000000;
+
+ for (int i = 0; i < runs; i++) {
+ boolean rmv = rand.nextBoolean();
+
+ int j = rand.nextInt(fifos.length);
+
+ MockEntry e = entry(fifos, j);
+
+ if (rmv)
+ fifos[j] = new MockEntry(Integer.toString(j));
+
+ p.onEntryAccessed(rmv, e);
+ }
+
+ info(p);
+
+ int curSize = p.getCurrentSize();
+
+ assert curSize < max + batchSize :
+ "curSize < max + batchSize [curSize=" + curSize + ", max=" + max + ", batchSize=" + batchSize + ']';
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testAllowEmptyEntries() throws Exception {
+ try {
+ startGrid();
+
+ MockEntry e1 = new MockEntry("1");
+
+ MockEntry e2 = new MockEntry("2");
+
+ MockEntry e3 = new MockEntry("3");
+
+ MockEntry e4 = new MockEntry("4");
+
+ MockEntry e5 = new MockEntry("5");
+
+ FifoEvictionPolicy<String, String> p = policy();
+
+ p.setBatchSize(2);
+
+ p.onEntryAccessed(false, e1);
+
+ assertFalse(e1.isEvicted());
+
+ p.onEntryAccessed(false, e2);
+
+ assertFalse(e1.isEvicted());
+ assertFalse(e2.isEvicted());
+
+ p.onEntryAccessed(false, e3);
+
+ assertFalse(e1.isEvicted());
+ assertFalse(e3.isEvicted());
+
+ p.onEntryAccessed(false, e4);
+
+ assertFalse(e1.isEvicted());
+ assertFalse(e3.isEvicted());
+ assertFalse(e4.isEvicted());
+
+ p.onEntryAccessed(false, e5);
+
+ assertFalse(e1.isEvicted());
+ assertFalse(e3.isEvicted());
+ assertFalse(e5.isEvicted());
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPut() throws Exception {
+ mode = LOCAL;
+ syncCommit = true;
+ plcMax = 10;
+
+ Ignite ignite = startGrid();
+
+ try {
+ IgniteCache<Object, Object> cache = ignite.cache(null);
+
+ int cnt = 500;
+
+ int min = Integer.MAX_VALUE;
+
+ int minIdx = 0;
+
+ for (int i = 0; i < cnt; i++) {
+ cache.put(i, i);
+
+ int cacheSize = cache.size();
+
+ if (i > plcMax && cacheSize < min) {
+ min = cacheSize;
+ minIdx = i;
+ }
+ }
+
+ // Batch evicted.
+ assert min >= plcMax : "Min cache size is too small: " + min;
+
+ info("Min cache size [min=" + min + ", idx=" + minIdx + ']');
+ info("Current cache size " + cache.size());
+ info("Current cache key size " + cache.size());
+
+ min = Integer.MAX_VALUE;
+
+ minIdx = 0;
+
+ // Touch.
+ for (int i = cnt; --i > cnt - plcMax;) {
+ cache.get(i);
+
+ int cacheSize = cache.size();
+
+ if (cacheSize < min) {
+ min = cacheSize;
+ minIdx = i;
+ }
+ }
+
+ info("----");
+ info("Min cache size [min=" + min + ", idx=" + minIdx + ']');
+ info("Current cache size " + cache.size());
+ info("Current cache key size " + cache.size());
+
+ // Batch evicted.
+ assert min >= plcMax : "Min cache size is too small: " + min;
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void testPartitionedNearDisabled() throws Exception {
+ plcBatchSize = 2;
+
+ super.testPartitionedNearDisabled();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected FifoEvictionPolicy<String, String> createPolicy(int plcMax) {
+ return new FifoEvictionPolicy<>(10, 2);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected FifoEvictionPolicy<String, String> createNearPolicy(int nearMax) {
+ return new FifoEvictionPolicy<>(nearMax, 2);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void checkNearPolicies(int endNearPlcSize) {
+ for (int i = 0; i < gridCnt; i++)
+ for (EvictableEntry<String, String> e : nearPolicy(i).queue())
+ assert !e.isCached() : "Invalid near policy size: " + nearPolicy(i).queue();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void checkPolicies(int plcMax) {
+ for (int i = 0; i < gridCnt; i++)
+ assert policy(i).queue().size() <= plcMax + policy(i).getBatchSize();
+ }
+
+}
[29/50] [abbrv] incubator-ignite git commit: # Ignite-593 Fix
compilation.
Posted by sb...@apache.org.
# Ignite-593 Fix compilation.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d49c0d3d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d49c0d3d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d49c0d3d
Branch: refs/heads/ignite-665
Commit: d49c0d3d3c41bfcc3acf99a5f342272152f7f4b6
Parents: f7cfc36
Author: AKuznetsov <ak...@gridgain.com>
Authored: Mon Apr 6 23:23:29 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Mon Apr 6 23:23:29 2015 +0700
----------------------------------------------------------------------
.../processors/query/h2/twostep/GridReduceQueryExecutor.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d49c0d3d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index 02c7c55..984e2c0 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -47,7 +47,7 @@ import org.h2.value.*;
import org.jsr166.*;
import javax.cache.*;
-import java.lang.reflect.*;
+import java.lang.reflect.Constructor;
import java.sql.*;
import java.util.*;
import java.util.concurrent.*;
[05/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'remotes/origin/ignite-571' into ignite-sprint-3
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-571' into ignite-sprint-3
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9e9a5c97
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9e9a5c97
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9e9a5c97
Branch: refs/heads/ignite-665
Commit: 9e9a5c972bf78bccc8f486a3a9709bf8bd605621
Parents: e061985 6924f0f
Author: ivasilinets <iv...@gridgain.com>
Authored: Mon Apr 6 14:39:11 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Mon Apr 6 14:39:11 2015 +0300
----------------------------------------------------------------------
modules/clients/readme.md | 2 -
.../processors/cache/CacheDistributionMode.java | 67 --------------------
.../IgniteCollectionAbstractTest.java | 23 -------
...GridCacheDhtEvictionNearReadersSelfTest.java | 2 +-
.../near/GridCacheNearEvictionSelfTest.java | 2 +-
...ePartitionedBasicStoreMultiNodeSelfTest.java | 8 +--
...NearDisabledBasicStoreMultiNodeSelfTest.java | 8 +--
.../cache/IgniteCacheAbstractQuerySelfTest.java | 6 +-
...niteCacheAtomicNearEnabledQuerySelfTest.java | 7 +-
.../near/IgniteCacheAtomicQuerySelfTest.java | 7 +-
modules/yardstick/README.md | 3 +-
.../yardstick/IgniteAbstractBenchmark.java | 5 +-
.../yardstick/IgniteBenchmarkArguments.java | 22 +++++--
.../org/apache/ignite/yardstick/IgniteNode.java | 11 ++--
14 files changed, 44 insertions(+), 129 deletions(-)
----------------------------------------------------------------------
[42/50] [abbrv] incubator-ignite git commit: # sprint-3 - Updated
streaming examples.
Posted by sb...@apache.org.
# sprint-3 - Updated streaming 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/cf6e1afa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/cf6e1afa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/cf6e1afa
Branch: refs/heads/ignite-665
Commit: cf6e1afa957d5bd04aa93fb995dbcbefcab475e7
Parents: 942f6de
Author: Dmitiry Setrakyan <ds...@gridgain.com>
Authored: Mon Apr 6 23:21:07 2015 -0700
Committer: Dmitiry Setrakyan <ds...@gridgain.com>
Committed: Mon Apr 6 23:21:07 2015 -0700
----------------------------------------------------------------------
.../streaming/transformers/package-info.java | 22 ++++++++++++++++++++
.../streaming/visitors/package-info.java | 22 ++++++++++++++++++++
.../streaming/wordcount/package-info.java | 22 ++++++++++++++++++++
.../streaming/transformers/package-info.java | 22 ++++++++++++++++++++
.../java8/streaming/visitors/package-info.java | 22 ++++++++++++++++++++
5 files changed, 110 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cf6e1afa/examples/src/main/java/org/apache/ignite/examples/streaming/transformers/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/transformers/package-info.java b/examples/src/main/java/org/apache/ignite/examples/streaming/transformers/package-info.java
new file mode 100644
index 0000000..8160531
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/transformers/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Streaming data transformation example.
+ */
+package org.apache.ignite.examples.streaming.transformers;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cf6e1afa/examples/src/main/java/org/apache/ignite/examples/streaming/visitors/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/visitors/package-info.java b/examples/src/main/java/org/apache/ignite/examples/streaming/visitors/package-info.java
new file mode 100644
index 0000000..9c158e0
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/visitors/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Streaming data visiting example.
+ */
+package org.apache.ignite.examples.streaming.visitors;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cf6e1afa/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
new file mode 100644
index 0000000..010f86a
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Streaming word count example.
+ */
+package org.apache.ignite.examples.streaming.wordcount;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cf6e1afa/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/transformers/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/transformers/package-info.java b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/transformers/package-info.java
new file mode 100644
index 0000000..7b37ca7
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/transformers/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Streaming data transformation example.
+ */
+package org.apache.ignite.examples.java8.streaming.transformers;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cf6e1afa/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/visitors/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/visitors/package-info.java b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/visitors/package-info.java
new file mode 100644
index 0000000..806f0a1
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/visitors/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Streaming data visiting example.
+ */
+package org.apache.ignite.examples.java8.streaming.visitors;
[43/50] [abbrv] incubator-ignite git commit: # sprint-3 - Updated
streaming examples.
Posted by sb...@apache.org.
# sprint-3 - Updated streaming 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/060ccf20
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/060ccf20
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/060ccf20
Branch: refs/heads/ignite-665
Commit: 060ccf2018f04fb3b51d4154c8658eda020c5639
Parents: cf6e1af
Author: Dmitiry Setrakyan <ds...@gridgain.com>
Authored: Mon Apr 6 23:25:02 2015 -0700
Committer: Dmitiry Setrakyan <ds...@gridgain.com>
Committed: Mon Apr 6 23:25:02 2015 -0700
----------------------------------------------------------------------
.../streaming/StreamTransformerExample.java | 101 +++++++++++
.../streaming/StreamVisitorExample.java | 176 +++++++++++++++++++
.../transformers/StreamTransformerExample.java | 101 -----------
.../streaming/transformers/package-info.java | 22 ---
.../visitors/StreamVisitorExample.java | 176 -------------------
.../streaming/visitors/package-info.java | 22 ---
.../streaming/StreamTransformerExample.java | 97 ++++++++++
.../java8/streaming/StreamVisitorExample.java | 173 ++++++++++++++++++
.../transformers/StreamTransformerExample.java | 97 ----------
.../streaming/transformers/package-info.java | 22 ---
.../visitors/StreamVisitorExample.java | 173 ------------------
.../java8/streaming/visitors/package-info.java | 22 ---
12 files changed, 547 insertions(+), 635 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/060ccf20/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
new file mode 100644
index 0000000..d5f619b
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/StreamTransformerExample.java
@@ -0,0 +1,101 @@
+/*
+ * 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;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.examples.*;
+import org.apache.ignite.stream.*;
+
+import javax.cache.processor.*;
+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 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. */
+ private static final Random RAND = new Random();
+
+ /** Range within which to generate numbers. */
+ private static final int RANGE = 1000;
+
+ public static void main(String[] args) throws Exception {
+ // Mark this cluster member as client.
+ Ignition.setClientMode(true);
+
+ try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+ if (!ExamplesUtils.hasServerNodes(ignite))
+ return;
+
+ CacheConfiguration<Integer, Long> cfg = new CacheConfiguration<>("randomNumbers");
+
+ // Index key and value.
+ cfg.setIndexedTypes(Integer.class, Long.class);
+
+ // Auto-close cache at the end of the example.
+ try (IgniteCache<Integer, Long> stmCache = ignite.getOrCreateCache(cfg)) {
+ try (IgniteDataStreamer<Integer, Long> stmr = ignite.dataStreamer(stmCache.getName())) {
+ // Allow data updates.
+ stmr.allowOverwrite(true);
+
+ // Configure data transformation to count instances of the same number.
+ stmr.receiver(new StreamTransformer<Integer, Long>() {
+ @Override
+ public Object process(MutableEntry<Integer, Long> e, Object... args) {
+ // Get current count.
+ Long val = e.getValue();
+
+ // Increment count by 1.
+ e.setValue(val == null ? 1L : val + 1);
+
+ return null;
+ }
+ });
+
+ // Stream 10 million of random numbers into the streamer cache.
+ for (int i = 1; i <= 10_000_000; i++) {
+ stmr.addData(RAND.nextInt(RANGE), 1L);
+
+ if (i % 500_000 == 0)
+ System.out.println("Number of tuples streamed into Ignite: " + i);
+ }
+ }
+
+ // Query top 10 most popular numbers every.
+ SqlFieldsQuery top10Qry = new SqlFieldsQuery("select _key, _val from Long order by _val desc limit 10");
+
+ // Execute queries.
+ List<List<?>> top10 = stmCache.query(top10Qry).getAll();
+
+ System.out.println("Top 10 most popular numbers:");
+
+ // Print top 10 words.
+ ExamplesUtils.printQueryResults(top10);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/060ccf20/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
new file mode 100644
index 0000000..47e5538
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/StreamVisitorExample.java
@@ -0,0 +1,176 @@
+/*
+ * 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;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.cache.query.annotations.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.examples.*;
+import org.apache.ignite.stream.*;
+
+import java.io.*;
+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 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. */
+ private static final Random RAND = new Random();
+
+ /** The list of instruments. */
+ private static final String[] INSTRUMENTS = {"IBM", "GOOG", "MSFT", "GE", "EBAY", "YHOO", "ORCL", "CSCO", "AMZN", "RHT"};
+
+ /** The list of initial instrument prices. */
+ private static final double[] INITIAL_PRICES = {194.9, 893.49, 34.21, 23.24, 57.93, 45.03, 44.41, 28.44, 378.49, 69.50};
+
+ public static void main(String[] args) throws Exception {
+ // Mark this cluster member as client.
+ Ignition.setClientMode(true);
+
+ try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+ if (!ExamplesUtils.hasServerNodes(ignite))
+ return;
+
+ // Market data cache with default configuration.
+ CacheConfiguration<String, Double> mktDataCfg = new CacheConfiguration<String, Double>("marketTicks");
+
+ // Financial instrument cache configuration.
+ CacheConfiguration<String, Instrument> instCfg = new CacheConfiguration<>("instCache");
+
+ // Index key and value for querying financial instruments.
+ // Note that Instrument class has @QuerySqlField annotation for secondary field indexing.
+ instCfg.setIndexedTypes(String.class, Instrument.class);
+
+ // Auto-close caches at the end of the example.
+ try (
+ IgniteCache<String, Double> mktCache = ignite.getOrCreateCache(mktDataCfg);
+ IgniteCache<String, Instrument> instCache = ignite.getOrCreateCache(instCfg)
+ ) {
+ try (IgniteDataStreamer<String, Double> mktStmr = ignite.dataStreamer(mktCache.getName())) {
+ // Note that we receive market data, but do not populate 'mktCache' (it remains empty).
+ // Instead we update the instruments in the 'instCache'.
+ // Since both, 'instCache' and 'mktCache' use the same key, updates are collocated.
+ mktStmr.receiver(new StreamVisitor<String, Double>() {
+ @Override
+ public void apply(IgniteCache<String, Double> cache, Map.Entry<String, Double> e) {
+ String symbol = e.getKey();
+ Double tick = e.getValue();
+
+ Instrument inst = instCache.get(symbol);
+
+ if (inst == null)
+ inst = new Instrument(symbol);
+
+ // Don't populate market cache, as we don't use it for querying.
+ // Update cached instrument based on the latest market tick.
+ inst.update(tick);
+
+ instCache.put(symbol, inst);
+ }
+ });
+
+ // Stream 10 million market data ticks into the system.
+ for (int i = 1; i <= 10_000_000; i++) {
+ int idx = RAND.nextInt(INSTRUMENTS.length);
+
+ // Use gaussian distribution to ensure that
+ // numbers closer to 0 have higher probability.
+ double price = round2(INITIAL_PRICES[idx] + RAND.nextGaussian());
+
+ mktStmr.addData(INSTRUMENTS[idx], price);
+
+ if (i % 500_000 == 0)
+ System.out.println("Number of tuples streamed into Ignite: " + i);
+ }
+ }
+
+ // Select top 3 best performing instruments.
+ SqlFieldsQuery top3qry = new SqlFieldsQuery(
+ "select symbol, (latest - open) from Instrument order by (latest - open) desc limit 3");
+
+ // Execute queries.
+ List<List<?>> top3 = instCache.query(top3qry).getAll();
+
+ System.out.println("Top performing financial instruments: ");
+
+ // Print top 10 words.
+ ExamplesUtils.printQueryResults(top3);
+ }
+ }
+ }
+
+ /**
+ * Rounds double value to two significant signs.
+ *
+ * @param val value to be rounded.
+ * @return rounded double value.
+ */
+ private static double round2(double val) {
+ return Math.floor(100 * val + 0.5) / 100;
+ }
+
+ /**
+ * Financial instrument.
+ */
+ public static class Instrument implements Serializable {
+ /** Instrument symbol. */
+ @QuerySqlField(index = true)
+ private final String symbol;
+
+ /** Open price. */
+ @QuerySqlField(index = true)
+ private double open;
+
+ /** Close price. */
+ @QuerySqlField(index = true)
+ private double latest;
+
+ /**
+ * @param symbol Symbol.
+ */
+ Instrument(String symbol) {
+ this.symbol = symbol;
+ }
+
+ /**
+ * Updates this instrument based on the latest price.
+ *
+ * @param price Latest price.
+ */
+ public void update(double price) {
+ if (open == 0)
+ open = price;
+
+ this.latest = price;
+ }
+
+ /** {@inheritDoc} */
+ @Override public synchronized String toString() {
+ return "Instrument [symbol=" + symbol + ", latest=" + latest + ", change=" + (latest - open) + ']';
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/060ccf20/examples/src/main/java/org/apache/ignite/examples/streaming/transformers/StreamTransformerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/transformers/StreamTransformerExample.java b/examples/src/main/java/org/apache/ignite/examples/streaming/transformers/StreamTransformerExample.java
deleted file mode 100644
index b2fc89d..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/transformers/StreamTransformerExample.java
+++ /dev/null
@@ -1,101 +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.transformers;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.query.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.examples.*;
-import org.apache.ignite.stream.*;
-
-import javax.cache.processor.*;
-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 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. */
- private static final Random RAND = new Random();
-
- /** Range within which to generate numbers. */
- private static final int RANGE = 1000;
-
- public static void main(String[] args) throws Exception {
- // Mark this cluster member as client.
- Ignition.setClientMode(true);
-
- try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
- if (!ExamplesUtils.hasServerNodes(ignite))
- return;
-
- CacheConfiguration<Integer, Long> cfg = new CacheConfiguration<>("randomNumbers");
-
- // Index key and value.
- cfg.setIndexedTypes(Integer.class, Long.class);
-
- // Auto-close cache at the end of the example.
- try (IgniteCache<Integer, Long> stmCache = ignite.getOrCreateCache(cfg)) {
- try (IgniteDataStreamer<Integer, Long> stmr = ignite.dataStreamer(stmCache.getName())) {
- // Allow data updates.
- stmr.allowOverwrite(true);
-
- // Configure data transformation to count instances of the same number.
- stmr.receiver(new StreamTransformer<Integer, Long>() {
- @Override
- public Object process(MutableEntry<Integer, Long> e, Object... args) {
- // Get current count.
- Long val = e.getValue();
-
- // Increment count by 1.
- e.setValue(val == null ? 1L : val + 1);
-
- return null;
- }
- });
-
- // Stream 10 million of random numbers into the streamer cache.
- for (int i = 1; i <= 10_000_000; i++) {
- stmr.addData(RAND.nextInt(RANGE), 1L);
-
- if (i % 500_000 == 0)
- System.out.println("Number of tuples streamed into Ignite: " + i);
- }
- }
-
- // Query top 10 most popular numbers every.
- SqlFieldsQuery top10Qry = new SqlFieldsQuery("select _key, _val from Long order by _val desc limit 10");
-
- // Execute queries.
- List<List<?>> top10 = stmCache.query(top10Qry).getAll();
-
- System.out.println("Top 10 most popular numbers:");
-
- // Print top 10 words.
- ExamplesUtils.printQueryResults(top10);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/060ccf20/examples/src/main/java/org/apache/ignite/examples/streaming/transformers/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/transformers/package-info.java b/examples/src/main/java/org/apache/ignite/examples/streaming/transformers/package-info.java
deleted file mode 100644
index 8160531..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/transformers/package-info.java
+++ /dev/null
@@ -1,22 +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 description. -->
- * Streaming data transformation example.
- */
-package org.apache.ignite.examples.streaming.transformers;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/060ccf20/examples/src/main/java/org/apache/ignite/examples/streaming/visitors/StreamVisitorExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/visitors/StreamVisitorExample.java b/examples/src/main/java/org/apache/ignite/examples/streaming/visitors/StreamVisitorExample.java
deleted file mode 100644
index cd973ea..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/visitors/StreamVisitorExample.java
+++ /dev/null
@@ -1,176 +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.visitors;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.query.*;
-import org.apache.ignite.cache.query.annotations.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.examples.*;
-import org.apache.ignite.stream.*;
-
-import java.io.*;
-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 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. */
- private static final Random RAND = new Random();
-
- /** The list of instruments. */
- private static final String[] INSTRUMENTS = {"IBM", "GOOG", "MSFT", "GE", "EBAY", "YHOO", "ORCL", "CSCO", "AMZN", "RHT"};
-
- /** The list of initial instrument prices. */
- private static final double[] INITIAL_PRICES = {194.9, 893.49, 34.21, 23.24, 57.93, 45.03, 44.41, 28.44, 378.49, 69.50};
-
- public static void main(String[] args) throws Exception {
- // Mark this cluster member as client.
- Ignition.setClientMode(true);
-
- try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
- if (!ExamplesUtils.hasServerNodes(ignite))
- return;
-
- // Market data cache with default configuration.
- CacheConfiguration<String, Double> mktDataCfg = new CacheConfiguration<String, Double>("marketTicks");
-
- // Financial instrument cache configuration.
- CacheConfiguration<String, Instrument> instCfg = new CacheConfiguration<>("instCache");
-
- // Index key and value for querying financial instruments.
- // Note that Instrument class has @QuerySqlField annotation for secondary field indexing.
- instCfg.setIndexedTypes(String.class, Instrument.class);
-
- // Auto-close caches at the end of the example.
- try (
- IgniteCache<String, Double> mktCache = ignite.getOrCreateCache(mktDataCfg);
- IgniteCache<String, Instrument> instCache = ignite.getOrCreateCache(instCfg)
- ) {
- try (IgniteDataStreamer<String, Double> mktStmr = ignite.dataStreamer(mktCache.getName())) {
- // Note that we receive market data, but do not populate 'mktCache' (it remains empty).
- // Instead we update the instruments in the 'instCache'.
- // Since both, 'instCache' and 'mktCache' use the same key, updates are collocated.
- mktStmr.receiver(new StreamVisitor<String, Double>() {
- @Override
- public void apply(IgniteCache<String, Double> cache, Map.Entry<String, Double> e) {
- String symbol = e.getKey();
- Double tick = e.getValue();
-
- Instrument inst = instCache.get(symbol);
-
- if (inst == null)
- inst = new Instrument(symbol);
-
- // Don't populate market cache, as we don't use it for querying.
- // Update cached instrument based on the latest market tick.
- inst.update(tick);
-
- instCache.put(symbol, inst);
- }
- });
-
- // Stream 10 million market data ticks into the system.
- for (int i = 1; i <= 10_000_000; i++) {
- int idx = RAND.nextInt(INSTRUMENTS.length);
-
- // Use gaussian distribution to ensure that
- // numbers closer to 0 have higher probability.
- double price = round2(INITIAL_PRICES[idx] + RAND.nextGaussian());
-
- mktStmr.addData(INSTRUMENTS[idx], price);
-
- if (i % 500_000 == 0)
- System.out.println("Number of tuples streamed into Ignite: " + i);
- }
- }
-
- // Select top 3 best performing instruments.
- SqlFieldsQuery top3qry = new SqlFieldsQuery(
- "select symbol, (latest - open) from Instrument order by (latest - open) desc limit 3");
-
- // Execute queries.
- List<List<?>> top3 = instCache.query(top3qry).getAll();
-
- System.out.println("Top performing financial instruments: ");
-
- // Print top 10 words.
- ExamplesUtils.printQueryResults(top3);
- }
- }
- }
-
- /**
- * Rounds double value to two significant signs.
- *
- * @param val value to be rounded.
- * @return rounded double value.
- */
- private static double round2(double val) {
- return Math.floor(100 * val + 0.5) / 100;
- }
-
- /**
- * Financial instrument.
- */
- public static class Instrument implements Serializable {
- /** Instrument symbol. */
- @QuerySqlField(index = true)
- private final String symbol;
-
- /** Open price. */
- @QuerySqlField(index = true)
- private double open;
-
- /** Close price. */
- @QuerySqlField(index = true)
- private double latest;
-
- /**
- * @param symbol Symbol.
- */
- Instrument(String symbol) {
- this.symbol = symbol;
- }
-
- /**
- * Updates this instrument based on the latest price.
- *
- * @param price Latest price.
- */
- public void update(double price) {
- if (open == 0)
- open = price;
-
- this.latest = price;
- }
-
- /** {@inheritDoc} */
- @Override public synchronized String toString() {
- return "Instrument [symbol=" + symbol + ", latest=" + latest + ", change=" + (latest - open) + ']';
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/060ccf20/examples/src/main/java/org/apache/ignite/examples/streaming/visitors/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/visitors/package-info.java b/examples/src/main/java/org/apache/ignite/examples/streaming/visitors/package-info.java
deleted file mode 100644
index 9c158e0..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/visitors/package-info.java
+++ /dev/null
@@ -1,22 +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 description. -->
- * Streaming data visiting example.
- */
-package org.apache.ignite.examples.streaming.visitors;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/060ccf20/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamTransformerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamTransformerExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamTransformerExample.java
new file mode 100644
index 0000000..fa13d20
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamTransformerExample.java
@@ -0,0 +1,97 @@
+/*
+ * 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.java8.streaming;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.examples.*;
+import org.apache.ignite.stream.*;
+
+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 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. */
+ private static final Random RAND = new Random();
+
+ /** Range within which to generate numbers. */
+ private static final int RANGE = 1000;
+
+ public static void main(String[] args) throws Exception {
+ // Mark this cluster member as client.
+ Ignition.setClientMode(true);
+
+ try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+ if (!ExamplesUtils.hasServerNodes(ignite))
+ return;
+
+ CacheConfiguration<Integer, Long> cfg = new CacheConfiguration<>("randomNumbers");
+
+ // Index key and value.
+ cfg.setIndexedTypes(Integer.class, Long.class);
+
+ // Auto-close cache at the end of the example.
+ try (IgniteCache<Integer, Long> stmCache = ignite.getOrCreateCache(cfg)) {
+ try (IgniteDataStreamer<Integer, Long> stmr = ignite.dataStreamer(stmCache.getName())) {
+ // Allow data updates.
+ stmr.allowOverwrite(true);
+
+ // Configure data transformation to count instances of the same number.
+ stmr.receiver(StreamTransformer.from((e, arg) -> {
+ // Get current count.
+ Long val = e.getValue();
+
+ // Increment count by 1.
+ e.setValue(val == null ? 1L : val + 1);
+
+ return null;
+ }));
+
+ // Stream 10 million of random numbers into the streamer cache.
+ for (int i = 1; i <= 10_000_000; i++) {
+ stmr.addData(RAND.nextInt(RANGE), 1L);
+
+ if (i % 500_000 == 0)
+ System.out.println("Number of tuples streamed into Ignite: " + i);
+ }
+ }
+
+ // Query top 10 most popular numbers every.
+ SqlFieldsQuery top10Qry = new SqlFieldsQuery("select _key, _val from Long order by _val desc limit 10");
+
+ // Execute queries.
+ List<List<?>> top10 = stmCache.query(top10Qry).getAll();
+
+ System.out.println("Top 10 most popular numbers:");
+
+ // Print top 10 words.
+ ExamplesUtils.printQueryResults(top10);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/060ccf20/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java
new file mode 100644
index 0000000..2fa7f16
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java
@@ -0,0 +1,173 @@
+/*
+ * 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.java8.streaming;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.cache.query.annotations.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.examples.*;
+import org.apache.ignite.stream.*;
+
+import java.io.*;
+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 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. */
+ private static final Random RAND = new Random();
+
+ /** The list of instruments. */
+ private static final String[] INSTRUMENTS = {"IBM", "GOOG", "MSFT", "GE", "EBAY", "YHOO", "ORCL", "CSCO", "AMZN", "RHT"};
+
+ /** The list of initial instrument prices. */
+ private static final double[] INITIAL_PRICES = {194.9, 893.49, 34.21, 23.24, 57.93, 45.03, 44.41, 28.44, 378.49, 69.50};
+
+ public static void main(String[] args) throws Exception {
+ // Mark this cluster member as client.
+ Ignition.setClientMode(true);
+
+ try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+ if (!ExamplesUtils.hasServerNodes(ignite))
+ return;
+
+ // Market data cache with default configuration.
+ CacheConfiguration<String, Double> mktDataCfg = new CacheConfiguration<String, Double>("marketTicks");
+
+ // Financial instrument cache configuration.
+ CacheConfiguration<String, Instrument> instCfg = new CacheConfiguration<>("instCache");
+
+ // Index key and value for querying financial instruments.
+ // Note that Instrument class has @QuerySqlField annotation for secondary field indexing.
+ instCfg.setIndexedTypes(String.class, Instrument.class);
+
+ // Auto-close caches at the end of the example.
+ try (
+ IgniteCache<String, Double> mktCache = ignite.getOrCreateCache(mktDataCfg);
+ IgniteCache<String, Instrument> instCache = ignite.getOrCreateCache(instCfg)
+ ) {
+ try (IgniteDataStreamer<String, Double> mktStmr = ignite.dataStreamer(mktCache.getName())) {
+ // Note that we receive market data, but do not populate 'mktCache' (it remains empty).
+ // Instead we update the instruments in the 'instCache'.
+ // Since both, 'instCache' and 'mktCache' use the same key, updates are collocated.
+ mktStmr.receiver(StreamVisitor.from((cache, e) -> {
+ String symbol = e.getKey();
+ Double tick = e.getValue();
+
+ Instrument inst = instCache.get(symbol);
+
+ if (inst == null)
+ inst = new Instrument(symbol);
+
+ // Don't populate market cache, as we don't use it for querying.
+ // Update cached instrument based on the latest market tick.
+ inst.update(tick);
+
+ instCache.put(symbol, inst);
+ }));
+
+ // Stream 10 million market data ticks into the system.
+ for (int i = 1; i <= 10_000_000; i++) {
+ int idx = RAND.nextInt(INSTRUMENTS.length);
+
+ // Use gaussian distribution to ensure that
+ // numbers closer to 0 have higher probability.
+ double price = round2(INITIAL_PRICES[idx] + RAND.nextGaussian());
+
+ mktStmr.addData(INSTRUMENTS[idx], price);
+
+ if (i % 500_000 == 0)
+ System.out.println("Number of tuples streamed into Ignite: " + i);
+ }
+ }
+
+ // Select top 3 best performing instruments.
+ SqlFieldsQuery top3qry = new SqlFieldsQuery(
+ "select symbol, (latest - open) from Instrument order by (latest - open) desc limit 3");
+
+ // Execute queries.
+ List<List<?>> top3 = instCache.query(top3qry).getAll();
+
+ System.out.println("Top performing financial instruments: ");
+
+ // Print top 10 words.
+ ExamplesUtils.printQueryResults(top3);
+ }
+ }
+ }
+
+ /**
+ * Rounds double value to two significant signs.
+ *
+ * @param val value to be rounded.
+ * @return rounded double value.
+ */
+ private static double round2(double val) {
+ return Math.floor(100 * val + 0.5) / 100;
+ }
+
+ /**
+ * Financial instrument.
+ */
+ public static class Instrument implements Serializable {
+ /** Instrument symbol. */
+ @QuerySqlField(index = true)
+ private final String symbol;
+
+ /** Open price. */
+ @QuerySqlField(index = true)
+ private double open;
+
+ /** Close price. */
+ @QuerySqlField(index = true)
+ private double latest;
+
+ /**
+ * @param symbol Symbol.
+ */
+ Instrument(String symbol) {
+ this.symbol = symbol;
+ }
+
+ /**
+ * Updates this instrument based on the latest price.
+ *
+ * @param price Latest price.
+ */
+ public void update(double price) {
+ if (open == 0)
+ open = price;
+
+ this.latest = price;
+ }
+
+ /** {@inheritDoc} */
+ @Override public synchronized String toString() {
+ return "Instrument [symbol=" + symbol + ", latest=" + latest + ", change=" + (latest - open) + ']';
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/060ccf20/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/transformers/StreamTransformerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/transformers/StreamTransformerExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/transformers/StreamTransformerExample.java
deleted file mode 100644
index 4ea1245..0000000
--- a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/transformers/StreamTransformerExample.java
+++ /dev/null
@@ -1,97 +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.java8.streaming.transformers;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.query.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.examples.*;
-import org.apache.ignite.stream.*;
-
-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 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. */
- private static final Random RAND = new Random();
-
- /** Range within which to generate numbers. */
- private static final int RANGE = 1000;
-
- public static void main(String[] args) throws Exception {
- // Mark this cluster member as client.
- Ignition.setClientMode(true);
-
- try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
- if (!ExamplesUtils.hasServerNodes(ignite))
- return;
-
- CacheConfiguration<Integer, Long> cfg = new CacheConfiguration<>("randomNumbers");
-
- // Index key and value.
- cfg.setIndexedTypes(Integer.class, Long.class);
-
- // Auto-close cache at the end of the example.
- try (IgniteCache<Integer, Long> stmCache = ignite.getOrCreateCache(cfg)) {
- try (IgniteDataStreamer<Integer, Long> stmr = ignite.dataStreamer(stmCache.getName())) {
- // Allow data updates.
- stmr.allowOverwrite(true);
-
- // Configure data transformation to count instances of the same number.
- stmr.receiver(StreamTransformer.from((e, arg) -> {
- // Get current count.
- Long val = e.getValue();
-
- // Increment count by 1.
- e.setValue(val == null ? 1L : val + 1);
-
- return null;
- }));
-
- // Stream 10 million of random numbers into the streamer cache.
- for (int i = 1; i <= 10_000_000; i++) {
- stmr.addData(RAND.nextInt(RANGE), 1L);
-
- if (i % 500_000 == 0)
- System.out.println("Number of tuples streamed into Ignite: " + i);
- }
- }
-
- // Query top 10 most popular numbers every.
- SqlFieldsQuery top10Qry = new SqlFieldsQuery("select _key, _val from Long order by _val desc limit 10");
-
- // Execute queries.
- List<List<?>> top10 = stmCache.query(top10Qry).getAll();
-
- System.out.println("Top 10 most popular numbers:");
-
- // Print top 10 words.
- ExamplesUtils.printQueryResults(top10);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/060ccf20/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/transformers/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/transformers/package-info.java b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/transformers/package-info.java
deleted file mode 100644
index 7b37ca7..0000000
--- a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/transformers/package-info.java
+++ /dev/null
@@ -1,22 +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 description. -->
- * Streaming data transformation example.
- */
-package org.apache.ignite.examples.java8.streaming.transformers;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/060ccf20/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/visitors/StreamVisitorExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/visitors/StreamVisitorExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/visitors/StreamVisitorExample.java
deleted file mode 100644
index 009a7c3..0000000
--- a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/visitors/StreamVisitorExample.java
+++ /dev/null
@@ -1,173 +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.java8.streaming.visitors;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.query.*;
-import org.apache.ignite.cache.query.annotations.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.examples.*;
-import org.apache.ignite.stream.*;
-
-import java.io.*;
-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 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. */
- private static final Random RAND = new Random();
-
- /** The list of instruments. */
- private static final String[] INSTRUMENTS = {"IBM", "GOOG", "MSFT", "GE", "EBAY", "YHOO", "ORCL", "CSCO", "AMZN", "RHT"};
-
- /** The list of initial instrument prices. */
- private static final double[] INITIAL_PRICES = {194.9, 893.49, 34.21, 23.24, 57.93, 45.03, 44.41, 28.44, 378.49, 69.50};
-
- public static void main(String[] args) throws Exception {
- // Mark this cluster member as client.
- Ignition.setClientMode(true);
-
- try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
- if (!ExamplesUtils.hasServerNodes(ignite))
- return;
-
- // Market data cache with default configuration.
- CacheConfiguration<String, Double> mktDataCfg = new CacheConfiguration<String, Double>("marketTicks");
-
- // Financial instrument cache configuration.
- CacheConfiguration<String, Instrument> instCfg = new CacheConfiguration<>("instCache");
-
- // Index key and value for querying financial instruments.
- // Note that Instrument class has @QuerySqlField annotation for secondary field indexing.
- instCfg.setIndexedTypes(String.class, Instrument.class);
-
- // Auto-close caches at the end of the example.
- try (
- IgniteCache<String, Double> mktCache = ignite.getOrCreateCache(mktDataCfg);
- IgniteCache<String, Instrument> instCache = ignite.getOrCreateCache(instCfg)
- ) {
- try (IgniteDataStreamer<String, Double> mktStmr = ignite.dataStreamer(mktCache.getName())) {
- // Note that we receive market data, but do not populate 'mktCache' (it remains empty).
- // Instead we update the instruments in the 'instCache'.
- // Since both, 'instCache' and 'mktCache' use the same key, updates are collocated.
- mktStmr.receiver(StreamVisitor.from((cache, e) -> {
- String symbol = e.getKey();
- Double tick = e.getValue();
-
- Instrument inst = instCache.get(symbol);
-
- if (inst == null)
- inst = new Instrument(symbol);
-
- // Don't populate market cache, as we don't use it for querying.
- // Update cached instrument based on the latest market tick.
- inst.update(tick);
-
- instCache.put(symbol, inst);
- }));
-
- // Stream 10 million market data ticks into the system.
- for (int i = 1; i <= 10_000_000; i++) {
- int idx = RAND.nextInt(INSTRUMENTS.length);
-
- // Use gaussian distribution to ensure that
- // numbers closer to 0 have higher probability.
- double price = round2(INITIAL_PRICES[idx] + RAND.nextGaussian());
-
- mktStmr.addData(INSTRUMENTS[idx], price);
-
- if (i % 500_000 == 0)
- System.out.println("Number of tuples streamed into Ignite: " + i);
- }
- }
-
- // Select top 3 best performing instruments.
- SqlFieldsQuery top3qry = new SqlFieldsQuery(
- "select symbol, (latest - open) from Instrument order by (latest - open) desc limit 3");
-
- // Execute queries.
- List<List<?>> top3 = instCache.query(top3qry).getAll();
-
- System.out.println("Top performing financial instruments: ");
-
- // Print top 10 words.
- ExamplesUtils.printQueryResults(top3);
- }
- }
- }
-
- /**
- * Rounds double value to two significant signs.
- *
- * @param val value to be rounded.
- * @return rounded double value.
- */
- private static double round2(double val) {
- return Math.floor(100 * val + 0.5) / 100;
- }
-
- /**
- * Financial instrument.
- */
- public static class Instrument implements Serializable {
- /** Instrument symbol. */
- @QuerySqlField(index = true)
- private final String symbol;
-
- /** Open price. */
- @QuerySqlField(index = true)
- private double open;
-
- /** Close price. */
- @QuerySqlField(index = true)
- private double latest;
-
- /**
- * @param symbol Symbol.
- */
- Instrument(String symbol) {
- this.symbol = symbol;
- }
-
- /**
- * Updates this instrument based on the latest price.
- *
- * @param price Latest price.
- */
- public void update(double price) {
- if (open == 0)
- open = price;
-
- this.latest = price;
- }
-
- /** {@inheritDoc} */
- @Override public synchronized String toString() {
- return "Instrument [symbol=" + symbol + ", latest=" + latest + ", change=" + (latest - open) + ']';
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/060ccf20/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/visitors/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/visitors/package-info.java b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/visitors/package-info.java
deleted file mode 100644
index 806f0a1..0000000
--- a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/visitors/package-info.java
+++ /dev/null
@@ -1,22 +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 description. -->
- * Streaming data visiting example.
- */
-package org.apache.ignite.examples.java8.streaming.visitors;
[45/50] [abbrv] incubator-ignite git commit: # sprint-3 - Updated
streaming examples.
Posted by sb...@apache.org.
# sprint-3 - Updated streaming 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/dcd24e0d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/dcd24e0d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/dcd24e0d
Branch: refs/heads/ignite-665
Commit: dcd24e0d60f6ecd7339798acd8a5e6bae0310dd0
Parents: 3c3931f
Author: Dmitiry Setrakyan <ds...@gridgain.com>
Authored: Tue Apr 7 00:00:24 2015 -0700
Committer: Dmitiry Setrakyan <ds...@gridgain.com>
Committed: Tue Apr 7 00:00:24 2015 -0700
----------------------------------------------------------------------
.../apache/ignite/examples/streaming/StreamTransformerExample.java | 2 +-
.../ignite/examples/java8/streaming/StreamTransformerExample.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dcd24e0d/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 d5f619b..5901984 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
@@ -62,7 +62,7 @@ public class StreamTransformerExample {
// Allow data updates.
stmr.allowOverwrite(true);
- // Configure data transformation to count instances of the same number.
+ // Configure data transformation to count random numbers added to the stream.
stmr.receiver(new StreamTransformer<Integer, Long>() {
@Override
public Object process(MutableEntry<Integer, Long> e, Object... args) {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dcd24e0d/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamTransformerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamTransformerExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamTransformerExample.java
index fa13d20..f66f9ea 100644
--- a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamTransformerExample.java
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamTransformerExample.java
@@ -61,7 +61,7 @@ public class StreamTransformerExample {
// Allow data updates.
stmr.allowOverwrite(true);
- // Configure data transformation to count instances of the same number.
+ // Configure data transformation to count random numbers added to the stream.
stmr.receiver(StreamTransformer.from((e, arg) -> {
// Get current count.
Long val = e.getValue();
[39/50] [abbrv] incubator-ignite git commit: # sprint-3 - Updated
streaming examples.
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/alice-in-wonderland.txt
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/alice-in-wonderland.txt b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/alice-in-wonderland.txt
new file mode 100644
index 0000000..d65883a
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/alice-in-wonderland.txt
@@ -0,0 +1,3735 @@
+Project Gutenberg's Alice's Adventures in Wonderland, by Lewis Carroll
+
+This eBook is for the use of anyone anywhere at no cost and with
+almost no restrictions whatsoever. You may copy it, give it away or
+re-use it under the terms of the Project Gutenberg License included
+with this eBook or online at www.gutenberg.org
+
+
+Title: Alice's Adventures in Wonderland
+
+Author: Lewis Carroll
+
+Posting Date: June 25, 2008 [EBook #11]
+Release Date: March, 1994
+[Last updated: December 20, 2011]
+
+Language: English
+
+
+*** START OF THIS PROJECT GUTENBERG EBOOK ALICE'S ADVENTURES IN WONDERLAND ***
+
+
+
+
+
+
+
+
+
+
+ALICE'S ADVENTURES IN WONDERLAND
+
+Lewis Carroll
+
+THE MILLENNIUM FULCRUM EDITION 3.0
+
+
+
+
+CHAPTER I. Down the Rabbit-Hole
+
+Alice was beginning to get very tired of sitting by her sister on the
+bank, and of having nothing to do: once or twice she had peeped into the
+book her sister was reading, but it had no pictures or conversations in
+it, 'and what is the use of a book,' thought Alice 'without pictures or
+conversation?'
+
+So she was considering in her own mind (as well as she could, for the
+hot day made her feel very sleepy and stupid), whether the pleasure
+of making a daisy-chain would be worth the trouble of getting up and
+picking the daisies, when suddenly a White Rabbit with pink eyes ran
+close by her.
+
+There was nothing so VERY remarkable in that; nor did Alice think it so
+VERY much out of the way to hear the Rabbit say to itself, 'Oh dear!
+Oh dear! I shall be late!' (when she thought it over afterwards, it
+occurred to her that she ought to have wondered at this, but at the time
+it all seemed quite natural); but when the Rabbit actually TOOK A WATCH
+OUT OF ITS WAISTCOAT-POCKET, and looked at it, and then hurried on,
+Alice started to her feet, for it flashed across her mind that she had
+never before seen a rabbit with either a waistcoat-pocket, or a watch
+to take out of it, and burning with curiosity, she ran across the field
+after it, and fortunately was just in time to see it pop down a large
+rabbit-hole under the hedge.
+
+In another moment down went Alice after it, never once considering how
+in the world she was to get out again.
+
+The rabbit-hole went straight on like a tunnel for some way, and then
+dipped suddenly down, so suddenly that Alice had not a moment to think
+about stopping herself before she found herself falling down a very deep
+well.
+
+Either the well was very deep, or she fell very slowly, for she had
+plenty of time as she went down to look about her and to wonder what was
+going to happen next. First, she tried to look down and make out what
+she was coming to, but it was too dark to see anything; then she
+looked at the sides of the well, and noticed that they were filled with
+cupboards and book-shelves; here and there she saw maps and pictures
+hung upon pegs. She took down a jar from one of the shelves as
+she passed; it was labelled 'ORANGE MARMALADE', but to her great
+disappointment it was empty: she did not like to drop the jar for fear
+of killing somebody, so managed to put it into one of the cupboards as
+she fell past it.
+
+'Well!' thought Alice to herself, 'after such a fall as this, I shall
+think nothing of tumbling down stairs! How brave they'll all think me at
+home! Why, I wouldn't say anything about it, even if I fell off the top
+of the house!' (Which was very likely true.)
+
+Down, down, down. Would the fall NEVER come to an end! 'I wonder how
+many miles I've fallen by this time?' she said aloud. 'I must be getting
+somewhere near the centre of the earth. Let me see: that would be four
+thousand miles down, I think--' (for, you see, Alice had learnt several
+things of this sort in her lessons in the schoolroom, and though this
+was not a VERY good opportunity for showing off her knowledge, as there
+was no one to listen to her, still it was good practice to say it over)
+'--yes, that's about the right distance--but then I wonder what Latitude
+or Longitude I've got to?' (Alice had no idea what Latitude was, or
+Longitude either, but thought they were nice grand words to say.)
+
+Presently she began again. 'I wonder if I shall fall right THROUGH the
+earth! How funny it'll seem to come out among the people that walk with
+their heads downward! The Antipathies, I think--' (she was rather glad
+there WAS no one listening, this time, as it didn't sound at all the
+right word) '--but I shall have to ask them what the name of the country
+is, you know. Please, Ma'am, is this New Zealand or Australia?' (and
+she tried to curtsey as she spoke--fancy CURTSEYING as you're falling
+through the air! Do you think you could manage it?) 'And what an
+ignorant little girl she'll think me for asking! No, it'll never do to
+ask: perhaps I shall see it written up somewhere.'
+
+Down, down, down. There was nothing else to do, so Alice soon began
+talking again. 'Dinah'll miss me very much to-night, I should think!'
+(Dinah was the cat.) 'I hope they'll remember her saucer of milk at
+tea-time. Dinah my dear! I wish you were down here with me! There are no
+mice in the air, I'm afraid, but you might catch a bat, and that's very
+like a mouse, you know. But do cats eat bats, I wonder?' And here Alice
+began to get rather sleepy, and went on saying to herself, in a dreamy
+sort of way, 'Do cats eat bats? Do cats eat bats?' and sometimes, 'Do
+bats eat cats?' for, you see, as she couldn't answer either question,
+it didn't much matter which way she put it. She felt that she was dozing
+off, and had just begun to dream that she was walking hand in hand with
+Dinah, and saying to her very earnestly, 'Now, Dinah, tell me the truth:
+did you ever eat a bat?' when suddenly, thump! thump! down she came upon
+a heap of sticks and dry leaves, and the fall was over.
+
+Alice was not a bit hurt, and she jumped up on to her feet in a moment:
+she looked up, but it was all dark overhead; before her was another
+long passage, and the White Rabbit was still in sight, hurrying down it.
+There was not a moment to be lost: away went Alice like the wind, and
+was just in time to hear it say, as it turned a corner, 'Oh my ears
+and whiskers, how late it's getting!' She was close behind it when she
+turned the corner, but the Rabbit was no longer to be seen: she found
+herself in a long, low hall, which was lit up by a row of lamps hanging
+from the roof.
+
+There were doors all round the hall, but they were all locked; and when
+Alice had been all the way down one side and up the other, trying every
+door, she walked sadly down the middle, wondering how she was ever to
+get out again.
+
+Suddenly she came upon a little three-legged table, all made of solid
+glass; there was nothing on it except a tiny golden key, and Alice's
+first thought was that it might belong to one of the doors of the hall;
+but, alas! either the locks were too large, or the key was too small,
+but at any rate it would not open any of them. However, on the second
+time round, she came upon a low curtain she had not noticed before, and
+behind it was a little door about fifteen inches high: she tried the
+little golden key in the lock, and to her great delight it fitted!
+
+Alice opened the door and found that it led into a small passage, not
+much larger than a rat-hole: she knelt down and looked along the passage
+into the loveliest garden you ever saw. How she longed to get out of
+that dark hall, and wander about among those beds of bright flowers and
+those cool fountains, but she could not even get her head through the
+doorway; 'and even if my head would go through,' thought poor Alice, 'it
+would be of very little use without my shoulders. Oh, how I wish I could
+shut up like a telescope! I think I could, if I only know how to begin.'
+For, you see, so many out-of-the-way things had happened lately,
+that Alice had begun to think that very few things indeed were really
+impossible.
+
+There seemed to be no use in waiting by the little door, so she went
+back to the table, half hoping she might find another key on it, or at
+any rate a book of rules for shutting people up like telescopes: this
+time she found a little bottle on it, ('which certainly was not here
+before,' said Alice,) and round the neck of the bottle was a paper
+label, with the words 'DRINK ME' beautifully printed on it in large
+letters.
+
+It was all very well to say 'Drink me,' but the wise little Alice was
+not going to do THAT in a hurry. 'No, I'll look first,' she said, 'and
+see whether it's marked "poison" or not'; for she had read several nice
+little histories about children who had got burnt, and eaten up by wild
+beasts and other unpleasant things, all because they WOULD not remember
+the simple rules their friends had taught them: such as, that a red-hot
+poker will burn you if you hold it too long; and that if you cut your
+finger VERY deeply with a knife, it usually bleeds; and she had never
+forgotten that, if you drink much from a bottle marked 'poison,' it is
+almost certain to disagree with you, sooner or later.
+
+However, this bottle was NOT marked 'poison,' so Alice ventured to taste
+it, and finding it very nice, (it had, in fact, a sort of mixed flavour
+of cherry-tart, custard, pine-apple, roast turkey, toffee, and hot
+buttered toast,) she very soon finished it off.
+
+ * * * * * * *
+
+ * * * * * *
+
+ * * * * * * *
+
+'What a curious feeling!' said Alice; 'I must be shutting up like a
+telescope.'
+
+And so it was indeed: she was now only ten inches high, and her face
+brightened up at the thought that she was now the right size for going
+through the little door into that lovely garden. First, however, she
+waited for a few minutes to see if she was going to shrink any further:
+she felt a little nervous about this; 'for it might end, you know,' said
+Alice to herself, 'in my going out altogether, like a candle. I wonder
+what I should be like then?' And she tried to fancy what the flame of a
+candle is like after the candle is blown out, for she could not remember
+ever having seen such a thing.
+
+After a while, finding that nothing more happened, she decided on going
+into the garden at once; but, alas for poor Alice! when she got to the
+door, she found she had forgotten the little golden key, and when she
+went back to the table for it, she found she could not possibly reach
+it: she could see it quite plainly through the glass, and she tried her
+best to climb up one of the legs of the table, but it was too slippery;
+and when she had tired herself out with trying, the poor little thing
+sat down and cried.
+
+'Come, there's no use in crying like that!' said Alice to herself,
+rather sharply; 'I advise you to leave off this minute!' She generally
+gave herself very good advice, (though she very seldom followed it),
+and sometimes she scolded herself so severely as to bring tears into
+her eyes; and once she remembered trying to box her own ears for having
+cheated herself in a game of croquet she was playing against herself,
+for this curious child was very fond of pretending to be two people.
+'But it's no use now,' thought poor Alice, 'to pretend to be two people!
+Why, there's hardly enough of me left to make ONE respectable person!'
+
+Soon her eye fell on a little glass box that was lying under the table:
+she opened it, and found in it a very small cake, on which the words
+'EAT ME' were beautifully marked in currants. 'Well, I'll eat it,' said
+Alice, 'and if it makes me grow larger, I can reach the key; and if it
+makes me grow smaller, I can creep under the door; so either way I'll
+get into the garden, and I don't care which happens!'
+
+She ate a little bit, and said anxiously to herself, 'Which way? Which
+way?', holding her hand on the top of her head to feel which way it was
+growing, and she was quite surprised to find that she remained the same
+size: to be sure, this generally happens when one eats cake, but Alice
+had got so much into the way of expecting nothing but out-of-the-way
+things to happen, that it seemed quite dull and stupid for life to go on
+in the common way.
+
+So she set to work, and very soon finished off the cake.
+
+ * * * * * * *
+
+ * * * * * *
+
+ * * * * * * *
+
+
+
+
+CHAPTER II. The Pool of Tears
+
+'Curiouser and curiouser!' cried Alice (she was so much surprised, that
+for the moment she quite forgot how to speak good English); 'now I'm
+opening out like the largest telescope that ever was! Good-bye, feet!'
+(for when she looked down at her feet, they seemed to be almost out of
+sight, they were getting so far off). 'Oh, my poor little feet, I wonder
+who will put on your shoes and stockings for you now, dears? I'm sure
+_I_ shan't be able! I shall be a great deal too far off to trouble
+myself about you: you must manage the best way you can;--but I must be
+kind to them,' thought Alice, 'or perhaps they won't walk the way I want
+to go! Let me see: I'll give them a new pair of boots every Christmas.'
+
+And she went on planning to herself how she would manage it. 'They must
+go by the carrier,' she thought; 'and how funny it'll seem, sending
+presents to one's own feet! And how odd the directions will look!
+
+ ALICE'S RIGHT FOOT, ESQ.
+ HEARTHRUG,
+ NEAR THE FENDER,
+ (WITH ALICE'S LOVE).
+
+Oh dear, what nonsense I'm talking!'
+
+Just then her head struck against the roof of the hall: in fact she was
+now more than nine feet high, and she at once took up the little golden
+key and hurried off to the garden door.
+
+Poor Alice! It was as much as she could do, lying down on one side, to
+look through into the garden with one eye; but to get through was more
+hopeless than ever: she sat down and began to cry again.
+
+'You ought to be ashamed of yourself,' said Alice, 'a great girl like
+you,' (she might well say this), 'to go on crying in this way! Stop this
+moment, I tell you!' But she went on all the same, shedding gallons of
+tears, until there was a large pool all round her, about four inches
+deep and reaching half down the hall.
+
+After a time she heard a little pattering of feet in the distance, and
+she hastily dried her eyes to see what was coming. It was the White
+Rabbit returning, splendidly dressed, with a pair of white kid gloves in
+one hand and a large fan in the other: he came trotting along in a great
+hurry, muttering to himself as he came, 'Oh! the Duchess, the Duchess!
+Oh! won't she be savage if I've kept her waiting!' Alice felt so
+desperate that she was ready to ask help of any one; so, when the Rabbit
+came near her, she began, in a low, timid voice, 'If you please, sir--'
+The Rabbit started violently, dropped the white kid gloves and the fan,
+and skurried away into the darkness as hard as he could go.
+
+Alice took up the fan and gloves, and, as the hall was very hot, she
+kept fanning herself all the time she went on talking: 'Dear, dear! How
+queer everything is to-day! And yesterday things went on just as usual.
+I wonder if I've been changed in the night? Let me think: was I the
+same when I got up this morning? I almost think I can remember feeling a
+little different. But if I'm not the same, the next question is, Who
+in the world am I? Ah, THAT'S the great puzzle!' And she began thinking
+over all the children she knew that were of the same age as herself, to
+see if she could have been changed for any of them.
+
+'I'm sure I'm not Ada,' she said, 'for her hair goes in such long
+ringlets, and mine doesn't go in ringlets at all; and I'm sure I can't
+be Mabel, for I know all sorts of things, and she, oh! she knows such a
+very little! Besides, SHE'S she, and I'm I, and--oh dear, how puzzling
+it all is! I'll try if I know all the things I used to know. Let me
+see: four times five is twelve, and four times six is thirteen, and
+four times seven is--oh dear! I shall never get to twenty at that rate!
+However, the Multiplication Table doesn't signify: let's try Geography.
+London is the capital of Paris, and Paris is the capital of Rome, and
+Rome--no, THAT'S all wrong, I'm certain! I must have been changed for
+Mabel! I'll try and say "How doth the little--"' and she crossed her
+hands on her lap as if she were saying lessons, and began to repeat it,
+but her voice sounded hoarse and strange, and the words did not come the
+same as they used to do:--
+
+ 'How doth the little crocodile
+ Improve his shining tail,
+ And pour the waters of the Nile
+ On every golden scale!
+
+ 'How cheerfully he seems to grin,
+ How neatly spread his claws,
+ And welcome little fishes in
+ With gently smiling jaws!'
+
+'I'm sure those are not the right words,' said poor Alice, and her eyes
+filled with tears again as she went on, 'I must be Mabel after all, and
+I shall have to go and live in that poky little house, and have next to
+no toys to play with, and oh! ever so many lessons to learn! No, I've
+made up my mind about it; if I'm Mabel, I'll stay down here! It'll be no
+use their putting their heads down and saying "Come up again, dear!" I
+shall only look up and say "Who am I then? Tell me that first, and then,
+if I like being that person, I'll come up: if not, I'll stay down here
+till I'm somebody else"--but, oh dear!' cried Alice, with a sudden burst
+of tears, 'I do wish they WOULD put their heads down! I am so VERY tired
+of being all alone here!'
+
+As she said this she looked down at her hands, and was surprised to see
+that she had put on one of the Rabbit's little white kid gloves while
+she was talking. 'How CAN I have done that?' she thought. 'I must
+be growing small again.' She got up and went to the table to measure
+herself by it, and found that, as nearly as she could guess, she was now
+about two feet high, and was going on shrinking rapidly: she soon found
+out that the cause of this was the fan she was holding, and she dropped
+it hastily, just in time to avoid shrinking away altogether.
+
+'That WAS a narrow escape!' said Alice, a good deal frightened at the
+sudden change, but very glad to find herself still in existence; 'and
+now for the garden!' and she ran with all speed back to the little door:
+but, alas! the little door was shut again, and the little golden key was
+lying on the glass table as before, 'and things are worse than ever,'
+thought the poor child, 'for I never was so small as this before, never!
+And I declare it's too bad, that it is!'
+
+As she said these words her foot slipped, and in another moment, splash!
+she was up to her chin in salt water. Her first idea was that she
+had somehow fallen into the sea, 'and in that case I can go back by
+railway,' she said to herself. (Alice had been to the seaside once in
+her life, and had come to the general conclusion, that wherever you go
+to on the English coast you find a number of bathing machines in the
+sea, some children digging in the sand with wooden spades, then a row
+of lodging houses, and behind them a railway station.) However, she soon
+made out that she was in the pool of tears which she had wept when she
+was nine feet high.
+
+'I wish I hadn't cried so much!' said Alice, as she swam about, trying
+to find her way out. 'I shall be punished for it now, I suppose, by
+being drowned in my own tears! That WILL be a queer thing, to be sure!
+However, everything is queer to-day.'
+
+Just then she heard something splashing about in the pool a little way
+off, and she swam nearer to make out what it was: at first she thought
+it must be a walrus or hippopotamus, but then she remembered how small
+she was now, and she soon made out that it was only a mouse that had
+slipped in like herself.
+
+'Would it be of any use, now,' thought Alice, 'to speak to this mouse?
+Everything is so out-of-the-way down here, that I should think very
+likely it can talk: at any rate, there's no harm in trying.' So she
+began: 'O Mouse, do you know the way out of this pool? I am very tired
+of swimming about here, O Mouse!' (Alice thought this must be the right
+way of speaking to a mouse: she had never done such a thing before, but
+she remembered having seen in her brother's Latin Grammar, 'A mouse--of
+a mouse--to a mouse--a mouse--O mouse!') The Mouse looked at her rather
+inquisitively, and seemed to her to wink with one of its little eyes,
+but it said nothing.
+
+'Perhaps it doesn't understand English,' thought Alice; 'I daresay it's
+a French mouse, come over with William the Conqueror.' (For, with all
+her knowledge of history, Alice had no very clear notion how long ago
+anything had happened.) So she began again: 'Ou est ma chatte?' which
+was the first sentence in her French lesson-book. The Mouse gave a
+sudden leap out of the water, and seemed to quiver all over with fright.
+'Oh, I beg your pardon!' cried Alice hastily, afraid that she had hurt
+the poor animal's feelings. 'I quite forgot you didn't like cats.'
+
+'Not like cats!' cried the Mouse, in a shrill, passionate voice. 'Would
+YOU like cats if you were me?'
+
+'Well, perhaps not,' said Alice in a soothing tone: 'don't be angry
+about it. And yet I wish I could show you our cat Dinah: I think you'd
+take a fancy to cats if you could only see her. She is such a dear quiet
+thing,' Alice went on, half to herself, as she swam lazily about in the
+pool, 'and she sits purring so nicely by the fire, licking her paws and
+washing her face--and she is such a nice soft thing to nurse--and she's
+such a capital one for catching mice--oh, I beg your pardon!' cried
+Alice again, for this time the Mouse was bristling all over, and she
+felt certain it must be really offended. 'We won't talk about her any
+more if you'd rather not.'
+
+'We indeed!' cried the Mouse, who was trembling down to the end of his
+tail. 'As if I would talk on such a subject! Our family always HATED
+cats: nasty, low, vulgar things! Don't let me hear the name again!'
+
+'I won't indeed!' said Alice, in a great hurry to change the subject of
+conversation. 'Are you--are you fond--of--of dogs?' The Mouse did not
+answer, so Alice went on eagerly: 'There is such a nice little dog near
+our house I should like to show you! A little bright-eyed terrier, you
+know, with oh, such long curly brown hair! And it'll fetch things when
+you throw them, and it'll sit up and beg for its dinner, and all sorts
+of things--I can't remember half of them--and it belongs to a farmer,
+you know, and he says it's so useful, it's worth a hundred pounds! He
+says it kills all the rats and--oh dear!' cried Alice in a sorrowful
+tone, 'I'm afraid I've offended it again!' For the Mouse was swimming
+away from her as hard as it could go, and making quite a commotion in
+the pool as it went.
+
+So she called softly after it, 'Mouse dear! Do come back again, and we
+won't talk about cats or dogs either, if you don't like them!' When the
+Mouse heard this, it turned round and swam slowly back to her: its
+face was quite pale (with passion, Alice thought), and it said in a low
+trembling voice, 'Let us get to the shore, and then I'll tell you my
+history, and you'll understand why it is I hate cats and dogs.'
+
+It was high time to go, for the pool was getting quite crowded with the
+birds and animals that had fallen into it: there were a Duck and a Dodo,
+a Lory and an Eaglet, and several other curious creatures. Alice led the
+way, and the whole party swam to the shore.
+
+
+
+
+CHAPTER III. A Caucus-Race and a Long Tale
+
+They were indeed a queer-looking party that assembled on the bank--the
+birds with draggled feathers, the animals with their fur clinging close
+to them, and all dripping wet, cross, and uncomfortable.
+
+The first question of course was, how to get dry again: they had a
+consultation about this, and after a few minutes it seemed quite natural
+to Alice to find herself talking familiarly with them, as if she had
+known them all her life. Indeed, she had quite a long argument with the
+Lory, who at last turned sulky, and would only say, 'I am older than
+you, and must know better'; and this Alice would not allow without
+knowing how old it was, and, as the Lory positively refused to tell its
+age, there was no more to be said.
+
+At last the Mouse, who seemed to be a person of authority among them,
+called out, 'Sit down, all of you, and listen to me! I'LL soon make you
+dry enough!' They all sat down at once, in a large ring, with the Mouse
+in the middle. Alice kept her eyes anxiously fixed on it, for she felt
+sure she would catch a bad cold if she did not get dry very soon.
+
+'Ahem!' said the Mouse with an important air, 'are you all ready? This
+is the driest thing I know. Silence all round, if you please! "William
+the Conqueror, whose cause was favoured by the pope, was soon submitted
+to by the English, who wanted leaders, and had been of late much
+accustomed to usurpation and conquest. Edwin and Morcar, the earls of
+Mercia and Northumbria--"'
+
+'Ugh!' said the Lory, with a shiver.
+
+'I beg your pardon!' said the Mouse, frowning, but very politely: 'Did
+you speak?'
+
+'Not I!' said the Lory hastily.
+
+'I thought you did,' said the Mouse. '--I proceed. "Edwin and Morcar,
+the earls of Mercia and Northumbria, declared for him: and even Stigand,
+the patriotic archbishop of Canterbury, found it advisable--"'
+
+'Found WHAT?' said the Duck.
+
+'Found IT,' the Mouse replied rather crossly: 'of course you know what
+"it" means.'
+
+'I know what "it" means well enough, when I find a thing,' said the
+Duck: 'it's generally a frog or a worm. The question is, what did the
+archbishop find?'
+
+The Mouse did not notice this question, but hurriedly went on, '"--found
+it advisable to go with Edgar Atheling to meet William and offer him the
+crown. William's conduct at first was moderate. But the insolence of his
+Normans--" How are you getting on now, my dear?' it continued, turning
+to Alice as it spoke.
+
+'As wet as ever,' said Alice in a melancholy tone: 'it doesn't seem to
+dry me at all.'
+
+'In that case,' said the Dodo solemnly, rising to its feet, 'I move
+that the meeting adjourn, for the immediate adoption of more energetic
+remedies--'
+
+'Speak English!' said the Eaglet. 'I don't know the meaning of half
+those long words, and, what's more, I don't believe you do either!' And
+the Eaglet bent down its head to hide a smile: some of the other birds
+tittered audibly.
+
+'What I was going to say,' said the Dodo in an offended tone, 'was, that
+the best thing to get us dry would be a Caucus-race.'
+
+'What IS a Caucus-race?' said Alice; not that she wanted much to know,
+but the Dodo had paused as if it thought that SOMEBODY ought to speak,
+and no one else seemed inclined to say anything.
+
+'Why,' said the Dodo, 'the best way to explain it is to do it.' (And, as
+you might like to try the thing yourself, some winter day, I will tell
+you how the Dodo managed it.)
+
+First it marked out a race-course, in a sort of circle, ('the exact
+shape doesn't matter,' it said,) and then all the party were placed
+along the course, here and there. There was no 'One, two, three, and
+away,' but they began running when they liked, and left off when they
+liked, so that it was not easy to know when the race was over. However,
+when they had been running half an hour or so, and were quite dry again,
+the Dodo suddenly called out 'The race is over!' and they all crowded
+round it, panting, and asking, 'But who has won?'
+
+This question the Dodo could not answer without a great deal of thought,
+and it sat for a long time with one finger pressed upon its forehead
+(the position in which you usually see Shakespeare, in the pictures
+of him), while the rest waited in silence. At last the Dodo said,
+'EVERYBODY has won, and all must have prizes.'
+
+'But who is to give the prizes?' quite a chorus of voices asked.
+
+'Why, SHE, of course,' said the Dodo, pointing to Alice with one finger;
+and the whole party at once crowded round her, calling out in a confused
+way, 'Prizes! Prizes!'
+
+Alice had no idea what to do, and in despair she put her hand in her
+pocket, and pulled out a box of comfits, (luckily the salt water had
+not got into it), and handed them round as prizes. There was exactly one
+a-piece all round.
+
+'But she must have a prize herself, you know,' said the Mouse.
+
+'Of course,' the Dodo replied very gravely. 'What else have you got in
+your pocket?' he went on, turning to Alice.
+
+'Only a thimble,' said Alice sadly.
+
+'Hand it over here,' said the Dodo.
+
+Then they all crowded round her once more, while the Dodo solemnly
+presented the thimble, saying 'We beg your acceptance of this elegant
+thimble'; and, when it had finished this short speech, they all cheered.
+
+Alice thought the whole thing very absurd, but they all looked so grave
+that she did not dare to laugh; and, as she could not think of anything
+to say, she simply bowed, and took the thimble, looking as solemn as she
+could.
+
+The next thing was to eat the comfits: this caused some noise and
+confusion, as the large birds complained that they could not taste
+theirs, and the small ones choked and had to be patted on the back.
+However, it was over at last, and they sat down again in a ring, and
+begged the Mouse to tell them something more.
+
+'You promised to tell me your history, you know,' said Alice, 'and why
+it is you hate--C and D,' she added in a whisper, half afraid that it
+would be offended again.
+
+'Mine is a long and a sad tale!' said the Mouse, turning to Alice, and
+sighing.
+
+'It IS a long tail, certainly,' said Alice, looking down with wonder at
+the Mouse's tail; 'but why do you call it sad?' And she kept on puzzling
+about it while the Mouse was speaking, so that her idea of the tale was
+something like this:--
+
+ 'Fury said to a
+ mouse, That he
+ met in the
+ house,
+ "Let us
+ both go to
+ law: I will
+ prosecute
+ YOU.--Come,
+ I'll take no
+ denial; We
+ must have a
+ trial: For
+ really this
+ morning I've
+ nothing
+ to do."
+ Said the
+ mouse to the
+ cur, "Such
+ a trial,
+ dear Sir,
+ With
+ no jury
+ or judge,
+ would be
+ wasting
+ our
+ breath."
+ "I'll be
+ judge, I'll
+ be jury,"
+ Said
+ cunning
+ old Fury:
+ "I'll
+ try the
+ whole
+ cause,
+ and
+ condemn
+ you
+ to
+ death."'
+
+
+'You are not attending!' said the Mouse to Alice severely. 'What are you
+thinking of?'
+
+'I beg your pardon,' said Alice very humbly: 'you had got to the fifth
+bend, I think?'
+
+'I had NOT!' cried the Mouse, sharply and very angrily.
+
+'A knot!' said Alice, always ready to make herself useful, and looking
+anxiously about her. 'Oh, do let me help to undo it!'
+
+'I shall do nothing of the sort,' said the Mouse, getting up and walking
+away. 'You insult me by talking such nonsense!'
+
+'I didn't mean it!' pleaded poor Alice. 'But you're so easily offended,
+you know!'
+
+The Mouse only growled in reply.
+
+'Please come back and finish your story!' Alice called after it; and the
+others all joined in chorus, 'Yes, please do!' but the Mouse only shook
+its head impatiently, and walked a little quicker.
+
+'What a pity it wouldn't stay!' sighed the Lory, as soon as it was quite
+out of sight; and an old Crab took the opportunity of saying to her
+daughter 'Ah, my dear! Let this be a lesson to you never to lose
+YOUR temper!' 'Hold your tongue, Ma!' said the young Crab, a little
+snappishly. 'You're enough to try the patience of an oyster!'
+
+'I wish I had our Dinah here, I know I do!' said Alice aloud, addressing
+nobody in particular. 'She'd soon fetch it back!'
+
+'And who is Dinah, if I might venture to ask the question?' said the
+Lory.
+
+Alice replied eagerly, for she was always ready to talk about her pet:
+'Dinah's our cat. And she's such a capital one for catching mice you
+can't think! And oh, I wish you could see her after the birds! Why,
+she'll eat a little bird as soon as look at it!'
+
+This speech caused a remarkable sensation among the party. Some of the
+birds hurried off at once: one old Magpie began wrapping itself up very
+carefully, remarking, 'I really must be getting home; the night-air
+doesn't suit my throat!' and a Canary called out in a trembling voice to
+its children, 'Come away, my dears! It's high time you were all in bed!'
+On various pretexts they all moved off, and Alice was soon left alone.
+
+'I wish I hadn't mentioned Dinah!' she said to herself in a melancholy
+tone. 'Nobody seems to like her, down here, and I'm sure she's the best
+cat in the world! Oh, my dear Dinah! I wonder if I shall ever see you
+any more!' And here poor Alice began to cry again, for she felt very
+lonely and low-spirited. In a little while, however, she again heard
+a little pattering of footsteps in the distance, and she looked up
+eagerly, half hoping that the Mouse had changed his mind, and was coming
+back to finish his story.
+
+
+
+
+CHAPTER IV. The Rabbit Sends in a Little Bill
+
+It was the White Rabbit, trotting slowly back again, and looking
+anxiously about as it went, as if it had lost something; and she heard
+it muttering to itself 'The Duchess! The Duchess! Oh my dear paws! Oh
+my fur and whiskers! She'll get me executed, as sure as ferrets are
+ferrets! Where CAN I have dropped them, I wonder?' Alice guessed in a
+moment that it was looking for the fan and the pair of white kid gloves,
+and she very good-naturedly began hunting about for them, but they were
+nowhere to be seen--everything seemed to have changed since her swim in
+the pool, and the great hall, with the glass table and the little door,
+had vanished completely.
+
+Very soon the Rabbit noticed Alice, as she went hunting about, and
+called out to her in an angry tone, 'Why, Mary Ann, what ARE you doing
+out here? Run home this moment, and fetch me a pair of gloves and a fan!
+Quick, now!' And Alice was so much frightened that she ran off at once
+in the direction it pointed to, without trying to explain the mistake it
+had made.
+
+'He took me for his housemaid,' she said to herself as she ran. 'How
+surprised he'll be when he finds out who I am! But I'd better take him
+his fan and gloves--that is, if I can find them.' As she said this, she
+came upon a neat little house, on the door of which was a bright brass
+plate with the name 'W. RABBIT' engraved upon it. She went in without
+knocking, and hurried upstairs, in great fear lest she should meet the
+real Mary Ann, and be turned out of the house before she had found the
+fan and gloves.
+
+'How queer it seems,' Alice said to herself, 'to be going messages for
+a rabbit! I suppose Dinah'll be sending me on messages next!' And she
+began fancying the sort of thing that would happen: '"Miss Alice! Come
+here directly, and get ready for your walk!" "Coming in a minute,
+nurse! But I've got to see that the mouse doesn't get out." Only I don't
+think,' Alice went on, 'that they'd let Dinah stop in the house if it
+began ordering people about like that!'
+
+By this time she had found her way into a tidy little room with a table
+in the window, and on it (as she had hoped) a fan and two or three pairs
+of tiny white kid gloves: she took up the fan and a pair of the gloves,
+and was just going to leave the room, when her eye fell upon a little
+bottle that stood near the looking-glass. There was no label this time
+with the words 'DRINK ME,' but nevertheless she uncorked it and put it
+to her lips. 'I know SOMETHING interesting is sure to happen,' she said
+to herself, 'whenever I eat or drink anything; so I'll just see what
+this bottle does. I do hope it'll make me grow large again, for really
+I'm quite tired of being such a tiny little thing!'
+
+It did so indeed, and much sooner than she had expected: before she had
+drunk half the bottle, she found her head pressing against the ceiling,
+and had to stoop to save her neck from being broken. She hastily put
+down the bottle, saying to herself 'That's quite enough--I hope I shan't
+grow any more--As it is, I can't get out at the door--I do wish I hadn't
+drunk quite so much!'
+
+Alas! it was too late to wish that! She went on growing, and growing,
+and very soon had to kneel down on the floor: in another minute there
+was not even room for this, and she tried the effect of lying down with
+one elbow against the door, and the other arm curled round her head.
+Still she went on growing, and, as a last resource, she put one arm out
+of the window, and one foot up the chimney, and said to herself 'Now I
+can do no more, whatever happens. What WILL become of me?'
+
+Luckily for Alice, the little magic bottle had now had its full effect,
+and she grew no larger: still it was very uncomfortable, and, as there
+seemed to be no sort of chance of her ever getting out of the room
+again, no wonder she felt unhappy.
+
+'It was much pleasanter at home,' thought poor Alice, 'when one wasn't
+always growing larger and smaller, and being ordered about by mice and
+rabbits. I almost wish I hadn't gone down that rabbit-hole--and yet--and
+yet--it's rather curious, you know, this sort of life! I do wonder what
+CAN have happened to me! When I used to read fairy-tales, I fancied that
+kind of thing never happened, and now here I am in the middle of one!
+There ought to be a book written about me, that there ought! And when I
+grow up, I'll write one--but I'm grown up now,' she added in a sorrowful
+tone; 'at least there's no room to grow up any more HERE.'
+
+'But then,' thought Alice, 'shall I NEVER get any older than I am
+now? That'll be a comfort, one way--never to be an old woman--but
+then--always to have lessons to learn! Oh, I shouldn't like THAT!'
+
+'Oh, you foolish Alice!' she answered herself. 'How can you learn
+lessons in here? Why, there's hardly room for YOU, and no room at all
+for any lesson-books!'
+
+And so she went on, taking first one side and then the other, and making
+quite a conversation of it altogether; but after a few minutes she heard
+a voice outside, and stopped to listen.
+
+'Mary Ann! Mary Ann!' said the voice. 'Fetch me my gloves this moment!'
+Then came a little pattering of feet on the stairs. Alice knew it was
+the Rabbit coming to look for her, and she trembled till she shook the
+house, quite forgetting that she was now about a thousand times as large
+as the Rabbit, and had no reason to be afraid of it.
+
+Presently the Rabbit came up to the door, and tried to open it; but, as
+the door opened inwards, and Alice's elbow was pressed hard against it,
+that attempt proved a failure. Alice heard it say to itself 'Then I'll
+go round and get in at the window.'
+
+'THAT you won't' thought Alice, and, after waiting till she fancied
+she heard the Rabbit just under the window, she suddenly spread out her
+hand, and made a snatch in the air. She did not get hold of anything,
+but she heard a little shriek and a fall, and a crash of broken glass,
+from which she concluded that it was just possible it had fallen into a
+cucumber-frame, or something of the sort.
+
+Next came an angry voice--the Rabbit's--'Pat! Pat! Where are you?' And
+then a voice she had never heard before, 'Sure then I'm here! Digging
+for apples, yer honour!'
+
+'Digging for apples, indeed!' said the Rabbit angrily. 'Here! Come and
+help me out of THIS!' (Sounds of more broken glass.)
+
+'Now tell me, Pat, what's that in the window?'
+
+'Sure, it's an arm, yer honour!' (He pronounced it 'arrum.')
+
+'An arm, you goose! Who ever saw one that size? Why, it fills the whole
+window!'
+
+'Sure, it does, yer honour: but it's an arm for all that.'
+
+'Well, it's got no business there, at any rate: go and take it away!'
+
+There was a long silence after this, and Alice could only hear whispers
+now and then; such as, 'Sure, I don't like it, yer honour, at all, at
+all!' 'Do as I tell you, you coward!' and at last she spread out her
+hand again, and made another snatch in the air. This time there were
+TWO little shrieks, and more sounds of broken glass. 'What a number of
+cucumber-frames there must be!' thought Alice. 'I wonder what they'll do
+next! As for pulling me out of the window, I only wish they COULD! I'm
+sure I don't want to stay in here any longer!'
+
+She waited for some time without hearing anything more: at last came a
+rumbling of little cartwheels, and the sound of a good many voices
+all talking together: she made out the words: 'Where's the other
+ladder?--Why, I hadn't to bring but one; Bill's got the other--Bill!
+fetch it here, lad!--Here, put 'em up at this corner--No, tie 'em
+together first--they don't reach half high enough yet--Oh! they'll
+do well enough; don't be particular--Here, Bill! catch hold of this
+rope--Will the roof bear?--Mind that loose slate--Oh, it's coming
+down! Heads below!' (a loud crash)--'Now, who did that?--It was Bill, I
+fancy--Who's to go down the chimney?--Nay, I shan't! YOU do it!--That I
+won't, then!--Bill's to go down--Here, Bill! the master says you're to
+go down the chimney!'
+
+'Oh! So Bill's got to come down the chimney, has he?' said Alice to
+herself. 'Shy, they seem to put everything upon Bill! I wouldn't be in
+Bill's place for a good deal: this fireplace is narrow, to be sure; but
+I THINK I can kick a little!'
+
+She drew her foot as far down the chimney as she could, and waited
+till she heard a little animal (she couldn't guess of what sort it was)
+scratching and scrambling about in the chimney close above her: then,
+saying to herself 'This is Bill,' she gave one sharp kick, and waited to
+see what would happen next.
+
+The first thing she heard was a general chorus of 'There goes Bill!'
+then the Rabbit's voice along--'Catch him, you by the hedge!' then
+silence, and then another confusion of voices--'Hold up his head--Brandy
+now--Don't choke him--How was it, old fellow? What happened to you? Tell
+us all about it!'
+
+Last came a little feeble, squeaking voice, ('That's Bill,' thought
+Alice,) 'Well, I hardly know--No more, thank ye; I'm better now--but I'm
+a deal too flustered to tell you--all I know is, something comes at me
+like a Jack-in-the-box, and up I goes like a sky-rocket!'
+
+'So you did, old fellow!' said the others.
+
+'We must burn the house down!' said the Rabbit's voice; and Alice called
+out as loud as she could, 'If you do. I'll set Dinah at you!'
+
+There was a dead silence instantly, and Alice thought to herself, 'I
+wonder what they WILL do next! If they had any sense, they'd take the
+roof off.' After a minute or two, they began moving about again, and
+Alice heard the Rabbit say, 'A barrowful will do, to begin with.'
+
+'A barrowful of WHAT?' thought Alice; but she had not long to doubt,
+for the next moment a shower of little pebbles came rattling in at the
+window, and some of them hit her in the face. 'I'll put a stop to this,'
+she said to herself, and shouted out, 'You'd better not do that again!'
+which produced another dead silence.
+
+Alice noticed with some surprise that the pebbles were all turning into
+little cakes as they lay on the floor, and a bright idea came into her
+head. 'If I eat one of these cakes,' she thought, 'it's sure to make
+SOME change in my size; and as it can't possibly make me larger, it must
+make me smaller, I suppose.'
+
+So she swallowed one of the cakes, and was delighted to find that she
+began shrinking directly. As soon as she was small enough to get through
+the door, she ran out of the house, and found quite a crowd of little
+animals and birds waiting outside. The poor little Lizard, Bill, was
+in the middle, being held up by two guinea-pigs, who were giving it
+something out of a bottle. They all made a rush at Alice the moment she
+appeared; but she ran off as hard as she could, and soon found herself
+safe in a thick wood.
+
+'The first thing I've got to do,' said Alice to herself, as she wandered
+about in the wood, 'is to grow to my right size again; and the second
+thing is to find my way into that lovely garden. I think that will be
+the best plan.'
+
+It sounded an excellent plan, no doubt, and very neatly and simply
+arranged; the only difficulty was, that she had not the smallest idea
+how to set about it; and while she was peering about anxiously among
+the trees, a little sharp bark just over her head made her look up in a
+great hurry.
+
+An enormous puppy was looking down at her with large round eyes, and
+feebly stretching out one paw, trying to touch her. 'Poor little thing!'
+said Alice, in a coaxing tone, and she tried hard to whistle to it; but
+she was terribly frightened all the time at the thought that it might be
+hungry, in which case it would be very likely to eat her up in spite of
+all her coaxing.
+
+Hardly knowing what she did, she picked up a little bit of stick, and
+held it out to the puppy; whereupon the puppy jumped into the air off
+all its feet at once, with a yelp of delight, and rushed at the stick,
+and made believe to worry it; then Alice dodged behind a great thistle,
+to keep herself from being run over; and the moment she appeared on the
+other side, the puppy made another rush at the stick, and tumbled head
+over heels in its hurry to get hold of it; then Alice, thinking it was
+very like having a game of play with a cart-horse, and expecting every
+moment to be trampled under its feet, ran round the thistle again; then
+the puppy began a series of short charges at the stick, running a very
+little way forwards each time and a long way back, and barking hoarsely
+all the while, till at last it sat down a good way off, panting, with
+its tongue hanging out of its mouth, and its great eyes half shut.
+
+This seemed to Alice a good opportunity for making her escape; so she
+set off at once, and ran till she was quite tired and out of breath, and
+till the puppy's bark sounded quite faint in the distance.
+
+'And yet what a dear little puppy it was!' said Alice, as she leant
+against a buttercup to rest herself, and fanned herself with one of the
+leaves: 'I should have liked teaching it tricks very much, if--if I'd
+only been the right size to do it! Oh dear! I'd nearly forgotten that
+I've got to grow up again! Let me see--how IS it to be managed? I
+suppose I ought to eat or drink something or other; but the great
+question is, what?'
+
+The great question certainly was, what? Alice looked all round her at
+the flowers and the blades of grass, but she did not see anything that
+looked like the right thing to eat or drink under the circumstances.
+There was a large mushroom growing near her, about the same height as
+herself; and when she had looked under it, and on both sides of it, and
+behind it, it occurred to her that she might as well look and see what
+was on the top of it.
+
+She stretched herself up on tiptoe, and peeped over the edge of the
+mushroom, and her eyes immediately met those of a large caterpillar,
+that was sitting on the top with its arms folded, quietly smoking a long
+hookah, and taking not the smallest notice of her or of anything else.
+
+
+
+
+CHAPTER V. Advice from a Caterpillar
+
+The Caterpillar and Alice looked at each other for some time in silence:
+at last the Caterpillar took the hookah out of its mouth, and addressed
+her in a languid, sleepy voice.
+
+'Who are YOU?' said the Caterpillar.
+
+This was not an encouraging opening for a conversation. Alice replied,
+rather shyly, 'I--I hardly know, sir, just at present--at least I know
+who I WAS when I got up this morning, but I think I must have been
+changed several times since then.'
+
+'What do you mean by that?' said the Caterpillar sternly. 'Explain
+yourself!'
+
+'I can't explain MYSELF, I'm afraid, sir' said Alice, 'because I'm not
+myself, you see.'
+
+'I don't see,' said the Caterpillar.
+
+'I'm afraid I can't put it more clearly,' Alice replied very politely,
+'for I can't understand it myself to begin with; and being so many
+different sizes in a day is very confusing.'
+
+'It isn't,' said the Caterpillar.
+
+'Well, perhaps you haven't found it so yet,' said Alice; 'but when you
+have to turn into a chrysalis--you will some day, you know--and then
+after that into a butterfly, I should think you'll feel it a little
+queer, won't you?'
+
+'Not a bit,' said the Caterpillar.
+
+'Well, perhaps your feelings may be different,' said Alice; 'all I know
+is, it would feel very queer to ME.'
+
+'You!' said the Caterpillar contemptuously. 'Who are YOU?'
+
+Which brought them back again to the beginning of the conversation.
+Alice felt a little irritated at the Caterpillar's making such VERY
+short remarks, and she drew herself up and said, very gravely, 'I think,
+you ought to tell me who YOU are, first.'
+
+'Why?' said the Caterpillar.
+
+Here was another puzzling question; and as Alice could not think of any
+good reason, and as the Caterpillar seemed to be in a VERY unpleasant
+state of mind, she turned away.
+
+'Come back!' the Caterpillar called after her. 'I've something important
+to say!'
+
+This sounded promising, certainly: Alice turned and came back again.
+
+'Keep your temper,' said the Caterpillar.
+
+'Is that all?' said Alice, swallowing down her anger as well as she
+could.
+
+'No,' said the Caterpillar.
+
+Alice thought she might as well wait, as she had nothing else to do, and
+perhaps after all it might tell her something worth hearing. For some
+minutes it puffed away without speaking, but at last it unfolded its
+arms, took the hookah out of its mouth again, and said, 'So you think
+you're changed, do you?'
+
+'I'm afraid I am, sir,' said Alice; 'I can't remember things as I
+used--and I don't keep the same size for ten minutes together!'
+
+'Can't remember WHAT things?' said the Caterpillar.
+
+'Well, I've tried to say "HOW DOTH THE LITTLE BUSY BEE," but it all came
+different!' Alice replied in a very melancholy voice.
+
+'Repeat, "YOU ARE OLD, FATHER WILLIAM,"' said the Caterpillar.
+
+Alice folded her hands, and began:--
+
+ 'You are old, Father William,' the young man said,
+ 'And your hair has become very white;
+ And yet you incessantly stand on your head--
+ Do you think, at your age, it is right?'
+
+ 'In my youth,' Father William replied to his son,
+ 'I feared it might injure the brain;
+ But, now that I'm perfectly sure I have none,
+ Why, I do it again and again.'
+
+ 'You are old,' said the youth, 'as I mentioned before,
+ And have grown most uncommonly fat;
+ Yet you turned a back-somersault in at the door--
+ Pray, what is the reason of that?'
+
+ 'In my youth,' said the sage, as he shook his grey locks,
+ 'I kept all my limbs very supple
+ By the use of this ointment--one shilling the box--
+ Allow me to sell you a couple?'
+
+ 'You are old,' said the youth, 'and your jaws are too weak
+ For anything tougher than suet;
+ Yet you finished the goose, with the bones and the beak--
+ Pray how did you manage to do it?'
+
+ 'In my youth,' said his father, 'I took to the law,
+ And argued each case with my wife;
+ And the muscular strength, which it gave to my jaw,
+ Has lasted the rest of my life.'
+
+ 'You are old,' said the youth, 'one would hardly suppose
+ That your eye was as steady as ever;
+ Yet you balanced an eel on the end of your nose--
+ What made you so awfully clever?'
+
+ 'I have answered three questions, and that is enough,'
+ Said his father; 'don't give yourself airs!
+ Do you think I can listen all day to such stuff?
+ Be off, or I'll kick you down stairs!'
+
+
+'That is not said right,' said the Caterpillar.
+
+'Not QUITE right, I'm afraid,' said Alice, timidly; 'some of the words
+have got altered.'
+
+'It is wrong from beginning to end,' said the Caterpillar decidedly, and
+there was silence for some minutes.
+
+The Caterpillar was the first to speak.
+
+'What size do you want to be?' it asked.
+
+'Oh, I'm not particular as to size,' Alice hastily replied; 'only one
+doesn't like changing so often, you know.'
+
+'I DON'T know,' said the Caterpillar.
+
+Alice said nothing: she had never been so much contradicted in her life
+before, and she felt that she was losing her temper.
+
+'Are you content now?' said the Caterpillar.
+
+'Well, I should like to be a LITTLE larger, sir, if you wouldn't mind,'
+said Alice: 'three inches is such a wretched height to be.'
+
+'It is a very good height indeed!' said the Caterpillar angrily, rearing
+itself upright as it spoke (it was exactly three inches high).
+
+'But I'm not used to it!' pleaded poor Alice in a piteous tone. And
+she thought of herself, 'I wish the creatures wouldn't be so easily
+offended!'
+
+'You'll get used to it in time,' said the Caterpillar; and it put the
+hookah into its mouth and began smoking again.
+
+This time Alice waited patiently until it chose to speak again. In
+a minute or two the Caterpillar took the hookah out of its mouth
+and yawned once or twice, and shook itself. Then it got down off the
+mushroom, and crawled away in the grass, merely remarking as it went,
+'One side will make you grow taller, and the other side will make you
+grow shorter.'
+
+'One side of WHAT? The other side of WHAT?' thought Alice to herself.
+
+'Of the mushroom,' said the Caterpillar, just as if she had asked it
+aloud; and in another moment it was out of sight.
+
+Alice remained looking thoughtfully at the mushroom for a minute, trying
+to make out which were the two sides of it; and as it was perfectly
+round, she found this a very difficult question. However, at last she
+stretched her arms round it as far as they would go, and broke off a bit
+of the edge with each hand.
+
+'And now which is which?' she said to herself, and nibbled a little of
+the right-hand bit to try the effect: the next moment she felt a violent
+blow underneath her chin: it had struck her foot!
+
+She was a good deal frightened by this very sudden change, but she felt
+that there was no time to be lost, as she was shrinking rapidly; so she
+set to work at once to eat some of the other bit. Her chin was pressed
+so closely against her foot, that there was hardly room to open her
+mouth; but she did it at last, and managed to swallow a morsel of the
+lefthand bit.
+
+
+ * * * * * * *
+
+ * * * * * *
+
+ * * * * * * *
+
+'Come, my head's free at last!' said Alice in a tone of delight, which
+changed into alarm in another moment, when she found that her shoulders
+were nowhere to be found: all she could see, when she looked down, was
+an immense length of neck, which seemed to rise like a stalk out of a
+sea of green leaves that lay far below her.
+
+'What CAN all that green stuff be?' said Alice. 'And where HAVE my
+shoulders got to? And oh, my poor hands, how is it I can't see you?'
+She was moving them about as she spoke, but no result seemed to follow,
+except a little shaking among the distant green leaves.
+
+As there seemed to be no chance of getting her hands up to her head, she
+tried to get her head down to them, and was delighted to find that her
+neck would bend about easily in any direction, like a serpent. She had
+just succeeded in curving it down into a graceful zigzag, and was going
+to dive in among the leaves, which she found to be nothing but the tops
+of the trees under which she had been wandering, when a sharp hiss made
+her draw back in a hurry: a large pigeon had flown into her face, and
+was beating her violently with its wings.
+
+'Serpent!' screamed the Pigeon.
+
+'I'm NOT a serpent!' said Alice indignantly. 'Let me alone!'
+
+'Serpent, I say again!' repeated the Pigeon, but in a more subdued tone,
+and added with a kind of sob, 'I've tried every way, and nothing seems
+to suit them!'
+
+'I haven't the least idea what you're talking about,' said Alice.
+
+'I've tried the roots of trees, and I've tried banks, and I've tried
+hedges,' the Pigeon went on, without attending to her; 'but those
+serpents! There's no pleasing them!'
+
+Alice was more and more puzzled, but she thought there was no use in
+saying anything more till the Pigeon had finished.
+
+'As if it wasn't trouble enough hatching the eggs,' said the Pigeon;
+'but I must be on the look-out for serpents night and day! Why, I
+haven't had a wink of sleep these three weeks!'
+
+'I'm very sorry you've been annoyed,' said Alice, who was beginning to
+see its meaning.
+
+'And just as I'd taken the highest tree in the wood,' continued the
+Pigeon, raising its voice to a shriek, 'and just as I was thinking I
+should be free of them at last, they must needs come wriggling down from
+the sky! Ugh, Serpent!'
+
+'But I'm NOT a serpent, I tell you!' said Alice. 'I'm a--I'm a--'
+
+'Well! WHAT are you?' said the Pigeon. 'I can see you're trying to
+invent something!'
+
+'I--I'm a little girl,' said Alice, rather doubtfully, as she remembered
+the number of changes she had gone through that day.
+
+'A likely story indeed!' said the Pigeon in a tone of the deepest
+contempt. 'I've seen a good many little girls in my time, but never ONE
+with such a neck as that! No, no! You're a serpent; and there's no use
+denying it. I suppose you'll be telling me next that you never tasted an
+egg!'
+
+'I HAVE tasted eggs, certainly,' said Alice, who was a very truthful
+child; 'but little girls eat eggs quite as much as serpents do, you
+know.'
+
+'I don't believe it,' said the Pigeon; 'but if they do, why then they're
+a kind of serpent, that's all I can say.'
+
+This was such a new idea to Alice, that she was quite silent for a
+minute or two, which gave the Pigeon the opportunity of adding, 'You're
+looking for eggs, I know THAT well enough; and what does it matter to me
+whether you're a little girl or a serpent?'
+
+'It matters a good deal to ME,' said Alice hastily; 'but I'm not looking
+for eggs, as it happens; and if I was, I shouldn't want YOURS: I don't
+like them raw.'
+
+'Well, be off, then!' said the Pigeon in a sulky tone, as it settled
+down again into its nest. Alice crouched down among the trees as well as
+she could, for her neck kept getting entangled among the branches, and
+every now and then she had to stop and untwist it. After a while she
+remembered that she still held the pieces of mushroom in her hands, and
+she set to work very carefully, nibbling first at one and then at the
+other, and growing sometimes taller and sometimes shorter, until she had
+succeeded in bringing herself down to her usual height.
+
+It was so long since she had been anything near the right size, that it
+felt quite strange at first; but she got used to it in a few minutes,
+and began talking to herself, as usual. 'Come, there's half my plan done
+now! How puzzling all these changes are! I'm never sure what I'm going
+to be, from one minute to another! However, I've got back to my right
+size: the next thing is, to get into that beautiful garden--how IS that
+to be done, I wonder?' As she said this, she came suddenly upon an open
+place, with a little house in it about four feet high. 'Whoever lives
+there,' thought Alice, 'it'll never do to come upon them THIS size: why,
+I should frighten them out of their wits!' So she began nibbling at the
+righthand bit again, and did not venture to go near the house till she
+had brought herself down to nine inches high.
+
+
+
+
+CHAPTER VI. Pig and Pepper
+
+For a minute or two she stood looking at the house, and wondering what
+to do next, when suddenly a footman in livery came running out of the
+wood--(she considered him to be a footman because he was in livery:
+otherwise, judging by his face only, she would have called him a
+fish)--and rapped loudly at the door with his knuckles. It was opened
+by another footman in livery, with a round face, and large eyes like a
+frog; and both footmen, Alice noticed, had powdered hair that curled all
+over their heads. She felt very curious to know what it was all about,
+and crept a little way out of the wood to listen.
+
+The Fish-Footman began by producing from under his arm a great letter,
+nearly as large as himself, and this he handed over to the other,
+saying, in a solemn tone, 'For the Duchess. An invitation from the Queen
+to play croquet.' The Frog-Footman repeated, in the same solemn tone,
+only changing the order of the words a little, 'From the Queen. An
+invitation for the Duchess to play croquet.'
+
+Then they both bowed low, and their curls got entangled together.
+
+Alice laughed so much at this, that she had to run back into the
+wood for fear of their hearing her; and when she next peeped out the
+Fish-Footman was gone, and the other was sitting on the ground near the
+door, staring stupidly up into the sky.
+
+Alice went timidly up to the door, and knocked.
+
+'There's no sort of use in knocking,' said the Footman, 'and that for
+two reasons. First, because I'm on the same side of the door as you
+are; secondly, because they're making such a noise inside, no one could
+possibly hear you.' And certainly there was a most extraordinary noise
+going on within--a constant howling and sneezing, and every now and then
+a great crash, as if a dish or kettle had been broken to pieces.
+
+'Please, then,' said Alice, 'how am I to get in?'
+
+'There might be some sense in your knocking,' the Footman went on
+without attending to her, 'if we had the door between us. For instance,
+if you were INSIDE, you might knock, and I could let you out, you know.'
+He was looking up into the sky all the time he was speaking, and this
+Alice thought decidedly uncivil. 'But perhaps he can't help it,' she
+said to herself; 'his eyes are so VERY nearly at the top of his head.
+But at any rate he might answer questions.--How am I to get in?' she
+repeated, aloud.
+
+'I shall sit here,' the Footman remarked, 'till tomorrow--'
+
+At this moment the door of the house opened, and a large plate came
+skimming out, straight at the Footman's head: it just grazed his nose,
+and broke to pieces against one of the trees behind him.
+
+'--or next day, maybe,' the Footman continued in the same tone, exactly
+as if nothing had happened.
+
+'How am I to get in?' asked Alice again, in a louder tone.
+
+'ARE you to get in at all?' said the Footman. 'That's the first
+question, you know.'
+
+It was, no doubt: only Alice did not like to be told so. 'It's really
+dreadful,' she muttered to herself, 'the way all the creatures argue.
+It's enough to drive one crazy!'
+
+The Footman seemed to think this a good opportunity for repeating his
+remark, with variations. 'I shall sit here,' he said, 'on and off, for
+days and days.'
+
+'But what am I to do?' said Alice.
+
+'Anything you like,' said the Footman, and began whistling.
+
+'Oh, there's no use in talking to him,' said Alice desperately: 'he's
+perfectly idiotic!' And she opened the door and went in.
+
+The door led right into a large kitchen, which was full of smoke from
+one end to the other: the Duchess was sitting on a three-legged stool in
+the middle, nursing a baby; the cook was leaning over the fire, stirring
+a large cauldron which seemed to be full of soup.
+
+'There's certainly too much pepper in that soup!' Alice said to herself,
+as well as she could for sneezing.
+
+There was certainly too much of it in the air. Even the Duchess
+sneezed occasionally; and as for the baby, it was sneezing and howling
+alternately without a moment's pause. The only things in the kitchen
+that did not sneeze, were the cook, and a large cat which was sitting on
+the hearth and grinning from ear to ear.
+
+'Please would you tell me,' said Alice, a little timidly, for she was
+not quite sure whether it was good manners for her to speak first, 'why
+your cat grins like that?'
+
+'It's a Cheshire cat,' said the Duchess, 'and that's why. Pig!'
+
+She said the last word with such sudden violence that Alice quite
+jumped; but she saw in another moment that it was addressed to the baby,
+and not to her, so she took courage, and went on again:--
+
+'I didn't know that Cheshire cats always grinned; in fact, I didn't know
+that cats COULD grin.'
+
+'They all can,' said the Duchess; 'and most of 'em do.'
+
+'I don't know of any that do,' Alice said very politely, feeling quite
+pleased to have got into a conversation.
+
+'You don't know much,' said the Duchess; 'and that's a fact.'
+
+Alice did not at all like the tone of this remark, and thought it would
+be as well to introduce some other subject of conversation. While she
+was trying to fix on one, the cook took the cauldron of soup off the
+fire, and at once set to work throwing everything within her reach at
+the Duchess and the baby--the fire-irons came first; then followed a
+shower of saucepans, plates, and dishes. The Duchess took no notice of
+them even when they hit her; and the baby was howling so much already,
+that it was quite impossible to say whether the blows hurt it or not.
+
+'Oh, PLEASE mind what you're doing!' cried Alice, jumping up and down in
+an agony of terror. 'Oh, there goes his PRECIOUS nose'; as an unusually
+large saucepan flew close by it, and very nearly carried it off.
+
+'If everybody minded their own business,' the Duchess said in a hoarse
+growl, 'the world would go round a deal faster than it does.'
+
+'Which would NOT be an advantage,' said Alice, who felt very glad to get
+an opportunity of showing off a little of her knowledge. 'Just think of
+what work it would make with the day and night! You see the earth takes
+twenty-four hours to turn round on its axis--'
+
+'Talking of axes,' said the Duchess, 'chop off her head!'
+
+Alice glanced rather anxiously at the cook, to see if she meant to take
+the hint; but the cook was busily stirring the soup, and seemed not to
+be listening, so she went on again: 'Twenty-four hours, I THINK; or is
+it twelve? I--'
+
+'Oh, don't bother ME,' said the Duchess; 'I never could abide figures!'
+And with that she began nursing her child again, singing a sort of
+lullaby to it as she did so, and giving it a violent shake at the end of
+every line:
+
+ 'Speak roughly to your little boy,
+ And beat him when he sneezes:
+ He only does it to annoy,
+ Because he knows it teases.'
+
+ CHORUS.
+
+ (In which the cook and the baby joined):--
+
+ 'Wow! wow! wow!'
+
+While the Duchess sang the second verse of the song, she kept tossing
+the baby violently up and down, and the poor little thing howled so,
+that Alice could hardly hear the words:--
+
+ 'I speak severely to my boy,
+ I beat him when he sneezes;
+ For he can thoroughly enjoy
+ The pepper when he pleases!'
+
+ CHORUS.
+
+ 'Wow! wow! wow!'
+
+'Here! you may nurse it a bit, if you like!' the Duchess said to Alice,
+flinging the baby at her as she spoke. 'I must go and get ready to play
+croquet with the Queen,' and she hurried out of the room. The cook threw
+a frying-pan after her as she went out, but it just missed her.
+
+Alice caught the baby with some difficulty, as it was a queer-shaped
+little creature, and held out its arms and legs in all directions, 'just
+like a star-fish,' thought Alice. The poor little thing was snorting
+like a steam-engine when she caught it, and kept doubling itself up and
+straightening itself out again, so that altogether, for the first minute
+or two, it was as much as she could do to hold it.
+
+As soon as she had made out the proper way of nursing it, (which was to
+twist it up into a sort of knot, and then keep tight hold of its right
+ear and left foot, so as to prevent its undoing itself,) she carried
+it out into the open air. 'IF I don't take this child away with me,'
+thought Alice, 'they're sure to kill it in a day or two: wouldn't it be
+murder to leave it behind?' She said the last words out loud, and the
+little thing grunted in reply (it had left off sneezing by this time).
+'Don't grunt,' said Alice; 'that's not at all a proper way of expressing
+yourself.'
+
+The baby grunted again, and Alice looked very anxiously into its face to
+see what was the matter with it. There could be no doubt that it had
+a VERY turn-up nose, much more like a snout than a real nose; also its
+eyes were getting extremely small for a baby: altogether Alice did not
+like the look of the thing at all. 'But perhaps it was only sobbing,'
+she thought, and looked into its eyes again, to see if there were any
+tears.
+
+No, there were no tears. 'If you're going to turn into a pig, my dear,'
+said Alice, seriously, 'I'll have nothing more to do with you. Mind
+now!' The poor little thing sobbed again (or grunted, it was impossible
+to say which), and they went on for some while in silence.
+
+Alice was just beginning to think to herself, 'Now, what am I to do with
+this creature when I get it home?' when it grunted again, so violently,
+that she looked down into its face in some alarm. This time there could
+be NO mistake about it: it was neither more nor less than a pig, and she
+felt that it would be quite absurd for her to carry it further.
+
+So she set the little creature down, and felt quite relieved to see
+it trot away quietly into the wood. 'If it had grown up,' she said
+to herself, 'it would have made a dreadfully ugly child: but it makes
+rather a handsome pig, I think.' And she began thinking over other
+children she knew, who might do very well as pigs, and was just saying
+to herself, 'if one only knew the right way to change them--' when she
+was a little startled by seeing the Cheshire Cat sitting on a bough of a
+tree a few yards off.
+
+The Cat only grinned when it saw Alice. It looked good-natured, she
+thought: still it had VERY long claws and a great many teeth, so she
+felt that it ought to be treated with respect.
+
+'Cheshire Puss,' she began, rather timidly, as she did not at all know
+whether it would like the name: however, it only grinned a little wider.
+'Come, it's pleased so far,' thought Alice, and she went on. 'Would you
+tell me, please, which way I ought to go from here?'
+
+'That depends a good deal on where you want to get to,' said the Cat.
+
+'I don't much care where--' said Alice.
+
+'Then it doesn't matter which way you go,' said the Cat.
+
+'--so long as I get SOMEWHERE,' Alice added as an explanation.
+
+'Oh, you're sure to do that,' said the Cat, 'if you only walk long
+enough.'
+
+Alice felt that this could not be denied, so she tried another question.
+'What sort of people live about here?'
+
+'In THAT direction,' the Cat said, waving its right paw round, 'lives
+a Hatter: and in THAT direction,' waving the other paw, 'lives a March
+Hare. Visit either you like: they're both mad.'
+
+'But I don't want to go among mad people,' Alice remarked.
+
+'Oh, you can't help that,' said the Cat: 'we're all mad here. I'm mad.
+You're mad.'
+
+'How do you know I'm mad?' said Alice.
+
+'You must be,' said the Cat, 'or you wouldn't have come here.'
+
+Alice didn't think that proved it at all; however, she went on 'And how
+do you know that you're mad?'
+
+'To begin with,' said the Cat, 'a dog's not mad. You grant that?'
+
+'I suppose so,' said Alice.
+
+'Well, then,' the Cat went on, 'you see, a dog growls when it's angry,
+and wags its tail when it's pleased. Now I growl when I'm pleased, and
+wag my tail when I'm angry. Therefore I'm mad.'
+
+'I call it purring, not growling,' said Alice.
+
+'Call it what you like,' said the Cat. 'Do you play croquet with the
+Queen to-day?'
+
+'I should like it very much,' said Alice, 'but I haven't been invited
+yet.'
+
+'You'll see me there,' said the Cat, and vanished.
+
+Alice was not much surprised at this, she was getting so used to queer
+things happening. While she was looking at the place where it had been,
+it suddenly appeared again.
+
+'By-the-bye, what became of the baby?' said the Cat. 'I'd nearly
+forgotten to ask.'
+
+'It turned into a pig,' Alice quietly said, just as if it had come back
+in a natural way.
+
+'I thought it would,' said the Cat, and vanished again.
+
+Alice waited a little, half expecting to see it again, but it did not
+appear, and after a minute or two she walked on in the direction in
+which the March Hare was said to live. 'I've seen hatters before,' she
+said to herself; 'the March Hare will be much the most interesting, and
+perhaps as this is May it won't be raving mad--at least not so mad as
+it was in March.' As she said this, she looked up, and there was the Cat
+again, sitting on a branch of a tree.
+
+'Did you say pig, or fig?' said the Cat.
+
+'I said pig,' replied Alice; 'and I wish you wouldn't keep appearing and
+vanishing so suddenly: you make one quite giddy.'
+
+'All right,' said the Cat; and this time it vanished quite slowly,
+beginning with the end of the tail, and ending with the grin, which
+remained some time after the rest of it had gone.
+
+'Well! I've often seen a cat without a grin,' thought Alice; 'but a grin
+without a cat! It's the most curious thing I ever saw in my life!'
+
+She had not gone much farther before she came in sight of the house
+of the March Hare: she thought it must be the right house, because the
+chimneys were shaped like ears and the roof was thatched with fur. It
+was so large a house, that she did not like to go nearer till she had
+nibbled some more of the lefthand bit of mushroom, and raised herself to
+about two feet high: even then she walked up towards it rather timidly,
+saying to herself 'Suppose it should be raving mad after all! I almost
+wish I'd gone to see the Hatter instead!'
+
+
+
+
+CHAPTER VII. A Mad Tea-Party
+
+There was a table set out under a tree in front of the house, and the
+March Hare and the Hatter were having tea at it: a Dormouse was sitting
+between them, fast asleep, and the other two were using it as a
+cushion, resting their elbows on it, and talking over its head. 'Very
+uncomfortable for the Dormouse,' thought Alice; 'only, as it's asleep, I
+suppose it doesn't mind.'
+
+The table was a large one, but the three were all crowded together at
+one corner of it: 'No room! No room!' they cried out when they saw Alice
+coming. 'There's PLENTY of room!' said Alice indignantly, and she sat
+down in a large arm-chair at one end of the table.
+
+'Have some wine,' the March Hare said in an encouraging tone.
+
+Alice looked all round the table, but there was nothing on it but tea.
+'I don't see any wine,' she remarked.
+
+'There isn't any,' said the March Hare.
+
+'Then it wasn't very civil of you to offer it,' said Alice angrily.
+
+'It wasn't very civil of you to sit down without being invited,' said
+the March Hare.
+
+'I didn't know it was YOUR table,' said Alice; 'it's laid for a great
+many more than three.'
+
+'Your hair wants cutting,' said the Hatter. He had been looking at Alice
+for some time with great curiosity, and this was his first speech.
+
+'You should learn not to make personal remarks,' Alice said with some
+severity; 'it's very rude.'
+
+The Hatter opened his eyes very wide on hearing this; but all he SAID
+was, 'Why is a raven like a writing-desk?'
+
+'Come, we shall have some fun now!' thought Alice. 'I'm glad they've
+begun asking riddles.--I believe I can guess that,' she added aloud.
+
+'Do you mean that you think you can find out the answer to it?' said the
+March Hare.
+
+'Exactly so,' said Alice.
+
+'Then you should say what you mean,' the March Hare went on.
+
+'I do,' Alice hastily replied; 'at least--at least I mean what I
+say--that's the same thing, you know.'
+
+'Not the same thing a bit!' said the Hatter. 'You might just as well say
+that "I see what I eat" is the same thing as "I eat what I see"!'
+
+'You might just as well say,' added the March Hare, 'that "I like what I
+get" is the same thing as "I get what I like"!'
+
+'You might just as well say,' added the Dormouse, who seemed to be
+talking in his sleep, 'that "I breathe when I sleep" is the same thing
+as "I sleep when I breathe"!'
+
+'It IS the same thing with you,' said the Hatter, and here the
+conversation dropped, and the party sat silent for a minute, while Alice
+thought over all she could remember about ravens and writing-desks,
+which wasn't much.
+
+The Hatter was the first to break the silence. 'What day of the month
+is it?' he said, turning to Alice: he had taken his watch out of his
+pocket, and was looking at it uneasily, shaking it every now and then,
+and holding it to his ear.
+
+Alice considered a little, and then said 'The fourth.'
+
+'Two days wrong!' sighed the Hatter. 'I told you butter wouldn't suit
+the works!' he added looking angrily at the March Hare.
+
+'It was the BEST butter,' the March Hare meekly replied.
+
+'Yes, but some crumbs must have got in as well,' the Hatter grumbled:
+'you shouldn't have put it in with the bread-knife.'
+
+The March Hare took the watch and looked at it gloomily: then he dipped
+it into his cup of tea, and looked at it again: but he could think of
+nothing better to say than his first remark, 'It was the BEST butter,
+you know.'
+
+Alice had been looking over his shoulder with some curiosity. 'What a
+funny watch!' she remarked. 'It tells the day of the month, and doesn't
+tell what o'clock it is!'
+
+'Why should it?' muttered the Hatter. 'Does YOUR watch tell you what
+year it is?'
+
+'Of course not,' Alice replied very readily: 'but that's because it
+stays the same year for such a long time together.'
+
+'Which is just the case with MINE,' said the Hatter.
+
+Alice felt dreadfully puzzled. The Hatter's remark seemed to have no
+sort of meaning in it, and yet it was certainly English. 'I don't quite
+understand you,' she said, as politely as she could.
+
+'The Dormouse is asleep again,' said the Hatter, and he poured a little
+hot tea upon its nose.
+
+The Dormouse shook its head impatiently, and said, without opening its
+eyes, 'Of course, of course; just what I was going to remark myself.'
+
+'Have you guessed the riddle yet?' the Hatter said, turning to Alice
+again.
+
+'No, I give it up,' Alice replied: 'what's the answer?'
+
+'I haven't the slightest idea,' said the Hatter.
+
+'Nor I,' said the March Hare.
+
+Alice sighed wearily. 'I think you might do something better with the
+time,' she said, 'than waste it in asking riddles that have no answers.'
+
+'If you knew Time as well as I do,' said the Hatter, 'you wouldn't talk
+about wasting IT. It's HIM.'
+
+'I don't know what you mean,' said Alice.
+
+'Of course you don't!' the Hatter said, tossing his head contemptuously.
+'I dare say you never even spoke to Time!'
+
+'Perhaps not,' Alice cautiously replied: 'but I know I have to beat time
+when I learn music.'
+
+'Ah! that accounts for it,' said the Hatter. 'He won't stand beating.
+Now, if you only kept on good terms with him, he'd do almost anything
+you liked with the clock. For instance, suppose it were nine o'clock in
+the morning, just time to begin lessons: you'd only have to whisper a
+hint to Time, and round goes the clock in a twinkling! Half-past one,
+time for dinner!'
+
+('I only wish it was,' the March Hare said to itself in a whisper.)
+
+'That would be grand, certainly,' said Alice thoughtfully: 'but then--I
+shouldn't be hungry for it, you know.'
+
+'Not at first, perhaps,' said the Hatter: 'but you could keep it to
+half-past one as long as you liked.'
+
+'Is that the way YOU manage?' Alice asked.
+
+The Hatter shook his head mournfully. 'Not I!' he replied. 'We
+quarrelled last March--just before HE went mad, you know--' (pointing
+with his tea spoon at the March Hare,) '--it was at the great concert
+given by the Queen of Hearts, and I had to sing
+
+ "Twinkle, twinkle, little bat!
+ How I wonder what you're at!"
+
+You know the song, perhaps?'
+
+'I've heard something like it,' said Alice.
+
+'It goes on, you know,' the Hatter continued, 'in this way:--
+
+ "Up above the world you fly,
+ Like a tea-tray in the sky.
+ Twinkle, twinkle--"'
+
+Here the Dormouse shook itself, and began singing in its sleep 'Twinkle,
+twinkle, twinkle, twinkle--' and went on so long that they had to pinch
+it to make it stop.
+
+'Well, I'd hardly finished the first verse,' said the Hatter, 'when the
+Queen jumped up and bawled out, "He's murdering the time! Off with his
+head!"'
+
+'How dreadfully savage!' exclaimed Alice.
+
+'And ever since that,' the Hatter went on in a mournful tone, 'he won't
+do a thing I ask! It's always six o'clock now.'
+
+A bright idea came into Alice's head. 'Is that the reason so many
+tea-things are put out here?' she asked.
+
+'Yes, that's it,' said the Hatter with a sigh: 'it's always tea-time,
+and we've no time to wash the things between whiles.'
+
+'Then you keep moving round, I suppose?' said Alice.
+
+'Exactly so,' said the Hatter: 'as the things get used up.'
+
+'But what happens when you come to the beginning again?' Alice ventured
+to ask.
+
+'Suppose we change the subject,' the March Hare interrupted, yawning.
+'I'm getting tired of this. I vote the young lady tells us a story.'
+
+'I'm afraid I don't know one,' said Alice, rather alarmed at the
+proposal.
+
+'Then the Dormouse shall!' they both cried. 'Wake up, Dormouse!' And
+they pinched it on both sides at once.
+
+The Dormouse slowly opened his eyes. 'I wasn't asleep,' he said in a
+hoarse, feeble voice: 'I heard every word you fellows were saying.'
+
+'Tell us a story!' said the March Hare.
+
+'Yes, please do!' pleaded Alice.
+
+'And be quick about it,' added the Hatter, 'or you'll be asleep again
+before it's done.'
+
+'Once upon a time there were three little sisters,' the Dormouse began
+in a great hurry; 'and their names were Elsie, Lacie, and Tillie; and
+they lived at the bottom of a well--'
+
+'What did they live on?' said Alice, who always took a great interest in
+questions of eating and drinking.
+
+'They lived on treacle,' said the Dormouse, after thinking a minute or
+two.
+
+'They couldn't have done that, you know,' Alice gently remarked; 'they'd
+have been ill.'
+
+'So they were,' said the Dormouse; 'VERY ill.'
+
+Alice tried to fancy to herself what such an extraordinary ways of
+living would be like, but it puzzled her too much, so she went on: 'But
+why did they live at the bottom of a well?'
+
+'Take some more tea,' the March Hare said to Alice, very earnestly.
+
+'I've had nothing yet,' Alice replied in an offended tone, 'so I can't
+take more.'
+
+'You mean you can't take LESS,' said the Hatter: 'it's very easy to take
+MORE than nothing.'
+
+'Nobody asked YOUR opinion,' said Alice.
+
+'Who's making personal remarks now?' the Hatter asked triumphantly.
+
+Alice did not quite know what to say to this: so she helped herself
+to some tea and bread-and-butter, and then turned to the Dormouse, and
+repeated her question. 'Why did they live at the bottom of a well?'
+
+The Dormouse again took a minute or two to think about it, and then
+said, 'It was a treacle-well.'
+
+'There's no such thing!' Alice was beginning very angrily, but the
+Hatter and the March Hare went 'Sh! sh!' and the Dormouse sulkily
+remarked, 'If you can't be civil, you'd better finish the story for
+yourself.'
+
+'No, please go on!' Alice said very humbly; 'I won't interrupt again. I
+dare say there may be ONE.'
+
+'One, indeed!' said the Dormouse indignantly. However, he consented to
+go on. 'And so these three little sisters--they were learning to draw,
+you know--'
+
+'What did they draw?' said Alice, quite forgetting her promise.
+
+'Treacle,' said the Dormouse, without considering at all this time.
+
+'I want a clean cup,' interrupted the Hatter: 'let's all move one place
+on.'
+
+He moved on as he spoke, and the Dormouse followed him: the March Hare
+moved into the Dormouse's place, and Alice rather unwillingly took
+the place of the March Hare. The Hatter was the only one who got any
+advantage from the change: and Alice was a good deal worse off than
+before, as the March Hare had just upset the milk-jug into his plate.
+
+Alice did not wish to offend the Dormouse again, so she began very
+cautiously: 'But I don't understand. Where did they draw the treacle
+from?'
+
+'You can draw water out of a water-well,' said the Hatter; 'so I should
+think you could draw treacle out of a treacle-well--eh, stupid?'
+
+'But they were IN the well,' Alice said to the Dormouse, not choosing to
+notice this last remark.
+
+'Of course they were', said the Dormouse; '--well in.'
+
+This answer so confused poor Alice, that she let the Dormouse go on for
+some time without interrupting it.
+
+'They were learning to draw,' the Dormouse went on, yawning and rubbing
+its eyes, for it was getting very sleepy; 'and they drew all manner of
+things--everything that begins with an M--'
+
+'Why with an M?' said Alice.
+
+'Why not?' said the March Hare.
+
+Alice was silent.
+
+The Dormouse had closed its eyes by this time, and was going off into
+a doze; but, on being pinched by the Hatter, it woke up again with
+a little shriek, and went on: '--that begins with an M, such as
+mouse-traps, and the moon, and memory, and muchness--you know you say
+things are "much of a muchness"--did you ever see such a thing as a
+drawing of a muchness?'
+
+'Really, now you ask me,' said Alice, very much confused, 'I don't
+think--'
+
+'Then you shouldn't talk,' said the Hatter.
+
+This piece of rudeness was more than Alice could bear: she got up in
+great disgust, and walked off; the Dormouse fell asleep instantly, and
+neither of the others took the least notice of her going, though she
+looked back once or twice, half hoping that they would call after her:
+the last time she saw them, they were trying to put the Dormouse into
+the teapot.
+
+'At any rate I'll never go THERE again!' said Alice as she picked her
+way through the wood. 'It's the stupidest tea-party I ever was at in all
+my life!'
+
+Just as she said this, she noticed that one of the trees had a door
+leading right into it. 'That's very curious!' she thought. 'But
+everything's curious today. I think I may as well go in at once.' And in
+she went.
+
+Once more she found herself in the long hall, and close to the little
+glass table. 'Now, I'll manage better this time,' she said to herself,
+and began by taking the little golden key, and unlocking the door that
+led into the garden. Then she went to work nibbling at the mushroom (she
+had kept a piece of it in her pocket) till she was about a foot high:
+then she walked down the little passage: and THEN--she found herself at
+last in the beautiful garden, among the bright flower-beds and the cool
+fountains.
+
+
+
+
+CHAPTER VIII. The Queen's Croquet-Ground
+
+A large rose-tree stood near the entrance of the garden: the roses
+growing on it were white, but there were three gardeners at it, busily
+painting them red. Alice thought this a very curious thing, and she went
+nearer to watch them, and just as she came up to them she heard one of
+them say, 'Look out now, Five! Don't go splashing paint over me like
+that!'
+
+'I couldn't help it,' said Five, in a sulky tone; 'Seven jogged my
+elbow.'
+
+On which Seven looked up and said, 'That's right, Five! Always lay the
+blame on others!'
+
+'YOU'D better not talk!' said Five. 'I heard the Queen say only
+yesterday you deserved to be beheaded!'
+
+'What for?' said the one who had spoken first.
+
+'That's none of YOUR business, Two!' said Seven.
+
+'Yes, it IS his business!' said Five, 'and I'll tell him--it was for
+bringing the cook tulip-roots instead of onions.'
+
+Seven flung down his brush, and had just begun 'Well, of all the unjust
+things--' when his eye chanced to fall upon Alice, as she stood watching
+them, and he checked himself suddenly: the others looked round also, and
+all of them bowed low.
+
+'Would you tell me,' said Alice, a little timidly, 'why you are painting
+those roses?'
+
+Five and Seven said nothing, but looked at Two. Two began in a low
+voice, 'Why the fact is, you see, Miss, this here ought to have been a
+RED rose-tree, and we put a white one in by mistake; and if the Queen
+was to find it out, we should all have our heads cut off, you know.
+So you see, Miss, we're doing our best, afore she comes, to--' At this
+moment Five, who had been anxiously looking across the garden, called
+out 'The Queen! The Queen!' and the three gardeners instantly threw
+themselves flat upon their faces. There was a sound of many footsteps,
+and Alice look
<TRUNCATED>
[30/50] [abbrv] incubator-ignite git commit: Merge branches
'ignite-564' and 'ignite-sprint-3' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-564
Posted by sb...@apache.org.
Merge branches 'ignite-564' and 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-564
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f14e0f26
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f14e0f26
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f14e0f26
Branch: refs/heads/ignite-665
Commit: f14e0f26e208f07af0941dd48c6adda5babf2bc1
Parents: 7fa7f42 f2b40c1
Author: AKuznetsov <ak...@gridgain.com>
Authored: Mon Apr 6 23:33:37 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Mon Apr 6 23:33:37 2015 +0700
----------------------------------------------------------------------
assembly/release-fabric.xml | 5 -
modules/clients/readme.md | 2 -
.../apache/ignite/internal/GridComponent.java | 2 +-
.../ignite/internal/GridKernalContextImpl.java | 3 +-
.../ignite/internal/GridPluginComponent.java | 4 +-
.../org/apache/ignite/internal/IgniteEx.java | 7 -
.../apache/ignite/internal/IgniteKernal.java | 27 +---
.../ignite/internal/IgniteNodeAttributes.java | 3 -
.../internal/managers/GridManagerAdapter.java | 6 +-
.../processors/GridProcessorAdapter.java | 2 +-
.../processors/cache/CacheDistributionMode.java | 67 --------
.../internal/processors/cache/CacheType.java | 77 +++++++++
.../cache/DynamicCacheChangeRequest.java | 17 ++
.../cache/DynamicCacheDescriptor.java | 15 +-
.../processors/cache/GridCacheAdapter.java | 6 +-
.../processors/cache/GridCacheContext.java | 26 ++-
.../cache/GridCacheDeploymentManager.java | 2 +-
.../processors/cache/GridCacheEventManager.java | 4 +-
.../processors/cache/GridCacheProcessor.java | 139 ++++++++++------
.../cache/GridCacheSharedContext.java | 4 +-
.../dht/GridDhtTransactionalCacheAdapter.java | 4 +-
.../near/GridNearTransactionalCache.java | 2 +-
.../continuous/CacheContinuousQueryManager.java | 2 +-
.../transactions/IgniteTransactionsImpl.java | 19 ++-
.../transactions/IgniteTxLocalAdapter.java | 2 +-
.../cache/transactions/IgniteTxManager.java | 8 +-
.../DiscoveryNodeValidationProcessor.java | 27 ++++
.../OsDiscoveryNodeValidationProcessor.java | 72 +++++++++
.../processors/query/GridQueryProcessor.java | 8 +-
.../processors/task/GridTaskProcessor.java | 24 ++-
.../ignite/internal/util/IgniteUtils.java | 46 +++++-
.../internal/visor/util/VisorTaskUtils.java | 18 ++-
.../ignite/spi/IgniteNodeValidationResult.java | 66 ++++++++
.../org/apache/ignite/spi/IgniteSpiAdapter.java | 2 +-
.../org/apache/ignite/spi/IgniteSpiContext.java | 2 +-
.../spi/IgniteSpiNodeValidationResult.java | 66 --------
.../spi/discovery/tcp/TcpDiscoverySpi.java | 106 +------------
.../cache/IgniteDynamicCacheStartSelfTest.java | 47 +++---
.../cache/IgniteInternalCacheTypesTest.java | 159 +++++++++++++++++++
.../IgniteCollectionAbstractTest.java | 23 ---
.../IgniteCacheSystemTransactionsSelfTest.java | 3 +-
...GridCacheDhtEvictionNearReadersSelfTest.java | 2 +-
.../near/GridCacheNearEvictionSelfTest.java | 2 +-
...ePartitionedBasicStoreMultiNodeSelfTest.java | 8 +-
...NearDisabledBasicStoreMultiNodeSelfTest.java | 8 +-
.../processors/igfs/IgfsStartCacheTest.java | 158 ++++++++++++++++++
.../processors/igfs/IgsfStartCacheTest.java | 115 --------------
.../loadtests/hashmap/GridCacheTestContext.java | 1 +
.../testframework/GridSpiTestContext.java | 2 +-
.../ignite/testsuites/IgniteCacheTestSuite.java | 2 +
.../ignite/testsuites/IgniteIgfsTestSuite.java | 2 +
.../HadoopDefaultMapReducePlannerSelfTest.java | 5 -
.../query/h2/sql/GridSqlQuerySplitter.java | 22 ++-
.../h2/twostep/GridReduceQueryExecutor.java | 13 +-
.../cache/IgniteCacheAbstractQuerySelfTest.java | 6 +-
...niteCacheAtomicNearEnabledQuerySelfTest.java | 7 +-
.../near/IgniteCacheAtomicQuerySelfTest.java | 7 +-
.../query/h2/sql/GridQueryParsingTest.java | 1 +
.../query/h2/sql/IgniteVsH2QueryTest.java | 7 +
modules/schedule/pom.xml | 20 +++
modules/yardstick/README.md | 3 +-
.../yardstick/IgniteAbstractBenchmark.java | 5 +-
.../yardstick/IgniteBenchmarkArguments.java | 22 ++-
.../org/apache/ignite/yardstick/IgniteNode.java | 11 +-
parent/pom.xml | 49 +++---
pom.xml | 94 ++++++++++-
66 files changed, 1075 insertions(+), 621 deletions(-)
----------------------------------------------------------------------
[27/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'origin/ignite-sprint-3' into ignite-sprint-3
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-3' into ignite-sprint-3
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f2b40c16
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f2b40c16
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f2b40c16
Branch: refs/heads/ignite-665
Commit: f2b40c166bceaf5a29efb8fec4a9f89ad4dccfe1
Parents: ddaede6 369a36d
Author: avinogradov <av...@gridgain.com>
Authored: Mon Apr 6 19:08:29 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Mon Apr 6 19:08:29 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/util/IgniteUtils.java | 46 ++++++++++++++++++--
1 file changed, 42 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
[46/50] [abbrv] incubator-ignite git commit: # sprint-3 - Updated
streaming examples.
Posted by sb...@apache.org.
# sprint-3 - Updated streaming 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/eadb5d5c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/eadb5d5c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/eadb5d5c
Branch: refs/heads/ignite-665
Commit: eadb5d5c2b53ba4ae374258e950ac137e713c650
Parents: dcd24e0
Author: Dmitiry Setrakyan <ds...@gridgain.com>
Authored: Tue Apr 7 00:57:00 2015 -0700
Committer: Dmitiry Setrakyan <ds...@gridgain.com>
Committed: Tue Apr 7 00:57:00 2015 -0700
----------------------------------------------------------------------
.../org/apache/ignite/examples/streaming/StreamVisitorExample.java | 2 +-
.../ignite/examples/java8/streaming/StreamVisitorExample.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/eadb5d5c/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 47e5538..16fbf3d 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
@@ -56,7 +56,7 @@ public class StreamVisitorExample {
return;
// Market data cache with default configuration.
- CacheConfiguration<String, Double> mktDataCfg = new CacheConfiguration<String, Double>("marketTicks");
+ CacheConfiguration<String, Double> mktDataCfg = new CacheConfiguration<>("marketTicks");
// Financial instrument cache configuration.
CacheConfiguration<String, Instrument> instCfg = new CacheConfiguration<>("instCache");
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/eadb5d5c/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java
index 2fa7f16..704c249 100644
--- a/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java
@@ -56,7 +56,7 @@ public class StreamVisitorExample {
return;
// Market data cache with default configuration.
- CacheConfiguration<String, Double> mktDataCfg = new CacheConfiguration<String, Double>("marketTicks");
+ CacheConfiguration<String, Double> mktDataCfg = new CacheConfiguration<>("marketTicks");
// Financial instrument cache configuration.
CacheConfiguration<String, Instrument> instCfg = new CacheConfiguration<>("instCache");
[14/50] [abbrv] incubator-ignite git commit: ignite-sprint-3 - map
query sort fix (IGNITE-682)
Posted by sb...@apache.org.
ignite-sprint-3 - map query sort fix (IGNITE-682)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/88268bf8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/88268bf8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/88268bf8
Branch: refs/heads/ignite-665
Commit: 88268bf8f1cf3c612bf0e68a471097817af9de87
Parents: af5c9d3
Author: S.Vladykin <sv...@gridgain.com>
Authored: Mon Apr 6 16:55:01 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Mon Apr 6 16:55:01 2015 +0300
----------------------------------------------------------------------
.../processors/query/h2/sql/GridSqlQuerySplitter.java | 2 ++
.../processors/query/h2/sql/GridQueryParsingTest.java | 1 +
.../internal/processors/query/h2/sql/IgniteVsH2QueryTest.java | 7 +++++++
3 files changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/88268bf8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
index 47e5e05..77e0cc8 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
@@ -110,6 +110,8 @@ public class GridSqlQuerySplitter {
// -- ORDER BY
if (!srcQry.sort().isEmpty()) {
+ mapQry.clearSort();
+
for (GridSqlSortColumn sortCol : srcQry.sort().values())
rdcQry.addSort(column(((GridSqlAlias)mapExps.get(sortCol.column())).alias()), sortCol);
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/88268bf8/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
index eada55a..7c76ddb 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
@@ -172,6 +172,7 @@ public class GridQueryParsingTest extends GridCommonAbstractTest {
checkQuery("select count(*) as a from Person");
checkQuery("select count(*) as a, count(p.*), count(p.name) from Person p");
checkQuery("select count(distinct p.name) from Person p");
+ checkQuery("select name, count(*) cnt from Person group by name order by cnt desc limit 10");
checkQuery("select p.name, avg(p.old), max(p.old) from Person p group by p.name");
checkQuery("select p.name n, avg(p.old) a, max(p.old) m from Person p group by p.name");
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/88268bf8/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/IgniteVsH2QueryTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/IgniteVsH2QueryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/IgniteVsH2QueryTest.java
index 0506ddf..1f4771a 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/IgniteVsH2QueryTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/IgniteVsH2QueryTest.java
@@ -538,6 +538,13 @@ public class IgniteVsH2QueryTest extends GridCommonAbstractTest {
}
/**
+ * @throws SQLException If failed.
+ */
+ public void testAggregateOrderBy() throws SQLException {
+ compareOrderedQueryRes0("select firstName name, count(*) cnt from \"part\".Person group by name order by cnt desc");
+ }
+
+ /**
* @throws Exception If failed.
*/
public void testNullParamSubstitution() throws Exception {
[12/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'origin/ignite-sprint-3' into ignite-sprint-3
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-3' into ignite-sprint-3
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/af5c9d3c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/af5c9d3c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/af5c9d3c
Branch: refs/heads/ignite-665
Commit: af5c9d3c9ab1b5d56ab4903a010a038a26443613
Parents: a7ba0be 60aaaaa
Author: S.Vladykin <sv...@gridgain.com>
Authored: Mon Apr 6 15:56:05 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Mon Apr 6 15:56:05 2015 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/GridComponent.java | 2 +-
.../ignite/internal/GridKernalContextImpl.java | 3 +-
.../ignite/internal/GridPluginComponent.java | 4 +-
.../org/apache/ignite/internal/IgniteEx.java | 7 --
.../apache/ignite/internal/IgniteKernal.java | 25 +----
.../ignite/internal/IgniteNodeAttributes.java | 3 -
.../internal/managers/GridManagerAdapter.java | 6 +-
.../processors/GridProcessorAdapter.java | 2 +-
.../processors/cache/GridCacheProcessor.java | 6 +-
.../DiscoveryNodeValidationProcessor.java | 27 +++++
.../OsDiscoveryNodeValidationProcessor.java | 72 +++++++++++++
.../ignite/spi/IgniteNodeValidationResult.java | 66 ++++++++++++
.../org/apache/ignite/spi/IgniteSpiAdapter.java | 2 +-
.../org/apache/ignite/spi/IgniteSpiContext.java | 2 +-
.../spi/IgniteSpiNodeValidationResult.java | 66 ------------
.../spi/discovery/tcp/TcpDiscoverySpi.java | 106 +------------------
.../testframework/GridSpiTestContext.java | 2 +-
.../HadoopDefaultMapReducePlannerSelfTest.java | 5 -
18 files changed, 186 insertions(+), 220 deletions(-)
----------------------------------------------------------------------
[41/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'origin/ignite-sprint-3' into ignite-sprint-3
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-3' into ignite-sprint-3
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/942f6de7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/942f6de7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/942f6de7
Branch: refs/heads/ignite-665
Commit: 942f6de740a124358e954137ecefe164d85c9978
Parents: b2984c9 e144a68
Author: Dmitiry Setrakyan <ds...@gridgain.com>
Authored: Mon Apr 6 23:16:11 2015 -0700
Committer: Dmitiry Setrakyan <ds...@gridgain.com>
Committed: Mon Apr 6 23:16:11 2015 -0700
----------------------------------------------------------------------
.../store/jdbc/CacheAbstractJdbcStore.java | 104 ++++++++++++++-----
.../ignite/internal/visor/cache/VisorCache.java | 19 +++-
.../VisorCacheConfigurationCollectorJob.java | 76 ++++++++++++++
.../VisorCacheConfigurationCollectorTask.java | 39 +++++++
.../VisorIgfsProfilerUniformityCounters.java | 6 +-
.../visor/node/VisorGridConfiguration.java | 38 -------
.../visor/node/VisorIgfsConfiguration.java | 2 +-
.../visor/node/VisorRestConfiguration.java | 1 +
.../internal/visor/util/VisorTaskUtils.java | 3 +-
.../h2/twostep/GridReduceQueryExecutor.java | 2 +-
.../commands/cache/VisorCacheCommand.scala | 26 ++---
.../config/VisorConfigurationCommand.scala | 15 +--
.../visor/commands/gc/VisorGcCommand.scala | 15 +--
.../scala/org/apache/ignite/visor/visor.scala | 34 ++++--
.../yardstick/config/benchmark-store.properties | 5 +-
15 files changed, 275 insertions(+), 110 deletions(-)
----------------------------------------------------------------------
[50/50] [abbrv] incubator-ignite git commit: Merge branch
'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite
into ignite-665
Posted by sb...@apache.org.
Merge branch 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-665
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/dfd748ba
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/dfd748ba
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/dfd748ba
Branch: refs/heads/ignite-665
Commit: dfd748ba1fad228aec4e3a3ecb83b3642f90ce21
Parents: 4f49274 d20d29b
Author: iveselovskiy <iv...@gridgain.com>
Authored: Tue Apr 7 11:44:43 2015 +0300
Committer: iveselovskiy <iv...@gridgain.com>
Committed: Tue Apr 7 11:44:43 2015 +0300
----------------------------------------------------------------------
DEVNOTES.txt | 2 +-
examples/README.txt | 11 +-
examples/config/example-ignite.xml | 2 +-
.../streaming/StreamTransformerExample.java | 101 +
.../streaming/StreamVisitorExample.java | 171 +
.../streaming/marketdata/CacheConfig.java | 44 -
.../streaming/marketdata/Instrument.java | 106 -
.../marketdata/QueryTopInstruments.java | 73 -
.../streaming/marketdata/StreamMarketData.java | 103 -
.../examples/streaming/numbers/CacheConfig.java | 46 -
.../streaming/numbers/QueryPopularNumbers.java | 74 -
.../streaming/numbers/StreamRandomNumbers.java | 78 -
.../streaming/wordcount/CacheConfig.java | 48 +
.../streaming/wordcount/QueryWords.java | 77 +
.../streaming/wordcount/StreamWords.java | 68 +
.../streaming/wordcount/alice-in-wonderland.txt | 3735 ++++++++++++++++++
.../streaming/wordcount/package-info.java | 22 +
.../streaming/StreamTransformerExample.java | 97 +
.../java8/streaming/StreamVisitorExample.java | 168 +
.../java8/streaming/marketdata/CacheConfig.java | 44 -
.../java8/streaming/marketdata/Instrument.java | 106 -
.../marketdata/QueryTopInstruments.java | 73 -
.../streaming/marketdata/StreamMarketData.java | 101 -
.../java8/streaming/numbers/CacheConfig.java | 46 -
.../streaming/numbers/QueryPopularNumbers.java | 74 -
.../streaming/numbers/StreamRandomNumbers.java | 74 -
.../ignite/cache/affinity/AffinityUuid.java | 50 +
.../cache/eviction/fifo/FifoEvictionPolicy.java | 58 +-
.../eviction/fifo/FifoEvictionPolicyMBean.java | 16 +
.../store/jdbc/CacheAbstractJdbcStore.java | 104 +-
.../ignite/internal/visor/cache/VisorCache.java | 19 +-
.../VisorCacheConfigurationCollectorJob.java | 76 +
.../VisorCacheConfigurationCollectorTask.java | 39 +
.../VisorIgfsProfilerUniformityCounters.java | 6 +-
.../visor/node/VisorGridConfiguration.java | 38 -
.../visor/node/VisorIgfsConfiguration.java | 2 +-
.../visor/node/VisorRestConfiguration.java | 1 +
.../internal/visor/util/VisorTaskUtils.java | 3 +-
.../org/apache/ignite/stream/StreamVisitor.java | 2 +-
.../eviction/GridCacheEvictionAbstractTest.java | 5 +-
...ridCacheFifoBatchEvictionPolicySelfTest.java | 385 ++
.../h2/twostep/GridReduceQueryExecutor.java | 2 +-
.../commands/cache/VisorCacheCommand.scala | 26 +-
.../config/VisorConfigurationCommand.scala | 15 +-
.../visor/commands/gc/VisorGcCommand.scala | 15 +-
.../scala/org/apache/ignite/visor/visor.scala | 34 +-
.../yardstick/config/benchmark-store.properties | 5 +-
parent/pom.xml | 1 +
pom.xml | 61 +-
49 files changed, 5333 insertions(+), 1174 deletions(-)
----------------------------------------------------------------------
[08/50] [abbrv] incubator-ignite git commit: # IGNITE-540 Revert
changes in generateColumnsFromQuery().
Posted by sb...@apache.org.
# IGNITE-540 Revert changes in generateColumnsFromQuery().
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e1db4076
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e1db4076
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e1db4076
Branch: refs/heads/ignite-665
Commit: e1db4076f1719364a8498d7e6f6a52d13a454443
Parents: 39ee717
Author: sevdokimov <se...@gridgain.com>
Authored: Mon Apr 6 14:59:26 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Mon Apr 6 14:59:26 2015 +0300
----------------------------------------------------------------------
.../h2/twostep/GridReduceQueryExecutor.java | 29 ++++++++------------
1 file changed, 12 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1db4076/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index acdc1bf..02c7c55 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -445,25 +445,20 @@ public class GridReduceQueryExecutor implements GridMessageListener {
String name = expr.getAlias();
long precision = expr.getPrecision();
int displaySize = expr.getDisplaySize();
+ DataType dt = DataType.getDataType(type);
+ if (precision > 0 && (dt.defaultPrecision == 0 ||
+ (dt.defaultPrecision > precision && dt.defaultPrecision < Byte.MAX_VALUE))) {
+ // dont' set precision to MAX_VALUE if this is the default
+ precision = dt.defaultPrecision;
+ }
int scale = expr.getScale();
-
- if (type != Value.UNKNOWN) {
- DataType dt = DataType.getDataType(type);
-
- if (precision > 0 && (dt.defaultPrecision == 0 ||
- (dt.defaultPrecision > precision && dt.defaultPrecision < Byte.MAX_VALUE))) {
- // dont' set precision to MAX_VALUE if this is the default
- precision = dt.defaultPrecision;
- }
-
- if (scale > 0 && (dt.defaultScale == 0 ||
- (dt.defaultScale > scale && dt.defaultScale < precision)))
- scale = dt.defaultScale;
-
- if (scale > precision)
- precision = scale;
+ if (scale > 0 && (dt.defaultScale == 0 ||
+ (dt.defaultScale > scale && dt.defaultScale < precision))) {
+ scale = dt.defaultScale;
+ }
+ if (scale > precision) {
+ precision = scale;
}
-
Column col = new Column(name, type, precision, scale, displaySize);
cols.add(col);
}
[02/50] [abbrv] incubator-ignite git commit: ignite-678
Posted by sb...@apache.org.
ignite-678
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9a3373f2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9a3373f2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9a3373f2
Branch: refs/heads/ignite-665
Commit: 9a3373f2e64fcc86b9921eb2fd7a1aac14933429
Parents: e061985
Author: avinogradov <av...@gridgain.com>
Authored: Mon Apr 6 13:54:57 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Mon Apr 6 13:54:57 2015 +0300
----------------------------------------------------------------------
assembly/release-fabric.xml | 5 ---
pom.xml | 95 +++++++++++++++++++++++++++++++++++++---
2 files changed, 89 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a3373f2/assembly/release-fabric.xml
----------------------------------------------------------------------
diff --git a/assembly/release-fabric.xml b/assembly/release-fabric.xml
index c3e6d35..3bd0997 100644
--- a/assembly/release-fabric.xml
+++ b/assembly/release-fabric.xml
@@ -86,11 +86,6 @@
</fileSet>
<fileSet>
- <directory>libs</directory>
- <outputDirectory>/libs</outputDirectory>
- </fileSet>
-
- <fileSet>
<directory>examples</directory>
<outputDirectory>/examples</outputDirectory>
<includes>
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9a3373f2/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 32da7eb..5390fe5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -99,10 +99,7 @@
</profile>
<profile>
- <id>clean-libs</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
+ <id>dev-libs</id>
<build>
<plugins>
<plugin>
@@ -128,6 +125,29 @@
</execution>
</executions>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.7</version>
+ <inherited>false</inherited>
+ <executions>
+ <execution>
+ <id>dev-libs</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <target>
+ <copy todir="${basedir}/libs">
+ <fileset dir="${basedir}/target/release-package/libs"/>
+ </copy>
+ </target>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
</profile>
@@ -323,7 +343,7 @@
<descriptors>
<descriptor>${basedir}/assembly/dependencies-${ignite.edition}.xml</descriptor>
</descriptors>
- <outputDirectory>${basedir}</outputDirectory>
+ <outputDirectory>${basedir}/target/release-package</outputDirectory>
<finalName>libs</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
@@ -340,7 +360,7 @@
<descriptor>${basedir}/assembly/dependencies-optional-${ignite.edition}.xml
</descriptor>
</descriptors>
- <outputDirectory>${basedir}/libs</outputDirectory>
+ <outputDirectory>${basedir}/target/release-package/libs</outputDirectory>
<finalName>optional</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
@@ -453,5 +473,68 @@
<module>examples</module>
</modules>
</profile>
+
+ <profile>
+ <id>apache-release</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>net.ju-n.maven.plugins</groupId>
+ <artifactId>checksum-maven-plugin</artifactId>
+ <version>1.2</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>files</goal>
+ </goals>
+ <phase>install</phase>
+ </execution>
+ </executions>
+ <configuration>
+ <fileSets>
+ <fileSet>
+ <directory>target</directory>
+ <includes>
+ <include>ignite-${project.version}-source-release.zip</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ <algorithms>
+ <algorithm>MD5</algorithm>
+ <algorithm>SHA-1</algorithm>
+ </algorithms>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.7</version>
+ <inherited>false</inherited>
+ <executions>
+ <execution>
+ <id>apache-sources-pack</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <phase>deploy</phase>
+ <configuration>
+ <target>
+ <zip destfile="${basedir}/target/sources-pack-${project.version}.zip" encoding="UTF-8">
+ <zipfileset dir="${basedir}/target" prefix="sources-pack-${project.version}">
+ <include name="ignite-${project.version}-source-release.zip" />
+ <include name="ignite-${project.version}-source-release.zip.asc" />
+ <include name="ignite-${project.version}-source-release.zip.md5" />
+ <include name="ignite-${project.version}-source-release.zip.sha1" />
+ </zipfileset>
+ </zip>
+ </target>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
[40/50] [abbrv] incubator-ignite git commit: # sprint-3 - Updated
streaming examples.
Posted by sb...@apache.org.
# sprint-3 - Updated streaming 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/b2984c9b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b2984c9b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b2984c9b
Branch: refs/heads/ignite-665
Commit: b2984c9bf4a2563cfd943def1c94d68e9b75aef6
Parents: 5a2b46c
Author: Dmitiry Setrakyan <ds...@gridgain.com>
Authored: Mon Apr 6 23:15:55 2015 -0700
Committer: Dmitiry Setrakyan <ds...@gridgain.com>
Committed: Mon Apr 6 23:15:55 2015 -0700
----------------------------------------------------------------------
examples/README.txt | 11 +-
examples/config/example-ignite.xml | 2 +-
.../streaming/marketdata/CacheConfig.java | 44 -
.../streaming/marketdata/Instrument.java | 106 -
.../marketdata/QueryTopInstruments.java | 73 -
.../streaming/marketdata/StreamMarketData.java | 103 -
.../examples/streaming/numbers/CacheConfig.java | 46 -
.../streaming/numbers/QueryPopularNumbers.java | 74 -
.../streaming/numbers/StreamRandomNumbers.java | 78 -
.../transformers/StreamTransformerExample.java | 101 +
.../visitors/StreamVisitorExample.java | 176 +
.../streaming/wordcount/CacheConfig.java | 48 +
.../streaming/wordcount/QueryWords.java | 77 +
.../streaming/wordcount/StreamWords.java | 68 +
.../streaming/wordcount/alice-in-wonderland.txt | 3735 ++++++++++++++++++
.../java8/streaming/marketdata/CacheConfig.java | 44 -
.../java8/streaming/marketdata/Instrument.java | 106 -
.../marketdata/QueryTopInstruments.java | 73 -
.../streaming/marketdata/StreamMarketData.java | 101 -
.../java8/streaming/numbers/CacheConfig.java | 46 -
.../streaming/numbers/QueryPopularNumbers.java | 74 -
.../streaming/numbers/StreamRandomNumbers.java | 74 -
.../transformers/StreamTransformerExample.java | 97 +
.../visitors/StreamVisitorExample.java | 173 +
.../ignite/cache/affinity/AffinityUuid.java | 47 +
25 files changed, 4532 insertions(+), 1045 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/examples/README.txt
----------------------------------------------------------------------
diff --git a/examples/README.txt b/examples/README.txt
index ce6b238..c75cbb3 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -1,5 +1,5 @@
Apache Ignite Examples
-----------------------
+======================
This folder contains code examples for various Apache Ignite functionality.
@@ -18,8 +18,15 @@ The examples folder contains he following subfolders:
are excluded by default, enable `java8-examples` Maven profile to include them (JDK8 is required).
- `src/main/scala` - contains examples demonstrating usage of API provided by Scalar.
+
Starting Remote Nodes
----------------------
+=====================
Remote nodes for examples should always be started with special configuration file which enables P2P
class loading: `examples/config/example-ignite.xml`. To run a remote node in IDE use `ExampleNodeStartup` class.
+
+
+Javay7 vs Java8
+===============
+Some examples (not all) which can benefit from Java8 Lambda support were re-written with Java8 lambdas.
+For full set of examples, look at both Java7 and Java8 packages.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/examples/config/example-ignite.xml
----------------------------------------------------------------------
diff --git a/examples/config/example-ignite.xml b/examples/config/example-ignite.xml
index e7adb54..e746e59 100644
--- a/examples/config/example-ignite.xml
+++ b/examples/config/example-ignite.xml
@@ -68,7 +68,7 @@
-->
<!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
<!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
+ <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
<property name="addresses">
<list>
<!-- In distributed environment, replace with actual host IP address. -->
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/examples/src/main/java/org/apache/ignite/examples/streaming/marketdata/CacheConfig.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/marketdata/CacheConfig.java b/examples/src/main/java/org/apache/ignite/examples/streaming/marketdata/CacheConfig.java
deleted file mode 100644
index f26ffb7..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/marketdata/CacheConfig.java
+++ /dev/null
@@ -1,44 +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.marketdata;
-
-import org.apache.ignite.configuration.*;
-
-/**
- * Configuration for the streaming caches for market data and financial instruments.
- */
-public class CacheConfig {
- /**
- * Configure streaming cache for market ticks.
- */
- public static CacheConfiguration<String, Double> marketTicksCache() {
- return new CacheConfiguration<>("marketTicks");
- }
-
- /**
- * Configure cache for financial instruments.
- */
- public static CacheConfiguration<String, Instrument> instrumentCache() {
- CacheConfiguration<String, Instrument> instCache = new CacheConfiguration<>("instCache");
-
- // Index some fields for querying portfolio positions.
- instCache.setIndexedTypes(String.class, Instrument.class);
-
- return instCache;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/examples/src/main/java/org/apache/ignite/examples/streaming/marketdata/Instrument.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/marketdata/Instrument.java b/examples/src/main/java/org/apache/ignite/examples/streaming/marketdata/Instrument.java
deleted file mode 100644
index 6daaffe..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/marketdata/Instrument.java
+++ /dev/null
@@ -1,106 +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.marketdata;
-
-import org.apache.ignite.cache.query.annotations.*;
-
-import java.io.*;
-
-/**
- * Financial instrument.
- */
-public class Instrument implements Serializable {
- /** Instrument symbol. */
- @QuerySqlField(index = true)
- private final String symbol;
-
- /** Open price. */
- @QuerySqlField(index = true)
- private double open;
-
- /** High price. */
- private double high;
-
- /** Low price. */
- private double low = Long.MAX_VALUE;
-
- /** Close price. */
- @QuerySqlField(index = true)
- private double latest;
-
- /**
- * @param symbol Symbol.
- */
- Instrument(String symbol) {
- this.symbol = symbol;
- }
-
- /**
- * Updates this instrument based on the latest price.
- *
- * @param price Latest price.
- */
- public void update(double price) {
- if (open == 0)
- open = price;
-
- high = Math.max(high, price);
- low = Math.min(low, price);
- this.latest = price;
- }
-
- /**
- * @return Symbol.
- */
- public String symbol() {
- return symbol;
- }
-
- /**
- * @return Open price.
- */
- public double open() {
- return open;
- }
-
- /**
- * @return High price.
- */
- public double high() {
- return high;
- }
-
- /**
- * @return Low price.
- */
- public double low() {
- return low;
- }
-
- /**
- * @return Close price.
- */
- public double latest() {
- return latest;
- }
-
- /** {@inheritDoc} */
- @Override public synchronized String toString() {
- return "Instrument [symbol=" + symbol + ", latest=" + latest + ", change=" + (latest - open) + ']';
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/examples/src/main/java/org/apache/ignite/examples/streaming/marketdata/QueryTopInstruments.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/marketdata/QueryTopInstruments.java b/examples/src/main/java/org/apache/ignite/examples/streaming/marketdata/QueryTopInstruments.java
deleted file mode 100644
index 4bcb2ba..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/marketdata/QueryTopInstruments.java
+++ /dev/null
@@ -1,73 +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.marketdata;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.query.*;
-import org.apache.ignite.examples.*;
-
-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 streaming using {@link StreamMarketData}.</li>
- * <li>Start querying top performing instruments using {@link QueryTopInstruments}.</li>
- * </ul>
- * <p>
- * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
- */
-public class QueryTopInstruments {
- public static void main(String[] args) throws Exception {
- // Mark this cluster member as client.
- Ignition.setClientMode(true);
-
- try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
- if (!ExamplesUtils.hasServerNodes(ignite))
- return;
-
- IgniteCache<String, Instrument> instCache = ignite.getOrCreateCache(CacheConfig.instrumentCache());
-
- // Select top 3 instruments.
- SqlFieldsQuery top3qry = new SqlFieldsQuery(
- "select symbol, (latest - open) from Instrument order by (latest - open) desc limit 3");
-
- // Select total profit.
- SqlFieldsQuery profitQry = new SqlFieldsQuery("select sum(latest - open) from Instrument");
-
- // Query top 3 best performing instruments every 5 seconds.
- while (true) {
- // Execute queries.
- List<List<?>> top3 = instCache.query(top3qry).getAll();
- List<List<?>> profit = instCache.query(profitQry).getAll();
-
- List<?> row = profit.get(0);
-
- if (row.get(0) != null)
- System.out.printf("Total profit: %.2f%n", row.get(0));
-
- // Print top 10 words.
- ExamplesUtils.printQueryResults(top3);
-
- Thread.sleep(5000);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/examples/src/main/java/org/apache/ignite/examples/streaming/marketdata/StreamMarketData.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/marketdata/StreamMarketData.java b/examples/src/main/java/org/apache/ignite/examples/streaming/marketdata/StreamMarketData.java
deleted file mode 100644
index bfac698..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/marketdata/StreamMarketData.java
+++ /dev/null
@@ -1,103 +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.marketdata;
-
-import org.apache.ignite.*;
-import org.apache.ignite.examples.*;
-import org.apache.ignite.stream.*;
-
-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 streaming using {@link StreamMarketData}.</li>
- * <li>Start querying top performing instruments using {@link QueryTopInstruments}.</li>
- * </ul>
- * <p>
- * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
- */
-public class StreamMarketData {
- /** Random number generator. */
- private static final Random RAND = new Random();
-
- /** The list of instruments. */
- private static final String[] INSTRUMENTS = {"IBM", "GOOG", "MSFT", "GE", "EBAY", "YHOO", "ORCL", "CSCO", "AMZN", "RHT"};
-
- /** The list of initial instrument prices. */
- private static final double[] INITIAL_PRICES = {194.9, 893.49, 34.21, 23.24, 57.93, 45.03, 44.41, 28.44, 378.49, 69.50};
-
- public static void main(String[] args) throws Exception {
- // 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<String, Double> mktCache = ignite.getOrCreateCache(CacheConfig.marketTicksCache());
- final IgniteCache<String, Instrument> instCache = ignite.getOrCreateCache(CacheConfig.instrumentCache());
-
- try (IgniteDataStreamer<String, Double> mktStmr = ignite.dataStreamer(mktCache.getName())) {
- // Note that we receive market data, but do not populate 'mktCache' (it remains empty).
- // Instead we update the instruments in the 'instCache'.
- mktStmr.receiver(new StreamVisitor<String, Double>() {
- @Override public void apply(IgniteCache<String, Double> cache, Map.Entry<String, Double> e) {
- String symbol = e.getKey();
- Double tick = e.getValue();
-
- Instrument inst = instCache.get(symbol);
-
- if (inst == null)
- inst = new Instrument(symbol);
-
- // Don't populate market cache, as we don't use it for querying.
- // Update cached instrument based on the latest market tick.
- inst.update(tick);
-
- instCache.put(symbol, inst);
- }
- });
-
- // Stream market data into market data stream cache.
- while (true) {
- for (int j = 0; j < INSTRUMENTS.length; j++) {
- // Use gaussian distribution to ensure that
- // numbers closer to 0 have higher probability.
- double price = round2(INITIAL_PRICES[j] + RAND.nextGaussian());
-
- mktStmr.addData(INSTRUMENTS[j], price);
- }
- }
- }
- }
- }
-
- /**
- * Rounds double value to two significant signs.
- *
- * @param val value to be rounded.
- * @return rounded double value.
- */
- private static double round2(double val) {
- return Math.floor(100 * val + 0.5) / 100;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/examples/src/main/java/org/apache/ignite/examples/streaming/numbers/CacheConfig.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/numbers/CacheConfig.java b/examples/src/main/java/org/apache/ignite/examples/streaming/numbers/CacheConfig.java
deleted file mode 100644
index 58592e1..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/numbers/CacheConfig.java
+++ /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.
- */
-
-package org.apache.ignite.examples.streaming.numbers;
-
-import org.apache.ignite.configuration.*;
-
-import javax.cache.configuration.*;
-import javax.cache.expiry.*;
-
-import static java.util.concurrent.TimeUnit.*;
-
-/**
- * Configuration for the streaming cache to store the stream of random numbers.
- * 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.
- */
-public class CacheConfig {
- /**
- * Configure streaming cache.
- */
- public static CacheConfiguration<Integer, Long> randomNumbersCache() {
- CacheConfiguration<Integer, Long> cfg = new CacheConfiguration<>("randomNumbers");
-
- cfg.setIndexedTypes(Integer.class, Long.class);
-
- // Sliding window of 1 seconds.
- cfg.setExpiryPolicyFactory(FactoryBuilder.factoryOf(new CreatedExpiryPolicy(new Duration(SECONDS, 1))));
-
- return cfg;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/examples/src/main/java/org/apache/ignite/examples/streaming/numbers/QueryPopularNumbers.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/numbers/QueryPopularNumbers.java b/examples/src/main/java/org/apache/ignite/examples/streaming/numbers/QueryPopularNumbers.java
deleted file mode 100644
index e08ae09..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/numbers/QueryPopularNumbers.java
+++ /dev/null
@@ -1,74 +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.numbers;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.query.*;
-import org.apache.ignite.examples.*;
-
-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 streaming using {@link StreamRandomNumbers}.</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 QueryPopularNumbers {
- public static void main(String[] args) throws Exception {
- // 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());
-
- // Select top 10 words.
- SqlFieldsQuery top10Qry = new SqlFieldsQuery("select _key, _val from Long order by _val desc limit 10");
-
- // Select average, min, and max counts among all the words.
- SqlFieldsQuery statsQry = new SqlFieldsQuery("select avg(_val), min(_val), max(_val) from Long");
-
- // Query top 10 popular numbers every 5 seconds.
- while (true) {
- // Execute queries.
- List<List<?>> top10 = stmCache.query(top10Qry).getAll();
- List<List<?>> stats = stmCache.query(statsQry).getAll();
-
- // Print average count.
- List<?> row = stats.get(0);
-
- if (row.get(0) != null)
- System.out.printf("Query results [avg=%.2f, min=%d, max=%d]%n", row.get(0), row.get(1), row.get(2));
-
- // Print top 10 words.
- ExamplesUtils.printQueryResults(top10);
-
- Thread.sleep(5000);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/examples/src/main/java/org/apache/ignite/examples/streaming/numbers/StreamRandomNumbers.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/numbers/StreamRandomNumbers.java b/examples/src/main/java/org/apache/ignite/examples/streaming/numbers/StreamRandomNumbers.java
deleted file mode 100644
index 02030fb..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/numbers/StreamRandomNumbers.java
+++ /dev/null
@@ -1,78 +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.numbers;
-
-import org.apache.ignite.*;
-import org.apache.ignite.examples.*;
-import org.apache.ignite.stream.*;
-
-import javax.cache.processor.*;
-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 streaming using {@link StreamRandomNumbers}.</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 StreamRandomNumbers {
- /** Random number generator. */
- private static final Random RAND = new Random();
-
- /** Range within which to generate numbers. */
- private static final int RANGE = 1000;
-
- public static void main(String[] args) throws Exception {
- // 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 number.
- 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;
- }
- });
-
- // Stream random numbers into the streamer cache.
- while (true)
- stmr.addData(RAND.nextInt(RANGE), 1L);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/examples/src/main/java/org/apache/ignite/examples/streaming/transformers/StreamTransformerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/transformers/StreamTransformerExample.java b/examples/src/main/java/org/apache/ignite/examples/streaming/transformers/StreamTransformerExample.java
new file mode 100644
index 0000000..b2fc89d
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/transformers/StreamTransformerExample.java
@@ -0,0 +1,101 @@
+/*
+ * 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.transformers;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.examples.*;
+import org.apache.ignite.stream.*;
+
+import javax.cache.processor.*;
+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 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. */
+ private static final Random RAND = new Random();
+
+ /** Range within which to generate numbers. */
+ private static final int RANGE = 1000;
+
+ public static void main(String[] args) throws Exception {
+ // Mark this cluster member as client.
+ Ignition.setClientMode(true);
+
+ try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+ if (!ExamplesUtils.hasServerNodes(ignite))
+ return;
+
+ CacheConfiguration<Integer, Long> cfg = new CacheConfiguration<>("randomNumbers");
+
+ // Index key and value.
+ cfg.setIndexedTypes(Integer.class, Long.class);
+
+ // Auto-close cache at the end of the example.
+ try (IgniteCache<Integer, Long> stmCache = ignite.getOrCreateCache(cfg)) {
+ try (IgniteDataStreamer<Integer, Long> stmr = ignite.dataStreamer(stmCache.getName())) {
+ // Allow data updates.
+ stmr.allowOverwrite(true);
+
+ // Configure data transformation to count instances of the same number.
+ stmr.receiver(new StreamTransformer<Integer, Long>() {
+ @Override
+ public Object process(MutableEntry<Integer, Long> e, Object... args) {
+ // Get current count.
+ Long val = e.getValue();
+
+ // Increment count by 1.
+ e.setValue(val == null ? 1L : val + 1);
+
+ return null;
+ }
+ });
+
+ // Stream 10 million of random numbers into the streamer cache.
+ for (int i = 1; i <= 10_000_000; i++) {
+ stmr.addData(RAND.nextInt(RANGE), 1L);
+
+ if (i % 500_000 == 0)
+ System.out.println("Number of tuples streamed into Ignite: " + i);
+ }
+ }
+
+ // Query top 10 most popular numbers every.
+ SqlFieldsQuery top10Qry = new SqlFieldsQuery("select _key, _val from Long order by _val desc limit 10");
+
+ // Execute queries.
+ List<List<?>> top10 = stmCache.query(top10Qry).getAll();
+
+ System.out.println("Top 10 most popular numbers:");
+
+ // Print top 10 words.
+ ExamplesUtils.printQueryResults(top10);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/examples/src/main/java/org/apache/ignite/examples/streaming/visitors/StreamVisitorExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/visitors/StreamVisitorExample.java b/examples/src/main/java/org/apache/ignite/examples/streaming/visitors/StreamVisitorExample.java
new file mode 100644
index 0000000..cd973ea
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/visitors/StreamVisitorExample.java
@@ -0,0 +1,176 @@
+/*
+ * 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.visitors;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.cache.query.annotations.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.examples.*;
+import org.apache.ignite.stream.*;
+
+import java.io.*;
+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 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. */
+ private static final Random RAND = new Random();
+
+ /** The list of instruments. */
+ private static final String[] INSTRUMENTS = {"IBM", "GOOG", "MSFT", "GE", "EBAY", "YHOO", "ORCL", "CSCO", "AMZN", "RHT"};
+
+ /** The list of initial instrument prices. */
+ private static final double[] INITIAL_PRICES = {194.9, 893.49, 34.21, 23.24, 57.93, 45.03, 44.41, 28.44, 378.49, 69.50};
+
+ public static void main(String[] args) throws Exception {
+ // Mark this cluster member as client.
+ Ignition.setClientMode(true);
+
+ try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+ if (!ExamplesUtils.hasServerNodes(ignite))
+ return;
+
+ // Market data cache with default configuration.
+ CacheConfiguration<String, Double> mktDataCfg = new CacheConfiguration<String, Double>("marketTicks");
+
+ // Financial instrument cache configuration.
+ CacheConfiguration<String, Instrument> instCfg = new CacheConfiguration<>("instCache");
+
+ // Index key and value for querying financial instruments.
+ // Note that Instrument class has @QuerySqlField annotation for secondary field indexing.
+ instCfg.setIndexedTypes(String.class, Instrument.class);
+
+ // Auto-close caches at the end of the example.
+ try (
+ IgniteCache<String, Double> mktCache = ignite.getOrCreateCache(mktDataCfg);
+ IgniteCache<String, Instrument> instCache = ignite.getOrCreateCache(instCfg)
+ ) {
+ try (IgniteDataStreamer<String, Double> mktStmr = ignite.dataStreamer(mktCache.getName())) {
+ // Note that we receive market data, but do not populate 'mktCache' (it remains empty).
+ // Instead we update the instruments in the 'instCache'.
+ // Since both, 'instCache' and 'mktCache' use the same key, updates are collocated.
+ mktStmr.receiver(new StreamVisitor<String, Double>() {
+ @Override
+ public void apply(IgniteCache<String, Double> cache, Map.Entry<String, Double> e) {
+ String symbol = e.getKey();
+ Double tick = e.getValue();
+
+ Instrument inst = instCache.get(symbol);
+
+ if (inst == null)
+ inst = new Instrument(symbol);
+
+ // Don't populate market cache, as we don't use it for querying.
+ // Update cached instrument based on the latest market tick.
+ inst.update(tick);
+
+ instCache.put(symbol, inst);
+ }
+ });
+
+ // Stream 10 million market data ticks into the system.
+ for (int i = 1; i <= 10_000_000; i++) {
+ int idx = RAND.nextInt(INSTRUMENTS.length);
+
+ // Use gaussian distribution to ensure that
+ // numbers closer to 0 have higher probability.
+ double price = round2(INITIAL_PRICES[idx] + RAND.nextGaussian());
+
+ mktStmr.addData(INSTRUMENTS[idx], price);
+
+ if (i % 500_000 == 0)
+ System.out.println("Number of tuples streamed into Ignite: " + i);
+ }
+ }
+
+ // Select top 3 best performing instruments.
+ SqlFieldsQuery top3qry = new SqlFieldsQuery(
+ "select symbol, (latest - open) from Instrument order by (latest - open) desc limit 3");
+
+ // Execute queries.
+ List<List<?>> top3 = instCache.query(top3qry).getAll();
+
+ System.out.println("Top performing financial instruments: ");
+
+ // Print top 10 words.
+ ExamplesUtils.printQueryResults(top3);
+ }
+ }
+ }
+
+ /**
+ * Rounds double value to two significant signs.
+ *
+ * @param val value to be rounded.
+ * @return rounded double value.
+ */
+ private static double round2(double val) {
+ return Math.floor(100 * val + 0.5) / 100;
+ }
+
+ /**
+ * Financial instrument.
+ */
+ public static class Instrument implements Serializable {
+ /** Instrument symbol. */
+ @QuerySqlField(index = true)
+ private final String symbol;
+
+ /** Open price. */
+ @QuerySqlField(index = true)
+ private double open;
+
+ /** Close price. */
+ @QuerySqlField(index = true)
+ private double latest;
+
+ /**
+ * @param symbol Symbol.
+ */
+ Instrument(String symbol) {
+ this.symbol = symbol;
+ }
+
+ /**
+ * Updates this instrument based on the latest price.
+ *
+ * @param price Latest price.
+ */
+ public void update(double price) {
+ if (open == 0)
+ open = price;
+
+ this.latest = price;
+ }
+
+ /** {@inheritDoc} */
+ @Override public synchronized String toString() {
+ return "Instrument [symbol=" + symbol + ", latest=" + latest + ", change=" + (latest - open) + ']';
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/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
new file mode 100644
index 0000000..58704ca
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/CacheConfig.java
@@ -0,0 +1,48 @@
+/*
+ * 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;
+
+import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.configuration.*;
+
+import javax.cache.configuration.*;
+import javax.cache.expiry.*;
+
+import static java.util.concurrent.TimeUnit.*;
+
+/**
+ * Configuration for the streaming cache to store the stream of random numbers.
+ * 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.
+ */
+public class CacheConfig {
+ /**
+ * Configure streaming cache.
+ */
+ public static CacheConfiguration<AffinityUuid, String> wordCache() {
+ CacheConfiguration<AffinityUuid, String> cfg = new CacheConfiguration<>("words");
+
+ // Index all words streamed into cache.
+ cfg.setIndexedTypes(AffinityUuid.class, String.class);
+
+ // Sliding window of 1 seconds.
+ cfg.setExpiryPolicyFactory(FactoryBuilder.factoryOf(new CreatedExpiryPolicy(new Duration(SECONDS, 1))));
+
+ return cfg;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/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
new file mode 100644
index 0000000..c32d8e8
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/QueryWords.java
@@ -0,0 +1,77 @@
+/*
+ * 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;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.examples.*;
+
+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 streaming using {@link StreamWords}.</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 QueryWords {
+ public static void main(String[] args) throws Exception {
+ // 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());
+
+ // Select top 10 words.
+ SqlFieldsQuery top10Qry = new SqlFieldsQuery(
+ "select _val, count(_val) as cnt from String group by _val order by cnt desc limit 10");
+
+ // Select average, min, and max counts among all the words.
+ SqlFieldsQuery statsQry = new SqlFieldsQuery(
+ "select avg(cnt), min(cnt), max(cnt) from (select count(_val) as cnt from String group by _val)");
+
+ // Query top 10 popular numbers every 5 seconds.
+ while (true) {
+ // Execute queries.
+ List<List<?>> top10 = stmCache.query(top10Qry).getAll();
+ List<List<?>> stats = stmCache.query(statsQry).getAll();
+
+ // Print average count.
+ List<?> row = stats.get(0);
+
+ if (row.get(0) != null)
+ System.out.printf("Query results [avg=%.2f, min=%d, max=%d]%n", row.get(0), row.get(1), row.get(2));
+
+ // Print top 10 words.
+ ExamplesUtils.printQueryResults(top10);
+
+ Thread.sleep(5000);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2984c9b/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
new file mode 100644
index 0000000..c59fa51
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/StreamWords.java
@@ -0,0 +1,68 @@
+/*
+ * 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;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.examples.*;
+
+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 streaming using {@link StreamWords}.</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 StreamWords {
+ public static void main(String[] args) throws Exception {
+ // 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())) {
+ // Stream words from "alice-in-wonderland" book.
+ while (true) {
+ InputStream in = StreamWords.class.getResourceAsStream("alice-in-wonderland.txt");
+
+ try (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.
+ // By using AffinityUuid we ensure that identical
+ // words are processed on the same cluster node.
+ stmr.addData(new AffinityUuid(word), word);
+ }
+ }
+ }
+ }
+ }
+ }
+}
[24/50] [abbrv] incubator-ignite git commit: minor
Posted by sb...@apache.org.
minor
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/369a36d7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/369a36d7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/369a36d7
Branch: refs/heads/ignite-665
Commit: 369a36d70f27571cd084b3b1b4990440cd4a510c
Parents: 15cebfc
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Mon Apr 6 18:57:34 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Mon Apr 6 18:57:34 2015 +0300
----------------------------------------------------------------------
.../main/java/org/apache/ignite/internal/util/IgniteUtils.java | 5 +++--
.../internal/processors/hadoop/HadoopCommandLineTest.java | 3 +--
2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/369a36d7/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 8a982bc..1aac985 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
@@ -3012,8 +3012,9 @@ public abstract class IgniteUtils {
* @return {@code true} if and only if the file or directory is successfully deleted,
* {@code false} otherwise
*/
- public static boolean delete(File file) {
- assert file != null;
+ public static boolean delete(@Nullable File file) {
+ if (file == null)
+ return false;
boolean res = true;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/369a36d7/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopCommandLineTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopCommandLineTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopCommandLineTest.java
index f6f7a01..d10ee5c 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopCommandLineTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopCommandLineTest.java
@@ -200,8 +200,7 @@ public class HadoopCommandLineTest extends GridCommonAbstractTest {
@Override protected void afterTestsStopped() throws Exception {
super.afterTestsStopped();
- if (testWorkDir != null)
- U.delete(testWorkDir);
+ U.delete(testWorkDir);
}
/** {@inheritDoc} */