Resolved the syncronization issue of concurrent requests protecting the critical section with:
synchronized method createMapping();
lock file.
Synchronized method ensures that threads running on the same pep-server enter the critical section one at a time; lock file ensure mutual exclusion between thread of different pep-server.
Now, the workflow basically is:
If the subject identifier file doesn't exist:
call createMapping();
in this function, try to get the lock;
if lock file already exist, the thread wait, because another thread is in the critical section;
got the lock, recheck subject identifier file: if already exists (another thread has created the mapping while this thread is waiting), go ahead, otherwise, create the mapping;
if hardlink count is correct, release the lock and return the account name;
Fix for: https://github.com/argus-authz/argus-pep-server/issues/3.
Resolved the syncronization issue of concurrent requests protecting the critical section with:
Synchronized method ensures that threads running on the same pep-server enter the critical section one at a time; lock file ensure mutual exclusion between thread of different pep-server.
Now, the workflow basically is: