Пример #1
0
 public RisProContext(string connectionString, ICommonLog logger)
     : base(connectionString)
 {
     _logger = logger;
     _logger.Log(LogLevel.Debug, "RisProContext.ctor");
     Database.Log = log => Debug.WriteLine(log);
     this.Database.CommandTimeout = 0;
 }
        public AsyncSocketListenerUDP(int _maxSize, int _maxConnnections, ICommonLog _logTool)
        {
            m_readWritePool   = new SocketAsyncEventArgsPool <SocketAsyncEventArgs>();
            m_maxConnnections = _maxConnnections;
            m_maxSize         = _maxSize;
            LogTool           = _logTool;

            m_maxNumberAcceptedClients = new Semaphore(m_maxConnnections, m_maxConnnections);
        }
Пример #3
0
        public AsyncSocketListenerUDP(int _maxSize, int _maxReciveCount, int _maxSendCount, ICommonLog _logTool)
        {
            m_readWritePool  = new SocketAsyncEventArgsPool <SocketAsyncEventArgs>();
            m_maxReciveCount = _maxReciveCount;
            m_maxSendCount   = _maxSendCount;
            m_maxSize        = _maxSize;
            LogTool          = _logTool;

            m_maxNumberReceiveClients = new Semaphore(m_maxReciveCount, m_maxReciveCount);
            m_maxNumberSendClients    = new Semaphore(m_maxSendCount, m_maxSendCount);
        }
Пример #4
0
        public AsyncSocketClient(int _maxSize, int _maxConnnections, ICommonLog _logTool)
        {
            m_readWritePool   = new SocketAsyncEventArgsPool <AsyncClientToken>();
            m_maxConnnections = _maxConnnections;
            m_maxSize         = _maxSize;
            LogTool           = _logTool;
            m_bufferManager   = BufferManager.CreateBufferManager(m_maxConnnections * m_maxSize, m_maxSize);

            for (int i = 0; i < _maxConnnections; i++)
            {
                AsyncClientToken asyncClientToken = new AsyncClientToken();
                asyncClientToken.Buffer = m_bufferManager.TakeBuffer(m_maxSize);
                m_readWritePool.Push(asyncClientToken);
            }

            m_maxNumberAcceptedClients = new Semaphore(m_maxConnnections, m_maxConnnections);
        }
        public AsyncSocketListener(int _maxSize, int _maxConnnections, ICommonLog _logTool)
        {
            m_readWritePool   = new SocketAsyncEventArgsPool <SocketAsyncEventArgs>();
            m_maxConnnections = _maxConnnections;
            m_maxSize         = _maxSize;
            LogTool           = _logTool;

            //m_bufferManager = BufferManager.CreateBufferManager(m_maxConnnections * m_maxSize * opsToPreAlloc, m_maxSize);
            m_bufferManager = BufferManager.CreateBufferManager(m_maxConnnections * m_maxSize, m_maxSize);

            for (int i = 0; i < m_maxConnnections; i++)
            {
                SocketAsyncEventArgs socketAsyncEventArg = new SocketAsyncEventArgs();
                socketAsyncEventArg.UserToken  = new T();
                socketAsyncEventArg.Completed += new EventHandler <SocketAsyncEventArgs>(IO_Completed);
                socketAsyncEventArg.SetBuffer(m_bufferManager.TakeBuffer(m_maxSize), 0, m_maxSize);
                m_readWritePool.Push(socketAsyncEventArg);
            }

            m_maxNumberAcceptedClients = new Semaphore(m_maxConnnections, m_maxConnnections);
        }
Пример #6
0
 public ActionLoggingFilter(ICommonLog logger)
 {
     _Logger = logger;
 }
    public static List <T> FetchAtLeastOneBlocking <T>(this BlockingCollection <T> threadSafeQueue, int maxCount, ICommonLog log)
    {
        var resultList = new List <T>();

        // Take() will block the thread until new elements appear
        // It will also throw an InvalidOperationException when blockingCollection is Completed
        resultList.Add(threadSafeQueue.Take());
        try
        {
            // Fetch more unblocking
            while (threadSafeQueue.Count > 0 && resultList.Count < maxCount)
            {
                T    item;
                bool success = false;
                success = threadSafeQueue.TryTake(out item);
                if (success)
                {
                    resultList.Add(item);
                }
                else
                {
                }
            }
        }
        catch (Exception ex)
        {
            log.Fatal($"Unknown error fetching more elements. Continuing to process the {resultList.Count} already fetched items.", ex);
        }
        return(resultList);
    }
Пример #8
0
 public LicenseService(ICommonLog logger)
 {
     _logger = logger;
 }
Пример #9
0
 public ApiExceptionLogger(ICommonLog logger)
 {
     _Logger = logger;
 }
Пример #10
0
 public FileDownloadController(ICommonLog logger)
 {
     _Logger = logger;
 }
Пример #11
0
 public ConsultationContext(string connectionString, ICommonLog logger, IInitialDataService initialDataService)
     : this(connectionString, logger)
 {
     _InitialDataService = initialDataService;
 }
Пример #12
0
 public ServerInstance(int _maxSize, int _maxReciveCount, int _maxSendCount, ICommonLog _logTool) : base(_maxSize, _maxReciveCount, _maxSendCount, _logTool)
 {
 }
Пример #13
0
 public MockLicenseService(ICommonLog commonLog)
 {
 }