Pessimistic write issue

I have a code which acquires a Pessimistic write lock for a given criteria present on the source code below.There are many workers requesting the Web API for obtaining the resource, and I am using pessimistic write to achieve concurrency. IT works fine with MYSQL , but in case of Oracle, it doesnot work. COuld you please guid me how can I achieve this in Oracle DB.