/// <summary>
        /// Initializes a new instance of the <see cref="DefaultBootstrap"/> class.
        /// </summary>
        /// <param name="rootConfig">The root config.</param>
        /// <param name="appServers">The app servers.</param>
        /// <param name="logFactory">The log factory.</param>
        public DefaultBootstrap(IRootConfig rootConfig, IEnumerable<IWorkItem> appServers, ILogFactory logFactory)
        {
            if (rootConfig == null)
                throw new ArgumentNullException("rootConfig");

            if (appServers == null)
                throw new ArgumentNullException("appServers");

            if(!appServers.Any())
                throw new ArgumentException("appServers must have one item at least", "appServers");

            if (logFactory == null)
                throw new ArgumentNullException("logFactory");

            m_RootConfig = rootConfig;

            m_AppServers = appServers.ToList();

            m_GlobalLog = logFactory.GetLog(this.GetType().Name);

            if (!rootConfig.DisablePerformanceDataCollector)
            {
                m_PerfMonitor = new PerformanceMonitor(rootConfig, m_AppServers, logFactory);
                m_PerfMonitor.Collected += new EventHandler<PermformanceDataEventArgs>(m_PerfMonitor_Collected);
            }

            m_Initialized = true;
        }
        /// <summary>
        /// Initialises an instance of the <see cref="AmqpBuilder"/> class.
        /// </summary>
        /// <param name="logFactory"></param>
        /// <param name="endpointAddress"></param>
        public AmqpBuilder(ILogFactory logFactory, QueueEndpointAddress endpointAddress) : this(logFactory)
        {
            endpointAddress.ShouldNotBeNull();

            m_Connection = BuildConnection(endpointAddress);
            m_EndpointAddress = endpointAddress;
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DefaultBootstrap"/> class.
        /// </summary>
        /// <param name="rootConfig">The root config.</param>
        /// <param name="appServers">The app servers.</param>
        /// <param name="logFactory">The log factory.</param>
        public DefaultBootstrap(IRootConfig rootConfig, IEnumerable<IWorkItem> appServers, ILogFactory logFactory)
        {
            if (rootConfig == null)
                throw new ArgumentNullException("rootConfig");

            if (appServers == null)
                throw new ArgumentNullException("appServers");

            if(!appServers.Any())
                throw new ArgumentException("appServers must have one item at least", "appServers");

            if (logFactory == null)
                throw new ArgumentNullException("logFactory");

            m_RootConfig = rootConfig;

            SetDefaultCulture(rootConfig);

            m_AppServers = appServers.ToList();

            m_GlobalLog = logFactory.GetLog(this.GetType().Name);

            if (!rootConfig.DisablePerformanceDataCollector)
            {
                m_PerfMonitor = new PerformanceMonitor(rootConfig, m_AppServers, logFactory);

                if (m_GlobalLog.IsDebugEnabled)
                    m_GlobalLog.Debug("The PerformanceMonitor has been initialized!");
            }

            if (m_GlobalLog.IsDebugEnabled)
                m_GlobalLog.Debug("The Bootstrap has been initialized!");

            m_Initialized = true;
        }
示例#4
0
 /// <summary>
 /// 指定一个新的日志工厂
 /// </summary>
 /// <param name="factory"></param>
 public static void AssignFactory(ILogFactory factory)
 {
     if (factory == null) {
         throw new ArgumentNullException("factory");
     }
     LogManager.factory = factory;
 }
        /// <summary>
        /// Initialises an instance of the <see cref="AmqpBuilder"/> class.
        /// </summary>
        /// <param name="logFactory"></param>
        /// <param name="endpointAddress"></param>
        /// <param name="closedEventHandler"></param>
        public AmqpBuilder(ILogFactory logFactory, QueueEndpointAddress endpointAddress, EventHandler closedEventHandler) : this(logFactory)
        {
            endpointAddress.ShouldNotBeNull();

            m_Connection = BuildConnection(endpointAddress, closedEventHandler);
            m_EndpointAddress = endpointAddress;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="MessageProcessing"/> class.
        /// </summary>
        /// <param name="receiveMessages">The receive messages.</param>
        /// <param name="messageContextFactory">The message context factory.</param>
        /// <param name="queueWaitFactory">The queue wait factory.</param>
        /// <param name="log">The log.</param>
        /// <param name="processMessage">The process message.</param>
        /// <param name="receivePoisonMessage">The receive poison message.</param>
        /// <param name="rollbackMessage">rolls back a message when an exception occurs</param>
        public MessageProcessing(
            IReceiveMessagesFactory receiveMessages,
            IMessageContextFactory messageContextFactory,
            IQueueWaitFactory queueWaitFactory,
            ILogFactory log,
            ProcessMessage processMessage,
            IReceivePoisonMessage receivePoisonMessage,
            IRollbackMessage rollbackMessage)
        {

            Guard.NotNull(() => receiveMessages, receiveMessages);
            Guard.NotNull(() => messageContextFactory, messageContextFactory);
            Guard.NotNull(() => queueWaitFactory, queueWaitFactory);
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => processMessage, processMessage);
            Guard.NotNull(() => receivePoisonMessage, receivePoisonMessage);
            Guard.NotNull(() => rollbackMessage, rollbackMessage);

            _receiveMessages = receiveMessages.Create();
            _messageContextFactory = messageContextFactory;
            _log = log.Create();
            _processMessage = processMessage;
            _receivePoisonMessage = receivePoisonMessage;
            _rollbackMessage = rollbackMessage;

            _noMessageToProcessBackoffHelper = new Lazy<IQueueWait>(queueWaitFactory.CreateQueueDelay);
            _seriousExceptionProcessBackOffHelper = new Lazy<IQueueWait>(queueWaitFactory.CreateFatalErrorDelay);

        }
 /// <summary>
 /// Initializes a new instance of the <see cref="RedisServerUnixTime" /> class.
 /// </summary>
 /// <param name="timeLua">The time lua.</param>
 /// <param name="log">The log.</param>
 /// <param name="configuration">The configuration.</param>
 public RedisServerUnixTime(TimeLua timeLua,
     ILogFactory log,
     BaseTimeConfiguration configuration): base(log, configuration)
 {
     Guard.NotNull(() => timeLua, timeLua);
     _timeLua = timeLua;
 }
        public Log4NetRemoteLoggingSinkWinService(int remotingPort ,ILogFactory logFactory)
        {
            InitializeComponent();

            _log = logFactory.New(GetType());
            _remotingPort = remotingPort;
        }
示例#9
0
 public SchedulingService()
 {
     _timer = new Timer(TimerCallbackHandler);
     _queue = new IntervalHeap<ScheduledJob>();
     _namedEntries = new HashDictionary<string, JobExecutionWrapper>();
     _logFactory = new DefaultLogFactory();
 }
示例#10
0
 public HttpServer(ILogFactory logFactory, IServiceLocator locator)
 {
     Logger = logFactory.Create("Http server");
     Listener = new HttpListener();
     Listener.IgnoreWriteExceptions = true;
     foreach (string key in ConfigurationManager.AppSettings.Keys)
     {
         if (key.StartsWith("HttpAddress", StringComparison.InvariantCultureIgnoreCase))
             Listener.Prefixes.Add(ConfigurationManager.AppSettings[key]);
     }
     if (Listener.Prefixes.Count == 0)
     {
         Listener.Prefixes.Add("http://*:80/");
         Listener.Prefixes.Add("https://*:443/");
     }
     Routes = new Routes(locator);
     var customAuth = ConfigurationManager.AppSettings["CustomAuth"];
     if (!string.IsNullOrEmpty(customAuth))
     {
         var authType = Type.GetType(customAuth);
         if (!typeof(HttpAuth).IsAssignableFrom(authType))
             throw new ConfigurationErrorsException("Custom auth does not inherit from HttpAuth. Please inherit from " + typeof(HttpAuth).FullName);
         Authentication = locator.Resolve<HttpAuth>(authType);
     }
     else Authentication = locator.Resolve<HttpAuth>();
 }
示例#11
0
 public SessionFactory(IApplication app, IMessageStoreFactory storeFactory, ILogFactory logFactory, IMessageFactory messageFactory)
 {
     application_ = app;
     messageStoreFactory_ = storeFactory;
     logFactory_ = logFactory;
     messageFactory_ = messageFactory ?? new DefaultMessageFactory();
 }
示例#12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HeartBeatWorker" /> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="context">The context.</param>
        /// <param name="sendHeartBeat">The send heart beat.</param>
        /// <param name="threadPool">The thread pool.</param>
        /// <param name="log">The log.</param>
        /// <param name="heartBeatNotificationFactory">The heart beat notification factory.</param>
        public HeartBeatWorker(IHeartBeatConfiguration configuration, 
            IMessageContext context,
            ISendHeartBeat sendHeartBeat,
            IHeartBeatThreadPool threadPool,
            ILogFactory log,
            IWorkerHeartBeatNotificationFactory heartBeatNotificationFactory)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => context, context);
            Guard.NotNull(() => sendHeartBeat, sendHeartBeat);
            Guard.NotNull(() => threadPool, threadPool);
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => heartBeatNotificationFactory, heartBeatNotificationFactory);

            _context = context;
            _checkTimespan = configuration.CheckTime;
            _sendHeartbeat = sendHeartBeat;
            _smartThreadPool = threadPool;
            _logger = log.Create();

            _runningLock = new ReaderWriterLockSlim();
            _stoppedLock = new ReaderWriterLockSlim();

            _cancel = new CancellationTokenSource();
            context.WorkerNotification.HeartBeat = heartBeatNotificationFactory.Create(_cancel.Token);
        }
示例#13
0
        public bool TryGetFactory(out ILogFactory factory, out string errors)
        {
            factory = null;
            errors = null;

            var typeName = ConfigurationManager.AppSettings[CONFIG_KEY];
            if (string.IsNullOrEmpty(typeName))
            {
                errors = "Log assembly not found. Loaded default logger.";
                return false;
            }

            var type = Type.GetType(typeName);
            if (type == null)
            {
                errors = "Type - '{0}' not found.";
                return false;
            }

            factory = Activator.CreateInstance(type) as ILogFactory;
            if (factory == null)
            {
                errors = "Type - '{0}' is not implemented ILogFactory.";
                return false;
            }

            return true;
        }
示例#14
0
 public DirectLogger(ILogFactory loggerFactory)
 {
     _loggerFactory = loggerFactory;
     _logLevel = LogLevel.Debug;
     _name = "unnamed";
     _stopwatch = new Stopwatch();
     _stopwatch.Start();
 }
示例#15
0
 public SocketInitiator(IApplication application, IMessageStoreFactory storeFactory, SessionSettings settings, ILogFactory logFactory, IMessageFactory messageFactory)
     : base(application, storeFactory, settings, logFactory, messageFactory)
 {
     app_ = application;
     storeFactory_ = storeFactory;
     settings_ = settings;
     logFactory_ = logFactory;
 }
示例#16
0
        public MethodLogger(ILogFactory logFactory, IExceptionLogger exceptionLogger)
        {
            Check.IsNotNull(exceptionLogger, "exceptionLogger");
            Check.IsNotNull(logFactory, "logFactory");

            _exceptionLogger = exceptionLogger;
            _logFactory = logFactory;
        }
示例#17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseQueue" /> class.
        /// </summary>
        /// <param name="log">The log.</param>
        protected BaseQueue(ILogFactory log)
        {
            Guard.NotNull(() => log, log);

            Log = log.Create();
            _startedLocker = new ReaderWriterLockSlim();
            _shouldWorkLocker = new ReaderWriterLockSlim();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="MessageExceptionHandler"/> class.
 /// </summary>
 /// <param name="transportErrorHandler">The transport error handler.</param>
 /// <param name="log">The log.</param>
 public MessageExceptionHandler(IReceiveMessagesError transportErrorHandler, 
     ILogFactory log)
 {
     Guard.NotNull(() => transportErrorHandler, transportErrorHandler);
     Guard.NotNull(() => log, log);
     _transportErrorHandler = transportErrorHandler;
     _log = log.Create();
 }
        /// <summary>	Constructor. </summary>
        /// <remarks>	9/2/2011. </remarks>
        /// <param name="logFactory">	The log factory that provides the original . </param>
        /// <param name="application"> The Http Application to log with. </param>
        public ElmahLogFactory(ILogFactory logFactory, HttpApplication application)
        {
            if (null == logFactory) { throw new ArgumentNullException("logFactory"); }
            if (null == application) { throw new ArgumentNullException("application"); }

            this.logFactory = logFactory;
            this.application = application;
        }
示例#20
0
        public Session(
            IApplication app, IMessageStoreFactory storeFactory, SessionID sessID, DataDictionaryProvider dataDictProvider,
            SessionSchedule sessionSchedule, int heartBtInt, ILogFactory logFactory, IMessageFactory msgFactory, string senderDefaultApplVerID)
        {
            this.Application = app;
            this.SessionID = sessID;
            this.DataDictionaryProvider = new DataDictionaryProvider(dataDictProvider);
            this.schedule_ = sessionSchedule;
            this.msgFactory_ = msgFactory;

            this.SenderDefaultApplVerID = senderDefaultApplVerID;

            this.SessionDataDictionary = this.DataDictionaryProvider.GetSessionDataDictionary(this.SessionID.BeginString);
            if (this.SessionID.IsFIXT)
                this.ApplicationDataDictionary = this.DataDictionaryProvider.GetApplicationDataDictionary(this.SenderDefaultApplVerID);
            else
                this.ApplicationDataDictionary = this.SessionDataDictionary;

            ILog log;
            if (null != logFactory)
                log = logFactory.Create(sessID);
            else
                log = new NullLog();

            state_ = new SessionState(log, heartBtInt)
            {
                MessageStore = storeFactory.Create(sessID)
            };

            // Configuration defaults.
            // Will be overridden by the SessionFactory with values in the user's configuration.
            this.PersistMessages = true;
            this.ResetOnDisconnect = false;
            this.SendRedundantResendRequests = false;
            this.ValidateLengthAndChecksum = true;
            this.CheckCompID = true;
            this.MillisecondsInTimeStamp = true;
            this.EnableLastMsgSeqNumProcessed = false;
            this.MaxMessagesInResendRequest = 0;
            this.SendLogoutBeforeTimeoutDisconnect = false;
            this.IgnorePossDupResendRequests = false;
            this.RequiresOrigSendingTime = true;
            this.CheckLatency = true;
            this.MaxLatency = 120;

            if (!IsSessionTime)
                Reset("Out of SessionTime (Session construction)");
            else if (IsNewSession)
                Reset("New session");

            lock (sessions_)
            {
                sessions_[this.SessionID] = this;
            }

            this.Application.OnCreate(this.SessionID);
            this.Log.OnEvent("Created session");
        }
示例#21
0
        /// <summary>
        /// Initializes the specified log factory.
        /// </summary>
        /// <param name="logFactory">The log factory.</param>
        public static void Initialize(ILogFactory logFactory)
        {
            if (m_Initialized)
                throw new Exception("The LogFactoryProvider has been initialized, you cannot initialize it again!");

            m_LogFactory = logFactory;
            GlobalLog = m_LogFactory.GetLog("Global");
            m_Initialized = true;
        }
示例#22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseTime" /> class.
        /// </summary>
        /// <param name="log">The log.</param>
        /// <param name="configuration">The configuration.</param>
        protected BaseTime(ILogFactory log,
            BaseTimeConfiguration configuration)
        {
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => configuration, configuration);

            Configuration = configuration;
            Log = log.Create();
        }
示例#23
0
 /// <summary>
 /// Assigns log factory being used.
 /// </summary>
 /// <param name="logFactory">The log factory.</param>
 /// <exception cref="InvalidOperationException">A factory have already been assigned.</exception>
 public static void Assign(ILogFactory logFactory)
 {
     if (logFactory == _factory)
         return;
     if (_isAssigned)
         throw new InvalidOperationException("A factory have already been assigned.");
     _isAssigned = true;
     _factory = logFactory;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ReceiveMessageQueryDecorator" /> class.
        /// </summary>
        /// <param name="log">The log.</param>
        /// <param name="handler">The handler.</param>
        public DelayedProcessingActionDecorator(ILogFactory log,
            IDelayedProcessingAction handler)
        {
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => handler, handler);

            _log = log.Create();
            _handler = handler;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ReceivePoisonMessageDecorator" /> class.
        /// </summary>
        /// <param name="log">The log.</param>
        /// <param name="handler">The handler.</param>
        public ReceivePoisonMessageDecorator(ILogFactory log,
            IReceivePoisonMessage handler)
        {
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => handler, handler);

            _log = log.Create();
            _handler = handler;
        }
示例#26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SqlServerTime" /> class.
 /// </summary>
 /// <param name="log">The log.</param>
 /// <param name="configuration">The configuration.</param>
 /// <param name="connectionInformation">The connection information.</param>
 /// <param name="dateTimeQueryHandler">The date time query handler.</param>
 public SqlServerTime(ILogFactory log,
     BaseTimeConfiguration configuration,
     IConnectionInformation connectionInformation,
     IQueryHandler<GetUtcDateQuery, DateTime> dateTimeQueryHandler) : base(log, configuration)
 {
     Guard.NotNull(() => connectionInformation, connectionInformation);
     Guard.NotNull(() => dateTimeQueryHandler, dateTimeQueryHandler);
     _queryHandler = dateTimeQueryHandler;
     _connectionInformation = connectionInformation;
 }
示例#27
0
        public SecureListener(IPEndPoint endPoint, X509Certificate2 serverCertificate, Action<MessageExchangeProtocol> protocolHandler, Predicate<string> verifyClientThumbprint, ILogFactory logFactory)
        {
            this.endPoint = endPoint;
            this.serverCertificate = serverCertificate;
            this.protocolHandler = protocolHandler;
            this.verifyClientThumbprint = verifyClientThumbprint;
            this.logFactory = logFactory;

            EnsureCertificateIsValidForListening(serverCertificate);
        }
        /// <summary> Constructor.</summary>
        /// <param name="repository"> The calendar repository. </param>
        /// <param name="keyBuilder"></param>
        /// <param name="logFactory"> The factory instance to use for logging operations. </param>
        public CalendarWebService(ICalendarRepository repository, ICacheKeyBuilder<Guid> keyBuilder, ILogFactory logFactory)
        {
            if (repository == null) throw new ArgumentNullException(nameof(repository));
            if (keyBuilder == null) throw new ArgumentNullException(nameof(keyBuilder));
            if (logFactory == null) throw new ArgumentNullException(nameof(logFactory));

            this.repository = repository;
            this.logFactory = logFactory;
            this.keyBuilder = keyBuilder;
            nullkey = keyBuilder.NullKey.ToString();
        }
示例#29
0
        public CachedEventService(TimeSpan? ttl, ICacheClient client, ICacheKeyBuilder<Guid> keyBuilder, ILogFactory factory)
        {
            if (client == null) throw new ArgumentNullException("client");
            if (keyBuilder == null) throw new ArgumentNullException("keyBuilder");
            if (factory == null) throw new ArgumentNullException("factory");

            this.ttl = ttl;
            this.client = client;
            this.factory = factory;
            this.keyBuilder = keyBuilder;
        }
示例#30
0
        public EventWebService(IEventRepository eventRepository, ICalendarRepository calendarRepository, ICacheKeyBuilder<Guid> keyBuilder, ILogFactory factory)
        {
            if (eventRepository == null) throw new ArgumentNullException("eventRepository");
            if (calendarRepository == null) throw new ArgumentNullException("calendarRepository");
            if (keyBuilder == null) throw new ArgumentNullException("keyBuilder");
            if (factory == null) throw new ArgumentNullException("factory");

            this.calendarRepository = calendarRepository;
            this.factory = factory;
            this.keyBuilder = keyBuilder;
            this.eventRepository = eventRepository;
        }
示例#31
0
 internal MainViewModelFactory(IPinStateService pinStateService, ISettings settings, IApplicationLoader mainApplicationLoader, ILogFactory logFactory, IExceptionHandler exceptionHandler, PropertyChangedEventHandler propertyChangedHandler)
 {
     Ensure.NotNull(pinStateService, "pinStateService");
     Ensure.NotNull(settings, "settings");
     Ensure.NotNull(mainApplicationLoader, "mainApplicationLoader");
     Ensure.NotNull(logFactory, "logFactory");
     Ensure.NotNull(exceptionHandler, "exceptionHandler");
     this.pinStateService        = pinStateService;
     this.settings               = settings;
     this.mainApplicationLoader  = mainApplicationLoader;
     this.logFactory             = logFactory;
     this.exceptionHandler       = exceptionHandler;
     this.propertyChangedHandler = propertyChangedHandler;
 }
示例#32
0
 public static void SetFactory(ILogFactory logFactory)
 {
     _logFactory = logFactory;
 }
 public StartupManager(ILogFactory logFactory)
 {
     _log = logFactory.CreateLog(this);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ClearExpiredMessagesMonitor" /> class.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <param name="clearErrorMessages">The clear messages implementation.</param>
 /// <param name="log">The log.</param>
 public ClearErrorMessagesMonitor(IMessageErrorConfiguration configuration,
                                  IClearErrorMessages clearErrorMessages, ILogFactory log)
     : base(Guard.NotNull(() => clearErrorMessages, clearErrorMessages).ClearMessages, configuration, log)
 {
 }
 public AuditMessageRepository(PostgreSQLContextFactory <AuditMessageContext> contextFactory,
                               ILogFactory logFactory)
 {
     _contextFactory = contextFactory;
     _log            = logFactory.CreateLog(this);
 }
 public ShutdownManager(ILogFactory logFactory, IEnumerable <IStopable> items)
 {
     _log   = logFactory.CreateLog(this);
     _items = items;
 }
示例#37
0
 public SecureListener(IPEndPoint endPoint, X509Certificate2 serverCertificate, Func <MessageExchangeProtocol, Task> protocolHandler, Predicate <string> verifyClientThumbprint, ILogFactory logFactory, Func <string> getFriendlyHtmlPageContent)
     : this(endPoint, serverCertificate, protocolHandler, verifyClientThumbprint, logFactory, getFriendlyHtmlPageContent, () => new Dictionary <string, string>())
 {
 }
示例#38
0
 public AppDomainWorkItemFactoryInfoLoader(IConfigurationSource config, ILogFactory passedInLogFactory)
     : base(config, passedInLogFactory)
 {
     InitliazeValidationAppDomain();
 }
示例#39
0
 private QueueService(ILogFactory logFactory)
 {
     _logger = logFactory.CreateLogger("QueueService");
 }
示例#40
0
 public bool Initialize(Func <IServerConfig, IServerConfig> serverConfigResolver, ILogFactory logFactory)
 {
     throw new NotSupportedException();
 }
示例#41
0
 public bool Initialize(ILogFactory logFactory)
 {
     throw new NotSupportedException();
 }
示例#42
0
 public WelcomeRegulationRuleContoller(IWelcomeRegulationRuleService welcomeRegulationRuleService, ILogFactory logFactory)
 {
     _welcomeRegulationRuleService = welcomeRegulationRuleService;
     _log = logFactory.CreateLog(this);
 }
示例#43
0
 public SecureListener(IPEndPoint endPoint, X509Certificate2 serverCertificate, Func <MessageExchangeProtocol, Task> protocolHandler, Predicate <string> verifyClientThumbprint, ILogFactory logFactory, Func <string> getFriendlyHtmlPageContent, Func <Dictionary <string, string> > getFriendlyHtmlPageHeaders) :
     this(endPoint, serverCertificate, protocolHandler, verifyClientThumbprint, logFactory, getFriendlyHtmlPageContent, getFriendlyHtmlPageHeaders, (clientName, thumbprint) => UnauthorizedClientConnectResponse.BlockConnection)
 {
 }
 public StoredProceduresController(ISqlAdapter sqlAdapter, ILogFactory logFactory)
 {
     _sqlAdapter = sqlAdapter;
     _log        = logFactory.CreateLog(this);
 }
示例#45
0
 public TraceLogAspect(IInvocationLogStringBuilder invocationLogStringBuilder, ILogFactory logFactory)
 {
     _invocationLogStringBuilder = invocationLogStringBuilder;
     _logFactory = logFactory;
 }
示例#46
0
 /// <summary>
 /// Initializes the bootstrap with the configuration
 /// </summary>
 /// <param name="logFactory">The log factory.</param>
 /// <returns></returns>
 public virtual bool Initialize(ILogFactory logFactory)
 {
     return(Initialize(c => c, logFactory));
 }
 public RegulationController(IRegulationService regulationService, ILogFactory logFactory)
 {
     _regulationService = regulationService;
     _log = logFactory.CreateLog(this);
 }
示例#48
0
 public ThreadedSocketAcceptor(IApplication application, IMessageStoreFactory storeFactory, SessionSettings settings, ILogFactory logFactory, IMessageFactory messageFactory)
     : this(new SessionFactory(application, storeFactory, logFactory, messageFactory), settings)
 {
 }
示例#49
0
 public LoadDataJob(CryptoIndexClientManager cryptoIndexClientManager, IDwhClient dwhClient, ILogFactory logFactory)
 {
     _cryptoIndexClientManager = cryptoIndexClientManager;
     _dwhClient = dwhClient;
     _log       = logFactory.CreateLog(this);
     _timer     = new TimerTrigger(nameof(LoadDataJob), TimeSpan.FromMinutes(1), logFactory, DoTimer);
 }
 public TickPricePublisher(ILogFactory logFactory, PublishingSettings settting)
 {
     _settting   = settting;
     _logFactory = logFactory;
     _log        = logFactory.CreateLog(this);
 }
 public TickPricePublisher(RabbitMqSettings settings, ILogFactory logFactory)
 {
     _logFactory = logFactory;
     _settings   = settings;
     _log        = logFactory.CreateLog(this);
 }
 public BoomkatFeedItemService(ILastAlbumsFeedItemHtmlParser lastAlbumsFeedItemHtmlParser,
                               IAlbumsFeedItemHtmlParser albumsFeedItemHtmlParser, IUrlBuilder urlBuilder, ILogFactory logFactory,
                               IWebClient webClient, IBoomkatConfiguration boomkatConfiguration)
 {
     _lastAlbumsFeedItemHtmlParser = lastAlbumsFeedItemHtmlParser;
     _albumsFeedItemHtmlParser     = albumsFeedItemHtmlParser;
     _urlBuilder           = urlBuilder;
     _boomkatConfiguration = boomkatConfiguration;
     _logFactory           = logFactory;
     _webClient            = webClient;
 }
示例#53
0
        /// <summary>
        /// Initializes the bootstrap with the configuration, config resolver and log factory.
        /// </summary>
        /// <param name="serverConfigResolver">The server config resolver.</param>
        /// <param name="logFactory">The log factory.</param>
        /// <returns></returns>
        public virtual bool Initialize(Func <IServerConfig, IServerConfig> serverConfigResolver, ILogFactory logFactory)
        {
            if (m_Initialized)
            {
                throw new Exception("The server had been initialized already, you cannot initialize it again!");
            }

            if (logFactory != null && !string.IsNullOrEmpty(m_Config.LogFactory))
            {
                throw new ArgumentException("You cannot pass in a logFactory parameter, if you have configured a root log factory.", "logFactory");
            }

            IEnumerable <WorkItemFactoryInfo> workItemFactories;

            using (var factoryInfoLoader = GetWorkItemFactoryInfoLoader(m_Config, logFactory))
            {
                var bootstrapLogFactory = factoryInfoLoader.GetBootstrapLogFactory();

                logFactory = bootstrapLogFactory.ExportFactory.CreateExport <ILogFactory>();

                LogFactory  = logFactory;
                m_GlobalLog = logFactory.GetLog(this.GetType().Name);

                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                try
                {
                    workItemFactories = factoryInfoLoader.LoadResult(serverConfigResolver);
                }
                catch (Exception e)
                {
                    if (m_GlobalLog.IsErrorEnabled)
                    {
                        m_GlobalLog.Error(e);
                    }

                    return(false);
                }
            }

            m_AppServers = new List <IWorkItem>(m_Config.Servers.Count());

            IWorkItem serverManager = null;

            //Initialize servers
            foreach (var factoryInfo in workItemFactories)
            {
                IWorkItem appServer;

                try
                {
                    appServer = CreateWorkItemInstance(factoryInfo.ServerType, factoryInfo.StatusInfoMetadata);

                    if (factoryInfo.IsServerManager)
                    {
                        serverManager = appServer;
                    }
                    else if (!(appServer is IsolationAppServer))//No isolation
                    {
                        //In isolation mode, cannot check whether is server manager in the factory info loader
                        if (TypeValidator.IsServerManagerType(appServer.GetType()))
                        {
                            serverManager = appServer;
                        }
                    }

                    if (m_GlobalLog.IsDebugEnabled)
                    {
                        m_GlobalLog.DebugFormat("The server instance {0} has been created!", factoryInfo.Config.Name);
                    }
                }
                catch (Exception e)
                {
                    if (m_GlobalLog.IsErrorEnabled)
                    {
                        m_GlobalLog.Error(string.Format("Failed to create server instance {0}!", factoryInfo.Config.Name), e);
                    }
                    return(false);
                }

                var exceptionSource = appServer as IExceptionSource;

                if (exceptionSource != null)
                {
                    exceptionSource.ExceptionThrown += new EventHandler <ErrorEventArgs>(exceptionSource_ExceptionThrown);
                }


                var setupResult = false;

                try
                {
                    setupResult = SetupWorkItemInstance(appServer, factoryInfo);

                    if (m_GlobalLog.IsDebugEnabled)
                    {
                        m_GlobalLog.DebugFormat("The server instance {0} has been initialized!", appServer.Name);
                    }
                }
                catch (Exception e)
                {
                    m_GlobalLog.Error(e);
                    setupResult = false;
                }

                if (!setupResult)
                {
                    if (m_GlobalLog.IsErrorEnabled)
                    {
                        m_GlobalLog.Error("Failed to setup server instance!");
                    }
                    return(false);
                }

                m_AppServers.Add(appServer);
            }

            if (!m_Config.DisablePerformanceDataCollector)
            {
                m_PerfMonitor = new PerformanceMonitor(m_Config, m_AppServers, serverManager, logFactory);

                if (m_GlobalLog.IsDebugEnabled)
                {
                    m_GlobalLog.Debug("The PerformanceMonitor has been initialized!");
                }
            }

            if (m_GlobalLog.IsDebugEnabled)
            {
                m_GlobalLog.Debug("The Bootstrap has been initialized!");
            }

            try
            {
                RegisterRemotingService();
            }
            catch (Exception e)
            {
                if (m_GlobalLog.IsErrorEnabled)
                {
                    m_GlobalLog.Error("Failed to register remoting access service!", e);
                }

                return(false);
            }

            m_Initialized = true;

            return(true);
        }
示例#54
0
 static LogManager()
 {
     _logFactory = new NullLogFactory();
 }
示例#55
0
        public SecureListener(IPEndPoint endPoint, X509Certificate2 serverCertificate, Action <MessageExchangeProtocol> protocolHandler, Predicate <string> verifyClientThumbprint, ILogFactory logFactory, Func <string> getFriendlyHtmlPageContent, Func <Dictionary <string, string> > getFriendlyHtmlPageHeaders)
            : this(endPoint, serverCertificate, h => Task.Run(() => protocolHandler(h)), verifyClientThumbprint, logFactory, getFriendlyHtmlPageContent, getFriendlyHtmlPageHeaders)

        {
        }
 public ProtobufSerializer(ILogFactory logFactory)
 {
     _serializer = new ResilientBinarySerializer <TMessage>(logFactory, SerializationFormat.ProtoBuf);
 }
示例#57
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DefaultBootstrap"/> class.
        /// </summary>
        /// <param name="rootConfig">The root config.</param>
        /// <param name="appServers">The app servers.</param>
        /// <param name="logFactory">The log factory.</param>
        public DefaultBootstrap(IRootConfig rootConfig, IEnumerable <IWorkItem> appServers, ILogFactory logFactory)
        {
            if (rootConfig == null)
            {
                throw new ArgumentNullException("rootConfig");
            }

            if (appServers == null)
            {
                throw new ArgumentNullException("appServers");
            }

            if (!appServers.Any())
            {
                throw new ArgumentException("appServers must have one item at least", "appServers");
            }

            if (logFactory == null)
            {
                throw new ArgumentNullException("logFactory");
            }

            m_RootConfig = rootConfig;

            SetDefaultCulture(rootConfig);

            m_AppServers = appServers.ToList();

            m_GlobalLog = logFactory.GetLog(this.GetType().Name);

            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            if (!rootConfig.DisablePerformanceDataCollector)
            {
                m_PerfMonitor = new PerformanceMonitor(rootConfig, m_AppServers, null, logFactory);

                if (m_GlobalLog.IsDebugEnabled)
                {
                    m_GlobalLog.Debug("The PerformanceMonitor has been initialized!");
                }
            }

            if (m_GlobalLog.IsDebugEnabled)
            {
                m_GlobalLog.Debug("The Bootstrap has been initialized!");
            }

            m_Initialized = true;
        }
示例#58
0
 public SecureListener(IPEndPoint endPoint, X509Certificate2 serverCertificate, Func <MessageExchangeProtocol, Task> protocolHandler, Predicate <string> verifyClientThumbprint, ILogFactory logFactory, Func <string> getFriendlyHtmlPageContent, Func <Dictionary <string, string> > getFriendlyHtmlPageHeaders, Func <string, string, UnauthorizedClientConnectResponse> unauthorizedClientConnect)
 {
     this.endPoint                   = endPoint;
     this.serverCertificate          = serverCertificate;
     this.protocolHandler            = protocolHandler;
     this.verifyClientThumbprint     = verifyClientThumbprint;
     this.unauthorizedClientConnect  = unauthorizedClientConnect;
     this.logFactory                 = logFactory;
     this.getFriendlyHtmlPageContent = getFriendlyHtmlPageContent;
     this.getFriendlyHtmlPageHeaders = getFriendlyHtmlPageHeaders;
     EnsureCertificateIsValidForListening(serverCertificate);
 }
示例#59
0
 public SmsService(ISmsRepository repository, IMapper mapper, ILogFactory logFactory)
 {
     _repository = repository;
     _mapper     = mapper;
     _log        = logFactory.CreateLog(this);
 }
示例#60
0
 /// <summary>
 /// Gets the work item factory info loader.
 /// </summary>
 /// <param name="config">The config.</param>
 /// <param name="logFactory">The log factory.</param>
 /// <returns></returns>
 internal virtual WorkItemFactoryInfoLoader GetWorkItemFactoryInfoLoader(IConfigurationSource config, ILogFactory logFactory)
 {
     return(new WorkItemFactoryInfoLoader(config, logFactory));
 }