refactoring common code for jms container