[keycloak-dev] KeycloakSession question
ssilvert at redhat.com
Fri Apr 10 11:55:49 EDT 2015
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
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
>> But this only works if we can assume KeycloakSession is short-lived.
>> keycloak-dev mailing list
>> keycloak-dev at lists.jboss.org
More information about the keycloak-dev