• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

My exam cloud, mock 3, transaction for the addTransfer method and etc  RSS feed

 
Ranch Hand
Posts: 1732
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


...Each transfer needs a unique ID for tracking purpose. The unique ID is generated by an existing system which is also
used by other applications. For performance reasons, the transaction that gets the unique ID should be as short as possible.
The scenario is implemented in four steps which are implemented in four business methods in a CMT session bean:
1. checkGoods - Checks goods in a database
2. getUniqeId - Retrieve the unique ID
3. checkAmount -Checks  the amount in a non-transactional system
4. storeTransfer - Stores the transfer in a database as part of the calling transaction.

These methods are called by the addTransfer method of a second CMT session bean in the following order:
checkGoods, getUniqueId, checkAmount, storeTransfer
Assuming no other transaction-related metadata, which is the correct set of transaction, attributes for the methods in the session
beans?
A.
0.addTransfer - Required
1.checkGoods  - Required
2.getUniqueId - Required_New
3.checkAmoutns - Not_Supported
4.storeTransfer - Mandatory

B.
0.addTransfer - Required
1.checkGoods  - Required
2.getUniqueId -Required
3.checkAmoutns - required
4. storeTransfer  - required

C
0.addTransfer - required
1.checkGoods  - Required
2.getUniqueId - Required_New
3.checkAmount - Never
4.storeTransfer - Mandatory

D.
0.addTransfer - Not_Supported
1. checkGoods - Required
2. getUniqueId - Required
3. checkAmounts -Not_Supported
4. storeTransfer - Mandatory

Answer A.

Explanation:
The unique  ID is generated by an existing system which is also used by other applications. For performance reasons,
the transaction that gets the unique ID should be as short as possible.
So, we should use REQUIRES_NEW finish the method as short as possible.



The question specified that getUniqueId should be done as soon as possible for higher performance. But the suggested solution is to use REQUIRES_NEW for getUniqueId().
When this getUniqueId is run in a new transaction, the overhead to create that new transaction is high and may affect the performance.
So, I think getUniquedId should use REQUIRED, SUPPORTS or even NOT_SUPPORTED.  If it uses REQUIRED OR SUPPORTS, it will be run in the transaction of addTransfer.
If it uses NOT_SUPPORTED, it will run in a non-transactional context.

Since getUniqueId is used for getting the id, not committing any data , it is fine to run it in a non-transactional context.
 
Creator of Enthuware JWS+ V6
Posts: 3272
296
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem statement clearly says "the transaction that gets the unique ID should be as short as possible" which means it can only be REQUIRES_NEW (is the mock realy using required_new??).
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!