invoke
method in the same Thread as the caller. This can be specified at the framework level, service level, or for each invocationinvoke
method in a background Thred, but copy the content of the service before making the callservicesExecutorPool
framework property allows to specify the number of Threads which will be used in the background Threads pool if the framework perform the services invocation in a background Thread. By default there is only one Thread in the pool.serviceInvocationMode
property:executorService
value, the framework will perform the invocation in a background Threadblocking
value, the framework will perform the invocation in the same Thread as the caller<files> <file url="applications.xml" /> <file url="services.xml" /> <file url="types.xml" /> <property key="serviceInvocationMode" value="blocking" /> </files>
invocationMode
attribute in the service definition:executorService
value, the framework will perform the invocation in a background Threadblocking
value, the framework will perform the invocation in the same Thread as the caller<publish name="position" invocationMode="blocking" > <data name="latitude" type="float" /> <data name="longitude" type="float" /> <data name="altitude" type="float" /> </publish>
eventService = module.getService("event"); eventService.setDataBooleanValue("event", true); eventService.invokeAndBlock();It is also possible to perform the invocation in another Thread but copying the content of the service priori to the call by calling the ServiceInstance.invokeAndCopy() method.
eventService = module.getService("event"); eventService.setDataBooleanValue("event", true); eventService.invokeAndCopy();
eventService = module.getService("event"); eventService.setDataBooleanValue("event", true); eventService.invoke();The method will return true if the invocation has been successful, and false in the following cases:
<files> <file url="applications.xml" /> <file url="services.xml" /> <file url="types.xml" /> <property key="serviceInvocationDomain" value="global" /> </files>
serviceInvocationMode
is executorService
, which means that a Thread pool will be usedservicesExecutorPool
is 1, which means that only one Thread will be usedserviceInvocationDomain
is module
, which means that there will be one pool for each moduleserviceInvocationDomain
as global
serviceInvocationMode
as blocking
<files> <file url="applications.xml" /> <file url="services.xml" /> <file url="types.xml" /> <property key="serviceInvocationDomain" value="global" /> </files>Note that by default there is only one Thread in the pool, which ensures that the invocations are performed in the correct order.
<files> <file url="applications.xml" /> <file url="services.xml" /> <file url="types.xml" /> <property key="serviceInvocationMode" value="blocking" /> </files>
Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence