IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
IKVM.Tools.Core.Diagnostics.DiagnosticChannelProvider Class Reference

Provides the capability to look up diagnostic channels. More...

Inheritance diagram for IKVM.Tools.Core.Diagnostics.DiagnosticChannelProvider:

Public Member Functions

 DiagnosticChannelProvider (IEnumerable< IDiagnosticChannelFactory > factories)
 Initializes a new instance.
 
IDiagnosticChannelGetOrCreateChannel (string spec)
 Attempts to parse the specification into a diagnostic channel.
 
void Dispose ()
 

Detailed Description

Provides the capability to look up diagnostic channels.

Definition at line 12 of file DiagnosticChannelProvider.cs.

Constructor & Destructor Documentation

◆ DiagnosticChannelProvider()

IKVM.Tools.Core.Diagnostics.DiagnosticChannelProvider.DiagnosticChannelProvider ( IEnumerable< IDiagnosticChannelFactory > factories)

Initializes a new instance.

Parameters
factories
Exceptions
ArgumentNullException

Definition at line 23 of file DiagnosticChannelProvider.cs.

24 {
25 _factories = factories ?? throw new ArgumentNullException(nameof(factories));
26 }

Member Function Documentation

◆ Dispose()

void IKVM.Tools.Core.Diagnostics.DiagnosticChannelProvider.Dispose ( )

Definition at line 39 of file DiagnosticChannelProvider.cs.

40 {
41 foreach (var i in _cache.Values)
42 if (i is IDisposable d)
43 d.Dispose();
44
45 _cache.Clear();
46 }

◆ GetOrCreateChannel()

IDiagnosticChannel? IKVM.Tools.Core.Diagnostics.DiagnosticChannelProvider.GetOrCreateChannel ( string spec)

Attempts to parse the specification into a diagnostic channel.

Parameters
spec
Returns

Definition at line 33 of file DiagnosticChannelProvider.cs.

34 {
35 return _cache.GetOrAdd(spec, _ => _factories.Select(i => i.CreateChannel(_)).FirstOrDefault(i => i != null));
36 }

The documentation for this class was generated from the following file: