Aracılığıyla paylaş


ServicePartition Interface

public interface ServicePartition

Provides information to the service about the partition to which it belongs and provides methods for the service to interact with the system during runtime.

Method Summary

Modifier and Type Method and Description
ServicePartitionInformation getPartitionInfo()

Provides access to the ServicePartitionInformation of the service, which contains the partition type and ID.

void reportFault(FaultType faultType)

Reports the load for a set of load balancing metrics. The load can be reported at any time via the java.util.Collection of LoadMetric method and provides one or more properties of the LoadMetric method.

Remarks:A fault is typically reported when the service code encounters some issue from which it cannot recover.

void reportLoad(Collection<LoadMetric> metrics)

Reports the load for a set of load balancing metrics. The load can be reported at any time via the java.util.Collection of LoadMetric method and provides one or more properties of the LoadMetric method.

Remarks:The reported metrics should correspond to those that are provided in the service load metric description as a part of the service description that is used to create the service. Load metrics that are not present in the description are ignored. Reporting custom metrics allows Service Fabric to balance services that are based on additional custom information.

void reportMoveCost(MoveCost moveCost)

Reports the move cost for a replica.

Remarks:Services can report move cost of a replica using this method. While the Service Fabric Resource Balances searches for the best balance in the cluster, it examines both load information and move cost of each replica. Resource balances will prefer to move replicas with lower cost in order to achieve balance.

void reportPartitionHealth(HealthInformation healthInfo)

Reports current partition health.

Method Details

getPartitionInfo

public ServicePartitionInformation getPartitionInfo()

Provides access to the ServicePartitionInformation of the service, which contains the partition type and ID.

Returns:

Throws:

FabricObjectClosedException - This indicates that the partition object is closed. The replica/replicator/instance has either been closed or is about to be closed.

reportFault

public void reportFault(FaultType faultType)

Reports the load for a set of load balancing metrics. The load can be reported at any time via the java.util.Collection of LoadMetric method and provides one or more properties of the LoadMetric method.

Remarks:A fault is typically reported when the service code encounters some issue from which it cannot recover.

Parameters:

faultType - The LoadMetric that the service has encountered.

Throws:

FabricObjectClosedException - This indicates that the partition object is closed. The replica/replicator/instance has either been closed or is about to be closed.

reportLoad

public void reportLoad(Collection metrics)

Reports the load for a set of load balancing metrics. The load can be reported at any time via the java.util.Collection of LoadMetric method and provides one or more properties of the LoadMetric method.

Remarks:The reported metrics should correspond to those that are provided in the service load metric description as a part of the service description that is used to create the service. Load metrics that are not present in the description are ignored. Reporting custom metrics allows Service Fabric to balance services that are based on additional custom information.

Parameters:

metrics - collection of LoadMetric to report the load for.

Throws:

FabricObjectClosedException - This indicates that the partition object is closed. The replica/replicator/instance has either been closed or is about to be closed.

reportMoveCost

public void reportMoveCost(MoveCost moveCost)

Reports the move cost for a replica.

Remarks:Services can report move cost of a replica using this method. While the Service Fabric Resource Balances searches for the best balance in the cluster, it examines both load information and move cost of each replica. Resource balances will prefer to move replicas with lower cost in order to achieve balance.

Parameters:

moveCost - The reported MoveCost.

Throws:

FabricObjectClosedException - This indicates that the partition object is closed. The replica/replicator/instance has either been closed or is about to be closed.

reportPartitionHealth

public void reportPartitionHealth(HealthInformation healthInfo)

Reports current partition health.

Parameters:

healthInfo - is HealthInformation

Throws:

FabricObjectClosedException - This indicates that the partition object is closed. The replica/replicator/instance has either been closed or is about to be closed.

Applies to