By default, a Java code, which is imported and invoked from XQuery, function will be executed in parallel with other code. However, if a Java function performs sensitive write operations, it is advisable to explicitly lock the code. This can be realized via locking annotations: