Hi I have a problem with create method. I have many complex solutions but none simple
What I want to do (am doing) is I have a map in data class
containing deleted rows. In create method I check if there are any rows which I can reuse. If there are, I take one. If not I extend a database size. I lock a record create it and unlock it. I decided to allow only one
creation thread at a time - method is synchronized on createMutex object.
Here comes a problem - I dont want to use this createMutex. But if I will not use this there can be a problem when there are no row ids to be reused.
Both threads will extend a database. If second will start writting first it will write far outside the file and exception will be thrown. Anybody has idea how to avoid this problem?