public async Task <IReplicator> OpenAsync( ReplicaOpenMode openMode, IStatefulServicePartition servicePartition, CancellationToken cancellationToken) { var self = this.serviceParameters; this.logger = new Logger(self) { Prefix = () => $"[{this.unsafeRole}] " }; this.logger.Log("OpenAsync"); IReplicator result; StateProvider provider; lock (this.replicaLock) { this.partition = servicePartition; provider = this.stateProvider = new StateProvider(this.logFilePath, this.logger, this.serializer); var replicatorSettings = ReplicatorSettings.LoadFrom( self.CodePackageActivationContext, ConfigPackageName, ReplicatorConfigSectionName); replicatorSettings.BatchAcknowledgementInterval = TimeSpan.FromMilliseconds(1); result = this.fabricReplicator = servicePartition.CreateReplicator(this.stateProvider, replicatorSettings); } await provider.Initialize(); this.logger.Log("Completed OpenAsync"); return(result); }
public Task <IReplicator> OpenAsync(ReplicaOpenMode openMode, IStatefulServicePartition partition, CancellationToken cancellationToken) { return(Task.Factory.StartNew <IReplicator>(() => { ServiceImplementationHelper.HandleOpen(this.initParams.InitializationData, this.replicaId); return partition.CreateReplicator(this, null); })); }
public Threading.Tasks.Task <IReplicator> OpenAsync(ReplicaOpenMode openMode, IStatefulServicePartition partition, CancellationToken cancellationToken) { return(Task.Factory.StartNew <IReplicator>(() => { Debug.WriteLine("OnOpen"); this.WriteEventToGlobalFile(SanityTest.OpenAsyncMarker); return partition.CreateReplicator(this, null); })); }
public Task <IReplicator> OpenAsync(ReplicaOpenMode openMode, IStatefulServicePartition partition, CancellationToken cancellationToken) { LogMessage(nameof(OpenAsync)); log = new InMemoryLog(LogMessage); replicator = partition.CreateReplicator(this, new ReplicatorSettings()); return(Task.FromResult((IReplicator)replicator)); }
Task <IReplicator> IStateProviderReplica.OpenAsync( ReplicaOpenMode openMode, IStatefulServicePartition partition, CancellationToken cancellationToken) { var fabricReplicator = partition.CreateReplicator(this, this.GetReplicatorSettings()); this.replicator = fabricReplicator.StateReplicator2; this.servicePartition = partition; return(Task.FromResult <IReplicator>(fabricReplicator)); }
public Task <IReplicator> OpenAsync(ReplicaOpenMode openMode, IStatefulServicePartition partition, CancellationToken cancellationToken) { this.TraceInfo("IStatefulServiceReplica::OpenAsync invoked. Open mode: {0}.", openMode); this.partition = partition; ReplicatorSettings replicatorSettings = this.CreateReplicatorSettings(); this.replicator = partition.CreateReplicator(this, replicatorSettings); this.TraceInfo("IStatefulServiceReplica::OpenAsync completed."); return(Task.FromResult(this.replicator as IReplicator)); }
/// <inheritdoc /> public Task <IReplicator> OpenAsync(ReplicaOpenMode openMode, IStatefulServicePartition partition, CancellationToken cancellationToken) { // TODO: open a service host this.listenerUri = new Uri("tcp://127.0.0.1:1234"); var replicatorSettings = this.GetReplicatorSettings(); ServiceEventSource.Current.ServiceMessage(this.serviceContext.ServiceContext, "ReplicatorSettings: {0}", replicatorSettings.ToString()); this.replicator = partition.CreateReplicator(this, replicatorSettings); this.serviceContext.Replicator = this.replicator; return(Task.FromResult <IReplicator>(this.replicator)); }
//// // IStatefulServiceReplica //// public Task <IReplicator> OpenAsync(ReplicaOpenMode openMode, IStatefulServicePartition partition, CancellationToken cancellationToken) { if (partition == null) { throw new ArgumentNullException("partition"); } Trace.WriteInfo(TraceType, "OpenAsync: {0}, OpenMode={1}", this.serviceId, openMode); ReplicatorSettings replicatorSettings = this.CreateReplicatorSettings(this.replicatorAddress); this.replicator = partition.CreateReplicator(this, replicatorSettings); this.partition = partition; this.serviceEndpoint = this.infrastructureServiceAgent.RegisterInfrastructureService( this.initializationParameters.PartitionId, this.initializationParameters.ReplicaId, this.coordinator); return(Utility.CreateCompletedTask <IReplicator>(this.replicator)); }