Comments (2)
SendResponse
does its main job in the "closing phase" of the two-phase commit protocol.
That could be either a commit
or abort
.
It's good to do it there (and to allow it to happen even if a previous participant aborted it) because that's when you have enough information to create your response.
I don't know what you're doing in your TriggerMerchantBlockCacheReload
.
If it's not related to the transaction, maybe you can choose to
- do the work also during commit/abort (instead of prepare)
- do the work asynchronously, for example by preparing some work payload and sending it to a queue from where a "TriggerMerchantBlockWhatever"
QBean
will be reading in its own thread and doing the work in a concurrent thread, after the transaction has happened.
from jpos-ee.
Thanks for responding @barspi
Could the identical code in commit and abort be moved to prepare and call prepare from abort and remove the commit call?
Option 2 was my backup though the long running participant is ideally part of the transaction :)
Suggestion
public int prepare(long id, Serializable context) {
sendHTTPResponse(context);
return PREPARED | READONLY;
}
protected void sendHTTPResponse(Serializable context) {
Context ctx = (Context) context;
ChannelHandlerContext ch = ctx.get(SESSION);
FullHttpRequest request = ctx.get(REQUEST);
FullHttpResponse response = getResponse(ctx);
sendResponse(ctx, ch, request, response);
}
@Override
public void abort(long id, Serializable context) {
sendHTTPResponse(context);
}
// don't call it in commit
from jpos-ee.
Related Issues (20)
- Incapable of initializing JVM because of ExplicitGCInvokesConcurrentAndUnloadsClasses HOT 3
- Database dependent issue in getBalances (run tests on postgres) HOT 3
- Postgresql tests for minigl? HOT 1
- Elasticsearch module - is not working async HOT 1
- Jpos hangs on response 204
- Balance cache is not created till reaches the safe window HOT 2
- Status hbm references non existent status column from SysLog HOT 4
- Unable to create slave databases in windows environment HOT 4
- Change visibility of ChannelMonitor's cfg and servicename to protected HOT 2
- Change DTD used from the SourceForge one to the hibernate one HOT 4
- Use try with resource to close Socket in Ping.java
- Use try with resource to close FileReader in DB.java
- Make the Debug participant extend the doPrepare(...) method to get profile dump the debug participant's timing info HOT 4
- QRest - handle headers greater than 8192 bytes (default)
- Consider upgrading Jetty to 10.x or 11.x
- A lot of check methods are not going through the entire list of params for validation HOT 3
- Let DB properties be loaded from resource path
- Logback 1.3.x is for java 8 and 1.4.x is for java 11 HOT 2
- [QREST] Make the txn mgr space timeout per route
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jpos-ee.