Exemplo n.º 1
0
 public LogConnectionCounterJob(
     ILogger <LogConnectionCounterJob> logger,
     ConnectionCounter connectionCounter)
     : base(logger)
 {
     _connectionCounter = connectionCounter;
 }
Exemplo n.º 2
0
 public void ConnectionCounterDecrement()
 {
     if (_counterEnabled)
     {
         ConnectionCounter.Decrement();
     }
 }
Exemplo n.º 3
0
 public void ConnectionCounterIncrement()
 {
     if (_counterEnabled)
     {
         ConnectionCounter.Increment();
         ConnectionSpeed.Increment();
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Creates a new Provider specific Connection that will held open until all actors want to close it
        /// </summary>
        /// <returns></returns>
        public IDbConnection CreateConnection()
        {
            var sqLiteConnection = new SQLiteConnection(_connStr);
            var counter          = ConnectionCounter.GetOrAdd(DatabaseFile, s => new SqLiteConnectionCounter(s));

            counter.AddConnection(sqLiteConnection);
            return(sqLiteConnection);
        }
Exemplo n.º 5
0
 private ConnectionCounter GetOrCreateCounter(string destination)
 {
     if (_counters.ContainsKey(destination))
         return _counters[destination];
     
     var counter = new ConnectionCounter() { Destination = destination };
     _counters[destination] = counter;
     return counter;
 }
Exemplo n.º 6
0
 public void CloseAllConnections()
 {
     foreach (var sqLiteConnectionCounter in ConnectionCounter.Where(f => f.Key.Equals(DatabaseFile)))
     {
         sqLiteConnectionCounter.Value.Dispose();
     }
     ConnectionCounter.Clear();
     GC.Collect();
     GC.WaitForPendingFinalizers();
     GC.Collect();
 }
Exemplo n.º 7
0
        public ServerForm()
        {
            InitializeComponent();
            isListening       = false;
            connectionCounter = new ConnectionCounter();

            backgroundWorker1.WorkerReportsProgress      = true;
            backgroundWorker1.WorkerSupportsCancellation = true;
            backgroundWorker1.DoWork             += backgroundWorker1_DoWork;
            backgroundWorker1.ProgressChanged    += backgroundWorker1_ProgressChanged;
            backgroundWorker1.RunWorkerCompleted += backgroundWorker1_RunWorkerCompleted;
        }
Exemplo n.º 8
0
 public ProxyHub(ConnectionCounter counter,
                 ClientStorage clientStorage,
                 MessageHistory messageHistory,
                 IComponentContext context,
                 ILogger <ProxyHub> logger)
 {
     _counter          = counter;
     _clientStorage    = clientStorage;
     _messageHistory   = messageHistory;
     _componentContext = context;
     _logger           = logger;
 }
Exemplo n.º 9
0
 public EchoHub(ConnectionCounter counter)
 {
     _counter = counter;
 }