protected virtual void Dispose(bool disposing) { if (!isDisposed) { isDisposed = true; if (disposing) { if (debug) { log.Debug("Dispose()"); } if (queueTask != null) { queueTask.Stop(); queueTask.Join(); } if (reader != null) { reader.Dispose(); } if (fillSimulator != null) { if (debug) { log.Debug("Setting fillSimulator.IsOnline false"); } fillSimulator.IsOnline = false; } else { if (debug) { log.Debug("fillSimulator is null."); } } tickSync.ForceClear("DisposeSimulator"); } } else { if (debug) { log.Debug("isDisposed " + isDisposed); } } }
public FIXServerSymbolHandler(FIXSimulatorSupport fixSimulatorSupport, bool isPlayBack, string symbolString, Func <Yield> onHeartbeat, Func <SymbolInfo, Tick, Yield> onTick, Action <PhysicalFill, int, int, int> onPhysicalFill, Action <PhysicalOrder, string> onRejectOrder) { this.fixSimulatorSupport = fixSimulatorSupport; this.isPlayBack = isPlayBack; this.onHeartbeat = onHeartbeat; this.onTick = onTick; this.symbol = Factory.Symbol.LookupSymbol(symbolString); reader = Factory.TickUtil.TickReader(); reader.Initialize("Test\\MockProviderData", symbolString); fillSimulator = Factory.Utility.FillSimulator("FIX", symbol, false); fillSimulator.OnPhysicalFill = onPhysicalFill; fillSimulator.OnRejectOrder = onRejectOrder; tickSync = SyncTicks.GetTickSync(symbol.BinaryIdentifier); tickSync.ForceClear(); queueTask = Factory.Parallel.Loop("FIXServerSymbol-" + symbolString, OnException, ProcessQueue); firstHearbeat = true; }