Package org.jboss.jms.client

Examples of org.jboss.jms.client.JBossConnection


      if (!ServerManagement.isRemote())
      {
         return;
      }

      JBossConnection connection = null;

      try
      {
         String address = InetAddress.getLocalHost().getHostAddress();
         System.setProperty("jboss.messaging.callback.bind.address", address);
        
         int freePort = PortUtil.findFreePort(InetAddress.getLocalHost().getHostName());
         System.setProperty("jboss.messaging.callback.bind.port", Integer.toString(freePort));

         System.setProperty("jboss.messaging.callback.reportPollingStatistics", "true");
        
         connection = (JBossConnection)cf.createConnection();
         connection.start();

         ClientConnectionDelegate delegate = (ClientConnectionDelegate)connection.getDelegate();
         JMSRemotingConnection remotingConnection = delegate.getRemotingConnection();
         Client client = remotingConnection.getRemotingClient();

         Field field = JMSRemotingConnection.class.getDeclaredField("serverLocator");
         field.setAccessible(true);
         InvokerLocator locator = (InvokerLocator)field.get(remotingConnection);
         String transport = locator.getProtocol();

         if ("socket".equals(transport)
               || "sslsocket".equals(transport)
               || "bisocket".equals(transport)
               || "sslbisocket".equals(transport))
         {
            field = Client.class.getDeclaredField("callbackConnectors");
            field.setAccessible(true);
            Map callbackConnectors = (Map)field.get(client);

            InvokerCallbackHandler callbackHandler = remotingConnection.getCallbackManager();
            HashSet map = (HashSet) callbackConnectors.get(callbackHandler);
            Connector connector = (Connector)map.iterator().next();
            locator = new InvokerLocator(connector.getInvokerLocator());
            assertEquals(address, locator.getHost());
            assertEquals(freePort, locator.getPort());
         }
         else if ("http".equals(transport))
         {
            field = Client.class.getDeclaredField("callbackPollers");
            field.setAccessible(true);
            Map callbackPollers = (Map)field.get(client);
            assertEquals(1, callbackPollers.size());

            CallbackPoller callbackPoller =
               (CallbackPoller)callbackPollers.values().iterator().next();

            field = CallbackPoller.class.getDeclaredField("reportStatistics");
            field.setAccessible(true);
            assertEquals(true, ((Boolean) field.get(callbackPoller)).booleanValue());
         }
         else
         {
            fail("Unrecognized transport: " + transport);
         }
      }
      finally
      {
         if (connection != null)
         {
            connection.close();
         }
        
         System.clearProperty("jboss.messaging.callback.bind.address");
        
         System.clearProperty("jboss.messaging.callback.bind.port");
View Full Code Here


      if (!(conn instanceof JBossConnection))
      {
         throw new Exception("Connection not an instance of JBossConnection");
      }
     
      JBossConnection jbconn = (JBossConnection)conn;
     
      DelegateSupport del = (DelegateSupport)jbconn.getDelegate();
     
      ConnectionState state = (ConnectionState)del.getState();
     
      return state.getServerID();
   }
View Full Code Here

      try
      {

         conn = cf.createXAConnection();

         JBossConnection jbConn = (JBossConnection)conn;

         ClientConnectionDelegate del = (ClientConnectionDelegate)jbConn.getDelegate();

         ConnectionState state = (ConnectionState)del.getState();

         ResourceManager rm = state.getResourceManager();
View Full Code Here

      try
      {

         conn = cf.createXAConnection();

         JBossConnection jbConn = (JBossConnection)conn;

         ClientConnectionDelegate del = (ClientConnectionDelegate)jbConn.getDelegate();

         ConnectionState state = (ConnectionState)del.getState();

         ResourceManager rm = state.getResourceManager();
View Full Code Here

      try
      {

         conn = cf.createXAConnection();

         JBossConnection jbConn = (JBossConnection)conn;

         ClientConnectionDelegate del = (ClientConnectionDelegate)jbConn.getDelegate();

         ConnectionState state = (ConnectionState)del.getState();

         ResourceManager rm = state.getResourceManager();
View Full Code Here

      try
      {

         conn = cf.createXAConnection();

         JBossConnection jbConn = (JBossConnection)conn;

         ClientConnectionDelegate del = (ClientConnectionDelegate)jbConn.getDelegate();

         ConnectionState state = (ConnectionState)del.getState();

         ResourceManager rm = state.getResourceManager();
View Full Code Here

      try
      {

         conn = cf.createXAConnection();

         JBossConnection jbConn = (JBossConnection)conn;

         ClientConnectionDelegate del = (ClientConnectionDelegate)jbConn.getDelegate();

         ConnectionState state = (ConnectionState)del.getState();

         ResourceManager rm = state.getResourceManager();
View Full Code Here

      try
      {
         xaConn = cf.createXAConnection();

         JBossConnection jbConn = (JBossConnection)xaConn;

         ClientConnectionDelegate del = (ClientConnectionDelegate)jbConn.getDelegate();

         ConnectionState state = (ConnectionState)del.getState();

         ResourceManager rm = state.getResourceManager();
View Full Code Here

      try
      {
         xaConn = cf.createXAConnection();

         JBossConnection jbConn = (JBossConnection)xaConn;

         ClientConnectionDelegate del = (ClientConnectionDelegate)jbConn.getDelegate();

         ConnectionState state = (ConnectionState)del.getState();

         ResourceManager rm = state.getResourceManager();
View Full Code Here

   //https://jira.jboss.org/jira/browse/JBMESSAGING-1751
   public void testCloseClientLeak() throws Exception
   {
      if (!this.isRemote()) return;
     
      JBossConnection conn = (JBossConnection)cf.createConnection();

      try
      {
         ClientConnectionDelegate delegate = (ClientConnectionDelegate)conn.getDelegate();
         JMSRemotingConnection rmconn = delegate.getRemotingConnection();
         Client client = rmconn.getRemotingClient();
         MicroSocketClientInvoker invoker = (MicroSocketClientInvoker)client.getInvoker();

         Field[] fields = MicroSocketClientInvoker.class.getDeclaredFields();
         Field poolsField = null;

         for (Field f : fields)
         {
            if ("connectionPools".equals(f.getName()))
            {
               poolsField = f;
               poolsField.setAccessible(true);
               break;
            }
         }

         Map pools = (Map)poolsField.get(invoker);

         assertEquals(2, pools.size());
      }
      finally
      {
         conn.close();
      }
   }
View Full Code Here

TOP

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

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.