コード例 #1
0
 protected AsynchQueueAgent(string nameSuffix, ILoggerFactory loggerFactory)
     : base(nameSuffix, loggerFactory)
 {
     requestQueue = new BlockingCollection <T>();
     if (StatisticsCollector.CollectQueueStats)
     {
         queueTracking = new QueueTrackingStatistic(base.Name);
     }
 }
コード例 #2
0
 protected AsynchQueueAgent(string nameSuffix, IMessagingConfiguration cfg)
     : base(nameSuffix)
 {
     config       = cfg;
     requestQueue = new BlockingCollection <T>();
     if (StatisticsCollector.CollectQueueStats)
     {
         queueTracking = new QueueTrackingStatistic(base.Name);
     }
 }
コード例 #3
0
ファイル: QueuedExecutor.cs プロジェクト: fanliang11/orleans
        public QueuedExecutor(string name, CancellationTokenSource cts, bool drainAfterCancel)
        {
            if (StatisticsCollector.CollectQueueStats)
            {
                queueTracking = new QueueTrackingStatistic(name);
            }

#if TRACK_DETAILED_STATS
            if (StatisticsCollector.CollectThreadTimeTrackingStats)
            {
                threadTracking = new ThreadTrackingStatistic(Name);
            }
#endif
            this.drainAfterCancel   = drainAfterCancel;
            cancellationTokenSource = cts;
            cancellationTokenSource.Token.Register(() =>
            {
                // allow threads to get a chance to exit gracefully.
                workQueue.Add(QueueWorkItemCallback.NoOpQueueWorkItemCallback);
                workQueue.CompleteAdding();
            });
            new ThreadPerTaskExecutor(name).QueueWorkItem(_ => ProcessQueue());
        }
コード例 #4
0
 public ProxiedMessageCenter(ClientConfiguration config, IPAddress localAddress, int gen, GrainId clientId, IGatewayListProvider gatewayListProvider)
 {
     lockable = new object();
     MyAddress = SiloAddress.New(new IPEndPoint(localAddress, 0), gen);
     ClientId = clientId;
     Running = false;
     MessagingConfiguration = config;
     GatewayManager = new GatewayManager(config, gatewayListProvider);
     PendingInboundMessages = new BlockingCollection<Message>();
     gatewayConnections = new Dictionary<Uri, GatewayConnection>();
     numMessages = 0;
     grainBuckets = new WeakReference[config.ClientSenderBuckets];
     logger = LogManager.GetLogger("Messaging.ProxiedMessageCenter", LoggerType.Runtime);
     if (logger.IsVerbose) logger.Verbose("Proxy grain client constructed");
     IntValueStatistic.FindOrCreate(StatisticNames.CLIENT_CONNECTED_GATEWAY_COUNT, () =>
         {
             lock (gatewayConnections)
             {
                 return gatewayConnections.Values.Count(conn => conn.IsLive);
             }
         });
     if (StatisticsCollector.CollectQueueStats)
     {
         queueTracking = new QueueTrackingStatistic("ClientReceiver");
     }
 }