Skip to content

Add Code to prevent collision on Repository implementation #8

@alkampfergit

Description

@alkampfergit

We already tested code on a private implementation of Repository to reduce ConcurrencyException. Using a ConcurrentDictinoary we can issue waits if another thread is using the same aggregate.

The idea is, if we have multi thread execution and three threads needs to issue a command on the same aggregate, if all three threads read the Aggregate at the same version, the first one that saves the aggregate will succeed but the other two will fail with a ConcurrencyException.

Before loading the Aggregate, the repository can check if other threads are working with the same Aggreagate and then sleep for a little while reducing the risk of ConcurrencyException.

This is even more useful when ICache will be implemented because avoiding exception will allow for the repository to immediately read from ram the new IMemento resulting from previous save.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions