Exemplo n.º 1
0
 private void DisposeNodeInstance(INodeInstance nodeInstance, TimeSpan delay)
 {
     if (delay == TimeSpan.Zero)
     {
         nodeInstance.Dispose();
     }
     else
     {
         Task.Run(async() => {
             try {
                 await Task.Delay(delay);
                 nodeInstance.Dispose();
             } catch (Exception ex) {
                 // Nothing's waiting for the delayed disposal task, so any exceptions in it would
                 // by default just get ignored. To make these discoverable, capture them here so
                 // they can be rethrown to the next caller to InvokeExportAsync.
                 this._instanceDelayedDisposalException = ex;
             }
         });
     }
 }
Exemplo n.º 2
0
 public void Dispose()
 {
     _nodeInstance.Dispose();
 }