示例#1
0
        private static AuctionUpdate[] createUpdaters()
        {
            mMaxFid = MamdaAuctionFields.getMaxFid();
            AuctionUpdate[] updaters = new AuctionUpdate[mMaxFid + 1];

            addToUpdatersList(updaters, MamdaCommonFields.SYMBOL, new MamdaAuctionSymbol());
            addToUpdatersList(updaters, MamdaCommonFields.ISSUE_SYMBOL, new MamdaAuctionIssueSymbol());
            addToUpdatersList(updaters, MamdaCommonFields.PART_ID, new MamdaAuctionPartId());
            addToUpdatersList(updaters, MamdaCommonFields.SRC_TIME, new MamdaAuctionSrcTime());
            addToUpdatersList(updaters, MamdaCommonFields.ACTIVITY_TIME, new MamdaAuctionActivityTime());
            addToUpdatersList(updaters, MamdaCommonFields.LINE_TIME, new MamdaAuctionLineTime());
            addToUpdatersList(updaters, MamdaCommonFields.SEND_TIME, new MamdaAuctionSendTime());
            addToUpdatersList(updaters, MamdaAuctionFields.UNCROSS_PRICE, new MamdaAuctionUncrossPrice());
            addToUpdatersList(updaters, MamdaAuctionFields.UNCROSS_VOLUME, new MamdaAuctionUncrossVolume());
            addToUpdatersList(updaters, MamdaAuctionFields.UNCROSS_PRICE_IND, new MamdaAuctionUncrossPriceInd());

            return(updaters);
        }
示例#2
0
/*      End Field State Accessors       */

        // Implementation of MamdaListener interface.
        // NB! For internal use only.
        public void onMsg(
            MamdaSubscription subscription,
            MamaMsg msg,
            mamaMsgType msgType)
        {
            // Listeners may be created on multiple threads and we only
            // want a single list of updaters.
            if (mUpdaters == null)
            {
                lock (mUpdatersGuard)
                {
                    if (!MamdaAuctionFields.isSet())
                    {
                        return;
                    }

                    if (mUpdaters == null)
                    {
                        AuctionUpdate[] updaters = createUpdaters();
                        Thread.MemoryBarrier();
                        mUpdaters = updaters;
                    }
                }
            }

            // If msg is a Auction-related message, invoke the
            // appropriate callback:
            switch (msgType)
            {
            case mamaMsgType.MAMA_MSG_TYPE_INITIAL:
            case mamaMsgType.MAMA_MSG_TYPE_RECAP:
            case mamaMsgType.MAMA_MSG_TYPE_UPDATE:
                handleAuctionMessage(subscription, msg, msgType);
                break;

            default:
                break;
            }
        }