From ac2fd506ed251b254469d47d9cbf5a8cb42ce4f6 Mon Sep 17 00:00:00 2001 From: Zp Bappi Date: Sat, 27 Oct 2018 10:43:38 +1100 Subject: [PATCH 1/3] updated access modifiers to more useful ones --- src/Vlingo.Actors.Tests/ActorLifecycleTest.cs | 4 +- src/Vlingo.Actors.Tests/ActorStopTest.cs | 4 +- .../Supervision/FailureControlActor.cs | 10 +-- src/Vlingo.Actors/Actor.cs | 31 +++++---- src/Vlingo.Actors/ActorFactory.cs | 2 +- src/Vlingo.Actors/ActorProxy.cs | 2 +- src/Vlingo.Actors/AddressFactory.cs | 2 - src/Vlingo.Actors/CommonSupervisor.cs | 2 +- src/Vlingo.Actors/Configuration.cs | 11 ---- src/Vlingo.Actors/DeadLettersActor.cs | 2 +- src/Vlingo.Actors/Definition.cs | 2 +- src/Vlingo.Actors/Directory.cs | 4 +- src/Vlingo.Actors/DirectoryScannerActor.cs | 2 +- src/Vlingo.Actors/Environment.cs | 2 +- src/Vlingo.Actors/FailureMark.cs | 4 +- src/Vlingo.Actors/FailureOutcome.cs | 1 - src/Vlingo.Actors/ICompletes.cs | 2 +- src/Vlingo.Actors/ICompletesEventually.cs | 4 +- src/Vlingo.Actors/LifeCycle.cs | 4 +- src/Vlingo.Actors/LocalMessage.cs | 4 +- src/Vlingo.Actors/Logger__Proxy.cs | 66 +++++++++++++++++++ .../OutcomeInterestActorProxy.cs | 4 +- src/Vlingo.Actors/Plugin/AbstractPlugin.cs | 5 ++ src/Vlingo.Actors/PooledCompletes.cs | 6 +- src/Vlingo.Actors/PrivateRootActor.cs | 4 +- src/Vlingo.Actors/ProxyGenerator.cs | 4 +- src/Vlingo.Actors/PublicRootActor.cs | 2 +- src/Vlingo.Actors/Stage.cs | 2 +- src/Vlingo.Actors/StageSupervisedActor.cs | 16 ++--- src/Vlingo.Actors/Stowage.cs | 4 +- src/Vlingo.Actors/TestKit/TestEnvironment.cs | 2 +- src/Vlingo.Actors/World.cs | 1 - 32 files changed, 137 insertions(+), 78 deletions(-) create mode 100644 src/Vlingo.Actors/Logger__Proxy.cs diff --git a/src/Vlingo.Actors.Tests/ActorLifecycleTest.cs b/src/Vlingo.Actors.Tests/ActorLifecycleTest.cs index aba96326..c4fdae33 100644 --- a/src/Vlingo.Actors.Tests/ActorLifecycleTest.cs +++ b/src/Vlingo.Actors.Tests/ActorLifecycleTest.cs @@ -42,13 +42,13 @@ public LifecycleActor(TestResults testResults) this.testResults = testResults; } - internal override void BeforeStart() + internal protected override void BeforeStart() { testResults.receivedBeforeStart.Set(true); testResults.until.Happened(); } - internal override void AfterStop() + internal protected override void AfterStop() { testResults.receivedAfterStop.Set(true); testResults.until.Happened(); diff --git a/src/Vlingo.Actors.Tests/ActorStopTest.cs b/src/Vlingo.Actors.Tests/ActorStopTest.cs index 4f661fc2..6e851185 100644 --- a/src/Vlingo.Actors.Tests/ActorStopTest.cs +++ b/src/Vlingo.Actors.Tests/ActorStopTest.cs @@ -95,7 +95,7 @@ public void CreateChildren() ChildActorFor(Definition.Has(Definition.Parameters(testResults), $"{pre}.3")); } - internal override void BeforeStart() + internal protected override void BeforeStart() { base.BeforeStart(); if (testResults.untilStart != null) @@ -105,7 +105,7 @@ internal override void BeforeStart() } private static readonly object afterStopMutex = new object(); - internal override void AfterStop() + internal protected override void AfterStop() { lock (afterStopMutex) { diff --git a/src/Vlingo.Actors.Tests/Supervision/FailureControlActor.cs b/src/Vlingo.Actors.Tests/Supervision/FailureControlActor.cs index abfe60a4..c542091f 100644 --- a/src/Vlingo.Actors.Tests/Supervision/FailureControlActor.cs +++ b/src/Vlingo.Actors.Tests/Supervision/FailureControlActor.cs @@ -42,35 +42,35 @@ public void FailNow() throw new ApplicationException("Intended failure."); } - internal override void BeforeStart() + internal protected override void BeforeStart() { testResults.BeforeStartCount.IncrementAndGet(); testResults.UntilFailNow.Happened(); base.BeforeStart(); } - internal override void AfterStop() + internal protected override void AfterStop() { testResults.AfterStopCount.IncrementAndGet(); testResults.UntilFailNow.Happened(); base.AfterStop(); } - internal override void BeforeRestart(Exception reason) + internal protected override void BeforeRestart(Exception reason) { testResults.BeforeRestartCount.IncrementAndGet(); testResults.UntilFailNow.Happened(); base.BeforeRestart(reason); } - internal override void AfterRestart(Exception reason) + internal protected override void AfterRestart(Exception reason) { base.AfterRestart(reason); testResults.AfterRestartCount.IncrementAndGet(); testResults.UntilAfterRestart.Happened(); } - internal override void BeforeResume(Exception reason) + internal protected override void BeforeResume(Exception reason) { testResults.BeforeResume.IncrementAndGet(); testResults.UntilBeforeResume.Happened(); diff --git a/src/Vlingo.Actors/Actor.cs b/src/Vlingo.Actors/Actor.cs index b95ee202..ded75509 100644 --- a/src/Vlingo.Actors/Actor.cs +++ b/src/Vlingo.Actors/Actor.cs @@ -98,7 +98,7 @@ protected T ChildActorFor(Definition definition) } } - internal ICompletes Completes() + internal protected ICompletes Completes() { if(completes == null) { @@ -110,7 +110,7 @@ internal ICompletes Completes() protected Definition Definition => LifeCycle.Definition; - internal ILogger Logger => LifeCycle.Environment.Logger; + internal protected ILogger Logger => LifeCycle.Environment.Logger; protected T ParentAs() { @@ -128,7 +128,7 @@ protected void Secure() LifeCycle.Secure(); } - internal T SelfAs() + internal protected T SelfAs() { return LifeCycle.Environment.Stage.ActorProxyFor(this, LifeCycle.Environment.Mailbox); } @@ -142,7 +142,7 @@ protected IOutcomeInterest SelfAsOutcomeInterest(TRef return new OutcomeInterestActorProxy(outcomeAware, reference); } - internal Stage Stage + internal protected Stage Stage { get { @@ -155,26 +155,29 @@ internal Stage Stage } } - protected Stage StageNamed(string name) + internal protected Stage StageNamed(string name) { return LifeCycle.Environment.Stage.World.StageNamed(name); } + //======================================= + // stowing/dispersing + //======================================= - internal bool IsDispersing => + internal protected virtual bool IsDispersing => LifeCycle.Environment.Stowage.IsDispersing; - protected void DisperseStowedMessages() + internal protected virtual void DisperseStowedMessages() { LifeCycle.Environment.Stowage.DispersingMode(); } - internal bool IsStowing => + internal protected virtual bool IsStowing => LifeCycle.Environment.Stowage.IsStowing; - protected void StowMessages() + internal protected virtual void StowMessages() { LifeCycle.Environment.Stowage.StowingMode(); } @@ -183,29 +186,29 @@ protected void StowMessages() // life cycle overrides //======================================= - internal virtual void BeforeStart() + internal protected virtual void BeforeStart() { // override } - internal virtual void AfterStop() + internal protected virtual void AfterStop() { // override } - internal virtual void BeforeRestart(Exception reason) + internal protected virtual void BeforeRestart(Exception reason) { // override LifeCycle.AfterStop(this); } - internal virtual void AfterRestart(Exception reason) + internal protected virtual void AfterRestart(Exception reason) { // override LifeCycle.BeforeStart(this); } - internal virtual void BeforeResume(Exception reason) + internal protected virtual void BeforeResume(Exception reason) { // override } diff --git a/src/Vlingo.Actors/ActorFactory.cs b/src/Vlingo.Actors/ActorFactory.cs index 0435a97d..a656e7af 100644 --- a/src/Vlingo.Actors/ActorFactory.cs +++ b/src/Vlingo.Actors/ActorFactory.cs @@ -10,7 +10,7 @@ namespace Vlingo.Actors { - public class ActorFactory + internal class ActorFactory { internal static readonly ThreadLocal ThreadLocalEnvironment = new ThreadLocal(false); diff --git a/src/Vlingo.Actors/ActorProxy.cs b/src/Vlingo.Actors/ActorProxy.cs index 37cdadcf..bc0bbd1a 100644 --- a/src/Vlingo.Actors/ActorProxy.cs +++ b/src/Vlingo.Actors/ActorProxy.cs @@ -11,7 +11,7 @@ namespace Vlingo.Actors { - public sealed class ActorProxy + internal static class ActorProxy { private static readonly DynaClassLoader classLoader = new DynaClassLoader(typeof(ActorProxy).GetAssemblyLoadContext()); private static readonly DynaCompiler proxyCompiler = new DynaCompiler(); diff --git a/src/Vlingo.Actors/AddressFactory.cs b/src/Vlingo.Actors/AddressFactory.cs index db4e76f6..f5b31c8f 100644 --- a/src/Vlingo.Actors/AddressFactory.cs +++ b/src/Vlingo.Actors/AddressFactory.cs @@ -39,7 +39,5 @@ public override string ToString() => $"AddressFactory[highId={highId.Get()}, nextId={nextId.Get()}]"; internal int TestNextIdValue() => nextId.Get(); - - } } diff --git a/src/Vlingo.Actors/CommonSupervisor.cs b/src/Vlingo.Actors/CommonSupervisor.cs index b73b9c23..066b6d01 100644 --- a/src/Vlingo.Actors/CommonSupervisor.cs +++ b/src/Vlingo.Actors/CommonSupervisor.cs @@ -7,7 +7,7 @@ namespace Vlingo.Actors { - public abstract class CommonSupervisor : DefaultSupervisor + internal abstract class CommonSupervisor : DefaultSupervisor { internal CommonSupervisor() { } } diff --git a/src/Vlingo.Actors/Configuration.cs b/src/Vlingo.Actors/Configuration.cs index ebee9f5f..98bd8c3f 100644 --- a/src/Vlingo.Actors/Configuration.cs +++ b/src/Vlingo.Actors/Configuration.cs @@ -19,17 +19,6 @@ namespace Vlingo.Actors { public class Configuration { - private ConcurrentQueueMailboxPluginConfiguration concurrentQueueMailboxPluginConfiguration; - private CommonSupervisorsPluginConfiguration commonSupervisorsPluginConfiguration; - private DefaultSupervisorOverridePluginConfiguration defaultSupervisorOverridePluginConfiguration; - private ConsoleLoggerPluginConfiguration jdkLoggerPluginConfiguration; - private PooledCompletesPluginConfiguration pooledCompletesPluginConfiguration; - private ManyToOneConcurrentArrayQueuePluginConfiguration manyToOneConcurrentArrayQueuePluginConfiguration; - private SharedRingBufferMailboxPluginConfiguration sharedRingBufferMailboxPluginConfiguration; - private string mainProxyGeneratedClassesPath; - private string mainProxyGeneratedSourcesPath; - private string testProxyGeneratedClassesPath; - private string testProxyGeneratedSourcesPath; private List plugins; public static Configuration Define() => new Configuration(); diff --git a/src/Vlingo.Actors/DeadLettersActor.cs b/src/Vlingo.Actors/DeadLettersActor.cs index b299d457..c6f5a8a8 100644 --- a/src/Vlingo.Actors/DeadLettersActor.cs +++ b/src/Vlingo.Actors/DeadLettersActor.cs @@ -43,7 +43,7 @@ public void RegisterListener(IDeadLettersListener listener) listeners.Add(listener); } - internal override void AfterStop() + internal protected override void AfterStop() { Stage.World.DeadLetters = null; base.AfterStop(); diff --git a/src/Vlingo.Actors/Definition.cs b/src/Vlingo.Actors/Definition.cs index bb791d48..9f08c715 100644 --- a/src/Vlingo.Actors/Definition.cs +++ b/src/Vlingo.Actors/Definition.cs @@ -14,7 +14,7 @@ namespace Vlingo.Actors // TODO: possible removal/cleanup of overloaded ctors public sealed class Definition { - internal static readonly List NoParameters = new List(); + public static readonly List NoParameters = new List(); public static Definition Has(List parameters) where T : Actor => new Definition(typeof(T), parameters); diff --git a/src/Vlingo.Actors/Directory.cs b/src/Vlingo.Actors/Directory.cs index eb55f72d..efead695 100644 --- a/src/Vlingo.Actors/Directory.cs +++ b/src/Vlingo.Actors/Directory.cs @@ -12,11 +12,11 @@ namespace Vlingo.Actors { - public sealed class Directory + internal sealed class Directory { private readonly ConcurrentDictionary[] maps; - public Directory() + internal Directory() { maps = Build(); } diff --git a/src/Vlingo.Actors/DirectoryScannerActor.cs b/src/Vlingo.Actors/DirectoryScannerActor.cs index 6464d588..2c55359e 100644 --- a/src/Vlingo.Actors/DirectoryScannerActor.cs +++ b/src/Vlingo.Actors/DirectoryScannerActor.cs @@ -7,7 +7,7 @@ namespace Vlingo.Actors { - public class DirectoryScannerActor : Actor, IDirectoryScanner + internal class DirectoryScannerActor : Actor, IDirectoryScanner { private readonly Directory directory; diff --git a/src/Vlingo.Actors/Environment.cs b/src/Vlingo.Actors/Environment.cs index 50cbc5a4..b91cc936 100644 --- a/src/Vlingo.Actors/Environment.cs +++ b/src/Vlingo.Actors/Environment.cs @@ -11,7 +11,7 @@ namespace Vlingo.Actors { - public class Environment + internal class Environment { internal Address Address { get; } internal List Children { get; } diff --git a/src/Vlingo.Actors/FailureMark.cs b/src/Vlingo.Actors/FailureMark.cs index c997494d..124971b8 100644 --- a/src/Vlingo.Actors/FailureMark.cs +++ b/src/Vlingo.Actors/FailureMark.cs @@ -20,7 +20,7 @@ public FailureMark() Reset(); } - protected internal bool FailedWithExcessiveFailures(long period, int intensity) + protected internal virtual bool FailedWithExcessiveFailures(long period, int intensity) { if (intensity == SupervisionStrategyConstants.ForeverIntensity) { @@ -58,7 +58,7 @@ protected internal bool FailedWithExcessiveFailures(long period, int intensity) return false; } - protected internal void Reset() + protected internal virtual void Reset() { startOfPeriod = 0; timedIntensity = 0; diff --git a/src/Vlingo.Actors/FailureOutcome.cs b/src/Vlingo.Actors/FailureOutcome.cs index 6770098f..a8e0b1d6 100644 --- a/src/Vlingo.Actors/FailureOutcome.cs +++ b/src/Vlingo.Actors/FailureOutcome.cs @@ -11,7 +11,6 @@ public class FailureOutcome : Outcome { public FailureOutcome(T value) : base(value) { - } } } diff --git a/src/Vlingo.Actors/ICompletes.cs b/src/Vlingo.Actors/ICompletes.cs index 333b3c13..c52505be 100644 --- a/src/Vlingo.Actors/ICompletes.cs +++ b/src/Vlingo.Actors/ICompletes.cs @@ -27,7 +27,7 @@ public interface ICompletes : ICompletes ICompletes AndThen(Action consumer); ICompletes AtLast(Action consumer); ICompletes AtLast(Func supplier); - T Outcome { get; } + new T Outcome { get; } ICompletes With(TOutcome outcome); } diff --git a/src/Vlingo.Actors/ICompletesEventually.cs b/src/Vlingo.Actors/ICompletesEventually.cs index af3e0beb..51237f64 100644 --- a/src/Vlingo.Actors/ICompletesEventually.cs +++ b/src/Vlingo.Actors/ICompletesEventually.cs @@ -14,9 +14,9 @@ public interface ICompletesEventually : IStoppable public abstract class CompletesEventually : ICompletesEventually { - public bool IsStopped => false; + public virtual bool IsStopped => false; - public void Stop() + public virtual void Stop() { } diff --git a/src/Vlingo.Actors/LifeCycle.cs b/src/Vlingo.Actors/LifeCycle.cs index b93781f6..5031f37f 100644 --- a/src/Vlingo.Actors/LifeCycle.cs +++ b/src/Vlingo.Actors/LifeCycle.cs @@ -9,10 +9,10 @@ namespace Vlingo.Actors { - public sealed class LifeCycle + internal sealed class LifeCycle { - public Environment Environment { get; set; } + internal Environment Environment { get; set; } internal LifeCycle(Environment environment) { diff --git a/src/Vlingo.Actors/LocalMessage.cs b/src/Vlingo.Actors/LocalMessage.cs index b4f408cc..8e0b9c7b 100644 --- a/src/Vlingo.Actors/LocalMessage.cs +++ b/src/Vlingo.Actors/LocalMessage.cs @@ -35,7 +35,7 @@ public LocalMessage(LocalMessage message) private Action Consumer { get; } - public void Deliver() + public virtual void Deliver() { if (Actor.LifeCycle.IsResuming) { @@ -59,7 +59,7 @@ public void Deliver() } } - public string Representation { get; } + public virtual string Representation { get; } public virtual bool IsStowed => false; diff --git a/src/Vlingo.Actors/Logger__Proxy.cs b/src/Vlingo.Actors/Logger__Proxy.cs new file mode 100644 index 00000000..2ca99aea --- /dev/null +++ b/src/Vlingo.Actors/Logger__Proxy.cs @@ -0,0 +1,66 @@ +// Copyright (c) 2012-2018 Vaughn Vernon. All rights reserved. +// +// This Source Code Form is subject to the terms of the +// Mozilla Public License, v. 2.0. If a copy of the MPL +// was not distributed with this file, You can obtain +// one at https://mozilla.org/MPL/2.0/. + +using System; + +namespace Vlingo.Actors +{ + public class Logger__Proxy : ILogger + { + private const string LogRepresentation1 = "Log(string)"; + private const string LogRepresentation2 = "Log(string, Exception)"; + private const string CloseRepresentation3 = "Close()"; + + private readonly Actor actor; + private readonly IMailbox mailbox; + + public Logger__Proxy(Actor actor, IMailbox mailbox) + { + this.actor = actor; + this.mailbox = mailbox; + } + public bool IsEnabled => false; + public string Name => null; + + public void Log(string message) + { + if (!actor.IsStopped) + { + Action consumer = actor => actor.Log(message); + mailbox.Send(new LocalMessage(actor, consumer, LogRepresentation1)); + } + else + { + actor.DeadLetters.FailedDelivery(new DeadLetter(actor, LogRepresentation1)); + } + } + public void Log(string message, Exception ex) + { + if (!actor.IsStopped) + { + Action consumer = actor => actor.Log(message, ex); + mailbox.Send(new LocalMessage(actor, consumer, LogRepresentation2)); + } + else + { + actor.DeadLetters.FailedDelivery(new DeadLetter(actor, LogRepresentation2)); + } + } + public void Close() + { + if (!actor.IsStopped) + { + Action consumer = actor => actor.Close(); + mailbox.Send(new LocalMessage(actor, consumer, CloseRepresentation3)); + } + else + { + actor.DeadLetters.FailedDelivery(new DeadLetter(actor, CloseRepresentation3)); + } + } + } +} diff --git a/src/Vlingo.Actors/OutcomeInterestActorProxy.cs b/src/Vlingo.Actors/OutcomeInterestActorProxy.cs index 27fe3414..2beabf74 100644 --- a/src/Vlingo.Actors/OutcomeInterestActorProxy.cs +++ b/src/Vlingo.Actors/OutcomeInterestActorProxy.cs @@ -20,12 +20,12 @@ public OutcomeInterestActorProxy( this.reference = reference; } - public void FailureOutcome(Outcome outcome) + public virtual void FailureOutcome(Outcome outcome) { outcomeAware.FailureOutcome(outcome, reference); } - public void SuccessfulOutcome(Outcome outcome) + public virtual void SuccessfulOutcome(Outcome outcome) { outcomeAware.SuccessfulOutcome(outcome, reference); } diff --git a/src/Vlingo.Actors/Plugin/AbstractPlugin.cs b/src/Vlingo.Actors/Plugin/AbstractPlugin.cs index f9e581b7..efaa4423 100644 --- a/src/Vlingo.Actors/Plugin/AbstractPlugin.cs +++ b/src/Vlingo.Actors/Plugin/AbstractPlugin.cs @@ -25,5 +25,10 @@ public override bool Equals(object obj) return string.Equals(Name, ((IPlugin)obj).Name); } + + public override int GetHashCode() + { + return $"{GetType().FullName}::{Name}".GetHashCode(); + } } } diff --git a/src/Vlingo.Actors/PooledCompletes.cs b/src/Vlingo.Actors/PooledCompletes.cs index b73895f9..0d373493 100644 --- a/src/Vlingo.Actors/PooledCompletes.cs +++ b/src/Vlingo.Actors/PooledCompletes.cs @@ -27,15 +27,15 @@ public PooledCompletes( public object Outcome { get; private set; } - public void With(object outcome) + public virtual void With(object outcome) { Outcome = outcome; CompletesEventually.With(this); } - public bool IsStopped => CompletesEventually.IsStopped; + public virtual bool IsStopped => CompletesEventually.IsStopped; - public void Stop() + public virtual void Stop() { } } diff --git a/src/Vlingo.Actors/PrivateRootActor.cs b/src/Vlingo.Actors/PrivateRootActor.cs index a9c692ac..ae34d7fa 100644 --- a/src/Vlingo.Actors/PrivateRootActor.cs +++ b/src/Vlingo.Actors/PrivateRootActor.cs @@ -9,7 +9,7 @@ namespace Vlingo.Actors { - public class PrivateRootActor : Actor, IStoppable, ISupervisor + public sealed class PrivateRootActor : Actor, IStoppable, ISupervisor { public ISupervisionStrategy SupervisionStrategy { get; } @@ -38,7 +38,7 @@ public PrivateRootActor() Logger); } - internal override void AfterStop() + internal protected override void AfterStop() { Stage.World.SetPrivateRoot(null); base.AfterStop(); diff --git a/src/Vlingo.Actors/ProxyGenerator.cs b/src/Vlingo.Actors/ProxyGenerator.cs index de39eca0..c9abf683 100644 --- a/src/Vlingo.Actors/ProxyGenerator.cs +++ b/src/Vlingo.Actors/ProxyGenerator.cs @@ -18,9 +18,9 @@ namespace Vlingo.Actors { - public class ProxyGenerator + internal class ProxyGenerator { - public sealed class Result + internal sealed class Result { internal Result( string fullyQualifiedClassName, diff --git a/src/Vlingo.Actors/PublicRootActor.cs b/src/Vlingo.Actors/PublicRootActor.cs index c3aada19..e823b7d3 100644 --- a/src/Vlingo.Actors/PublicRootActor.cs +++ b/src/Vlingo.Actors/PublicRootActor.cs @@ -30,7 +30,7 @@ public void Inform(Exception error, ISupervised supervised) supervised.RestartWithin(SupervisionStrategy.Period, SupervisionStrategy.Intensity, SupervisionStrategy.Scope); } - internal override void AfterStop() + internal protected override void AfterStop() { Stage.World.SetDefaultParent(null); Stage.World.SetPublicRoot(null); diff --git a/src/Vlingo.Actors/Stage.cs b/src/Vlingo.Actors/Stage.cs index 7850ea11..1cde88a9 100644 --- a/src/Vlingo.Actors/Stage.cs +++ b/src/Vlingo.Actors/Stage.cs @@ -114,7 +114,7 @@ public TestActor TestActorFor(Definition definition) } } - public Protocols TestActorFor(Definition definition, Type[] protocols) + internal Protocols TestActorFor(Definition definition, Type[] protocols) { var redefinition = Definition.Has( definition.Type, diff --git a/src/Vlingo.Actors/StageSupervisedActor.cs b/src/Vlingo.Actors/StageSupervisedActor.cs index bac49a32..662d13fc 100644 --- a/src/Vlingo.Actors/StageSupervisedActor.cs +++ b/src/Vlingo.Actors/StageSupervisedActor.cs @@ -21,11 +21,11 @@ protected internal StageSupervisedActor(Actor actor, Exception error) Error = error; } - public Address Address => actor.Address; + public virtual Address Address => actor.Address; - public void Escalate() => Supervisor.Supervisor.Inform(Error, this); + public virtual void Escalate() => Supervisor.Supervisor.Inform(Error, this); - public void RestartWithin(long period, int intensity, Scope scope) + public virtual void RestartWithin(long period, int intensity, Scope scope) { if (FailureThresholdReached(period, intensity)) { @@ -47,13 +47,13 @@ public void RestartWithin(long period, int intensity, Scope scope) } } - public void Resume() + public virtual void Resume() { actor.LifeCycle.BeforeResume(actor, Error); actor.LifeCycle.Resume(); } - public void Stop(Scope scope) + public virtual void Stop(Scope scope) { if(scope == Scope.One) { @@ -68,11 +68,11 @@ public void Stop(Scope scope) } } - public void Suspend() => actor.LifeCycle.Suspend(); + public virtual void Suspend() => actor.LifeCycle.Suspend(); - public ISupervisor Supervisor => actor.LifeCycle.Supervisor(); + public virtual ISupervisor Supervisor => actor.LifeCycle.Supervisor(); - public Exception Error { get; } + public virtual Exception Error { get; } private IEnumerable SelfWithSiblings() => EnvironmentOf(EnvironmentOf(actor).Parent).Children; diff --git a/src/Vlingo.Actors/Stowage.cs b/src/Vlingo.Actors/Stowage.cs index acf9f5a4..73e591ad 100644 --- a/src/Vlingo.Actors/Stowage.cs +++ b/src/Vlingo.Actors/Stowage.cs @@ -11,7 +11,7 @@ namespace Vlingo.Actors { - public class Stowage + internal class Stowage { private Queue stowedMessages; private AtomicBoolean dispersing; @@ -36,7 +36,7 @@ protected internal void Dump(ILogger logger) protected internal bool HasMessages => stowedMessages.Count > 0; - internal IMessage Head + protected internal IMessage Head { get { diff --git a/src/Vlingo.Actors/TestKit/TestEnvironment.cs b/src/Vlingo.Actors/TestKit/TestEnvironment.cs index 7c52fb61..2d3292bf 100644 --- a/src/Vlingo.Actors/TestKit/TestEnvironment.cs +++ b/src/Vlingo.Actors/TestKit/TestEnvironment.cs @@ -10,7 +10,7 @@ namespace Vlingo.Actors.TestKit { - public class TestEnvironment : Environment + internal class TestEnvironment : Environment { public TestEnvironment() : base( diff --git a/src/Vlingo.Actors/World.cs b/src/Vlingo.Actors/World.cs index e4ebef3b..3c479afd 100644 --- a/src/Vlingo.Actors/World.cs +++ b/src/Vlingo.Actors/World.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; -using Vlingo.Actors.Plugin; using Vlingo.Common.Compiler; namespace Vlingo.Actors From d873679b81c1339289d5c5d8caea9488d106c1cb Mon Sep 17 00:00:00 2001 From: Zp Bappi Date: Sat, 27 Oct 2018 10:44:13 +1100 Subject: [PATCH 2/3] update version to 0.1.1 --- src/Vlingo.Actors/Vlingo.Actors.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Vlingo.Actors/Vlingo.Actors.csproj b/src/Vlingo.Actors/Vlingo.Actors.csproj index 3a381c41..37602b69 100644 --- a/src/Vlingo.Actors/Vlingo.Actors.csproj +++ b/src/Vlingo.Actors/Vlingo.Actors.csproj @@ -4,7 +4,7 @@ true - 0.1.0 + 0.1.1 Vlingo.Actors Vlingo From b6add113af13a36270ca4388ff83b621ae09ce01 Mon Sep 17 00:00:00 2001 From: Zp Bappi Date: Sat, 27 Oct 2018 22:35:28 +1100 Subject: [PATCH 3/3] deleted unnecessary file --- src/Vlingo.Actors.Tests/Proxy/ProxyTest.cs | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 src/Vlingo.Actors.Tests/Proxy/ProxyTest.cs diff --git a/src/Vlingo.Actors.Tests/Proxy/ProxyTest.cs b/src/Vlingo.Actors.Tests/Proxy/ProxyTest.cs deleted file mode 100644 index 583c82bb..00000000 --- a/src/Vlingo.Actors.Tests/Proxy/ProxyTest.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2012-2018 Vaughn Vernon. All rights reserved. -// -// This Source Code Form is subject to the terms of the -// Mozilla Public License, v. 2.0. If a copy of the MPL -// was not distributed with this file, You can obtain -// one at https://mozilla.org/MPL/2.0/. - -namespace Vlingo.Actors.Tests.Proxy -{ - public abstract class ProxyTest - { - public readonly string classname = "Vlingo.Actors.Proxy.TestProxy"; - public readonly string source = "TODO: ???"; - } -}