aboutsummaryrefslogtreecommitdiff
path: root/lib/Plugins.Runtime/src/RuntimePluginLoader.cs
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2024-03-24 21:01:06 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2024-03-24 21:01:06 -0400
commit55859158fbd0bf54473a0baeb486045a025c7c5d (patch)
tree380fe100af2b29246398237bfe95f392dc513ffe /lib/Plugins.Runtime/src/RuntimePluginLoader.cs
parentdd0f384ec3b2fd86ec03aa0fb42387091b5430a7 (diff)
Squashed commit of the following:
commit 6c1667be23597513537f8190e2f55d65eb9b7c7a Author: vnugent <public@vaughnnugent.com> Date: Fri Mar 22 12:01:53 2024 -0400 refactor: Overhauled native library loading and lazy init commit ebf688f2f974295beabf7b5def7e6f6f150551d0 Author: vnugent <public@vaughnnugent.com> Date: Wed Mar 20 22:16:17 2024 -0400 refactor: Update compression header files and macros + Ci build commit 9c7b564911080ccd5cbbb9851a0757b05e1e9047 Author: vnugent <public@vaughnnugent.com> Date: Tue Mar 19 21:54:49 2024 -0400 refactor: JWK overhaul & add length getter to FileUpload commit 6d8c3444e09561e5957491b3cc1ae858e0abdd14 Author: vnugent <public@vaughnnugent.com> Date: Mon Mar 18 16:13:20 2024 -0400 feat: Add FNV1a software checksum and basic correction tests commit 00d182088cecefc08ca80b1faee9bed3f215f40b Author: vnugent <public@vaughnnugent.com> Date: Fri Mar 15 01:05:27 2024 -0400 chore: #6 Use utils filewatcher instead of built-in commit d513c10d9895c6693519ef1d459c6a5a76929436 Author: vnugent <public@vaughnnugent.com> Date: Sun Mar 10 21:58:14 2024 -0400 source tree project location updated
Diffstat (limited to 'lib/Plugins.Runtime/src/RuntimePluginLoader.cs')
-rw-r--r--lib/Plugins.Runtime/src/RuntimePluginLoader.cs17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/Plugins.Runtime/src/RuntimePluginLoader.cs b/lib/Plugins.Runtime/src/RuntimePluginLoader.cs
index 60edf55..23bbcab 100644
--- a/lib/Plugins.Runtime/src/RuntimePluginLoader.cs
+++ b/lib/Plugins.Runtime/src/RuntimePluginLoader.cs
@@ -38,10 +38,9 @@ namespace VNLib.Plugins.Runtime
/// </summary>
public sealed class RuntimePluginLoader : VnDisposeable, IPluginReloadEventHandler
{
- private static readonly IPluginAssemblyWatcher Watcher = new AssemblyWatcher();
-
- private readonly IPluginAssemblyLoader Loader;
+ private readonly IPluginAssemblyLoader Loader;
private readonly ILogProvider? Log;
+ private readonly IDisposable? Watcher;
/// <summary>
/// Gets the plugin assembly loader configuration information
@@ -61,13 +60,15 @@ namespace VNLib.Plugins.Runtime
/// <exception cref="ArgumentNullException"></exception>
public RuntimePluginLoader(IPluginAssemblyLoader loader, ILogProvider? log)
{
- Log = log;
- Loader = loader ?? throw new ArgumentNullException(nameof(loader));
+ ArgumentNullException.ThrowIfNull(loader);
+
+ Log = log;
+ Loader = loader;
//Configure watcher if requested
if (loader.Config.WatchForReload)
{
- Watcher.WatchAssembly(this, loader);
+ Watcher = AssemblyWatcher.WatchAssembly(this, loader);
}
//Init container
@@ -200,10 +201,8 @@ namespace VNLib.Plugins.Runtime
///<inheritdoc/>
protected override void Free()
{
- //Stop watching for events
- Watcher.StopWatching(this);
-
//Cleanup
+ Watcher?.Dispose();
Controller.Dispose();
Loader.Dispose();
}