@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 |
|---|---|
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 Fabric : ver. 1.5.11 Release Date : April 8 2016