|
GigaSpaces XAP 9.7.2 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.remoting.support.RemotingSupport org.springframework.remoting.support.RemoteAccessor org.openspaces.remoting.EventDrivenSpaceRemotingProxyFactoryBean
public class EventDrivenSpaceRemotingProxyFactoryBean
A space event driven remoting proxy that forward the service execution to a remote service with the space as
the transport layer. Services are remotely exported in the "server side" using the
SpaceRemotingServiceExporter
which in turn is registered with an event container. This proxy builds
a representation of the remote invocation using SpaceRemotingEntry
and waits
for a remoting response represented by SpaceRemotingEntry
.
The proxy requires a setGigaSpace(org.openspaces.core.GigaSpace)
interface to be set in
order to write the remote invocation and wait for a response using the space API. It also
requires a RemoteAccessor.setServiceInterface(Class)
which represents the interface that will be
proxied.
Allows for one way invocations (i.e. not waiting for a response). The one way invocation can be
set globally for all of the service methods by setting setGlobalOneWay(boolean)
or can
be enabled only for methods that return void
by setting
setVoidOneWay(boolean)
. Note, if using one way invocation and an exception is raised by
the remote service, it won't be raised by this proxy.
A timeout which controls how long the proxy will wait for the response can be set using
setTimeout(long)
. The timeout value if in milliseconds.
The space remote proxy supports a future based invocation. This means that if, on the client side,
one of the service interface methods returns Future
, it
can be used for async execution. Note, this means that in terms of interfaces there will have to
be two different service interfaces (under the same package and with the same name). One for the
server side service that returns the actual value, and one on the client side that for the same
method simply returns the future. Another option is not having two different interfaces, but having
the same interface with async methods (returning Future
). The async methods should start
with a specified prefix (defaults to async
) and should have no implementation on the server
side (simply return null
).
In case of remote invocation over a partitioned space the default partitioned routing index will
be random (the hashCode of the newly created SpaceRemotingEntry
class).
The proxy allows for a pluggable routing handler implementation by setting
setRemoteRoutingHandler(RemoteRoutingHandler)
.
The actual remote invocation can be replaced with an aspect implementing RemoteInvocationAspect
which can be set using setRemoteInvocationAspect(RemoteInvocationAspect)
. It is up the aspect to then
call the actual remote invocation.
Note that it is also possible to configure method level fifo behavior, one way behavior, RemoteResultReducer
,
RemoteRoutingHandler
, RemoteInvocationAspect
and MetaArgumentsHandler
using the
EventDrivenRemotingMethod
annotation.
SpaceRemotingServiceExporter
Field Summary | |
---|---|
static String |
DEFAULT_ASYNC_METHOD_PREFIX
|
Fields inherited from class org.springframework.remoting.support.RemotingSupport |
---|
logger |
Constructor Summary | |
---|---|
EventDrivenSpaceRemotingProxyFactoryBean()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
|
Object |
getObject()
|
Class<?> |
getObjectType()
|
Object |
invoke(MethodInvocation methodInvocation)
|
Object |
invokeRemote(MethodInvocation methodInvocation)
This invocation will cause the actual remote invocation. |
boolean |
isSingleton()
|
void |
setApplicationContext(ApplicationContext applicationContext)
|
void |
setAsyncMethodPrefix(String asyncMethodPrefix)
Sets the async method prefix. |
void |
setFifo(boolean fifo)
Sets the remote invocation objects written to the Space to work in FIFO. |
void |
setGigaSpace(GigaSpace gigaSpace)
Sets the GigaSpace interface that will be used to work with the space as the transport layer for both writing and taking SpaceRemotingEntry . |
void |
setGlobalOneWay(boolean globalOneWay)
If set to true (defaults to false ) all of the service methods
will be invoked and the proxy will not wait for a return value. |
void |
setMetaArgumentsHandler(MetaArgumentsHandler metaArgumentsHandler)
Allows to set a meta argument handler that will control SpaceRemotingInvocation.getMetaArguments() . |
void |
setRemoteInvocationAspect(RemoteInvocationAspect remoteInvocationAspect)
The actual remote invocation can be replaced with an aspect implementing RemoteInvocationAspect
which can be set using setRemoteInvocationAspect(RemoteInvocationAspect) . |
void |
setRemoteRoutingHandler(RemoteRoutingHandler remoteRoutingHandler)
In case of remote invocation over a partitioned space the default partitioned routing index will be random (the hashCode of the newly created SpaceRemotingEntry class). |
void |
setTimeout(long timeout)
Sets the timeout that will be used to wait for the remote invocation response. |
void |
setVoidOneWay(boolean voidOneWay)
If set to true (defaults to false ) service methods that return
void will be invoked and the proxy will not wait for a return value. |
Methods inherited from class org.springframework.remoting.support.RemoteAccessor |
---|
getServiceInterface, setServiceInterface |
Methods inherited from class org.springframework.remoting.support.RemotingSupport |
---|
getBeanClassLoader, overrideThreadContextClassLoader, resetThreadContextClassLoader, setBeanClassLoader |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_ASYNC_METHOD_PREFIX
Constructor Detail |
---|
public EventDrivenSpaceRemotingProxyFactoryBean()
Method Detail |
---|
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext
in interface ApplicationContextAware
BeansException
public void setGigaSpace(GigaSpace gigaSpace)
SpaceRemotingEntry
.
public void setTimeout(long timeout)
60000
(60 seconds).
public void setRemoteRoutingHandler(RemoteRoutingHandler remoteRoutingHandler)
SpaceRemotingEntry
class). This
RemoteRoutingHandler
allows for custom routing computation
(for example, based on one of the service method parameters).
public void setMetaArgumentsHandler(MetaArgumentsHandler metaArgumentsHandler)
SpaceRemotingInvocation.getMetaArguments()
.
public void setGlobalOneWay(boolean globalOneWay)
true
(defaults to false
) all of the service methods
will be invoked and the proxy will not wait for a return value. Note, any exception raised by
the remote service will be logged on the server side and not propagated to the client.
public void setVoidOneWay(boolean voidOneWay)
true
(defaults to false
) service methods that return
void will be invoked and the proxy will not wait for a return value. Note, any exception
raised by the remote service will be logged on the server side and not propagated to the
client.
public void setFifo(boolean fifo)
SpaceRemotingServiceExporter
. This allows for remoting
to work in fifo mode without needing to set the whole Space to work in fifo mode.
public void setAsyncMethodPrefix(String asyncMethodPrefix)
DEFAULT_ASYNC_METHOD_PREFIX
.
public void setRemoteInvocationAspect(RemoteInvocationAspect remoteInvocationAspect)
RemoteInvocationAspect
which can be set using setRemoteInvocationAspect(RemoteInvocationAspect)
. It is up the aspect to then
call the actual remote invocation.
public void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
public Object getObject()
getObject
in interface FactoryBean
public Class<?> getObjectType()
getObjectType
in interface FactoryBean
public boolean isSingleton()
isSingleton
in interface FactoryBean
public Object invoke(MethodInvocation methodInvocation) throws Throwable
invoke
in interface MethodInterceptor
Throwable
public Object invokeRemote(MethodInvocation methodInvocation) throws Throwable
RemotingInvoker
invokeRemote
in interface RemotingInvoker
Throwable
|
GigaSpaces XAP 9.7.2 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |