Class ConnectionFactoryContextWrapper


  • public class ConnectionFactoryContextWrapper
    extends java.lang.Object
    Helper class to handle ConnectionFactory context binding and unbinding when executing instructions.
    Since:
    2.3
    Author:
    Wander Costa, Artem Bilan
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> T call​(java.lang.String contextName, java.util.concurrent.Callable<T> callable)
      Execute a Callable binding the given ConnectionFactory and finally unbinding it.
      <T> T call​(java.util.concurrent.Callable<T> callable)
      Execute a Callable binding to the default ConnectionFactory and finally unbinding it.
      void run​(java.lang.Runnable runnable)
      Execute a Runnable binding to the default ConnectionFactory and finally unbinding it.
      void run​(java.lang.String contextName, java.lang.Runnable runnable)
      Execute a Runnable binding the given ConnectionFactory and finally unbinding it.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConnectionFactoryContextWrapper

        public ConnectionFactoryContextWrapper​(ConnectionFactory connectionFactory)
    • Method Detail

      • call

        public <T> T call​(java.util.concurrent.Callable<T> callable)
        Execute a Callable binding to the default ConnectionFactory and finally unbinding it.
        Type Parameters:
        T - the return type.
        Parameters:
        callable - the Callable object to be executed.
        Returns:
        the result of the Callable.
      • call

        public <T> T call​(@Nullable
                          java.lang.String contextName,
                          java.util.concurrent.Callable<T> callable)
        Execute a Callable binding the given ConnectionFactory and finally unbinding it.
        Type Parameters:
        T - the return type.
        Parameters:
        contextName - the name of the context. In null, empty or blank, default context is bound.
        callable - the Callable object to be executed.
        Returns:
        the result of the Callable.
      • run

        public void run​(java.lang.Runnable runnable)
        Execute a Runnable binding to the default ConnectionFactory and finally unbinding it.
        Parameters:
        runnable - the Runnable object to be executed.
        Throws:
        java.lang.RuntimeException - when a RuntimeException is thrown by the Runnable.
      • run

        public void run​(@Nullable
                        java.lang.String contextName,
                        java.lang.Runnable runnable)
        Execute a Runnable binding the given ConnectionFactory and finally unbinding it.
        Parameters:
        contextName - the name of the context. In null, empty or blank, default context is bound.
        runnable - the Runnable object to be executed.
        Throws:
        java.lang.RuntimeException - when a RuntimeException is thrown by the Runnable.