On 4/10/2015 10:28 AM, Bill Burke wrote:
KeycloakSession is analogous to an EntityManager in JPA. It only
exists
for the duration of the request. What you'd want is for File-based
storage to queue up writes and flush them when the KeycloakSession is
committed.
That's basically what happens now. The problem is that there is no
concept of individual writes. Every time you write, you must write the
entire model. With each KeycloakSession having its own copy of the
model, one KeycloakSession can overwrite the changes of another.
If you use a single shared in-memory model, you have to wait until
everyone is done writing to it before you can save it to disk. That's
the scheme I outlined below. It sounds like it will work since we know
that each KeycloakSession will end in a timely manner.
On 4/10/2015 9:15 AM, Stan Silvert wrote:
> Is KeycloakSession always short-lived?
>
> If so, it might be relatively easy to make the JSON File based
> persistence more robust and probably fix the cache tests that currently
> fail with it.
>
> All KeycloakSessions would share the same in-memory model. When a
> KeycloakSession ends and requests to write the model to disk, all new
> requests for access to the model are blocked. When all active
> KeycloakSessions are done, we write out the model and unblock the new
> KeycloakSessions.
>
> But this only works if we can assume KeycloakSession is short-lived.
> _______________________________________________
> keycloak-dev mailing list
> keycloak-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/keycloak-dev
>