-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from ba-st/improvingTransactionsInRepositories
Improving transactions in repositories
- Loading branch information
Showing
6 changed files
with
186 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
source/Sagan-GemStone-Tests/SemaphorizedGemStoneRepository.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
" | ||
This class is specifically created for testing transaction management in crud services of repostiories | ||
" | ||
Class { | ||
#name : 'SemaphorizedGemStoneRepository', | ||
#superclass : 'GemStoneRepository', | ||
#instVars : [ | ||
'semaphore' | ||
], | ||
#category : 'Sagan-GemStone-Tests', | ||
#package : 'Sagan-GemStone-Tests' | ||
} | ||
|
||
{ #category : 'instance creation' } | ||
SemaphorizedGemStoneRepository class >> checkingConflictsAccordingTo: aConflictCheckingStrategy waitingOn: aSemaphore [ | ||
|
||
^ self new initializeCheckingConflictsAccordingTo: aConflictCheckingStrategy waitingOn: aSemaphore | ||
] | ||
|
||
{ #category : 'initialization' } | ||
SemaphorizedGemStoneRepository >> initializeCheckingConflictsAccordingTo: aConflictCheckingStrategy waitingOn: aSemaphore [ | ||
|
||
self initializeCheckingConflictsAccordingTo: aConflictCheckingStrategy. | ||
semaphore := aSemaphore | ||
] | ||
|
||
{ #category : 'private - management' } | ||
SemaphorizedGemStoneRepository >> synchronize: aDomainObject with: anUpdatedDomainObject [ | ||
|
||
super synchronize: aDomainObject with: anUpdatedDomainObject. | ||
semaphore wait | ||
] |
58 changes: 58 additions & 0 deletions
58
source/Sagan-GemStone-Tests/SemaphorizedGemStoneRepositoryProvider.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
" | ||
This class is specifically created for testing transaction management in crud services of repostiories | ||
" | ||
Class { | ||
#name : 'SemaphorizedGemStoneRepositoryProvider', | ||
#superclass : 'RepositoryProvider', | ||
#instVars : [ | ||
'semaphore' | ||
], | ||
#category : 'Sagan-GemStone-Tests', | ||
#package : 'Sagan-GemStone-Tests' | ||
} | ||
|
||
{ #category : 'instance creation' } | ||
SemaphorizedGemStoneRepositoryProvider class >> waitingOn: aSemaphore [ | ||
|
||
^ self new initializeWaitingOn: aSemaphore | ||
] | ||
|
||
{ #category : 'building' } | ||
SemaphorizedGemStoneRepositoryProvider >> createRepositoryStoringObjectsOfType: aBusinessObjectClass | ||
checkingConflictsAccordingTo: aConflictCheckingStrategy [ | ||
|
||
|
||
^ SemaphorizedGemStoneRepository | ||
checkingConflictsAccordingTo: aConflictCheckingStrategy | ||
waitingOn: semaphore | ||
] | ||
|
||
{ #category : 'controlling' } | ||
SemaphorizedGemStoneRepositoryProvider >> destroyRepositories [ | ||
|
||
IndexManager current removeAllIndexes | ||
] | ||
|
||
{ #category : 'initialization' } | ||
SemaphorizedGemStoneRepositoryProvider >> initializeWaitingOn: aSemaphore [ | ||
|
||
semaphore := aSemaphore | ||
] | ||
|
||
{ #category : 'controlling' } | ||
SemaphorizedGemStoneRepositoryProvider >> prepareForInitialPersistence [ | ||
|
||
|
||
] | ||
|
||
{ #category : 'controlling' } | ||
SemaphorizedGemStoneRepositoryProvider >> prepareForShutDown [ | ||
|
||
|
||
] | ||
|
||
{ #category : 'initialization' } | ||
SemaphorizedGemStoneRepositoryProvider >> reset [ | ||
|
||
|
||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters