Show / Hide Table of Contents

# Interface IService

Represents Ignite-managed service.

###### Namespace: Apache.Ignite.Core.Services

###### Assembly: Apache.Ignite.Core.dll

##### Syntax

    public interface IService

### Methods

#### Cancel(IServiceContext)

Cancels this instance.

Note that Ignite cannot guarantee that the service exits from Execute(IServiceContext) method whenever Cancel(IServiceContext) is called. It is up to the user to make sure that the service code properly reacts to cancellations.

##### Declaration

    void Cancel(IServiceContext context)

##### Parameters

Type | Name | Description
--- | --- | ---
IServiceContext | context | Service execution context.

#### Execute(IServiceContext)

Starts execution of this service. This method is automatically invoked whenever an instance of the service is deployed on a Ignite node. Note that service is considered deployed even after it exits the Execute method and can be cancelled (or undeployed) only by calling any of the Cancel methods on IServices API. Also note that service is not required to exit from Execute method until Cancel method was called.

##### Declaration

    void Execute(IServiceContext context)

##### Parameters

Type | Name | Description
--- | --- | ---
IServiceContext | context | Service execution context.

#### Init(IServiceContext)

Initializes this instance before execution.

##### Declaration

    void Init(IServiceContext context)

##### Parameters

Type | Name | Description
--- | --- | ---
IServiceContext | context | Service execution context.