public OrderListByState FindStateLaneDoesntContain(Order order)
        {
            OrderListByState expectedToNotContain = this.FindStateLaneExpectedByOrderState(order.State);

            if (expectedToNotContain.Contains(order))
            {
                return(new OrderListByState(OrderStatesCollections.Unknown));
            }
            return(expectedToNotContain);
        }
Beispiel #2
0
        void suggestLanePopupException(Order order)
        {
            if (this.neighborLanesWhenOrdersAll == null)
            {
                return;
            }
            string msg = "";

            if (order == null)
            {
                msg = "suggestLane(" + order + "), wanna insert a breakpoint here?";
                this.neighborLanesWhenOrdersAll.OrderProcessor.PopupException(new Exception(msg));
            }
            Stopwatch fullScanTook = new Stopwatch();

            fullScanTook.Start();
            OrderListByState laneFound;
            OrderListByState laneExpected = this.neighborLanesWhenOrdersAll.FindStateLaneExpectedByOrderState(order.State);

            if (laneExpected.Contains(order))
            {
                msg      += "FOUND_IN_EXPECTED_LANE";
                laneFound = laneExpected;
            }
            else
            {
                msg += "NOT_FOUND_WHERE_EXPECTED_TRYING_FULL_SEARCH";
                OrderListByState lanesFullScan = neighborLanesWhenOrdersAll.FindStateLaneWhichContainsOrder(order);
                if (lanesFullScan.StatesAllowed == OrderStatesCollections.Unknown)
                {
                    msg += "; only OrdersAll contains this order, pass iDontNeedSuggestionsHere=true";
                    return;
                }
                laneFound = lanesFullScan;
            }
            fullScanTook.Stop();
            msg += " (fullScanTook " + fullScanTook.ElapsedMilliseconds + "ms)";
            msg  = "USE [" + laneFound.ToShortString() + "] instead of OrdersAll: " + msg;
            this.neighborLanesWhenOrdersAll.OrderProcessor.PopupException(new Exception(msg));
            int a = 1;
        }
        public void SwitchLanesForOrderPostStatusUpdate(Order orderNowAfterUpdate, OrderState orderStatePriorToUpdate)
        {
            string msig = " OrderProcessorDataSnapshot::SwitchLanesForOrderPostStatusUpdate() ";

            lock (this.orderStateUpdateAtomicJustInCase) {
                OrderListByState orderLaneBeforeStateUpdate = this.FindStateLaneExpectedByOrderState(orderStatePriorToUpdate);
                OrderListByState orderLaneAfterStateUpdate  = this.FindStateLaneExpectedByOrderState(orderNowAfterUpdate.State);
                if (orderLaneBeforeStateUpdate == orderLaneAfterStateUpdate)
                {
                    return;
                }
                try {
                    orderLaneBeforeStateUpdate.Remove(orderNowAfterUpdate);
                } catch (Exception e) {
                    Assembler.PopupException(msig, e);
                }
                try {
                    orderLaneAfterStateUpdate.Insert(0, orderNowAfterUpdate);
                } catch (Exception e) {
                    Assembler.PopupException(msig, e);
                }
            }
        }