scheduled tasks - How to use multiple java programs running on different machine accessing same table without getting deadlock -


i have java program running on different machines. in program have used scheduler inserts , updates table in database. how should handle program dead lock doesn't occur in future because may happen program in both machine try update table @ same time or if 1 updating table , if other tries access table since being used program on different machine may become slow.

please note same program running on different machines..

i thought of using synchronization since programs on different machine , there no need use synchronization here.

what logic should used?

you can't deadlock 1 resource being locked. deadlock requires 2 or more resources , inconsistent locking order. long have 1 table, or multiple tables locks in same order, you're ok.


Comments