示例#1
0
        /// <summary>
        /// 获取Loader
        /// </summary>
        /// <param name="hash"></param>
        /// <returns></returns>
        public static ABLoader GetLoader(uint hash, ABLoadContext _loadContext)
        {
            //如果已经存在Laoder则返回loader
            if (_loadContext.loadingLoaderDict.ContainsKey(hash))
            {
                return(_loadContext.loadingLoaderDict[hash]);
            }

            ABData data = _loadContext.dataHelper.GetABData(hash);

            if (data == null)
            {
                ReDebug.LogError(ReLogType.System, "ABManager",
                                 string.Format("ABData is null, abName={0}", hash));
                return(null);
            }

            //创建Loader并且加入表中
            ABLoader loader = ReusableObjectPool <ABLoader> .Get();

            loader.abName = data.fullName;
            loader.abData = data;
            _loadContext.loadingLoaderDict[hash] = loader;
            loader._loadContext = _loadContext;

            return(loader);
        }
示例#2
0
        public ReceivedMessage GetMessage()
        {
            if (!_journalInitialized)
            {
                CreateJournal();
                ReturnJournalMessages();
            }

            try
            {
                var pipeline = _dequeuePipelinePool.Get(_msmqDequeuePipelineType) ?? new MsmqGetMessagePipeline();

                pipeline.Execute(_parser, _timeout);

                _dequeuePipelinePool.Release(pipeline);

                var message = pipeline.State.Get <Message>();

                return(message == null ? null : new ReceivedMessage(message.BodyStream, new Guid(message.Label)));
            }
            catch (Exception ex)
            {
                _log.Error(string.Format(Resources.GetMessageError, _parser.Path, ex.AllMessages()));

                throw;
            }
        }
        public TPipeline GetPipeline <TPipeline>(IServiceBus bus) where TPipeline : MessagePipeline
        {
            var messagePipeline = _pool.Get(typeof(TPipeline)) ?? CreatePipeline <TPipeline>(bus);

            messagePipeline.Obtained();

            return((TPipeline)messagePipeline);
        }