Message-ID: <924040828.2195.1394455286410.JavaMail.email@example.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_2194_39792435.1394455286409" ------=_Part_2194_39792435.1394455286409 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
A "distributed service" is a service running on multiple peers= within a given Service Space. They have a name which uniquely identifies t= hem, once again within a given Service Space, and can be remotely invoked v= ia a RPCish API.=20
Any class implementing a set of interfaces is a valid distributed servic=
e implementation. Implemented interfaces capture the contracts, i.e. method=
s, which can be remotely executed.
Optionally, a service may implemen= t the org.codehaus.wadi.core.Lifecycle interface. If implemented, it receiv= es lifecycle callbacks when it is started or stopped. A service is started = or stopped by the service registry it has been registered with when the ass= ociated service space starts or stops.
The following snippets show a = basic service space implementation:
and its registration:=20 =20
A service defined by a given service space can be remotely executed via =
a RPC like API. This API offers multiple configuration parameters developer=
s can use to specify how invocations are to be performed.
The first s= tep is to retrieve a ServiceProxyFactory from the service space defining th= e service to be invoked:
The first parameter of getServiceProxyFactory is the name of the targete= d service and the second is an array of interfaces the service implements.<= br /> The returned ServiceProxyFactory allows the configuration of global i= nvocation parameters , which are inherited by all the service proxies creat= ed by this factory. For instance, here is how to set a global request-reply= timeout to 2000ms:=20 =20
The actual creation of a service proxy is done through the getProxy() co= ntract. The returned object is a ServiceProxy instance, which also implemen= ts the interfaces passed in to getServiceProxyFactory. Invocation parameter= s can be configured for this instance by retrieving the attached Invocation= MetaData and the remote invocation is simply done by casting the instance t= o one of the service interfaces and executing it. For instance, this is how= our BasicTaskExecutor service is executed on peer1:=20 =20
The way remote invocations are executed is controlled by the InvocationM=
etaData instance attached to ServiceProxyFactory, for inherited global set-=
up, and ServiceProxy, for instance specific set-up.
The following inv= ocation parameters are available: