public class IgniteSpringBean extends Object implements Ignite, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, Externalizable
Ignition methods.
In other words, this bean class allows to inject new grid instance from
Spring configuration file directly without invoking static
Ignition methods. This class can be wired directly from
Spring and can be referenced from within other Spring beans.
By virtue of implementing DisposableBean and InitializingBean
interfaces, GridSpringBean automatically starts and stops underlying
grid instance.
<bean id="mySpringBean" class="org.apache.ignite.GridSpringBean">
<property name="configuration">
<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="gridName" value="mySpringGrid"/>
</bean>
</property>
</bean>
Or use default configuration:
<bean id="mySpringBean" class="org.apache.ignite.GridSpringBean"/>
AbstractApplicationContext ctx = new FileSystemXmlApplicationContext("/path/to/spring/file");
// Register Spring hook to destroy bean automatically.
ctx.registerShutdownHook();
Grid grid = (Grid)ctx.getBean("mySpringBean");
| Constructor and Description |
|---|
IgniteSpringBean() |
public IgniteConfiguration configuration()
configuration in interface Ignitepublic void setConfiguration(IgniteConfiguration cfg)
cfg - Grid configuration.public void setApplicationContext(org.springframework.context.ApplicationContext ctx)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionpublic void destroy()
throws Exception
destroy in interface org.springframework.beans.factory.DisposableBeanExceptionpublic void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionpublic IgniteLogger log()
public IgniteProductVersion version()
public IgniteCompute compute()
public IgniteServices services()
public IgniteMessaging message()
public IgniteEvents events()
public ExecutorService executorService()
executorService in interface Ignitepublic IgniteCluster cluster()
public IgniteCompute compute(ClusterGroup grp)
public IgniteMessaging message(ClusterGroup prj)
public IgniteEvents events(ClusterGroup grp)
public IgniteServices services(ClusterGroup grp)
public ExecutorService executorService(ClusterGroup grp)
executorService in interface Ignitepublic IgniteScheduler scheduler()
public <K,V> IgniteCache<K,V> cache(@Nullable String name)
public <K,V> IgniteCache<K,V> createCache(CacheConfiguration<K,V> cacheCfg)
createCache in interface Ignitepublic <K,V> IgniteCache<K,V> getOrCreateCache(CacheConfiguration<K,V> cacheCfg)
getOrCreateCache in interface Ignitepublic <K,V> IgniteCache<K,V> createCache(CacheConfiguration<K,V> cacheCfg, NearCacheConfiguration<K,V> nearCfg)
createCache in interface Ignitepublic <K,V> IgniteCache<K,V> getOrCreateCache(CacheConfiguration<K,V> cacheCfg, NearCacheConfiguration<K,V> nearCfg)
getOrCreateCache in interface Ignitepublic <K,V> IgniteCache<K,V> createNearCache(String cacheName, NearCacheConfiguration<K,V> nearCfg)
createNearCache in interface Ignitepublic <K,V> IgniteCache<K,V> getOrCreateNearCache(@Nullable String cacheName, NearCacheConfiguration<K,V> nearCfg)
getOrCreateNearCache in interface Ignitepublic <K,V> IgniteCache<K,V> getOrCreateCache(String cacheName)
getOrCreateCache in interface Ignitepublic <K,V> IgniteCache<K,V> createCache(String cacheName)
createCache in interface Ignitepublic <K,V> void addCacheConfiguration(CacheConfiguration<K,V> cacheCfg)
addCacheConfiguration in interface Ignitepublic void destroyCache(String cacheName)
destroyCache in interface Ignitepublic IgniteTransactions transactions()
transactions in interface Ignitepublic <K,V> IgniteDataStreamer<K,V> dataStreamer(@Nullable String cacheName)
dataStreamer in interface Ignitepublic IgniteFileSystem fileSystem(String name)
fileSystem in interface Ignitepublic Collection<IgniteFileSystem> fileSystems()
fileSystems in interface Ignitepublic <T extends IgnitePlugin> T plugin(String name) throws PluginNotFoundException
plugin in interface IgnitePluginNotFoundExceptionpublic void close()
throws IgniteException
close in interface AutoCloseableclose in interface IgniteIgniteException@Nullable public IgniteAtomicSequence atomicSequence(String name, long initVal, boolean create)
atomicSequence in interface Ignite@Nullable public IgniteAtomicLong atomicLong(String name, long initVal, boolean create)
atomicLong in interface Ignite@Nullable public <T> IgniteAtomicReference<T> atomicReference(String name, @Nullable T initVal, boolean create)
atomicReference in interface Ignite@Nullable public <T,S> IgniteAtomicStamped<T,S> atomicStamped(String name, @Nullable T initVal, @Nullable S initStamp, boolean create)
atomicStamped in interface Ignite@Nullable public IgniteCountDownLatch countDownLatch(String name, int cnt, boolean autoDel, boolean create)
countDownLatch in interface Ignite@Nullable public <T> IgniteQueue<T> queue(String name, int cap, CollectionConfiguration cfg)
@Nullable public <T> IgniteSet<T> set(String name, CollectionConfiguration cfg)
public void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundException
Follow @ApacheIgnite
Ignite Fabric : ver. 1.0.7 Release Date : May 27 2015