示例#1
0
        /// <inheritdoc />
        protected override async Task <BoolResult> PreStartupAsync(Context context)
        {
            var contentStore = ContentStore as IAcquireDirectoryLock;

            if (contentStore != null)
            {
                var acquireLockResult = await contentStore.AcquireDirectoryLockAsync(context);

                if (!acquireLockResult.Succeeded)
                {
                    return(acquireLockResult);
                }
            }

            if (MemoizationStore is IAcquireDirectoryLock memoizationStore)
            {
                var acquireLockResult = await memoizationStore.AcquireDirectoryLockAsync(context);

                if (!acquireLockResult.Succeeded)
                {
                    if (contentStore != null)
                    {
                        ContentStore?.Dispose(); // Dispose to release the content store's directory lock.
                    }

                    return(acquireLockResult);
                }
            }

            return(BoolResult.Success);
        }
示例#2
0
 protected override void DisposeCore()
 {
     MemoizationStore?.Dispose();
     ContentStore?.Dispose();
 }