Package org.apache.ignite
Class IgniteClientSpringBean
- java.lang.Object
-
- org.apache.ignite.IgniteClientSpringBean
-
- All Implemented Interfaces:
AutoCloseable,IgniteClient,org.springframework.context.Lifecycle,org.springframework.context.Phased,org.springframework.context.SmartLifecycle
public class IgniteClientSpringBean extends Object implements IgniteClient, org.springframework.context.SmartLifecycle
Represents Ignite client Spring bean that provides the ability to automatically start Ignite client during Spring Context initialization. It requiresClientConfigurationto be set before bean use (seesetClientConfiguration(ClientConfiguration)}). A note should be taken that Ignite client instance is started after all other Spring beans have been initialized and right before Spring context is refreshed. That implies that it's not valid to referenceIgniteClientSpringBeanfrom any kind of Spring bean init methods likejavax.annotation.PostConstruct. If it's required to referenceIgniteClientSpringBeanfor other bean initialization purposes, it should be done from aContextRefreshedEventlistener method declared in that bean.Spring XML Configuration Example
<bean id="igniteClient" class="org.apache.ignite.IgniteClientSpringBean"> <property name="clientConfiguration"> <bean class="org.apache.ignite.configuration.ClientConfiguration"> <property name="addresses"> <list> <value>127.0.0.1:10800</value> </list> </property> </bean> </property> </bean>
-
-
Field Summary
Fields Modifier and Type Field Description static intDFLT_IGNITE_CLI_LIFECYCLE_PHASEDefault Ignite clientSmartLifecyclephase.
-
Constructor Summary
Constructors Constructor Description IgniteClientSpringBean()
-
Method Summary
-
-
-
Field Detail
-
DFLT_IGNITE_CLI_LIFECYCLE_PHASE
public static final int DFLT_IGNITE_CLI_LIFECYCLE_PHASE
Default Ignite clientSmartLifecyclephase.- See Also:
- Constant Field Values
-
-
Method Detail
-
isAutoStartup
public boolean isAutoStartup()
- Specified by:
isAutoStartupin interfaceorg.springframework.context.SmartLifecycle
-
stop
public void stop(Runnable callback)
- Specified by:
stopin interfaceorg.springframework.context.SmartLifecycle
-
stop
public void stop()
- Specified by:
stopin interfaceorg.springframework.context.Lifecycle
-
isRunning
public boolean isRunning()
- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle
-
start
public void start()
- Specified by:
startin interfaceorg.springframework.context.Lifecycle
-
getPhase
public int getPhase()
- Specified by:
getPhasein interfaceorg.springframework.context.Phased- Specified by:
getPhasein interfaceorg.springframework.context.SmartLifecycle
-
getOrCreateCache
public <K,V> ClientCache<K,V> getOrCreateCache(String name) throws ClientException
- Specified by:
getOrCreateCachein interfaceIgniteClient- Throws:
ClientException
-
getOrCreateCacheAsync
public <K,V> IgniteClientFuture<ClientCache<K,V>> getOrCreateCacheAsync(String name) throws ClientException
- Specified by:
getOrCreateCacheAsyncin interfaceIgniteClient- Throws:
ClientException
-
getOrCreateCache
public <K,V> ClientCache<K,V> getOrCreateCache(ClientCacheConfiguration cfg) throws ClientException
- Specified by:
getOrCreateCachein interfaceIgniteClient- Throws:
ClientException
-
getOrCreateCacheAsync
public <K,V> IgniteClientFuture<ClientCache<K,V>> getOrCreateCacheAsync(ClientCacheConfiguration cfg) throws ClientException
- Specified by:
getOrCreateCacheAsyncin interfaceIgniteClient- Throws:
ClientException
-
cache
public <K,V> ClientCache<K,V> cache(String name)
- Specified by:
cachein interfaceIgniteClient
-
cacheNames
public Collection<String> cacheNames() throws ClientException
- Specified by:
cacheNamesin interfaceIgniteClient- Throws:
ClientException
-
cacheNamesAsync
public IgniteClientFuture<Collection<String>> cacheNamesAsync() throws ClientException
- Specified by:
cacheNamesAsyncin interfaceIgniteClient- Throws:
ClientException
-
destroyCache
public void destroyCache(String name) throws ClientException
- Specified by:
destroyCachein interfaceIgniteClient- Throws:
ClientException
-
destroyCacheAsync
public IgniteClientFuture<Void> destroyCacheAsync(String name) throws ClientException
- Specified by:
destroyCacheAsyncin interfaceIgniteClient- Throws:
ClientException
-
createCache
public <K,V> ClientCache<K,V> createCache(String name) throws ClientException
- Specified by:
createCachein interfaceIgniteClient- Throws:
ClientException
-
createCacheAsync
public <K,V> IgniteClientFuture<ClientCache<K,V>> createCacheAsync(String name) throws ClientException
- Specified by:
createCacheAsyncin interfaceIgniteClient- Throws:
ClientException
-
createCache
public <K,V> ClientCache<K,V> createCache(ClientCacheConfiguration cfg) throws ClientException
- Specified by:
createCachein interfaceIgniteClient- Throws:
ClientException
-
createCacheAsync
public <K,V> IgniteClientFuture<ClientCache<K,V>> createCacheAsync(ClientCacheConfiguration cfg) throws ClientException
- Specified by:
createCacheAsyncin interfaceIgniteClient- Throws:
ClientException
-
binary
public IgniteBinary binary()
- Specified by:
binaryin interfaceIgniteClient
-
query
public FieldsQueryCursor<List<?>> query(SqlFieldsQuery qry)
- Specified by:
queryin interfaceIgniteClient
-
transactions
public ClientTransactions transactions()
- Specified by:
transactionsin interfaceIgniteClient
-
compute
public ClientCompute compute()
- Specified by:
computein interfaceIgniteClient
-
compute
public ClientCompute compute(ClientClusterGroup grp)
- Specified by:
computein interfaceIgniteClient
-
cluster
public ClientCluster cluster()
- Specified by:
clusterin interfaceIgniteClient
-
services
public ClientServices services()
- Specified by:
servicesin interfaceIgniteClient
-
services
public ClientServices services(ClientClusterGroup grp)
- Specified by:
servicesin interfaceIgniteClient
-
atomicLong
public ClientAtomicLong atomicLong(String name, long initVal, boolean create)
- Specified by:
atomicLongin interfaceIgniteClient
-
atomicLong
public ClientAtomicLong atomicLong(String name, ClientAtomicConfiguration cfg, long initVal, boolean create)
- Specified by:
atomicLongin interfaceIgniteClient
-
set
public <T> ClientIgniteSet<T> set(String name, @Nullable @Nullable ClientCollectionConfiguration cfg)
- Specified by:
setin interfaceIgniteClient
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceIgniteClient
-
setClientConfiguration
public IgniteClientSpringBean setClientConfiguration(ClientConfiguration cfg)
Sets Ignite client configuration.- Parameters:
cfg- Ignite thin client configuration.- Returns:
thisfor chaining.
-
getClientConfiguration
public ClientConfiguration getClientConfiguration()
- Returns:
- Ignite client configuration.
-
setPhase
public IgniteClientSpringBean setPhase(int phase)
SetsSmartLifecyclephase during which the current bean will be initialized. Note, underlying Ignite client will be closed during handling ofDisposableBeansinceIgniteClientimplementsAutoCloseableinterface.- Parameters:
phase-SmartLifecyclephase.- Returns:
thisfor chaining.
-
-