There’s an easy solution to your problem, and a right solution to your problem.
First the easy one, but please, consider the right one too.
The easiest thing to do is to spawn a thread whenever you receive a transaction.
Imagine you create a little class like this:
protected class Process implements Runnable {
ISOSource source;
ISOMsg m;
Process (ISOSource source, ISOMsg m) {
super();
this.source = source;
this.m = m;
}
public void run () {
...
...
Implement your logic here
...
...
}
}
So your process method can be something like this:
public boolean process (ISOSource source, ISOMsg m) {
new Thread(new Process(source,m)).start();
return true;
}
You can also use a ThreadPool if you want to put a cap in the number of threads, you’d call pool.execute(new Process (source, m));
.
But a better solution is to use the TransactionManager, where you can control the number of sessions and get useful information about the time spent in each participant. When using the TransactionManager, your ISORequestListener just creates a context, places the ISOSource and ISOMsg in it and hands off the context to the TM so it can be processed there.
I suggest you join one of the free webinars provided by Transactility every other Friday (http://www.transactility.com/contact), there you can get additional information on how to use the TM and please believe me, you’ll be tempted to implement the solution mentioned above, it’s the easy one, but once your system start growing, the increased load will be a problem. The TransactionManager will be your friend.
--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+unsubscribe@googlegroups.com.
To post to this group, send email to jpos-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CABm7V61QBhdeo_iWoV6Bem2a0su0s7KmG-%3Ds1nYLSGo_hG-zrw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAgSK%3DkXrsfCHFgrX9%3Dger_fABUN323xRQLAK7NkreuqurgTpg%40mail.gmail.com.