当前位置: 首页>>代码示例>>Java>>正文


Java ActiveMQException.printStackTrace方法代码示例

本文整理汇总了Java中org.apache.activemq.artemis.api.core.ActiveMQException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java ActiveMQException.printStackTrace方法的具体用法?Java ActiveMQException.printStackTrace怎么用?Java ActiveMQException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.activemq.artemis.api.core.ActiveMQException的用法示例。


在下文中一共展示了ActiveMQException.printStackTrace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testBasicPluginAuthorization

import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
@Test
public void testBasicPluginAuthorization() throws Exception {
   server.start();
   ClientSessionFactory cf = locator.createSessionFactory();
   String name = "queue1";

   try {
      ClientSession session = cf.createSession("first", "secret", false, true, true, false, 0);
      session.createQueue(SimpleString.toSimpleString(name), SimpleString.toSimpleString(name));
      ClientProducer producer = session.createProducer();
      producer.send(name, session.createMessage(false));
      session.close();
   } catch (ActiveMQException e) {
      e.printStackTrace();
      Assert.fail("should not throw exception");
   }

   cf.close();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:20,代码来源:LegacyLDAPSecuritySettingPluginTest.java

示例2: testJAASSecurityManagerAuthentication

import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
@Test
public void testJAASSecurityManagerAuthentication() throws Exception {
   server.start();
   ClientSessionFactory cf = locator.createSessionFactory();

   try {
      ClientSession session = cf.createSession("first", "secret", false, true, true, false, 0);
      session.close();
   } catch (ActiveMQException e) {
      e.printStackTrace();
      Assert.fail("should not throw exception");
   }

   cf.close();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:16,代码来源:LDAPSecurityTest.java

示例3: testJAASSecurityManagerAuthentication

import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
@Test
public void testJAASSecurityManagerAuthentication() throws Exception {
   ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("PropertiesLogin");
   ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false));
   server.start();
   ClientSessionFactory cf = createSessionFactory(locator);

   try {
      ClientSession session = cf.createSession("first", "secret", false, true, true, false, 0);
      session.close();
   } catch (ActiveMQException e) {
      e.printStackTrace();
      Assert.fail("should not throw exception");
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:16,代码来源:SecurityTest.java

示例4: testJAASSecurityManagerAuthenticationWithValidateUser

import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
@Test
public void testJAASSecurityManagerAuthenticationWithValidateUser() throws Exception {
   ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("PropertiesLogin");
   ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false));
   server.getConfiguration().setPopulateValidatedUser(true);
   server.start();
   Role role = new Role("programmers", true, true, true, true, true, true, true, true, true, true);
   Set<Role> roles = new HashSet<>();
   roles.add(role);
   server.getSecurityRepository().addMatch("#", roles);
   ClientSessionFactory cf = createSessionFactory(locator);

   try {
      ClientSession session = cf.createSession("first", "secret", false, true, true, false, 0);
      server.createQueue(SimpleString.toSimpleString("address"), RoutingType.ANYCAST, SimpleString.toSimpleString("queue"), null, true, false);
      ClientProducer producer = session.createProducer("address");
      producer.send(session.createMessage(true));
      session.commit();
      producer.close();
      ClientConsumer consumer = session.createConsumer("queue");
      session.start();
      ClientMessage message = consumer.receive(1000);
      assertNotNull(message);
      assertEquals("first", message.getValidatedUserID());
      session.close();
   } catch (ActiveMQException e) {
      e.printStackTrace();
      Assert.fail("should not throw exception");
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:31,代码来源:SecurityTest.java

示例5: testJAASSecurityManagerAuthenticationWithCerts

import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
@Test
public void testJAASSecurityManagerAuthenticationWithCerts() throws Exception {
   ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("CertLogin");
   ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false));

   Map<String, Object> params = new HashMap<>();
   params.put(TransportConstants.SSL_ENABLED_PROP_NAME, true);
   params.put(TransportConstants.KEYSTORE_PATH_PROP_NAME, "server-side-keystore.jks");
   params.put(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, "secureexample");
   params.put(TransportConstants.TRUSTSTORE_PATH_PROP_NAME, "server-side-truststore.jks");
   params.put(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME, "secureexample");
   params.put(TransportConstants.NEED_CLIENT_AUTH_PROP_NAME, true);

   server.getConfiguration().addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params));

   server.start();

   TransportConfiguration tc = new TransportConfiguration(NETTY_CONNECTOR_FACTORY);
   tc.getParams().put(TransportConstants.SSL_ENABLED_PROP_NAME, true);
   tc.getParams().put(TransportConstants.TRUSTSTORE_PATH_PROP_NAME, "client-side-truststore.jks");
   tc.getParams().put(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME, "secureexample");
   tc.getParams().put(TransportConstants.KEYSTORE_PATH_PROP_NAME, "client-side-keystore.jks");
   tc.getParams().put(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, "secureexample");
   ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc));
   ClientSessionFactory cf = createSessionFactory(locator);

   try {
      ClientSession session = cf.createSession();
      session.close();
   } catch (ActiveMQException e) {
      e.printStackTrace();
      Assert.fail("should not throw exception");
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:35,代码来源:SecurityTest.java

示例6: testJAASSecurityManagerAuthenticationGuest

import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
@Test
public void testJAASSecurityManagerAuthenticationGuest() throws Exception {
   ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("GuestLogin");
   ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false));
   server.start();
   ClientSessionFactory cf = createSessionFactory(locator);

   try {
      ClientSession session = cf.createSession("first", "secret", false, true, true, false, 0);
      session.close();
   } catch (ActiveMQException e) {
      e.printStackTrace();
      Assert.fail("should not throw exception");
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:16,代码来源:SecurityTest.java

示例7: onMessage

import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
@Override
public void onMessage(ClientMessage message) {
   count++;
   latch.countDown();
   try {
      clientSession.rollback(true);
   } catch (ActiveMQException e) {
      e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
   }
   throw new RuntimeException();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:12,代码来源:DeadLetterAddressTest.java

示例8: onMessage

import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
@Override
public void onMessage(final ClientMessage request) {
   try {
      ClientMessage reply = session.createMessage(false);
      SimpleString replyTo = (SimpleString) request.getObjectProperty(ClientMessageImpl.REPLYTO_HEADER_NAME);
      long value = (Long) request.getObjectProperty(key);
      reply.putLongProperty(key, value);
      ClientProducer replyProducer = session.createProducer(replyTo);
      replyProducer.send(reply);
      request.acknowledge();
   } catch (ActiveMQException e) {
      e.printStackTrace();
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:15,代码来源:RequestorTest.java

示例9: onMessage

import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
@Override
public void onMessage(final ClientMessage message) {
   try {
      message.acknowledge();
   } catch (ActiveMQException e) {
      try {
         session.close();
      } catch (ActiveMQException e1) {
         e1.printStackTrace();
      }
   }
   latch.countDown();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:14,代码来源:CommitRollbackTest.java

示例10: onMessage

import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
@Override
public void onMessage(final ClientMessage message) {
   int i = message.getBodyBuffer().readInt();
   try {
      message.acknowledge();
   } catch (ActiveMQException e) {
      e.printStackTrace();
   }
   if (i <= lastMessage) {
      failed = true;
   }
   lastMessage = i;
   latch.countDown();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:15,代码来源:DeliveryOrderTest.java

示例11: onMessage

import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
@Override
public void onMessage(final ClientMessage message) {
   messagesReceived++;
   try {
      message.acknowledge();
   } catch (ActiveMQException e) {
      e.printStackTrace();
   }
   latch.countDown();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:11,代码来源:AutogroupIdTest.java

示例12: receiveMessages

import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
private void receiveMessages(ServerGroup server,
                             String queueName,
                             int num,
                             boolean checkDup) throws ActiveMQException {
   try {
      server.receiveMessages(queueName, num, checkDup);
   } catch (ActiveMQException e) {
      e.printStackTrace();
      throw e;
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:12,代码来源:JMSBridgeClusteredTest.java

示例13: testBackupStartsWhenLiveIsReceivingLargeMessage

import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
/**
 * LargeMessages are passed from the client to the server in chunks. Here we test the backup
 * starting the data synchronization with the live in the middle of a multiple chunks large
 * message upload from the client to the live server.
 *
 * @throws Exception
 */
@Test
public void testBackupStartsWhenLiveIsReceivingLargeMessage() throws Exception {
   final ClientSession session = addClientSession(sessionFactory.createSession(true, true));
   session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
   final ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS);
   final ClientMessage message = session.createMessage(true);
   final int largeMessageSize = 1000 * MIN_LARGE_MESSAGE;
   message.setBodyInputStream(ActiveMQTestBase.createFakeLargeStream(largeMessageSize));

   final AtomicBoolean caughtException = new AtomicBoolean(false);
   final CountDownLatch latch = new CountDownLatch(1);
   final CountDownLatch latch2 = new CountDownLatch(1);

   Runnable r = new Runnable() {
      @Override
      public void run() {
         try {
            latch.countDown();
            producer.send(message);
            sendMessages(session, producer, 20);
            session.commit();
         } catch (ActiveMQException e) {
            e.printStackTrace();
            caughtException.set(true);
         } finally {
            latch2.countDown();
         }
      }
   };
   Executors.defaultThreadFactory().newThread(r).start();
   waitForLatch(latch);
   startBackupFinishSyncing();
   ActiveMQTestBase.waitForLatch(latch2);
   crash(session);
   assertFalse("no exceptions while sending message", caughtException.get());

   session.start();
   ClientConsumer consumer = session.createConsumer(FailoverTestBase.ADDRESS);
   ClientMessage msg = consumer.receive(2000);
   ActiveMQBuffer buffer = msg.getBodyBuffer();

   for (int j = 0; j < largeMessageSize; j++) {
      Assert.assertTrue("large msg , expecting " + largeMessageSize + " bytes, got " + j, buffer.readable());
      Assert.assertEquals("equal at " + j, ActiveMQTestBase.getSamplebyte(j), buffer.readByte());
   }
   receiveMessages(consumer, 0, 20, true);
   assertNull("there should be no more messages!", consumer.receiveImmediate());
   consumer.close();
   session.commit();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:58,代码来源:BackupSyncLargeMessageTest.java

示例14: testTimeoutOnFailover

import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
@Test(timeout = 120000)
public void testTimeoutOnFailover() throws Exception {
   locator.setCallTimeout(1000).setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setAckBatchSize(0).setReconnectAttempts(300).setRetryInterval(100);

   if (nodeManager instanceof InVMNodeManager) {
      ((InVMNodeManager) nodeManager).failoverPause = 500L;
   }

   ClientSessionFactoryInternal sf1 = (ClientSessionFactoryInternal) createSessionFactory(locator);

   final ClientSession session = createSession(sf1, true, true);

   session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true);

   final ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS);

   final CountDownLatch latch = new CountDownLatch(10);
   final CountDownLatch latchFailed = new CountDownLatch(1);

   Runnable r = new Runnable() {
      @Override
      public void run() {
         for (int i = 0; i < 500; i++) {
            ClientMessage message = session.createMessage(true);
            message.putIntProperty("counter", i);
            try {
               System.out.println("Sent " + i);
               producer.send(message);
               if (i < 10) {
                  latch.countDown();
                  if (latch.getCount() == 0) {
                     latchFailed.await(10, TimeUnit.SECONDS);
                  }
               }
            } catch (Exception e) {
               // this is our retry
               try {
                  if (!producer.isClosed())
                     producer.send(message);
               } catch (ActiveMQException e1) {
                  e1.printStackTrace();
               }
            }
         }
      }
   };
   Thread t = new Thread(r);
   t.start();
   Assert.assertTrue("latch released", latch.await(10, TimeUnit.SECONDS));
   crash(session);
   latchFailed.countDown();
   t.join(30000);
   if (t.isAlive()) {
      t.interrupt();
      Assert.fail("Thread still alive");
   }
   Assert.assertTrue(backupServer.getServer().waitForActivation(5, TimeUnit.SECONDS));
   ClientConsumer consumer = session.createConsumer(FailoverTestBase.ADDRESS);
   session.start();
   for (int i = 0; i < 500; i++) {
      ClientMessage m = consumer.receive(1000);
      Assert.assertNotNull("message #=" + i, m);
      // assertEquals(i, m.getIntProperty("counter").intValue());
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:66,代码来源:FailoverTest.java

示例15: testCloseConsumerDuringTransmission

import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
@Test
public void testCloseConsumerDuringTransmission() throws Exception {
   ActiveMQServer server = createServer(true, isNetty());

   LargeMessageTestInterceptorIgnoreLastPacket.disableInterrupt();

   server.start();

   locator.setBlockOnNonDurableSend(false).setBlockOnDurableSend(false).addIncomingInterceptor(new LargeMessageTestInterceptorIgnoreLastPacket());

   ClientSessionFactory sf = createSessionFactory(locator);

   final ClientSession session = sf.createSession(false, true, true);

   session.createQueue(ADDRESS, ADDRESS, true);

   ClientProducer producer = session.createProducer(ADDRESS);

   Message clientFile = createLargeClientMessageStreaming(session, LARGE_MESSAGE_SIZE, true);

   producer.send(clientFile);

   session.commit();

   LargeMessageTestInterceptorIgnoreLastPacket.clearInterrupt();

   final AtomicInteger unexpectedErrors = new AtomicInteger(0);
   final AtomicInteger expectedErrors = new AtomicInteger(0);
   final ClientConsumer cons = session.createConsumer(ADDRESS);

   session.start();

   Thread t = new Thread() {
      @Override
      public void run() {
         try {
            System.out.println("Receiving message");
            ClientMessage msg = cons.receive(5000);
            if (msg == null) {
               System.err.println("Message not received");
               unexpectedErrors.incrementAndGet();
               return;
            }

            msg.checkCompletion();
         } catch (ActiveMQException e) {
            e.printStackTrace();
            expectedErrors.incrementAndGet();
         }
      }
   };

   t.start();

   LargeMessageTestInterceptorIgnoreLastPacket.awaitInterrupt();

   cons.close();

   t.join();

   Assert.assertEquals(0, unexpectedErrors.get());
   Assert.assertEquals(1, expectedErrors.get());

   session.close();

   server.stop();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:68,代码来源:InterruptedLargeMessageTest.java


注:本文中的org.apache.activemq.artemis.api.core.ActiveMQException.printStackTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。