SailPoint generating the same employee id for contractors

Hi,
We have create contractor functionality in SailPoint which used a custom form to get all the details of a contractor and then uses a custom workflow to create a identity in SailPoint. Now if we create 2 contractors one by one and approve them at the same time within a second then it is creating same employee id in SailPoint which is leading to failure of one of the request. The logic for employee id generation is purely a java code which check the last employee id generated and increments it by one every time.

Kindly let us know why this is happening.

Regards,
Mahesh

This is most likely due to a concurrency issue. You might want to try putting your Java code inside of a “synchronized” block or method so that it can only be accessed by a single thread at a time:

https://docs.oracle.com/javase/tutorial/essential/concurrency/syncmeth.html