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 Ignite
public 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.ApplicationContextAware
org.springframework.beans.BeansException
public void destroy() throws Exception
destroy
in interface org.springframework.beans.factory.DisposableBean
Exception
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
public IgniteLogger log()
public IgniteProductVersion version()
public IgniteCompute compute()
public IgniteServices services()
public IgniteMessaging message()
public IgniteEvents events()
public ExecutorService executorService()
executorService
in interface Ignite
public 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 Ignite
public 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 Ignite
public <K,V> IgniteCache<K,V> getOrCreateCache(CacheConfiguration<K,V> cacheCfg)
getOrCreateCache
in interface Ignite
public <K,V> IgniteCache<K,V> createCache(CacheConfiguration<K,V> cacheCfg, NearCacheConfiguration<K,V> nearCfg)
createCache
in interface Ignite
public <K,V> IgniteCache<K,V> getOrCreateCache(CacheConfiguration<K,V> cacheCfg, NearCacheConfiguration<K,V> nearCfg)
getOrCreateCache
in interface Ignite
public <K,V> IgniteCache<K,V> createNearCache(String cacheName, NearCacheConfiguration<K,V> nearCfg)
createNearCache
in interface Ignite
public <K,V> IgniteCache<K,V> getOrCreateNearCache(@Nullable String cacheName, NearCacheConfiguration<K,V> nearCfg)
getOrCreateNearCache
in interface Ignite
public void destroyCache(String cacheName)
destroyCache
in interface Ignite
public IgniteTransactions transactions()
transactions
in interface Ignite
public <K,V> IgniteDataStreamer<K,V> dataStreamer(@Nullable String cacheName)
dataStreamer
in interface Ignite
public IgniteFileSystem fileSystem(String name)
fileSystem
in interface Ignite
public Collection<IgniteFileSystem> fileSystems()
fileSystems
in interface Ignite
public <T extends IgnitePlugin> T plugin(String name) throws PluginNotFoundException
plugin
in interface Ignite
PluginNotFoundException
public void close() throws IgniteException
close
in interface AutoCloseable
close
in interface Ignite
IgniteException
@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 Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
Follow @ApacheIgnite
Ignite Fabric : ver. 1.0.0 Release Date : March 31 2015