How to synchronize a java method called by PL/SQL

后端 未结 2 1646
忘了有多久
忘了有多久 2021-01-25 11:52

I just have a problem relative to concurrency whose logic flow is when a client (called Oracle Forms) will submit a request (called concurrent program ) and call a plsql procedu

相关标签:
2条回答
  • 2021-01-25 12:08

    I have no idea how the JVM inside the Oracle DB is implemented, but since (at least in some common configurations) every database connection gets its own server process, then if a separate JVM is embedded into each of those, a synchronized block won't do you much good. You'd need to use database locks.

    0 讨论(0)
  • 2021-01-25 12:12
    1. Assuming that the calls to the Java static method are done within the same classloader, then synchronized is all you need.

    2. Your logging may be faulty. How exactly are you logging?

    3. Your statement about the database lookup being "time consuming" is not convincing. Databases tend to cache data, for example.

    In a nutshell: if, by your definition, an "atomic operation" is a combination of lookup + insert, then you should "synchronize" over both. Acquiring a database lock seems like a reasonable way to go about it.

    0 讨论(0)
提交回复
热议问题