<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<div><br></div><div>As there is a high community demand for having these operations in place, and most of these are targeted for post 5.1 releases, I thought about a workaround for having this functionality in place.&nbsp;</div><div>I hijacked Hotrod's put operation and added a custom interceptor, so that if a certain object is being "put" into remote cache, the server side interceptor jumps in and runs transactions.</div><div>This doesn't look too bad for the user, e.g. for supporting transactions:</div><div><br></div><div><meta charset="utf-8"><span class="Apple-style-span" style="font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 19px; "><pre style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 6px; padding-right: 10px; padding-bottom: 6px; padding-left: 10px; font: normal normal normal 12px/normal 'Bitstream Vera Sans Mono', Courier, monospace; background-color: rgb(248, 248, 248); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); font-size: 13px; line-height: 19px; overflow-x: auto; overflow-y: auto; border-top-left-radius: 3px 3px; border-top-right-radius: 3px 3px; border-bottom-right-radius: 3px 3px; border-bottom-left-radius: 3px 3px; "><code style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 12px/normal 'Bitstream Vera Sans Mono', Courier, monospace; background-color: transparent; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-top-color: rgb(222, 222, 222); border-right-color: rgb(222, 222, 222); border-bottom-color: rgb(222, 222, 222); border-left-color: rgb(222, 222, 222); font-size: 13px; border-top-left-radius: 3px 3px; border-top-right-radius: 3px 3px; border-bottom-right-radius: 3px 3px; border-bottom-left-radius: 3px 3px; border-width: initial; border-color: initial; ">RemoteCache rc = getRemoteCache();//from somewhere...

//this is what we'll use for running remote transactions over hotrod
BatchEnabledRemoteCache berc = new BatchEnabledRemoteCache(rc);

berc.startBatch(); //everything from here to endBatch call is a single transaction
berc.put("k", "v1");
berc.put("k2", "v2");
berc.put("k3", "v3");
berc.endBatch(true); // all or nothing!
</code></pre><div><code style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 12px/normal 'Bitstream Vera Sans Mono', Courier, monospace; background-color: transparent; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-top-color: rgb(222, 222, 222); border-right-color: rgb(222, 222, 222); border-bottom-color: rgb(222, 222, 222); border-left-color: rgb(222, 222, 222); font-size: 13px; border-top-left-radius: 3px 3px; border-top-right-radius: 3px 3px; border-bottom-right-radius: 3px 3px; border-bottom-left-radius: 3px 3px; border-width: initial; border-color: initial; "><br></code></div><div><font class="Apple-style-span" face="'Bitstream Vera Sans Mono', Courier, monospace" size="3"><span class="Apple-style-span" style="font-size: 13px; line-height: normal;"><br></span></font></div><div><font class="Apple-style-span" face="'Bitstream Vera Sans Mono', Courier, monospace" size="3"><span class="Apple-style-span" style="font-size: 13px; line-height: normal;"><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; ">Of course this won't work with other clients than the java client, but I think most of our users are using that one ATM.&nbsp;</span></span></font></div><div><font class="Apple-style-span" face="'Bitstream Vera Sans Mono', Courier, monospace" size="3"><span class="Apple-style-span" style="font-size: 13px; line-height: normal;"><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; ">Currently there's only support for transactions but this approach (and the code) can be easily extended to mapreduce and querying.&nbsp;</span></span></font></div><div><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="line-height: normal; font-size: medium;">I added s short description on how this can be used [1], also the source code is available here[2].</span></font></div><div><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="line-height: normal; font-size: medium;"><br></span></font></div><div><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="line-height: normal; font-size: medium;">What do you think about it? Is it worth suggesting to the users this approach(and possibly the code as well)?</span></font></div><div><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="line-height: normal; font-size: medium;"><br></span></font></div><div><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="line-height: normal; font-size: medium;">Cheers,</span></font></div><div><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="line-height: normal; font-size: medium;">Mircea</span></font></div><div><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="line-height: normal; font-size: medium;"><br></span></font></div><div><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="line-height: normal; font-size: medium;">[1]&nbsp;</span></font><a href="https://github.com/mmarkus/ops_over_hotrod/wiki/Usage-guide">https://github.com/mmarkus/ops_over_hotrod/wiki/Usage-guide</a></div><div><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="line-height: normal; font-size: medium;">[2]</span></font><a href="https://github.com/mmarkus/ops_over_hotrod">https://github.com/mmarkus/ops_over_hotrod</a></div></span></div></body></html>