Skip to content
This repository was archived by the owner on Dec 9, 2021. It is now read-only.

Commit 903cd1e

Browse files
committed
Fixed compression thread lock in FileSystemBlockService
1 parent 729de89 commit 903cd1e

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/cloudb-nunit/Deveel.Data/ShardedDataTestBase.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected virtual IDatabase CreateDatabase() {
3737
if (storeType == StoreType.FileSystem) {
3838
string testPath = TestPath;
3939
if (Directory.Exists(testPath))
40-
Directory.Delete(testPath);
40+
Directory.Delete(testPath, true);
4141

4242
Directory.CreateDirectory(testPath);
4343
return new FileSystemDatabase(testPath);

src/cloudb-nunit/cloudb-nunit.csproj

+6-3
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@
6565
<SpecificVersion>False</SpecificVersion>
6666
<HintPath>..\packages\cloudb.1.5.4.2\lib\net20\cloudb.dll</HintPath>
6767
</Reference>
68-
<Reference Include="cloudb-service">
69-
<HintPath>..\packages\cloudb-service.8.1.0\lib\net20\cloudb-service.dll</HintPath>
70-
</Reference>
7168
<Reference Include="nunit.framework, Version=2.6.3.13283, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
7269
<SpecificVersion>False</SpecificVersion>
7370
<HintPath>..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
@@ -121,6 +118,12 @@
121118
<ItemGroup>
122119
<None Include="Deveel.Data.Net\ChangeLog" />
123120
</ItemGroup>
121+
<ItemGroup>
122+
<ProjectReference Include="..\cloudb-service\cloudb-service.csproj">
123+
<Project>{682fa6a5-8786-4b75-bc04-df35267d80de}</Project>
124+
<Name>cloudb-service</Name>
125+
</ProjectReference>
126+
</ItemGroup>
124127
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
125128
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
126129
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />

src/cloudb-service/Deveel.Data.Net/FileSystemBlockService.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,13 @@ public override void Complete() {
235235

236236
private class CompressionThread {
237237
private readonly FileSystemBlockService service;
238-
private readonly Thread thread;
239238
private bool finished;
240239
private bool hasFinished;
241240

242241
public CompressionThread(FileSystemBlockService service) {
243242
this.service = service;
244243

245-
thread = new Thread(Execute);
244+
var thread = new Thread(Execute);
246245
thread.IsBackground = true;
247246
thread.Name = "BlockService::Compression";
248247
thread.Start();
@@ -267,7 +266,7 @@ private void Execute() {
267266
lock (this) {
268267

269268
// Wait 2 seconds,
270-
Monitor.Wait(2000);
269+
Monitor.Wait(this, 2000);
271270

272271
// Any new block containers added, we need to process,
273272
List<BlockContainer> newItems = new List<BlockContainer>();

0 commit comments

Comments
 (0)