StatelessServiceBase Class
- java.
lang. Object - microsoft.
servicefabric. services. runtime. StatelessServiceBase
- microsoft.
public class StatelessServiceBase
Represents base class for Microsoft Service Fabric based stateless reliable service.
Constructor Summary
Constructor | Description | |
---|---|---|
StatelessServiceBase() |
Method Summary
Modifier and Type | Method and Description |
---|---|
List<Service |
createServiceInstanceListeners()
Override this method to supply the communication listeners for the service instance. The endpoints returned by the communication listener's are stored as a JSON string of ListenerName, Endpoint string pairs like {"Endpoints":{"Listener1":"Endpoint1","Listener2":"Endpoint2" ...}} |
Map<String, String> |
getAddresses()
Gets list of all the addresses for this service instances as (ListenerName, Endpoint) key-value pair. |
Stateless |
getPartition()
Gets the service partition to which current service instance belongs. |
Stateless |
getServiceContext()
Gets the service context that this stateless service is operating under. It provides information like InstanceId, PartitionId, ServiceName etc. |
void |
onAbort()
Notification that the service is being aborted. RunAsync MAY be running concurrently with the execution of this method, as cancellation is not awaited on the abort path. |
CompletableFuture<?> |
onCloseAsync(CancellationToken cancellationToken)
This method is called as the final step of closing the service. Override this method to be notified that Close has completed for this instance's internal components. |
CompletableFuture<?> |
onOpenAsync(CancellationToken cancellationToken)
This method is called as the final step of opening the service. Override this method to be notified that Open has completed for this instance's internal components. |
CompletableFuture<?> |
runAsync(CancellationToken cancellationToken)
Services that want to implement a background task which runs when it is opened, just override this method with their logic. |
void |
setAddresses(Map<String, String> addresses)
Sets list of all the addresses for this service instance as (ListenerName, Endpoint) key-value pair. |
Constructor Details
StatelessServiceBase
protected StatelessServiceBase()
Method Details
createServiceInstanceListeners
protected List
Override this method to supply the communication listeners for the service instance. The endpoints returned by the communication listener's are stored as a JSON string of ListenerName, Endpoint string pairs like {"Endpoints":{"Listener1":"Endpoint1","Listener2":"Endpoint2" ...}}
Returns:
getAddresses
protected Map
Gets list of all the addresses for this service instances as (ListenerName, Endpoint) key-value pair.
Returns:
getPartition
protected StatelessServicePartition getPartition()
Gets the service partition to which current service instance belongs.
Returns:
getServiceContext
public StatelessServiceContext getServiceContext()
Gets the service context that this stateless service is operating under. It provides information like InstanceId, PartitionId, ServiceName etc.
Returns:
onAbort
protected void onAbort()
Notification that the service is being aborted. RunAsync MAY be running concurrently with the execution of this method, as cancellation is not awaited on the abort path.
onCloseAsync
protected CompletableFuture onCloseAsync(CancellationToken cancellationToken)
This method is called as the final step of closing the service. Override this method to be notified that Close has completed for this instance's internal components.
Parameters:
CancellationToken object to indicate the cancellation status of the operation.
Returns:
onOpenAsync
protected CompletableFuture onOpenAsync(CancellationToken cancellationToken)
This method is called as the final step of opening the service. Override this method to be notified that Open has completed for this instance's internal components.
Parameters:
CancellationToken object to indicate the cancellation status of the operation.
Returns:
runAsync
protected CompletableFuture runAsync(CancellationToken cancellationToken)
Services that want to implement a background task which runs when it is opened, just override this method with their logic.
Parameters:
CancellationToken object to indicate the cancellation status of the operation.
Returns:
setAddresses
protected void setAddresses(Map
Sets list of all the addresses for this service instance as (ListenerName, Endpoint) key-value pair.
Parameters:
Applies to
Azure SDK for Java