Tuesday, August 21, 2012

Sequence diagram tool on ubuntu

Web is amazing, I was trying to find some good tool to create sequence diagrams on ubuntu as my writing is awful and fortunately landed onto http://www.websequencediagrams.com/

All you need to do is write some text in the left pane like

UI->Jersey:Invoke Rest api
Jersey->Spring:Spawn a transaction

and it would generate an image for you in right pane.

Kudos to the guy who created it.

Friday, August 17, 2012

Spring query timeout or transaction timeout

If you are using spring to manage transactions then you can specify default transaction timeout using

    <bean id="transactionManager"
        <property name="dataSource" ref="dataSource" />
        <property name="defaultTimeout" value="30" /> <!--30 sec--->             

or you can override the timeout in the annotation

    @Transactional(readOnly = false, timeout=30)

or if you are doing it programatic transactions then you can do

DataSourceTransactionManager transactionManager = new DataSourceTransactionManager(dataSource);

 or you can override the timeout for one particular transaction

TransactionTemplate transactionTemplate = new TransactionTemplate();