Package org.jboss.jms.client

Examples of org.jboss.jms.client.JBossConnectionFactory


   private void rebindConnectionFactory(Context ic, JNDIBindings jndiBindings,
                                        ConnectionFactoryDelegate delegate)
      throws NamingException
   {
      JBossConnectionFactory cf = new JBossConnectionFactory(delegate);

      if (jndiBindings != null)
      {
         List jndiNames = jndiBindings.getNames();
         for(Iterator i = jndiNames.iterator(); i.hasNext(); )
View Full Code Here


     
      if (connections.get(nid) == null)
      {
        try
        {
           ConnectionInfo info = new ConnectionInfo(new JBossConnectionFactory(delegate), suckerUser, suckerPassword);
          
           log.trace(this + " created connection info " + info);
          
           connections.put(nid, info);
          
View Full Code Here

   public void testRoundRobinLoadBalancingOneNode() throws Exception
   {
      // the round robin policy is default

      JBossConnectionFactory jbcf = (JBossConnectionFactory)cf;
      ClientClusteredConnectionFactoryDelegate clusteredDelegate =
         (ClientClusteredConnectionFactoryDelegate )jbcf.getDelegate();

      assertSame(RoundRobinLoadBalancingPolicy.class,
         clusteredDelegate.getLoadBalancingPolicy().getClass());

      Connection conn0 = cf.createConnection();
View Full Code Here

   }


   public void testRoundRobinLoadBalancingTwoNodes() throws Exception
   {
      JBossConnectionFactory jbcf = (JBossConnectionFactory)cf;
      ClientClusteredConnectionFactoryDelegate clusteredDelegate =
         (ClientClusteredConnectionFactoryDelegate )jbcf.getDelegate();

      assertSame(RoundRobinLoadBalancingPolicy.class,
         clusteredDelegate.getLoadBalancingPolicy().getClass());

      Connection conn0 = cf.createConnection();
View Full Code Here

   private void rebindConnectionFactory(Context ic, JNDIBindings jndiBindings,
                                        ConnectionFactoryDelegate delegate)
      throws NamingException
   {
      JBossConnectionFactory cf = new JBossConnectionFactory(delegate);

      if (jndiBindings != null)
      {
         List jndiNames = jndiBindings.getNames();
         for(Iterator i = jndiNames.iterator(); i.hasNext(); )
View Full Code Here

     
      if (connections.get(nid) == null)
      {
        try
        {
           ConnectionInfo info = new ConnectionInfo(new JBossConnectionFactory(delegate), suckerUser, suckerPassword);
          
           log.trace(this + " created connection info " + info);
          
           connections.put(nid, info);
          
View Full Code Here

   private void rebindConnectionFactory(Context ic, JNDIBindings jndiBindings,
                                        ConnectionFactoryDelegate delegate)
      throws NamingException
   {
      JBossConnectionFactory cf = new JBossConnectionFactory(delegate);

      if (jndiBindings != null)
      {
         List jndiNames = jndiBindings.getNames();
         for(Iterator i = jndiNames.iterator(); i.hasNext(); )
View Full Code Here

     
      if (connections.get(nid) == null)
      {
        try
        {
           ConnectionInfo info = new ConnectionInfo(new JBossConnectionFactory(delegate), suckerUser, suckerPassword);
          
           log.trace(this + " created connection info " + info);
          
           connections.put(nid, info);
          
View Full Code Here

                                               name3,
                                               "/TestConnectionFactory4",
                                               "clientid4",
                                               false);

      JBossConnectionFactory f1 = (JBossConnectionFactory)ic.lookup("/TestConnectionFactory1");
      ClientConnectionFactoryDelegate del1 = (ClientConnectionFactoryDelegate)f1.getDelegate();

      assertTrue(del1.getServerLocatorURI().startsWith("bisocket://localhost:1234"));

      JBossConnectionFactory f2 = (JBossConnectionFactory)ic.lookup("/TestConnectionFactory2");
      ClientConnectionFactoryDelegate del2 = (ClientConnectionFactoryDelegate)f2.getDelegate();
      assertTrue(del2.getServerLocatorURI().startsWith("bisocket://localhost:1235"));

      JBossConnectionFactory f3 = (JBossConnectionFactory)ic.lookup("/TestConnectionFactory3");
      ClientConnectionFactoryDelegate del3 = (ClientConnectionFactoryDelegate)f3.getDelegate();
      assertTrue(del3.getServerLocatorURI().startsWith("bisocket://localhost:1236"));

      JBossConnectionFactory f4 = (JBossConnectionFactory)ic.lookup("/TestConnectionFactory4");
      ClientConnectionFactoryDelegate del4 = (ClientConnectionFactoryDelegate)f4.getDelegate();
      assertTrue(del4.getServerLocatorURI().startsWith("bisocket://localhost:1236"));

      Connection con1 = f1.createConnection();
      Connection con2 = f2.createConnection();
      Connection con3 = f3.createConnection();
      Connection con4 = f4.createConnection();
      con1.close();
      con2.close();
      con3.close();
      con4.close();

      stopService(cf1);
      stopService(cf2);
      stopService(cf3);

      // Check f4 is still ok
      Connection conn5 = f4.createConnection();
      conn5.close();

      stopService(cf4);

      stopService(c1);
View Full Code Here

   {
      Connection conn0 = null;
      Connection conn1 = null;
     
      Map<String, TextMessage> msgs = new ConcurrentHashMap<String, TextMessage>();
      JBossConnectionFactory cf0;

      try
      {
         //we need to kill node 2, only leave two nodes.
         //otherwise messages may be merged to node2 and never sucked again.
         ServerManagement.kill(2);

         cf0 = (JBossConnectionFactory)ic[0].lookup("/ConnectionFactory");

         conn0 = cf0.createConnection();

         Session sess0 = conn0.createSession(false, Session.AUTO_ACKNOWLEDGE);
         MessageProducer prod0 = sess0.createProducer(queue[0]);

         final int NUM_MESSAGES = 1000;

         for (int i = 0; i < NUM_MESSAGES; i++)
         {
            TextMessage tm = sess0.createTextMessage("suckmsg-" + i);
            prod0.send(tm);
         }
        
         startReceive(msgs);
         startReceive(msgs);
         startReceive(msgs);
         startReceive(msgs);
         startReceive(msgs);
        
         JBossConnectionFactory cf1 = (JBossConnectionFactory)ic[1].lookup("/ConnectionFactory");
         conn1 = cf1.createConnection();
         Session sess1 = conn1.createSession(false, Session.CLIENT_ACKNOWLEDGE);
         MessageConsumer cons1 = sess1.createConsumer(queue[1]);
         conn1.start();
        
         TextMessage rm = (TextMessage)cons1.receive(5000);
View Full Code Here

TOP

Related Classes of org.jboss.jms.client.JBossConnectionFactory

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.