Package org.openspaces.core.jini
Class JiniServiceFactoryBean
java.lang.Object
org.springframework.beans.factory.config.AbstractFactoryBean
org.openspaces.core.jini.JiniServiceFactoryBean
- All Implemented Interfaces:
org.aopalliance.aop.Advice,org.aopalliance.intercept.Interceptor,org.aopalliance.intercept.MethodInterceptor,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanClassLoaderAware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.FactoryBean,org.springframework.beans.factory.InitializingBean
public class JiniServiceFactoryBean
extends org.springframework.beans.factory.config.AbstractFactoryBean
implements org.aopalliance.intercept.MethodInterceptor
JiniServiceFactoryBean for Jini environments. The class is made up from various samples found on
jini.org customized in a Spring specific way. The search will be executed using the provided
ServiceTemplate or, if it is null, one will be created using the serviceClass and serviceName. If
the lookup operation times out (30 seconds by default), a null service will be returned. For most
cases the serviceClass and serviceNames are enough and hide the jini details from the client.
The factoryBean can be configured to do a lookup each time before returning the object type by setting the "singleton" property to false.
The service factory can be configured to return a smart proxy that will try and perform
another lookup in case of an invocation exception (see setSmartProxy(boolean). The retry
count can be controlled using setRetryCountOnFailure(int).
- Author:
- kimchy
-
Field Summary
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectCreates an instance of the service.String[]Returns the groups.String[]Returns the locators.Class<?>Class<?>longThe timeout to wait looking up the serviceinvoke(org.aopalliance.intercept.MethodInvocation methodInvocation) When using smart proxy, wraps the invocation of a service method and in case of failure will try and perform another lookup for the service.protected ObjectA helper method to lookup the service.voidThe groups to setvoidsetLocators(String[] locators) Sets the locators.voidsetRetryCountOnFailure(int retryCountOnFailure) Sets the number of successive method invocation lookup retry count in case of a failure.voidsetServiceClass(Class<?> serviceClass) voidsetServiceName(String serviceName) voidsetSmartProxy(boolean smartProxy) Sets if this proxy will be a smart proxy.voidsetTemplate(ServiceTemplate template) voidsetTimeout(long timeout) The timeout to wait looking up the serviceMethods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
afterPropertiesSet, destroy, destroyInstance, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton
-
Constructor Details
-
JiniServiceFactoryBean
public JiniServiceFactoryBean()
-
-
Method Details
-
getObjectType
- Specified by:
getObjectTypein interfaceorg.springframework.beans.factory.FactoryBean- Specified by:
getObjectTypein classorg.springframework.beans.factory.config.AbstractFactoryBean
-
createInstance
Creates an instance of the service. Performs a lookup (usinglookupService()and if smart proxy is used, will wrap the returned service with a proxy that performs lookups in case of failures.- Specified by:
createInstancein classorg.springframework.beans.factory.config.AbstractFactoryBean- Throws:
Exception
-
invoke
When using smart proxy, wraps the invocation of a service method and in case of failure will try and perform another lookup for the service.- Specified by:
invokein interfaceorg.aopalliance.intercept.MethodInterceptor- Throws:
Throwable
-
lookupService
A helper method to lookup the service.- Throws:
Exception
-
setSmartProxy
public void setSmartProxy(boolean smartProxy) Sets if this proxy will be a smart proxy. When this value is set totruethe service found will be wrapped with a smart proxy that will detect failures and try to lookup the service again in such cases. Defaults tofalse. -
setRetryCountOnFailure
public void setRetryCountOnFailure(int retryCountOnFailure) Sets the number of successive method invocation lookup retry count in case of a failure. Defaults to 3. -
getGroups
Returns the groups. -
setGroups
The groups to set -
getLocators
Returns the locators. -
setLocators
Sets the locators. -
getServiceClass
- Returns:
- Returns the serviceClass.
-
setServiceClass
- Parameters:
serviceClass- The serviceClass to set.
-
getServiceName
- Returns:
- Returns the serviceName.
-
setServiceName
- Parameters:
serviceName- The serviceName to set.
-
getTemplate
- Returns:
- Returns the template.
-
setTemplate
- Parameters:
template- The template to set.
-
getTimeout
public long getTimeout()The timeout to wait looking up the service -
setTimeout
public void setTimeout(long timeout) The timeout to wait looking up the service
-