Hi Dasarath,
I have some questions about the BankOne example provided with Kand1.
Precisely  my questions are related to the use case shown.
My understanding is that the use case shown into the example is the
following:
1) There is some business logic already developed after a given interface (
e.g. bankone.BankOne). There is no JTA TX behavior into it.
2) In order to make it transactional (part of WS TX) the original business
logic is wrapped into an implementation class (i.e.
bankone.BankOneSoapBindingImpl) by a developer.
3) This Impl class adds JTA TX behavior to it. At the same time it uses the
so called Bridge (e.g. org.apache.kandula.geronimo.Bridge) that is
responsible to mediate b/n WS TX and the JTA TX contexts, right?
4) bankone.BankOneSoapBindingStub is also created by the developer? or it is
generated somehow? if so how it was generated?
5) At this point we have several classes developed: BankOne, BankOneService,
BankOneSoapBindingImpl and BankOneSoapBindingStub. All these looks to me
very similar to the Remote Proxy Pattern.
6) In addition a service locator is also developed (e.g.
bankone.BankOneServiceLocator) and used by a given client to invoke the
business logic;
7) At the end all this is registered as a WS into the server-config.wsdd and
deployed at a given server.

Something like this is done and for the client of the above mentioned WS.

So, in summary, we need some development in order to reuse an already
developed business logic in order to be a part of WS TX? What if this
business logic is already (internally) demarcated by a JTA TX? Should we
leave it like this so the TX become a Nested JTA TX, part of the one created
into the Impl class (e.g. BankOneSoapBindingImpl). E.g. lets look at
bankone.BankOneDBMS. Only one method is shown for bravity:

...
   public double debit(int accountNo, double amount) {
       if (cache == null)
           throw new IllegalStateException("transaction required.");
       return cache[accountNo] -= amount;
   }
...

Let's suppose that this debit() method do some business logic into a JTA TX.
It becomes as Nested TX for the one demarcated into the
test.BankOneTestSoapBindingImpl:


   private void tx2(BankOne bank) throws RemoteException {
       System.out.println("[BankOneTestSoapBindingImpl] tx2");
       tm.begin();
       bank.credit(0, 50.0);
       bank.debit(1, 50.0);
       tm.commit();
       getBalances(bank);
   }

Will we have atomic behavior in this case? If there is a rollback will the
nested TX will be rolled back too?

Thank you in advance!

Dobri

Reply via email to