你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

ServiceContext Class

  • java.lang.Object
    • system.fabric.ServiceContext

public class ServiceContext

Represents the service context that the service is operating under.

Constructor Summary

Constructor Description
ServiceContext(NodeContext nodeContext, CodePackageActivationContext codePackageActivationContext, String serviceTypeName, URI serviceName, byte[] initializationData, UUID partitionId, long replicaOrInstanceId)

Initializes a new instance of the system.fabric.ServiceContext class.

Method Summary

Modifier and Type Method and Description
CodePackageActivationContext getCodePackageActivationContext()

Gets the code package activation context.

byte [] getInitializationData()

Gets the initialization data of the service.

NodeContext getNodeContext()

Gets the node context for the node where the service replica is instantiated.

UUID getPartitionId()

Gets the partition id.

long getReplicaOrInstanceId()

Gets the stateful service replica id or the stateless service instance id.

URI getServiceName()

Get the service name.

String getServiceTypeName()

Gets the service type name.

String getTraceId()

Gets the trace id of the service.

Remarks:The trace id can be used as an identifier for generated traces.

Constructor Details

ServiceContext

protected ServiceContext(NodeContext nodeContext, CodePackageActivationContext codePackageActivationContext, String serviceTypeName, URI serviceName, byte[] initializationData, UUID partitionId, long replicaOrInstanceId)

Initializes a new instance of the system.fabric.ServiceContext class.

Parameters:

nodeContext - The node context.
codePackageActivationContext - The code package activation context.
serviceTypeName - The service type name.
serviceName - The service name.
initializationData - The initialization data.
partitionId - The partition id.
replicaOrInstanceId - The replica or instance id.

Method Details

getCodePackageActivationContext

public CodePackageActivationContext getCodePackageActivationContext()

Gets the code package activation context.

Returns:

The code package activation context.

getInitializationData

public byte [] getInitializationData()

Gets the initialization data of the service.

Returns:

The initialization data.

getNodeContext

public NodeContext getNodeContext()

Gets the node context for the node where the service replica is instantiated.

Returns:

The node context.

getPartitionId

public UUID getPartitionId()

Gets the partition id.

Returns:

The partition id.

getReplicaOrInstanceId

public long getReplicaOrInstanceId()

Gets the stateful service replica id or the stateless service instance id.

Returns:

The stateful service replica id or the stateless service instance id.

getServiceName

public URI getServiceName()

Get the service name.

Returns:

The service name.

getServiceTypeName

public String getServiceTypeName()

Gets the service type name.

Returns:

The service type name.

getTraceId

public String getTraceId()

Gets the trace id of the service.

Remarks:The trace id can be used as an identifier for generated traces.

Returns:

The trace id of the service.

Applies to