Example usage for org.springframework.jms.connection JmsResourceHolder containsSession

List of usage examples for org.springframework.jms.connection JmsResourceHolder containsSession

Introduction

In this page you can find the example usage for org.springframework.jms.connection JmsResourceHolder containsSession.

Prototype

public boolean containsSession(Session session) 

Source Link

Document

Determine whether the given Session is registered with this resource holder.

Usage

From source file:org.springframework.jms.connection.ConnectionFactoryUtils.java

/**
 * Determine whether the given JMS Session is transactional, that is,
 * bound to the current thread by Spring's transaction facilities.
 * @param session the JMS Session to check
 * @param cf the JMS ConnectionFactory that the Session originated from
 * @return whether the Session is transactional
 *///from www .  j  ava2  s  .  c o m
public static boolean isSessionTransactional(@Nullable Session session, @Nullable ConnectionFactory cf) {
    if (session == null || cf == null) {
        return false;
    }
    JmsResourceHolder resourceHolder = (JmsResourceHolder) TransactionSynchronizationManager.getResource(cf);
    return (resourceHolder != null && resourceHolder.containsSession(session));
}