private static LeaseManagerConfig CreateLeaseManagerConfig(IKernel kernel)
        {
            // Configure the lease manager
            var configRetriever = kernel.Resolve<IGetEnvironmentConfiguration>();
            var leaseManagerConfig = new LeaseManagerConfig { LeaseName = "SampleDataJobs", UniqueId = configRetriever.UniqueInstanceId };
            kernel.ReleaseComponent(configRetriever);

            return leaseManagerConfig;
        }
Esempio n. 2
0
        public LeaseManager(ISession session, TaskCache<string, PreparedStatement> statementCache, LeaseManagerConfig config)
        {
            if (session == null) throw new ArgumentNullException("session");
            if (statementCache == null) throw new ArgumentNullException("statementCache");
            if (config == null) throw new ArgumentNullException("config");
            
            _session = session;
            _statementCache = statementCache;
            _leaseName = config.LeaseName;
            _uniqueId = config.UniqueId;

            // Start by assuming we are not the lease owner
            _leaseOwnerUntil = DateTimeOffset.MinValue;
        }
Esempio n. 3
0
        public LeaseManager(ISession session, TaskCache <string, PreparedStatement> statementCache, LeaseManagerConfig config)
        {
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }
            if (statementCache == null)
            {
                throw new ArgumentNullException("statementCache");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            _session        = session;
            _statementCache = statementCache;
            _leaseName      = config.LeaseName;
            _uniqueId       = config.UniqueId;

            // Start by assuming we are not the lease owner
            _leaseOwnerUntil = DateTimeOffset.MinValue;
        }