Package org.jboss.logging

Examples of org.jboss.logging.Logger


      MessageConsumer receiver = session.createConsumer(queue);
      receiver.setMessageListener(new MessageListener()
      {
         public void onMessage(Message msg)
         {
            Logger log = Logger.getLogger(getClass().getName());
            log.debug("ML");
            try
            {
               if (msg instanceof TextMessage)
               {
                  log.debug(((TextMessage) msg).getText());
                  counter1.release();
               }
            }
            catch (Exception e)
            {
            }
         }
      });

      MessageProducer sender = session.createProducer(queue);

      TextMessage message = session.createTextMessage();
      message.setText("Normal message");
      sender.send(message, DeliveryMode.NON_PERSISTENT, 4, 0);
      //sender.send(queue, message, DeliveryMode.NON_PERSISTENT, 4, 0);
      message.setText("Persistent message");
      sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
      //sender.send(queue, message, DeliveryMode.PERSISTENT, 4, 0);
      message.setText("High Priority Persistent message");
      sender.send(message, DeliveryMode.PERSISTENT, 9, 0);
      //sender.send(queue, message, DeliveryMode.PERSISTENT, 9, 0);

      // Wait for the msgs to be received
      counter1.acquire();
      log.debug("MessageListener1 received the TMs sent");

      final CountDown counter2 = new CountDown(2);
      receiver.setMessageListener(new MessageListener()
      {
         public void onMessage(Message msg)
         {
            Logger log = Logger.getLogger(getClass().getName());
            log.debug("ML 2");
            try
            {
               if (msg instanceof TextMessage)
               {
                  log.debug(((TextMessage) msg).getText());
                  counter2.release();
               }
            }
            catch (Exception e)
            {
            }
         }
      });

      message.setText("Persistent message");
      sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
      //sender.send(queue, message, DeliveryMode.PERSISTENT, 4, 0);
      message.setText("High Priority Persistent message");
      sender.send(message, DeliveryMode.PERSISTENT, 9, 0);
      //sender.send(queue, message, DeliveryMode.PERSISTENT, 9, 0);

      // Wait for the msgs to be received
      counter2.acquire();
      log.debug("MessageListener2 received the TMs sent");

      receiver.setMessageListener(null);

      message.setText("Persistent message");
      sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
View Full Code Here


      session.setMessageListener(new MessageListener()
      {
         public void onMessage(Message mess)
         {
            Logger log = Logger.getLogger(getClass().getName());
            log.debug("Processing message");
            try
            {
               if (mess instanceof TextMessage)
                  log.debug(((TextMessage) mess).getText());
            }
            catch (Exception e)
            {
               log.error("Error", e);
            }
         }
      });

      MessageProducer sender = session.createProducer(testQueue);
View Full Code Here

         queueConnection.start();
         drainQueue();
         queueConnection.stop();
      }
      final int iterationCount = getIterationCount();
      final Logger log = getLog();

      Thread sendThread =
         new Thread()
         {
            /**
             * Main processing method for the JBossMQPerfStressTestCase object
             */
            public void run()
            {
               try
               {
                  QueueSession session = queueConnection.createQueueSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
                  Queue queue = (Queue)context.lookup(TEST_QUEUE);

                  QueueSender sender = session.createSender(queue);

                  BytesMessage message = session.createBytesMessage();
                  message.writeBytes(PERFORMANCE_TEST_DATA_PAYLOAD);

                  long startTime = System.currentTimeMillis();
                  for (int i = 0; i < iterationCount; i++)
                  {
                     //sender.send(queue, message, persistence, 4, 0);
                     sender.send(message, persistence, 4, 0);
                     //getLog().debug("  Sent #"+i);
                     if (transacted == TRANS_INDIVIDUAL)
                     {
                        session.commit();
                     }
                  }

                  if (transacted == TRANS_TOTAL)
                  {
                     session.commit();
                  }

                  long endTime = System.currentTimeMillis();

                  session.close();

                  long pTime = endTime - startTime;
                  log.debug("  sent all messages in " + ((double)pTime / 1000) + " seconds. ");
               }
               catch (Exception e)
               {
                  log.error("error", e);
               }
            }
         };

      final QueueSession session = queueConnection.createQueueSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
      Queue queue = (Queue)context.lookup(TEST_QUEUE);
      QueueReceiver receiver = session.createReceiver(queue);

      MessageListener listener =
         new MessageListener()
         {
            long startTime = System.currentTimeMillis();
            int i = 0;

            /**
             * #Description of the Method
             *
             * @param message  Description of Parameter
             */
            public void onMessage(Message message)
            {
               try
               {
        if( transacted == TRANS_INDIVIDUAL )
          session.commit();
                  i++;
               }
               catch (JMSException e)
               {
                  getLog().error("Unable to commit", e);
                  synchronized (this)
                  {
                     this.notify();
                  }
               }
               if (i >= iterationCount)
               {
                  long endTime = System.currentTimeMillis();
                  long pTime = endTime - startTime;
                  log.debug("  received all messages in " + ((double)pTime / 1000) + " seconds. ");

                  synchronized (this)
                  {
                     this.notify();
                  }
View Full Code Here

         queueConnection.start();
         drainQueue();
      }

      final int iterationCount = getIterationCount();
      final Logger log = getLog();
     
      final CountDownLatch startFlag = new CountDownLatch(1);

      Thread sendThread =
         new Thread()
         {
            /**
             * Main processing method for the JMSPerfStressTestCase object
             */
            public void run()
            {
               try
               {

                  TopicSession session = topicConnection.createTopicSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
                  Topic topic = (Topic)context.lookup(TEST_TOPIC);

                  TopicPublisher publisher = session.createPublisher(topic);

                  startFlag.await();

                  BytesMessage message = session.createBytesMessage();
                  message.writeBytes(PERFORMANCE_TEST_DATA_PAYLOAD);

                  long startTime = System.currentTimeMillis();
                  for (int i = 0; i < iterationCount; i++)
                  {
                     publisher.publish(message, persistence, 4, 0);
                     //publisher.publish(topic, message, persistence, 4, 0);
                     //getLog().debug("  Sent #"+i);
                     if (transacted == TRANS_INDIVIDUAL)
                     {
                        session.commit();
                     }
                  }

                  if (transacted == TRANS_TOTAL)
                  {
                     session.commit();
                  }

                  long endTime = System.currentTimeMillis();
                  session.close();

                  long pTime = endTime - startTime;
                  log.debug("  sent all messages in " + ((double)pTime / 1000) + " seconds. ");
               }
               catch (Exception e)
               {
                  log.error("error", e);
               }
            }
         };

      final TopicSession session = topicConnection.createTopicSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
      Topic topic = (Topic)context.lookup(TEST_TOPIC);
      TopicSubscriber subscriber = session.createSubscriber(topic);

      MessageListener listener =
         new MessageListener()
         {
            long startTime = System.currentTimeMillis();
            int i = 0;

            /**
             * #Description of the Method
             *
             * @param message  Description of Parameter
             */
            public void onMessage(Message message)
            {
               try
               {
        if( transacted == TRANS_INDIVIDUAL )
          session.commit();
                  i++;
               }
               catch (JMSException e)
               {
                  getLog().error("Unable to commit", e);
                  synchronized (this)
                  {
                     this.notify();
                  }
               }
               if (i >= iterationCount)
               {
                  long endTime = System.currentTimeMillis();
                  long pTime = endTime - startTime;
                  log.debug("  received all messages in " + ((double)pTime / 1000) + " seconds. ");

                  synchronized (this)
                  {
                     this.notify();
                  }
View Full Code Here

      {
         queueConnection.start();
         drainQueue();
      }
      final int iterationCount = getIterationCount();
      final Logger log = getLog();

      Thread sendThread =
         new Thread()
         {
            /**
             * Main processing method for the JMSPerfStressTestCase object
             */
            public void run()
            {
               try
               {
                  QueueSession session = queueConnection.createQueueSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
                  Queue queue = (Queue)context.lookup(TEST_QUEUE);

                  QueueSender sender = session.createSender(queue);

                  BytesMessage message = session.createBytesMessage();
                  message.writeBytes(PERFORMANCE_TEST_DATA_PAYLOAD);

                  long startTime = System.currentTimeMillis();
                  for (int i = 0; i < iterationCount; i++)
                  {
                     sender.send( message, persistence, 4, 0);
                     //sender.send(queue, message, persistence, 4, 0);
                     //getLog().debug("  Sent #"+i);
                     if (transacted == TRANS_INDIVIDUAL)
                     {
                        session.commit();
                     }
                  }

                  if (transacted == TRANS_TOTAL)
                  {
                     session.commit();
                  }

                  session.close();

                  long endTime = System.currentTimeMillis();

                  long pTime = endTime - startTime;
                  log.debug("  sent all messages in " + ((double)pTime / 1000) + " seconds. ");
               }
               catch (Exception e)
               {
                  log.error("error", e);
               }
            }
         };

      Thread recvThread =
         new Thread()
         {
            /**
             * Main processing method for the JMSPerfStressTestCase object
             */
            public void run()
            {
               try
               {

                  QueueSession session = queueConnection.createQueueSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
                  Queue queue = (Queue)context.lookup(TEST_QUEUE);

                  QueueReceiver receiver = session.createReceiver(queue);
                  long startTime = System.currentTimeMillis();
                  for (int i = 0; i < iterationCount; i++)
                  {
                     receiver.receive();
                     //getLog().debug("  Received #"+i);
                     if (transacted == TRANS_INDIVIDUAL)
                     {
                        session.commit();
                     }
                  }

                  if (transacted == TRANS_TOTAL)
                  {
                     session.commit();
                  }

                  long endTime = System.currentTimeMillis();

                  session.close();

                  long pTime = endTime - startTime;
                  log.debug("  received all messages in " + ((double)pTime / 1000) + " seconds. ");

               }
               catch (Exception e)
               {
                  log.error("error", e);
               }
            }
         };

      getLog().debug("  Synch Queue: This test will send " + getIterationCount() + " "
View Full Code Here

         queueConnection.start();
         topicConnection.start();
         drainQueue();
      }
      final int iterationCount = getIterationCount();
      final Logger log = getLog();
     
      final CountDownLatch alignFlag = new CountDownLatch(2);
     

      Thread sendThread =
         new Thread("sendThread transacted = " + transacted + " persistent = " + persistence)
         {
            /**
             * Main processing method for the JBossMQPerfStressTestCase object
             */
            public void run()
            {
               try
               {

                  TopicSession session = topicConnection.createTopicSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
                  Topic topic = (Topic)context.lookup(TEST_TOPIC);

                  TopicPublisher publisher = session.createPublisher(topic);

                  alignFlag.countDown();
                  alignFlag.await();

                  BytesMessage message = session.createBytesMessage();
                  message.writeBytes(PERFORMANCE_TEST_DATA_PAYLOAD);

                  long startTime = System.currentTimeMillis();
                  for (int i = 0; i < iterationCount; i++)
                  {
                     publisher.publish(message, persistence, 4, 0);
                     //publisher.publish(topic, message, persistence, 4, 0);
                     //getLog().debug("  Sent #"+i);
                     if (transacted == TRANS_INDIVIDUAL)
                     {
                        session.commit();
                     }
                  }

                  if (transacted == TRANS_TOTAL)
                  {
                     session.commit();
                  }

                  long endTime = System.currentTimeMillis();

                  session.close();

                  long pTime = endTime - startTime;
                  log.debug("  sent all messages in " + ((double)pTime / 1000) + " seconds. ");
               }
               catch (Exception e)
               {
                  log.error("error", e);
               }
            }
         };

      Thread recvThread =
         new Thread("recvThread transacted = " + transacted + " persistent = " + persistence)
         {
            /**
             * Main processing method for the JBossMQPerfStressTestCase object
             */
            public void run()
            {
               try
               {

                  TopicSession session = topicConnection.createTopicSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
                  Topic topic = (Topic)context.lookup(TEST_TOPIC);
                  TopicSubscriber subscriber = session.createSubscriber(topic);

                  alignFlag.countDown();
                  alignFlag.await();

                  long startTime = System.currentTimeMillis();
                  for (int i = 0; i < iterationCount; i++)
                  {
                     subscriber.receive();
                     //getLog().debug("  Received #"+i);
                     if (transacted == TRANS_INDIVIDUAL)
                     {
                        session.commit();
                     }
                  }

                  if (transacted == TRANS_TOTAL)
                  {
                     session.commit();
                  }

                  long endTime = System.currentTimeMillis();

                  session.close();

                  long pTime = endTime - startTime;
                  log.debug("  received all messages in " + ((double)pTime / 1000) + " seconds. ");

               }
               catch (Exception e)
               {
                  log.error("error", e);
               }
            }
         };

      getLog().debug("  Synch Topic: This test will send " + getIterationCount() + " "
View Full Code Here

     super.setUp() ;
      JMSDestinationsUtil.setupBasicDestinations();

     if (context == null)
     {
       Logger log = getLog() ;
       if (log == null)
         System.out.println("JMSPerfStressTestCase: getLog() returned null") ;

       getLog().debug("JMSPerfStresTestCase - setUp") ;
View Full Code Here

    */
   public void runQueueSendRollBack(final int persistence, final boolean explicit) throws Exception
   {
      drainQueue();
      final int iterationCount = getIterationCount();
      final Logger log = getLog();

      Thread sendThread = new Thread()
      {
         public void run()
         {
            try
            {
               QueueSession session = queueConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
               Queue queue = (Queue) context.lookup(TEST_QUEUE);

               QueueSender sender = session.createSender(queue);

               BytesMessage message = session.createBytesMessage();
               message.writeBytes(PAYLOAD);
               message.setStringProperty("TEST_NAME", "runQueueSendRollback");
               message.setIntProperty("TEST_PERSISTENCE", persistence);
               message.setBooleanProperty("TEST_EXPLICIT", explicit);
              
               for (int i = 0; i < iterationCount; i++)
               {
                  sender.send(message, persistence, 4, 0);
               }

               if (explicit)
                  session.rollback();
               session.close();
            }
            catch (Exception e)
            {
               log.error("error", e);
            }
         }
      };

      sendThread.start();
View Full Code Here

   {
      drainQueue();
      drainTopic();

      final int iterationCount = getIterationCount();
      final Logger log = getLog();

      Thread sendThread = new Thread()
      {
         public void run()
         {
            try
            {

               TopicSession session = topicConnection.createTopicSession(true, Session.AUTO_ACKNOWLEDGE);
               Topic topic = (Topic) context.lookup(TEST_TOPIC);

               TopicPublisher publisher = session.createPublisher(topic);

               BytesMessage message = session.createBytesMessage();
               message.writeBytes(PAYLOAD);
               message.setStringProperty("TEST_NAME", "runTopicSendRollback");
               message.setIntProperty("TEST_PERSISTENCE", persistence);
               message.setBooleanProperty("TEST_EXPLICIT", explicit);

               for (int i = 0; i < iterationCount; i++)
               {
                  publisher.publish(message, persistence, 4, 0);
               }

               session.close();
            }
            catch (Exception e)
            {
               log.error("error", e);
            }
         }
      };

      sendThread.start();
View Full Code Here

   public void runAsynchQueueReceiveRollBack(final int persistence, final boolean explicit) throws Exception
   {
      drainQueue();

      final int iterationCount = getIterationCount();
      final Logger log = getLog();

      Thread sendThread = new Thread()
      {
         public void run()
         {
            try
            {
               QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
               Queue queue = (Queue) context.lookup(TEST_QUEUE);

               QueueSender sender = session.createSender(queue);

               BytesMessage message = session.createBytesMessage();
               message.writeBytes(PAYLOAD);
               message.setStringProperty("TEST_NAME", "runAsynchQueueReceiveRollback");
               message.setIntProperty("TEST_PERSISTENCE", persistence);
               message.setBooleanProperty("TEST_EXPLICIT", explicit);

               for (int i = 0; i < iterationCount; i++)
               {
                  sender.send(message, persistence, 4, 0);
               }

               session.close();
            }
            catch (Exception e)
            {
               log.error("error", e);
            }
         }
      };

      QueueSession session = queueConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
View Full Code Here

TOP

Related Classes of org.jboss.logging.Logger

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.