How to implement synchronized methods/classes in webmethods Java service

Hello,
We have a method in a java service which creates NDM node objects to initiate the file transfer to another host.
The current design we have is multi-threaded, which means multiple threads will invoke this java service to created the NDM node.

Problem we have is if the first host has instantiated the NDM object, and if its still active - when another host is trying to instantiated the same object - object initialisation is failing for the second host.

We are thinking to implement the create Node java method as synchronized to rectify this issue, but we are unable to do so. However we are able to do this POC test in actual java project (outside webmethods!).

If anyone has any pointers on how can we implement this in webmethods java service, that would be really helpful!!