public TraceTransfer ( |
||
eventCache | ||
source | String | |
id | int | |
message | string | |
relatedActivityId | Guid | |
리턴 | void |
public void TraceTransfer(int id, string message, Guid relatedActivityId) { // Ensure that config is loaded Initialize(); TraceEventCache manager = new TraceEventCache(); if (_internalSwitch.ShouldTrace(TraceEventType.Transfer) && _listeners != null) { if (TraceInternal.UseGlobalLock) { // we lock on the same object that Trace does because we're writing to the same Listeners. lock (TraceInternal.critSec) { for (int i = 0; i < _listeners.Count; i++) { TraceListener listener = _listeners[i]; listener.TraceTransfer(manager, Name, id, message, relatedActivityId); if (Trace.AutoFlush) { listener.Flush(); } } } } else { for (int i = 0; i < _listeners.Count; i++) { TraceListener listener = _listeners[i]; if (!listener.IsThreadSafe) { lock (listener) { listener.TraceTransfer(manager, Name, id, message, relatedActivityId); if (Trace.AutoFlush) { listener.Flush(); } } } else { listener.TraceTransfer(manager, Name, id, message, relatedActivityId); if (Trace.AutoFlush) { listener.Flush(); } } } } } }
public void TraceTransfer(int id, string message, Guid relatedActivityId) { this.Initialize(); TraceEventCache eventCache = new TraceEventCache(); if (this.internalSwitch.ShouldTrace(TraceEventType.Transfer) && (this.listeners != null)) { if (TraceInternal.UseGlobalLock) { lock (TraceInternal.critSec) { for (int j = 0; j < this.listeners.Count; j++) { TraceListener listener = this.listeners[j]; listener.TraceTransfer(eventCache, this.Name, id, message, relatedActivityId); if (Trace.AutoFlush) { listener.Flush(); } } return; } } for (int i = 0; i < this.listeners.Count; i++) { TraceListener listener2 = this.listeners[i]; if (!listener2.IsThreadSafe) { lock (listener2) { listener2.TraceTransfer(eventCache, this.Name, id, message, relatedActivityId); if (Trace.AutoFlush) { listener2.Flush(); } continue; } } listener2.TraceTransfer(eventCache, this.Name, id, message, relatedActivityId); if (Trace.AutoFlush) { listener2.Flush(); } } } }
public void TraceTransfer(int id, string message, Guid relatedActivityId) { if (!this.source_switch.ShouldTrace(TraceEventType.Transfer)) { return; } object syncRoot = ((ICollection)this.listeners).SyncRoot; lock (syncRoot) { foreach (object obj in this.listeners) { TraceListener traceListener = (TraceListener)obj; traceListener.TraceTransfer(null, this.Name, id, message, relatedActivityId); } } }