Free cookie consent management tool by TermsFeed Policy Generator

Changeset 557


Ignore:
Timestamp:
09/12/08 17:36:43 (16 years ago)
Author:
gkronber
Message:

added very coarse grained locking in the Store as a quick fix to support distributed execution model generating engines

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.DB/Store.cs

    r551 r557  
    4141    private string connectionString;
    4242    private SemWeb.Store store;
     43    private object bigLock = new object();
    4344    public Store(string connectionString) {
    44       this.connectionString = connectionString;
    45       store = SemWeb.Store.Create(connectionString);
     45      lock(bigLock) {
     46        this.connectionString = connectionString;
     47        store = SemWeb.Store.Create(connectionString);
     48      }
    4649    }
    4750
    4851    public void Add(Statement statement) {
    49       store.Add(Translate(statement));
     52      lock(bigLock) {
     53        store.Add(Translate(statement));
     54      }
    5055    }
    5156
    5257    public IList<Statement> Select(Statement template) {
    53       SemWeb.SelectResult result = store.Select(Translate(template));
     58      SemWeb.SelectResult result;
     59      lock(bigLock) {
     60        result = store.Select(Translate(template));
     61      }
    5462      List<Statement> r = new List<Statement>();
    5563      foreach(SemWeb.Statement resultStatement in result) {
     
    6068
    6169    public IList<Statement> Select(SelectFilter filter) {
    62       SemWeb.SelectResult result = store.Select(Translate(filter));
     70      SemWeb.SelectResult result;
     71      lock(bigLock) {
     72        result = store.Select(Translate(filter));
     73      }
    6374      List<Statement> r = new List<Statement>();
    6475      foreach(SemWeb.Statement resultStatement in result) {
Note: See TracChangeset for help on using the changeset viewer.