ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [10/10] incubator-ignite git commit: ignite-454 config fixes
Date Mon, 16 Mar 2015 14:13:35 GMT
ignite-454 config fixes


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5ab695bb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5ab695bb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5ab695bb

Branch: refs/heads/ignite-454
Commit: 5ab695bbe9b4f8e741b9f4fe6cb5076cd185faa0
Parents: 0620e9e
Author: avinogradov <avinogradov@gridgain.com>
Authored: Mon Mar 16 16:59:38 2015 +0300
Committer: avinogradov <avinogradov@gridgain.com>
Committed: Mon Mar 16 16:59:38 2015 +0300

----------------------------------------------------------------------
 examples/config/example-streamer-j8.xml         | 293 +++++++++++++++++++
 .../hibernate/example-hibernate-L2-cache-j8.xml |  67 +++++
 .../hibernate/HibernateL2CacheExample.java      |   2 +-
 .../streaming/StreamingCheckInExample.java      |   2 +-
 .../streaming/StreamingNodeStartup.java         |   2 +-
 .../StreamingPopularNumbersExample.java         |   2 +-
 .../streaming/StreamingPriceBarsExample.java    |   2 +-
 .../StreamingRunningAverageExample.java         |   2 +-
 8 files changed, 366 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5ab695bb/examples/config/example-streamer-j8.xml
----------------------------------------------------------------------
diff --git a/examples/config/example-streamer-j8.xml b/examples/config/example-streamer-j8.xml
new file mode 100644
index 0000000..2c0b1c3
--- /dev/null
+++ b/examples/config/example-streamer-j8.xml
@@ -0,0 +1,293 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<!--
+    Ignite Spring configuration file to startup ignite with streamers.
+
+    When starting a standalone node, you need to execute the following command:
+    {IGNITE_HOME}/bin/ignite.{bat|sh} examples/config/example-streamer.xml
+    When starting nodes this way JAR file containing the examples code
+    should be placed to {IGNITE_HOME}/libs folder. You can build
+    ignite-examples.jar by running "mvn package" in {IGNITE_HOME}/examples folder.
+    After that ignite-examples.jar will be generated by Maven in
+    {IGNITE_HOME}/examples/target folder.
+
+    When starting Ignite from Java IDE, pass path to this file to Ignition:
+    Ignition.start("examples/config/example-cache.xml");
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="
+        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+    <!--
+        Optional description.
+    -->
+    <description>
+        Spring file for ignite configuration with benchmark.
+    </description>
+
+    <!--
+        Configuration below demonstrates how to setup caches within cluster nodes.
+    -->
+    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+        <property name="marshaller">
+            <bean class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller">
+                <!-- Set to false to allow non-serializable objects in examples, default
is true. -->
+                <property name="requireSerializable" value="false"/>
+            </bean>
+        </property>
+
+        <!-- Streamer configurations. -->
+        <property name="streamerConfiguration">
+            <!--
+                Specify list of streamer configurations here.
+            -->
+            <list>
+                <!--
+                    Streamer for StreamingRunningAverageExample.
+                -->
+                <bean class="org.apache.ignite.streamer.StreamerConfiguration">
+                    <property name="name" value="running-average"/>
+
+                    <property name="windows">
+                        <!--
+                            Window size is 500, which means that we will be
+                            computing running average over the last 500 events.
+                        -->
+                        <bean class="org.apache.ignite.streamer.window.StreamerBoundedSizeWindow">
+                            <property name="maximumSize" value="500"/>
+                        </bean>
+                    </property>
+
+                    <property name="stages">
+                        <list>
+                            <bean class="org.apache.ignite.examples8.streaming.StreamingRunningAverageExample$StreamerStage"/>
+                        </list>
+                    </property>
+
+                    <property name="router">
+                        <!--
+                            Use random event router to execute streamer stages on random
nodes
+                            just for demonstration purposes.
+                        -->
+                        <bean class="org.apache.ignite.streamer.router.StreamerRandomEventRouter"/>
+                        <!--
+                        <bean class="org.apache.ignite.streamer.router.StreamerLocalEventRouter"/>
+                        -->
+                    </property>
+
+                    <!--
+                        If at-least-once is set, then we may wish to configure maximum
+                        amount of concurrent sessions to prevent overloading the system.
+                    -->
+                    <!--
+                    <property name="maximumConcurrentSessions" value="200"/>
+                    <property name="atLeastOnce" value="true"/>
+                    -->
+                </bean>
+
+                <!--
+                    Streamer for StreamingPopularNumbersExample.
+                -->
+                <bean class="org.apache.ignite.streamer.StreamerConfiguration">
+                    <property name="name" value="popular-numbers"/>
+
+                    <property name="windows">
+                        <!--
+                            For this example we use a running window with upper bound of
10,000 events.
+                            This means that streamer will find most popular numbers among
last 10,000 events.
+                        -->
+                        <bean class="org.apache.ignite.streamer.window.StreamerBoundedSizeWindow">
+                            <property name="maximumSize" value="10000"/>
+
+                            <property name="indexes">
+                                <list>
+                                    <bean class="org.apache.ignite.streamer.index.tree.StreamerTreeIndexProvider">
+                                        <property name="updater">
+                                            <bean class="org.apache.ignite.examples8.streaming.StreamingPopularNumbersExample$IndexUpdater"/>
+                                        </property>
+                                    </bean>
+                                </list>
+                            </property>
+                        </bean>
+                    </property>
+
+                    <property name="stages">
+                        <list>
+                            <bean class="org.apache.ignite.examples8.streaming.StreamingPopularNumbersExample$StreamerStage"/>
+                        </list>
+                    </property>
+
+                    <property name="maximumConcurrentSessions" value="200"/>
+
+                    <property name="router">
+                        <!--
+                            For this example we use affinity event router to make sure that
+                            identical numbers are routed to the same node. This is important
+                            because we keep counters for all numbers in the stream and if
+                            numbers are pushed to wrong nodes, the counters will become
+                            inaccurate.
+                        -->
+                        <bean class="org.apache.ignite.streamer.router.StreamerAffinityEventRouter"/>
+                    </property>
+
+                    <!--
+                        If at-least-once is set, then we may wish to configure maximum
+                        amount of concurrent sessions to prevent overloading the system.
+                    -->
+                    <!--
+                    <property name="maximumConcurrentSessions" value="200"/>
+                    <property name="atLeastOnce" value="true"/>
+                    -->
+                </bean>
+
+                <!--
+                    Streamer for StreamingOpenHighLowCloseExample.
+                -->
+                <bean class="org.apache.ignite.streamer.StreamerConfiguration">
+                    <property name="name" value="priceBars"/>
+
+                    <property name="windows">
+                        <list>
+                            <!--
+                                For this example we use a running batch window with upper
bound of 1 second.
+                                This means that streamer composes a batch with events within
1 second time interval.
+                            -->
+                            <bean class="org.apache.ignite.streamer.window.StreamerBoundedTimeBatchWindow">
+                                <property name="name" value="stage1"/>
+                                <property name="batchTimeInterval" value="1000"/>
+                                <property name="batchSize" value="2147483647"/>
+                                <property name="maximumBatches" value="2147483647"/>
+                            </bean>
+
+                            <!--
+                                For this example we use a running batch window with upper
bound of 2 seconds.
+                                This means that streamer composes a batch with events within
2 seconds time interval.
+                            -->
+                            <bean class="org.apache.ignite.streamer.window.StreamerBoundedTimeBatchWindow">
+                                <property name="name" value="stage2"/>
+                                <property name="batchTimeInterval" value="2000"/>
+                                <property name="batchSize" value="2147483647"/>
+                                <property name="maximumBatches" value="2147483647"/>
+                            </bean>
+                        </list>
+                    </property>
+
+                    <property name="stages">
+                        <list>
+                            <bean class="org.apache.ignite.examples8.streaming.StreamingPriceBarsExample$FirstStage"/>
+                            <bean class="org.apache.ignite.examples8.streaming.StreamingPriceBarsExample$SecondStage"/>
+                        </list>
+                    </property>
+
+                    <property name="router">
+                        <!--
+                            For this example we use affinity event router to make sure that
+                            quotes for identical instruments are routed to the same node.
+                        -->
+                        <bean class="org.apache.ignite.streamer.router.StreamerAffinityEventRouter"/>
+                    </property>
+                </bean>
+
+                <!--
+                    Streamer for StreamingCheckInExample.
+                -->
+                <bean class="org.apache.ignite.streamer.StreamerConfiguration">
+                    <property name="name" value="check-in"/>
+
+                    <property name="windows">
+                        <list>
+                            <!--
+                                For this example we use windows with 10 seconds time interval.
+                                This means that only events for last 10 seconds will be present
in
+                                these windows (other events are marked for eviction).
+                            -->
+                            <bean class="org.apache.ignite.streamer.window.StreamerBoundedTimeWindow">
+                                <property name="name" value="AddToWindowStage"/>
+                                <property name="timeInterval" value="10000"/>
+
+                                <!--
+                                    We use a unique index to avoid repetitive check-ins in
a specified period
+                                    of time.
+                                -->
+                                <property name="indexes">
+                                    <list>
+                                        <bean class="org.apache.ignite.streamer.index.hash.StreamerHashIndexProvider">
+                                            <property name="unique" value="true"/>
+
+                                            <property name="updater">
+                                                <bean class="org.apache.ignite.examples8.streaming.StreamingCheckInExample$CheckInEventIndexUpdater"/>
+                                            </property>
+                                        </bean>
+                                    </list>
+                                </property>
+                            </bean>
+                            <bean class="org.apache.ignite.streamer.window.StreamerBoundedTimeWindow">
+                                <property name="name" value="DetectPlacesStage"/>
+                                <property name="timeInterval" value="10000"/>
+
+                                <property name="indexes">
+                                    <list>
+                                        <bean class="org.apache.ignite.streamer.index.hash.StreamerHashIndexProvider">
+                                            <property name="unique" value="true"/>
+
+                                            <property name="updater">
+                                                <bean class="org.apache.ignite.examples8.streaming.StreamingCheckInExample$PlacesIndexUpdater"/>
+                                            </property>
+                                        </bean>
+                                    </list>
+                                </property>
+                            </bean>
+                        </list>
+                    </property>
+
+                    <property name="stages">
+                        <list>
+                            <bean class="org.apache.ignite.examples8.streaming.StreamingCheckInExample$AddToWindowStage"/>
+                            <bean class="org.apache.ignite.examples8.streaming.StreamingCheckInExample$DetectPlacesStage"/>
+                        </list>
+                    </property>
+                </bean>
+            </list>
+        </property>
+
+        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes.
-->
+        <property name="discoverySpi">
+            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+                <property name="ipFinder">
+                    <!--
+                        Ignite provides several options for automatic discovery that can
be used
+                        instead os static IP based discovery. For information on all options
refer
+                        to our documentation: http://doc.gridgain.org/latest/Automatic+Node+Discovery
+                    -->
+                    <!-- 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">
+                        <property name="addresses">
+                            <list>
+                                <!-- In distributed environment, replace with actual host
IP address. -->
+                                <value>127.0.0.1:47500..47509</value>
+                            </list>
+                        </property>
+                    </bean>
+                </property>
+            </bean>
+        </property>
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5ab695bb/examples/config/hibernate/example-hibernate-L2-cache-j8.xml
----------------------------------------------------------------------
diff --git a/examples/config/hibernate/example-hibernate-L2-cache-j8.xml b/examples/config/hibernate/example-hibernate-L2-cache-j8.xml
new file mode 100644
index 0000000..a1acfaa
--- /dev/null
+++ b/examples/config/hibernate/example-hibernate-L2-cache-j8.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+
+<!DOCTYPE hibernate-configuration PUBLIC
+    "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+    "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
+
+<!--
+    Configuration file for HibernateL2CacheExample.
+-->
+
+<hibernate-configuration>
+    <session-factory>
+        <!-- Database connection settings -->
+        <property name="connection.url">jdbc:h2:mem:example;DB_CLOSE_DELAY=-1</property>
+
+        <!-- Drop and re-create the database schema on startup. -->
+        <property name="hbm2ddl.auto">create</property>
+
+        <!-- Enable L2 cache. -->
+        <property name="cache.use_second_level_cache">true</property>
+
+        <!-- Enable query cache. -->
+        <property name="cache.use_query_cache">true</property>
+
+        <!-- Generate L2 cache statistics. -->
+        <property name="generate_statistics">true</property>
+
+        <!-- Specify Ignite as L2 cache provider. -->
+        <property name="cache.region.factory_class">org.apache.ignite.cache.hibernate.HibernateRegionFactory</property>
+
+        <!-- Specify the name of the ignite, that will be used for second level caching.
-->
+        <property name="org.apache.ignite.hibernate.grid_name">hibernate-grid</property>
+
+        <!-- Specify connection release mode. -->
+        <property name="connection.release_mode">on_close</property>
+
+        <!-- Set default L2 cache access type. -->
+        <property name="org.apache.ignite.hibernate.default_access_type">READ_ONLY</property>
+
+        <!-- Specify the entity classes for mapping. -->
+        <mapping class="org.apache.ignite.examples8.datagrid.hibernate.User"/>
+        <mapping class="org.apache.ignite.examples8.datagrid.hibernate.Post"/>
+
+        <!-- Per-class L2 cache settings. -->
+        <class-cache class="org.apache.ignite.examples8.datagrid.hibernate.User" usage="read-only"/>
+        <class-cache class="org.apache.ignite.examples8.datagrid.hibernate.Post" usage="read-only"/>
+        <collection-cache collection="org.apache.ignite.examples8.datagrid.hibernate.User.posts"
usage="read-only"/>
+    </session-factory>
+</hibernate-configuration>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5ab695bb/examples/src/main/java8/org/apache/ignite/examples8/datagrid/hibernate/HibernateL2CacheExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples8/datagrid/hibernate/HibernateL2CacheExample.java
b/examples/src/main/java8/org/apache/ignite/examples8/datagrid/hibernate/HibernateL2CacheExample.java
index 471bfd6..a591e9b 100644
--- a/examples/src/main/java8/org/apache/ignite/examples8/datagrid/hibernate/HibernateL2CacheExample.java
+++ b/examples/src/main/java8/org/apache/ignite/examples8/datagrid/hibernate/HibernateL2CacheExample.java
@@ -69,7 +69,7 @@ public class HibernateL2CacheExample {
     private static final String JDBC_URL = "jdbc:h2:mem:example;DB_CLOSE_DELAY=-1";
 
     /** Path to hibernate configuration file (will be resolved from application {@code CLASSPATH}).
*/
-    private static final String HIBERNATE_CFG = "hibernate/example-hibernate-L2-cache.xml";
+    private static final String HIBERNATE_CFG = "hibernate/example-hibernate-L2-cache-j8.xml";
 
     /** Entity names for stats output. */
     private static final List<String> ENTITY_NAMES =

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5ab695bb/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingCheckInExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingCheckInExample.java
b/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingCheckInExample.java
index 7f9959c..4a9128a 100644
--- a/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingCheckInExample.java
+++ b/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingCheckInExample.java
@@ -107,7 +107,7 @@ public class StreamingCheckInExample {
         Timer timer = new Timer("check-in-query-worker");
 
         // Start ignite.
-        final Ignite ignite = Ignition.start("examples/config/example-streamer.xml");
+        final Ignite ignite = Ignition.start("examples/config/example-streamer-j8.xml");
 
         System.out.println();
         System.out.println(">>> Streaming check-in example started.");

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5ab695bb/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingNodeStartup.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingNodeStartup.java
b/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingNodeStartup.java
index 60ed1cd..0dc00c3 100644
--- a/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingNodeStartup.java
+++ b/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingNodeStartup.java
@@ -30,6 +30,6 @@ public class StreamingNodeStartup {
      * @throws org.apache.ignite.IgniteException If example execution failed.
      */
     public static void main(String[] args) throws IgniteException {
-        Ignition.start("examples/config/example-streamer.xml");
+        Ignition.start("examples/config/example-streamer-j8.xml");
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5ab695bb/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingPopularNumbersExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingPopularNumbersExample.java
b/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingPopularNumbersExample.java
index 75f0956..700f1ad 100644
--- a/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingPopularNumbersExample.java
+++ b/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingPopularNumbersExample.java
@@ -92,7 +92,7 @@ public class StreamingPopularNumbersExample {
         Timer popularNumbersQryTimer = new Timer("numbers-query-worker");
 
         // Start ignite.
-        final Ignite ignite = Ignition.start("examples/config/example-streamer.xml");
+        final Ignite ignite = Ignition.start("examples/config/example-streamer-j8.xml");
 
         System.out.println();
         System.out.println(">>> Streaming popular numbers example started.");

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5ab695bb/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingPriceBarsExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingPriceBarsExample.java
b/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingPriceBarsExample.java
index 65ffc30..a344b827 100644
--- a/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingPriceBarsExample.java
+++ b/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingPriceBarsExample.java
@@ -79,7 +79,7 @@ public class StreamingPriceBarsExample {
         Timer timer = new Timer("priceBars");
 
         // Start ignite.
-        final Ignite ignite = Ignition.start("examples/config/example-streamer.xml");
+        final Ignite ignite = Ignition.start("examples/config/example-streamer-j8.xml");
 
         System.out.println();
         System.out.println(">>> Streaming price bars example started.");

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5ab695bb/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingRunningAverageExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingRunningAverageExample.java
b/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingRunningAverageExample.java
index 724c9da..8c59ddc 100644
--- a/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingRunningAverageExample.java
+++ b/examples/src/main/java8/org/apache/ignite/examples8/streaming/StreamingRunningAverageExample.java
@@ -50,7 +50,7 @@ public class StreamingRunningAverageExample {
      * @throws Exception If failed.
      */
     public static void main(String[] args) throws Exception {
-        Ignite ignite = Ignition.start("examples/config/example-streamer.xml");
+        Ignite ignite = Ignition.start("examples/config/example-streamer-j8.xml");
 
         System.out.println();
         System.out.println(">>> Streaming running average example started.");


Mime
View raw message