FabricRuntime 类

定义

Allows user created hosts to obtain their CodePackageActivationContext, well as to register the necessary service factories [ StatelessServiceFactory, StatefulServiceFactory ] or service types directly.

public class FabricRuntime
继承
java.lang.Object
AutoCloseable
FabricRuntime

方法

close()

Closes the associated FabricCodePackageActivationContext instance and release the associated runtime pointer.

create()

Creates the system.fabric.FabricRuntime object.

createAsync(Duration timeout)

Creates the system.fabric.FabricRuntime object asynchronously with the specified timeout parameter.

createAsync(Runnable fabricExitCallback, Duration timeout)

Creates the system.fabric.FabricRuntime object asynchronously with the specified callback function which will be executed if the underlying runtime terminates or exits for any reason.

getActivationContext()

Retrieves the current system.fabric.FabricRuntime's CodePackageActivationContext.

getActivationContextAsync(Duration timeout)

Retrieves the current system.fabric.FabricRuntime’s CodePackageActivationContext asynchronously with the specified parameter.

getNodeContext()

Gets the Node Context object that contains information about Fabric Node.

getNodeContextAsync(Duration timeout)

Gets Node Context from Fabric Node asynchronously with timeout and cancellation token.

registerServiceType(String serviceTypeName, Class<?> serviceTypeImplementation)

Associates the specified serviceTypeName with the actual managed Type that implements it.

Remarks:Note that this mechanism for service type registration does not require a custom StatelessServiceFactory or StatefulServiceFactory to be provided at registration time. Service Fabric will generate one at runtime and utilize it automatically. If there is a need for a custom implementation of the factory, you can implement StatelessServiceFactory or StatefulServiceFactory and then provide those via the corresponding factory registration methods ( system.fabric.FabricRuntime#registerStatelessServiceFactoryAsync(java.lang.String, system.fabric.StatelessServiceFactory, java.time.Duration) or system.fabric.FabricRuntime#registerStatefulServiceFactoryAsync(java.lang.String, system.fabric.StatefulServiceFactory, java.time.Duration) )

registerServiceTypeAsync(String serviceTypeName, Class<?> serviceTypeImplementation, Duration timeout)

Asynchronously associates the specified serviceTypeName with the actual managed Type that implements it, with the specified timeout

registerStatefulServiceFactory(String serviceTypeName, StatefulServiceFactory factory)

Registers the specified StatefulServiceFactory for the specified service type.

registerStatefulServiceFactoryAsync(String serviceTypeName, StatefulServiceFactory factory, Duration timeout)

Registers the specified StatefulServiceFactory for the specified service type with the specified timeout and cancellationToken.

registerStatelessServiceFactory(String serviceTypeName, StatelessServiceFactory factory)

Registers the specified StatelessServiceFactory for the specified service type.

registerStatelessServiceFactoryAsync(String serviceTypeName, StatelessServiceFactory factory, Duration timeout)

Asynchronously registers the specified StatelessServiceFactory for the specified service type, with the specified timeout and cancellationToken

适用于