Package org.jboss.jms.util

Examples of org.jboss.jms.util.ThreadContextClassLoaderChanger


   public void setMessageListener(MessageListener listener) throws JMSException
   {
      if (log.isTraceEnabled()) { log.trace("setMessageListener(" + listener + ") called"); }

      ThreadContextClassLoaderChanger tccc = new ThreadContextClassLoaderChanger();

      try
      {
         tccc.set(getClass().getClassLoader());

         delegate.setMessageListener(listener);
      }
      finally
      {
         tccc.restore();
      }
   }
View Full Code Here


      if (d != null && !(d instanceof JBossDestination))
      {
         throw new InvalidDestinationException("Not a JBossDestination:" + d);
      }
          
      ThreadContextClassLoaderChanger tccc = new ThreadContextClassLoaderChanger();

      try
      {
         tccc.set(getClass().getClassLoader());

         ProducerDelegate producerDelegate = delegate.createProducerDelegate((JBossDestination)d);
         return new JBossMessageProducer(producerDelegate);
      }
      finally
      {
         tccc.restore();
      }
   }
View Full Code Here

         throw new InvalidDestinationException("Not a JBossDestination:" + d);
      }

      log.debug("attempting to create consumer for destination:" + d + (messageSelector == null ? "" : ", messageSelector: " + messageSelector) + (noLocal ? ", noLocal = true" : ""));

      ThreadContextClassLoaderChanger tccc = new ThreadContextClassLoaderChanger();

      try
      {
         tccc.set(getClass().getClassLoader());

         ConsumerDelegate cd = delegate.
            createConsumerDelegate((JBossDestination)d, messageSelector, noLocal, null, false);
        
         return new JBossMessageConsumer(cd);
      }
      finally
      {
         tccc.restore();
      }
   }
View Full Code Here

      if (!(topic instanceof JBossTopic))
      {
         throw new InvalidDestinationException("Not a JBossTopic:" + topic);
      }

      ThreadContextClassLoaderChanger tccc = new ThreadContextClassLoaderChanger();

      try
      {
         tccc.set(getClass().getClassLoader());

         ConsumerDelegate cd =
            delegate.createConsumerDelegate((JBossTopic)topic, null, false, name, false);

         return new JBossMessageConsumer(cd);
      }
      finally
      {
         tccc.restore();
      }
   }
View Full Code Here

      if ("".equals(messageSelector))
      {
         messageSelector = null;
      }

      ThreadContextClassLoaderChanger tccc = new ThreadContextClassLoaderChanger();

      try
      {
         tccc.set(getClass().getClassLoader());

         BrowserDelegate del =
            delegate.createBrowserDelegate((JBossQueue)queue, messageSelector);
        
         return new JBossQueueBrowser(queue, messageSelector, del);
      }
      finally
      {
         tccc.restore();
      }
   }
View Full Code Here

      if (this.maxMessages < 1)
      {
         this.maxMessages = 1;
      }

      ThreadContextClassLoaderChanger tccc = new ThreadContextClassLoaderChanger();

      try
      {
         tccc.set(getClass().getClassLoader());

         // Create a consumer. The MessageCallbackhandler knows we are a connection consumer so will
         // not call pre or postDeliver so messages won't be acked, or stored in session/tx.
         sess = conn.createSessionDelegate(false, Session.CLIENT_ACKNOWLEDGE, false);

         cons = sess.createConsumerDelegate(dest, messageSelector, false, subName, true);
      }
      finally
      {
         tccc.restore();
      }

      ConsumerState state = (ConsumerState)((DelegateSupport)cons).getState();

      this.consumerID = state.getConsumerID();     
View Full Code Here

      delegate.close();
   }

   public Enumeration getEnumeration() throws JMSException
   {
      ThreadContextClassLoaderChanger tccc = new ThreadContextClassLoaderChanger();

      try
      {
         tccc.set(getClass().getClassLoader());
         delegate.reset();
      }
      finally
      {
         tccc.restore();
      }
     
      return new BrowserEnumeration();
   }
View Full Code Here

      if (destination != null && !(destination instanceof JBossDestination))
      {
         throw new InvalidDestinationException("Not a JBossDestination:" + destination);
      }

      ThreadContextClassLoaderChanger tccc = new ThreadContextClassLoaderChanger();

      try
      {
         tccc.set(getClass().getClassLoader());

         delegate.send((JBossDestination)destination, m, deliveryMode, priority, timeToLive);
      }
      finally
      {
         tccc.restore();
      }     
   }
View Full Code Here

  
   protected JBossConnection createConnectionInternal(String username, String password,
                                                      boolean isXA, int type)
      throws JMSException
   {
      ThreadContextClassLoaderChanger tccc = new ThreadContextClassLoaderChanger();
     
      try
      {
         tccc.set(getClass().getClassLoader());

         try
         {
            ClientAOPStackLoader.getInstance().load(delegate);
         }
         catch(Exception e)
         {
            // Need to log message since no guarantee that client will log it
            final String msg = "Failed to download and/or install client side AOP stack";
            log.error(msg, e);
            throw new RuntimeException(msg, e);
         }
  
         // The version used by the connection is the minimum of the server version for the
         // connection factory and the client code version
        
         CreateConnectionResult res = delegate.createConnectionDelegate(username, password, -1);       
        
         return new JBossConnection(res.getDelegate(), type);
      }
      finally
      {
         tccc.restore();
      }
   }
View Full Code Here

      return createSessionInternal(transacted, acknowledgeMode, false, TYPE_GENERIC_CONNECTION);
   }

   public String getClientID() throws JMSException
   {
      ThreadContextClassLoaderChanger tccc = new ThreadContextClassLoaderChanger();

      try
      {
         tccc.set(getClass().getClassLoader());

         return delegate.getClientID();
      }
      finally
      {
         tccc.restore();
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.jms.util.ThreadContextClassLoaderChanger

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.