public TableServiceImpl( IReaderWriterLockManager rwLockManager, IThreadLocalManager threadLocalManager) { _tableExprEvaluatorContext = new TableExprEvaluatorContext(threadLocalManager); _rwLockManager = rwLockManager; }
/// <summary> /// Initializes a new instance of the <see cref="ObsoleteConcurrentDictionary<K, V>" /> class. /// </summary> /// <param name="subDictionary">The sub dictionary.</param> /// <param name="rwLockManager">The rw lock manager.</param> public ObsoleteConcurrentDictionary(IDictionary <K, V> subDictionary, IReaderWriterLockManager rwLockManager) { _subDictionary = subDictionary; _rwLock = rwLockManager.CreateLock(GetType()); _rLock = _rwLock.ReadLock; _wLock = _rwLock.WriteLock; }
/// <summary> /// Ctor. /// </summary> /// <param name="specification">configuration</param> /// <param name="runtimeURI">runtime URI</param> /// <param name="rwLockManager">the read-write lock manager</param> public MetricReportingServiceImpl( ConfigurationRuntimeMetricsReporting specification, string runtimeURI, IReaderWriterLockManager rwLockManager) { this.specification = specification; this.runtimeURI = runtimeURI; if (!specification.IsEnableMetricsReporting) { schedule = null; stmtMetricRepository = null; statementMetricHandles = null; metricsExecutor = null; return; } if (specification.IsEnableMetricsReporting) { //MetricUtil.Initialize(); } schedule = new MetricScheduleService(); stmtMetricRepository = new StatementMetricRepository(runtimeURI, specification, rwLockManager); statementGroupExecutions = new LinkedHashMap<string, MetricExecStatement>(); statementMetricHandles = new Dictionary<DeploymentIdNamePair, StatementMetricHandle>(); StatementOutputHooks = new CopyOnWriteArraySet<MetricsStatementResultListener>(); if (specification.IsThreading) { metricsExecutor = new MetricsExecutorThreaded(runtimeURI); } else { metricsExecutor = new MetricsExecutorUnthreaded(); } }
public FilterServiceLockFine( IReaderWriterLockManager rwLockManager, int stageId) : base(new FilterServiceGranularLockFactoryReentrant(rwLockManager), stageId) { _lock = rwLockManager.CreateLock(GetType()); }
/// <summary> /// Ctor. /// </summary> /// <param name="engineURI">engine URI</param> /// <param name="specification">specifies statement groups</param> /// <param name="rwLockManager">The rw lock manager.</param> public StatementMetricRepository( String engineURI, ConfigurationMetricsReporting specification, IReaderWriterLockManager rwLockManager) { _specification = specification; int numGroups = specification.StatementGroups.Count + 1; // +1 for default group (remaining stmts) _groupMetrics = new StatementMetricArray[numGroups]; // default group _groupMetrics[0] = new StatementMetricArray(engineURI, "group-default", 100, false, rwLockManager); // initialize all other groups int countGroups = 1; foreach (var entry in specification.StatementGroups) { ConfigurationMetricsReporting.StmtGroupMetrics config = entry.Value; int initialNumStmts = config.NumStatements; if (initialNumStmts < 10) { initialNumStmts = 10; } _groupMetrics[countGroups] = new StatementMetricArray( engineURI, "group-" + countGroups, initialNumStmts, config.IsReportInactive, rwLockManager); countGroups++; } _statementGroups = new Dictionary <String, int>(); }
public FilterServiceLockCoarse( IReaderWriterLockManager rwLockManager, int stageId) : base(FilterServiceGranularLockFactoryNone.Instance, stageId) { _lock = rwLockManager.CreateLock(GetType()); }
/*======================= PUBLIC ========================================*/ /************************ Events *****************************************/ /************************ Properties *************************************/ /************************ Construction ***********************************/ /*----------------------- ReaderWriterLockFilterAsyncAttribute ----------*/ /// <summary> /// Constructor /// </summary> /// <param name="config"> /// Git configuration object /// </param> /// <param name="gitContext"> /// Git context object /// </param> /// <param name="lockManager"> /// Lock manager /// </param> /// <param name="logger"> /// Logger for the object /// </param> /// <param name="remoteStatusSvc"> /// Service for getting the reference status /// </param> public ReaderWriterLockFilterAsyncAttribute( IReaderWriterLockManager <string> lockManager, ILogger <ReaderWriterLockFilterAsyncAttribute> logger, IGitCacheConfiguration config, IRemoteStatus remoteStatusSvc, IGitContext gitContext) { if (null == (Manager = lockManager)) { throw new ArgumentNullException( nameof(lockManager), "Lock manager must be a valid value"); } if (null == (Logger = logger)) { throw new ArgumentNullException( nameof(logger), "Logger must be a valid value"); } if (null == (Configuration = config)) { throw new ArgumentNullException( nameof(config), "Configuration must be a valid value"); } if (null == (RemoteStatusService = remoteStatusSvc)) { throw new ArgumentNullException( nameof(remoteStatusSvc), "Remote status service must be a valid value"); } if (null == (GitContext = gitContext)) { throw new ArgumentNullException( nameof(gitContext), "A valid git context must be provided"); } } /* End of Function - ReaderWriterLockFilterAsyncAttribute */
public FilterServiceLockFine( ILockManager lockManager, IReaderWriterLockManager rwLockManager, bool allowIsolation) : base(lockManager, new FilterServiceGranularLockFactoryReentrant(rwLockManager), allowIsolation) { _iLock = rwLockManager.CreateLock(GetType()); }
public TableStateInstanceUngroupedImpl( TableMetadata tableMetadata, AgentInstanceContext agentInstanceContext, IReaderWriterLockManager rwLockManager) : base(tableMetadata, agentInstanceContext, rwLockManager) { _eventReference = new Atomic <ObjectArrayBackedEventBean>(null); }
public FilterServiceLockCoarse( ILockManager lockManager, IReaderWriterLockManager rwLockManager, bool allowIsolation) : base(lockManager, FilterServiceGranularLockFactoryNone.Instance, allowIsolation) { _iLock = rwLockManager.CreateLock(GetType()); }
protected TableStateInstance( TableMetadata tableMetadata, AgentInstanceContext agentInstanceContext, IReaderWriterLockManager rwLockManager) { this._tableLevelRWLock = rwLockManager.CreateLock(GetType()); this._tableMetadata = tableMetadata; this._agentInstanceContext = agentInstanceContext; this._indexRepository = new EventTableIndexRepository(tableMetadata.EventTableIndexMetadataRepo); }
/// <summary> Creates an implementation of the FilterEvaluationService interface.</summary> /// <returns> implementation /// </returns> public static FilterServiceSPI NewService( ILockManager lockManager, IReaderWriterLockManager rwLockManager, ConfigurationEngineDefaults.FilterServiceProfile filterServiceProfile, bool allowIsolation) { if (filterServiceProfile == ConfigurationEngineDefaults.FilterServiceProfile.READMOSTLY) { return(new FilterServiceLockCoarse(lockManager, rwLockManager, allowIsolation)); } else { return(new FilterServiceLockFine(lockManager, rwLockManager, allowIsolation)); } }
public SupportIndexTreeBuilderRunnable( EventType eventType, FilterHandleSetNode topNode, IList <FilterSpecActivatable> testFilterSpecs, IList <EventBean> matchedEvents, IList <EventBean> unmatchedEvents, IReaderWriterLockManager rwLockManager) { this.eventType = eventType; this.topNode = topNode; this.testFilterSpecs = testFilterSpecs; this.matchedEvents = matchedEvents; this.unmatchedEvents = unmatchedEvents; this.lockFactory = new FilterServiceGranularLockFactoryReentrant(rwLockManager); }
// Statements ids to remove with the next flush /// <summary> /// Ctor. /// </summary> /// <param name="engineURI">engine URI</param> /// <param name="name">name of statement group</param> /// <param name="initialSize">initial size of array</param> /// <param name="isReportInactive">true to indicate to report on inactive statements</param> /// <param name="rwLockManager">The rw lock manager.</param> public StatementMetricArray( String engineURI, String name, int initialSize, bool isReportInactive, IReaderWriterLockManager rwLockManager) { this.engineURI = engineURI; this.isReportInactive = isReportInactive; metrics = new StatementMetric[initialSize]; statementNames = new String[initialSize]; currentLastElement = -1; rwLock = rwLockManager.CreateLock(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); removedStatementNames = new HashSet <String>(); }
/// <summary> /// Ctor. /// </summary> /// <param name="runtimeUri">runtime URI</param> /// <param name="name">name of statement group</param> /// <param name="initialSize">initial size of array</param> /// <param name="isReportInactive">true to indicate to report on inactive statements</param> /// <param name="lockManager">the lock manager</param> public StatementMetricArray( string runtimeUri, string name, int initialSize, bool isReportInactive, IReaderWriterLockManager lockManager) { this.runtimeURI = runtimeUri; this.isReportInactive = isReportInactive; metrics = new StatementMetric[initialSize]; statementNames = new DeploymentIdNamePair[initialSize]; currentLastElement = -1; RWLock = lockManager.CreateLock(GetType()); //RWLock = new ManagedReadWriteLock("StatementMetricArray-" + name, true); removedStatementNames = new HashSet<DeploymentIdNamePair>(); }
/// <summary> /// Ctor. /// </summary> /// <param name="variableService">variables</param> /// <param name="tableService">The table service.</param> /// <param name="namedWindowMgmtService">The named window MGMT service.</param> /// <param name="lockManager">The lock manager.</param> public StatementVariableRefImpl( VariableService variableService, TableService tableService, NamedWindowMgmtService namedWindowMgmtService, IReaderWriterLockManager lockManager) { _variableToStmt = new Dictionary <String, ICollection <String> >().WithNullSupport(); _stmtToVariable = new Dictionary <String, ICollection <String> >().WithNullSupport(); _mapLock = lockManager.CreateLock(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); _variableService = variableService; _tableService = tableService; _namedWindowMgmtService = namedWindowMgmtService; _configuredVariables = new HashSet <String>(); foreach (var entry in variableService.VariableReadersNonCP) { _configuredVariables.Add(entry.Key); } }
public TableStateInstanceGroupedImpl( TableMetadata tableMetadata, AgentInstanceContext agentInstanceContext, IReaderWriterLockManager rwLockManager) : base(tableMetadata, agentInstanceContext, rwLockManager) { IList <EventPropertyGetter> indexGetters = new List <EventPropertyGetter>(); IList <string> keyNames = new List <string>(); foreach (var entry in tableMetadata.TableColumns) { if (entry.Value.IsKey) { keyNames.Add(entry.Key); indexGetters.Add(tableMetadata.InternalEventType.GetGetter(entry.Key)); } } var tableName = "primary-" + tableMetadata.TableName; var organization = new EventTableOrganization(tableName, true, false, 0, Collections.GetEmptyList <string>(), EventTableOrganizationType.HASH); EventTable table; if (indexGetters.Count == 1) { var tableMap = new TransformDictionary <object, EventBean, object, ObjectArrayBackedEventBean>( _rows, k => k, v => v, k => k, v => v as ObjectArrayBackedEventBean); table = new PropertyIndexedEventTableSingleUnique(indexGetters[0], organization, tableMap); } else { var getters = indexGetters.ToArrayOrNull(); var tableMap = new TransformDictionary <MultiKeyUntyped, EventBean, object, ObjectArrayBackedEventBean>( _rows, k => k as MultiKeyUntyped, v => v, k => k, v => v as ObjectArrayBackedEventBean); table = new PropertyIndexedEventTableUnique(getters, organization, tableMap); } var pair = TableServiceUtil.GetIndexMultikeyForKeys(tableMetadata.TableColumns, tableMetadata.InternalEventType); _primaryIndexKey = pair.Second; _indexRepository.AddIndex(_primaryIndexKey, new EventTableIndexRepositoryEntry(tableName, table)); }
/// <summary> /// Ctor. /// </summary> /// <param name="specification">configuration</param> /// <param name="engineUri">engine URI</param> /// <param name="rwLockManager">The rw lock manager.</param> public MetricReportingServiceImpl( ConfigurationMetricsReporting specification, String engineUri, IReaderWriterLockManager rwLockManager) { _specification = specification; _engineUri = engineUri; _schedule = new MetricScheduleService(); _stmtMetricRepository = new StatementMetricRepository(engineUri, specification, rwLockManager); _statementGroupExecutions = new LinkedHashMap <String, MetricExecStatement>(); _statementMetricHandles = new Dictionary <String, StatementMetricHandle>(); StatementOutputHooks = new CopyOnWriteArraySet <StatementResultListener>(); if (specification.IsThreading) { _metricsExecutor = new MetricsExecutorThreaded(engineUri); } else { _metricsExecutor = new MetricsExecutorUnthreaded(); } }
/// <summary> /// Ctor. /// </summary> /// <param name="runtimeUri">runtime URI</param> /// <param name="specification">specifies statement groups</param> /// <param name="rwLockManager">the lock manager</param> public StatementMetricRepository( string runtimeUri, ConfigurationRuntimeMetricsReporting specification, IReaderWriterLockManager rwLockManager) { this.specification = specification; var numGroups = specification.StatementGroups.Count + 1; // +1 for default group (remaining stmts) groupMetrics = new StatementMetricArray[numGroups]; // default group groupMetrics[0] = new StatementMetricArray( runtimeUri, "group-default", 100, false, rwLockManager); // initialize all other groups var countGroups = 1; foreach (var entry in specification.StatementGroups) { var config = entry.Value; var initialNumStmts = config.NumStatements; if (initialNumStmts < 10) { initialNumStmts = 10; } groupMetrics[countGroups] = new StatementMetricArray( runtimeUri, "group-" + countGroups, initialNumStmts, config.IsReportInactive, rwLockManager); countGroups++; } statementGroups = new Dictionary<DeploymentIdNamePair, int>(); }
/// <summary>Ctor. </summary> public StatementEventTypeRefImpl(IReaderWriterLockManager lockManager) { _typeToStmt = new Dictionary <String, ICollection <String> >(); _stmtToType = new Dictionary <String, String[]>(); _mapLock = lockManager.CreateLock(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); }
public StatementLockFactoryImpl(IReaderWriterLockManager lockManager, bool fairlocks, bool disableLocking) { _lockManager = lockManager; _fairlocks = fairlocks; _disableLocking = disableLocking; }
public FilterServiceGranularLockFactoryReentrant(IReaderWriterLockManager rwLockManager) { _rwLockManager = rwLockManager; }
/// <summary>Ctor, assigns default name. </summary> protected BaseSubscription(IReaderWriterLockManager rwLockManager) { SubscriptionName = "default"; }