@Documented @Retention(value=RUNTIME) @Target(value={METHOD,FIELD}) public @interface ServiceResource
Here is how injection would typically happen:
public class MyGridJob implements ComputeJob { ... // Inject single instance of 'myService'. If there is // more than one, first deployed instance will be picked. @IgniteServiceResource(serviceName = "myService", proxyInterface = MyService.class) private MyService svc; ... }or attach the same annotations to methods:
public class MyGridJob implements ComputeJob { ... private MyService svc; ... // Inject all locally deployed instances of 'myService'. @IgniteServiceResource(serviceName = "myService") public void setMyService(MyService svc) { this.svc = svc; } ... }
Modifier and Type | Required Element and Description |
---|---|
String |
serviceName
Service name.
|
Modifier and Type | Optional Element and Description |
---|---|
boolean |
forwardCallerContext
Flag indicating that the service call context should be passed to the injected service.
|
Class<?> |
proxyInterface
In case if an instance of the service is not available locally,
an instance of the service proxy for a remote service instance
may be returned.
|
boolean |
proxySticky
Flag indicating if a sticky instance of a service proxy should be returned.
|
public abstract String serviceName
public abstract Class<?> proxyInterface
null
.
For more information about service proxies, see
IgniteServices.serviceProxy(String, Class, boolean)
documentation.
public abstract boolean proxySticky
proxyInterface()
is not null
.
For information about sticky flag, see IgniteServices.serviceProxy(String, Class, boolean)
documentation.
True
if a sticky instance of a service proxy should be injected.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.16.0 Release Date : December 15 2023