ResourceManagerImpl constructor
ResourceManagerImpl({
- Limiter? limiter,
Implementation
ResourceManagerImpl({Limiter? limiter}) : _limiter = limiter ?? FixedLimiter() {
_systemScope = SystemScopeImpl(_limiter.getSystemLimits(), 'system');
_systemScope.incRef(); // System scope is always active
_transientScope = TransientScopeImpl(
_limiter.getTransientLimits(),
'transient',
edges: [_systemScope], // Transient is a child of System
);
_transientScope.incRef(); // Transient scope is always active
// TODO: Initialize allowlisted scopes
// _allowlistedSystemScope = ResourceScopeImpl(_limiter.getAllowlistedSystemLimits(), 'allowlistedSystem');
// _allowlistedSystemScope.incRef();
// _allowlistedTransientScope = ResourceScopeImpl(
// _limiter.getAllowlistedTransientLimits(),
// 'allowlistedTransient',
// edges: [_allowlistedSystemScope],
// );
// _allowlistedTransientScope.incRef();
_startGarbageCollector();
_logger.fine('ResourceManager initialized.');
}