org.apache.ignite.resources

## Annotation Type IgniteInstanceResource

    @Documented
    @Retention(value=RUNTIME)
    @Target(value={METHOD,FIELD})
    public @interface IgniteInstanceResource

Annotates a field or a setter method for injection of current `Ignite` instance. It can be injected into grid tasks and grid jobs. Note that grid instance will not be injected into SPI's, as there is no grid during SPI start.

Grid instance can be injected into instances of following classes:

- `ComputeTask`
- `ComputeJob`
- `LifecycleBean`
- All closures and predicates that can run on grid.

Here is how injection would typically happen:

     public class MyIgniteJob implements ComputeJob {
          ...
          @IgniteInstanceResource
          private Ignite ignite;
          ...
      }

or

     public class MyIgniteJob implements ComputeJob {
         ...
         private Ignite ignite;
         ...
         @IgniteInstanceResource
         public void setIgnite(Ignite ignite) {
              this.ignite = ignite;
         }
         ...
     }

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.1.0
Release Date | : July 20 2017