Hello,
We encountered a problem while using idbroker with more than one JVM. We
needed to add a behavior for synchronizing the different JVMs when they
receive the same id "block" from the database, for that a common code
was needed. So instead of modifying the Torque code, the cleanest
solution we found to achieve this goal was to do the following things:
1. Create a new BasePeer class of our own, with the required algorithms
in doInsert.
2. Modify the schema xml and add a basePeer property pointing to the new
BasePeer class.
3. Create a torque-gen-extension.jar file with one file: "om/Peer.vm"
with the modified lines:
3.1 Wherever there was a direct reference to "BasePeer" in Peer.jm,
it was replaced by "${table.BasePeer}", e.g.
return BasePeer.doInsert(criteria, con); >> return
${table.BasePeer}.doInsert(criteria, con);
4. Regenerate Base... and Base...Peer files using the ant-script.
[REMARK: The common code currently just catches the double second id
assignment and asks for a new id. This is not yet a smart notification.
The best thing I would have liked to do was to ask idbroker for a new
"block" of IDs, but this currently is unavailable. The only option is to
ask for MAX_INT ids (which will definitely switch to the next block),
but the next call will ask for yet another block which leads to increase
in QUANTITY, and upon several of those, the value of QUANTITY is fairly
huge].
I wanted to know if there are any suggestions / comments for this. And
if there are no big no-nos, is it possible to integrate this new
behavior in a next version of Torque (in torque-gen-X.X.X.jar)?
Sincerely,
Tal Kramer
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]