Ejemplo n.º 1
0
        public static Boolean setConfig(int Price, Step2Operation operation, Boolean priceOnly = false)
        {
            logger.Info("setConfig {...}");
            Boolean rtn = false;
            if (Monitor.TryEnter(SubmitPriceStep2Job.lockObj, 500))
            {
                if ((null == SubmitPriceStep2Job.bidOperation)
                    || (operation.updateTime > SubmitPriceStep2Job.bidOperation.updateTime))//确保同一个版本(修改)的Operation只被配置并执行一次,避免多次执行
                {
                    logger.DebugFormat("PRICE     : {0}", operation.price);
                    logger.DebugFormat("startTime : {0}", operation.startTime);
                    logger.DebugFormat("expireTime: {0}", operation.expireTime);

                    SubmitPriceStep2Job.priceOnly = priceOnly;
                    SubmitPriceStep2Job.price = Price;
                    SubmitPriceStep2Job.executeCount = 0;
                    SubmitPriceStep2Job.bidOperation = operation;
                    SubmitPriceStep2Job.operation = Newtonsoft.Json.JsonConvert.DeserializeObject<BidStep2>(operation.content);
                    rtn = true;
                }
                Monitor.Exit(SubmitPriceStep2Job.lockObj);
            }
            else
                logger.Error("obtain SubmitPriceJob.lockObj timeout on setConfig(...)");
            return rtn;
        }
Ejemplo n.º 2
0
 public static Step2Operation getConfig()
 {
     Step2Operation ops = new Step2Operation();
     ops.expireTime = SubmitPriceStep2Job.bidOperation.expireTime;
     ops.startTime = SubmitPriceStep2Job.bidOperation.startTime;
     ops.content = SubmitPriceStep2Job.bidOperation.content;
     ops.id = SubmitPriceStep2Job.bidOperation.id;
     ops.price = SubmitPriceStep2Job.bidOperation.price;
     ops.type = SubmitPriceStep2Job.bidOperation.type;
     ops.updateTime = SubmitPriceStep2Job.bidOperation.updateTime;
     return ops;
 }