Partager via


StatelessServiceInstance Interface

public interface StatelessServiceInstance

Stateless services are those which have no state that requires management by Service Fabric. Stateless service types must implement this interface.

Method Summary

Modifier and Type Method and Description
void abort()

Terminates this instance ungracefully with this synchronous method call.

Remarks:Examples of ungraceful termination are lease loss and, in response to the service, the use of reportFault(FaultType faultType) to report a Permanent fault. When the service instance receives this method, it should immediately release and clean up all references and return.

CompletableFuture<?> closeAsync(CancellationToken cancellationToken)

Closes this service instance gracefully when the service instance is being shut down.

void initialize(StatelessServiceInitializationParameters initializationParameters)

Initializes a newly created service instance.

CompletableFuture<String> openAsync(StatelessServicePartition partition, CancellationToken cancellationToken)

Opens an initialized service instance so that it can be contacted by clients.

Remarks:Opening an instance stateless service indicates that the service is now resolvable and discoverable by service clients. The string that is returned is the address of this service instance. The address is associated with the service name via Service Fabric naming and returned to clients that resolve the service.

Method Details

abort

public void abort()

Terminates this instance ungracefully with this synchronous method call.

Remarks:Examples of ungraceful termination are lease loss and, in response to the service, the use of reportFault(FaultType faultType) to report a Permanent fault. When the service instance receives this method, it should immediately release and clean up all references and return.

closeAsync

public CompletableFuture closeAsync(CancellationToken cancellationToken)

Closes this service instance gracefully when the service instance is being shut down.

Parameters:

cancellationToken -

CancellationToken object to indicate the cancellation status of the operation.

Returns:

Returns CompletableFuture.

initialize

public void initialize(StatelessServiceInitializationParameters initializationParameters)

Initializes a newly created service instance.

Parameters:

initializationParameters - The StatelessServiceInitializationParameters for this service.

openAsync

public CompletableFuture openAsync(StatelessServicePartition partition, CancellationToken cancellationToken)

Opens an initialized service instance so that it can be contacted by clients.

Remarks:Opening an instance stateless service indicates that the service is now resolvable and discoverable by service clients. The string that is returned is the address of this service instance. The address is associated with the service name via Service Fabric naming and returned to clients that resolve the service.

Parameters:

partition - The StatelessServicePartition that this instance is associated with
cancellationToken -

CancellationToken object to indicate the cancellation status of the operation.

Returns:

Returns CompletableFuture of type java.lang.String.

Applies to