You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/06/19 16:02:39 UTC
[2/4] incubator-ignite git commit: # ignite-reflectionFactory: config
params and java-example
# ignite-reflectionFactory: config params and java-example
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e89ab786
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e89ab786
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e89ab786
Branch: refs/heads/IgniteReflectionFactory-doc
Commit: e89ab78693cd44f5d893593a13f62e034359e4a7
Parents: 11e4489
Author: ashutak <as...@gridgain.com>
Authored: Fri Jun 19 16:20:10 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Fri Jun 19 16:20:10 2015 +0300
----------------------------------------------------------------------
.../configuration/IgniteReflectionFactory.java | 77 ++++++++------------
1 file changed, 32 insertions(+), 45 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e89ab786/modules/core/src/main/java/org/apache/ignite/configuration/IgniteReflectionFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteReflectionFactory.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteReflectionFactory.java
index 8d645ac..a6d4c40 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteReflectionFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteReflectionFactory.java
@@ -63,58 +63,38 @@ import java.util.*;
* <li>Heartbeat frequency (see {@link #setHeartbeatFrequency(long)}) - 100ms</li>
* <li>Socket timeout (see {@link #setSocketTimeout(long)}) - 200ms</li>
* <li>Message acknowledgement timeout (see {@link #setAckTimeout(long)}) - 50ms</li>
+ *
+ *
+ *
+ *
+ * * * * * *
* </ul>
* <h1 class="header">Configuration</h1>
* <h2 class="header">Mandatory</h2>
- * There are no mandatory configuration parameters.
- * <h2 class="header">Optional</h2>
- * The following configuration parameters are optional:
- * <ul>
- * <li>IP finder to share info about nodes IP addresses
- * (see {@link #setIpFinder(TcpDiscoveryIpFinder)}).
- * See the following IP finder implementations for details on configuration:
+ * The following configuration parameters are mandatory:
* <ul>
- * <li>{@link TcpDiscoverySharedFsIpFinder}</li>
- * <li>{@ignitelink org.apache.ignite.spi.discovery.tcp.ipfinder.s3.TcpDiscoveryS3IpFinder}</li>
- * <li>{@link TcpDiscoveryJdbcIpFinder}</li>
- * <li>{@link TcpDiscoveryVmIpFinder}</li>
- * <li>{@link TcpDiscoveryMulticastIpFinder} - default</li>
- * </ul>
- * </li>
+ * <li>Component class - class to be created (see {@link #setComponentClass(Class)}.
+ * It have to be public java POJO class with default constructor
+ * and public setters to be used by properties injection (see {@link #setProperties(Map)})</li>
* </ul>
+ * <h2 class="header">Optional</h2>
+ * The following configuration parameters are optional:
* <ul>
* </li>
- * <li>Local address (see {@link #setLocalAddress(String)})</li>
- * <li>Local port to bind to (see {@link #setLocalPort(int)})</li>
- * <li>Local port range to try binding to if previous ports are in use
- * (see {@link #setLocalPortRange(int)})</li>
- * <li>Heartbeat frequency (see {@link #setHeartbeatFrequency(long)})</li>
- * <li>Max missed heartbeats (see {@link #setMaxMissedHeartbeats(int)})</li>
- * <li>Number of times node tries to (re)establish connection to another node
- * (see {@link #setReconnectCount(int)})</li>
- * <li>Network timeout (see {@link #setNetworkTimeout(long)})</li>
- * <li>Socket timeout (see {@link #setSocketTimeout(long)})</li>
- * <li>Message acknowledgement timeout (see {@link #setAckTimeout(long)})</li>
- * <li>Maximum message acknowledgement timeout (see {@link #setMaxAckTimeout(long)})</li>
- * <li>Join timeout (see {@link #setJoinTimeout(long)})</li>
- * <li>Thread priority for threads started by SPI (see {@link #setThreadPriority(int)})</li>
- * <li>IP finder clean frequency (see {@link #setIpFinderCleanFrequency(long)})</li>
- * <li>Statistics print frequency (see {@link #setStatisticsPrintFrequency(long)}</li>
- * <li>Force server mode (see {@link #setForceServerMode(boolean)}</li>
+ * <li>Singleton mode (see {@link #setSingleton(boolean)})</li>
+ * <li>Properties map (see {@link #setProperties(Map)}</li>
+ * <li>With method (see {@link #setWithMethod(Object, String, Serializable)}</li>
* </ul>
* <h2 class="header">Java Example</h2>
* <pre name="code" class="java">
- * TcpDiscoverySpi spi = new TcpDiscoverySpi();
- *
- * TcpDiscoveryVmIpFinder finder =
- * new GridTcpDiscoveryVmIpFinder();
- *
- * spi.setIpFinder(finder);
+ * Factory<CacheStoreSessionListener> factory =
+ * new IgniteReflectionFactory<CacheStoreSessionListener>(MyCacheStoreSessionListener.class);
*
- * IgniteConfiguration cfg = new IgniteConfiguration();
+ * CacheConfiguration cc = new CacheConfiguration()
+ * .setCacheStoreSessionListenerFactories(factory);
*
- * // Override default discovery SPI.
- * cfg.setDiscoverySpi(spi);
+ * IgniteConfiguration cfg = new IgniteConfiguration()
+ * .setCacheConfiguration(cc);
*
* // Start grid.
* Ignition.start(cfg);
@@ -124,6 +104,7 @@ import java.util.*;
* <pre name="code" class="xml">
* <bean id="grid.custom.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" singleton="true">
* ...
+ * <bean id="grid.custom.cfg" class="org.apache.ignite.configuration.IgniteCacheConfiguration">
* <property name="discoverySpi">
* <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
* <property name="ipFinder">
@@ -138,26 +119,26 @@ import java.util.*;
* <img src="http://ignite.incubator.apache.org/images/spring-small.png">
* <br>
* For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
- * @see DiscoverySpi
+ * @see Factory
*/
public class IgniteReflectionFactory<T> implements Factory<T> {
/** */
private static final long serialVersionUID = 0L;
- /** */
+ /** Singletom mode */
private volatile boolean singleton;
- /** */
+ /** Component class */
private volatile Class<? extends T> cls;
- /** */
+ /** Properties */
private volatile Map<String, Serializable> props;
/** */
private transient T instance;
/**
- *
+ * Default constructor.
*/
public IgniteReflectionFactory() {
// No-op.
@@ -210,6 +191,9 @@ public class IgniteReflectionFactory<T> implements Factory<T> {
}
/**
+ * Gets a map of properties. Map contains entries of component class field name
+ * to value of the filed which will be used as initial value.
+ *
* @return Properties.
*/
public Map<String, Serializable> getProperties() {
@@ -217,6 +201,9 @@ public class IgniteReflectionFactory<T> implements Factory<T> {
}
/**
+ * Sets a map of properties. Map contains entries of component class field name
+ * to a value of the filed which will be used as initial value.
+ *
* @param props Properties.
*/
public void setProperties(Map<String, Serializable> props) {