class SubscriptionDelegate {

    synchronized Publisher getPublisher(NotificationSubscriptionContext subscriptionContext) {
        // System.out.println("********** BRANO ****** session hashcode" + transactionManager.getSessionFactory().getCurrentSession().hashCode());
        // TODO: NOT THREAD_SAFE !!!!!! find/check null => Publisher NOT per Identity => NOT THREAD SAFE

        Publisher publisher = publisherDao.findPublisher(subscriptionContext.getContextId(), subscriptionContext.getContextType(), subscriptionContext.getSourceId(),
                subscriptionContext.getSourceType());
        if (publisher == null) {
            // System.out.println("getPublisher - found NOTHING!, so call createAndSavePublisher");
            publisher = publisherDao.createAndSavePublisher(subscriptionContext.getContextId(), subscriptionContext.getContextType(), subscriptionContext.getSourceId(),
                    subscriptionContext.getSourceType(), subscriptionContext.getSubcontextId());
        }
        return publisher;
    }

}