public class JiniServiceFactoryBean extends AbstractFactoryBean implements org.aopalliance.intercept.MethodInterceptor
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).
| Constructor and Description |
|---|
JiniServiceFactoryBean() |
| Modifier and Type | Method and Description |
|---|---|
protected Object |
createInstance()
Creates an instance of the service.
|
String[] |
getGroups()
Returns the groups.
|
String[] |
getLocators()
Returns the locators.
|
Class<?> |
getObjectType() |
Class<?> |
getServiceClass() |
String |
getServiceName() |
net.jini.core.lookup.ServiceTemplate |
getTemplate() |
long |
getTimeout()
The timeout to wait looking up the service
|
Object |
invoke(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 Object |
lookupService()
A helper method to lookup the service.
|
void |
setGroups(String[] groups)
The groups to set
|
void |
setLocators(String[] locators)
Sets the locators.
|
void |
setRetryCountOnFailure(int retryCountOnFailure)
Sets the number of successive method invocation lookup retry count in case of a
failure.
|
void |
setServiceClass(Class<?> serviceClass) |
void |
setServiceName(String serviceName) |
void |
setSmartProxy(boolean smartProxy)
Sets if this proxy will be a smart proxy.
|
void |
setTemplate(net.jini.core.lookup.ServiceTemplate template) |
void |
setTimeout(long timeout)
The timeout to wait looking up the service
|
afterPropertiesSet, destroy, destroyInstance, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingletonpublic Class<?> getObjectType()
getObjectType in interface FactoryBeangetObjectType in class AbstractFactoryBeanprotected Object createInstance() throws Exception
lookupService()
and if smart proxy is used, will wrap the returned service with a proxy that performs
lookups in case of failures.createInstance in class AbstractFactoryBeanExceptionpublic Object invoke(org.aopalliance.intercept.MethodInvocation methodInvocation) throws Throwable
invoke in interface org.aopalliance.intercept.MethodInterceptorThrowableprotected Object lookupService() throws Exception
Exceptionpublic void setSmartProxy(boolean smartProxy)
true
the service found will be wrapped with a smart proxy that will detect failures and try
to lookup the service again in such cases. Defaults to false.public void setRetryCountOnFailure(int retryCountOnFailure)
public String[] getGroups()
public void setGroups(String[] groups)
public String[] getLocators()
public void setLocators(String[] locators)
public Class<?> getServiceClass()
public void setServiceClass(Class<?> serviceClass)
serviceClass - The serviceClass to set.public String getServiceName()
public void setServiceName(String serviceName)
serviceName - The serviceName to set.public net.jini.core.lookup.ServiceTemplate getTemplate()
public void setTemplate(net.jini.core.lookup.ServiceTemplate template)
template - The template to set.public long getTimeout()
public void setTimeout(long timeout)
Copyright © GigaSpaces.