Package org.jboss.jms.server

Examples of org.jboss.jms.server.ServerPeer


                                               "each Connection Factory");
         }
     
         String locatorURI = (String)JMXAccessor.getJMXAttributeOverSecurity(server, connectorObjectName, "InvokerLocator");

         ServerPeer serverPeer = (ServerPeer)JMXAccessor.getJMXAttributeOverSecurity(server, serverPeerObjectName, "Instance");

         if (!serverPeer.isSupportsFailover())
         {
            this.supportsFailover = false;
         }
        
         InvokerLocator locator = new InvokerLocator(locatorURI);
        
         String protocol = locator.getProtocol();
        
         if (!disableRemotingChecks && (protocol.equals("bisocket") || protocol.equals("sslbisocket")))
         {        
           //Sanity check - If users are using the AS Service Binding Manager to provide the remoting connector
           //configuration, it is quite easy for them to end up using an old version depending on what version on
           //the AS they are running in - e.g. if they have forgotten to update it.
           //This can lead to subtle errors - therefore we do a sanity check by checking the existence of some properties
           //which should always be there
           Map params = locator.getParameters();          
          
           //The "compulsory" parameters
           boolean cont =
             checkParam(params, "marshaller", "org.jboss.jms.wireformat.JMSWireFormat") &&              
             checkParam(params, "unmarshaller", "org.jboss.jms.wireformat.JMSWireFormat") &&
             checkParam(params, "dataType", "jms") &&
             checkParam(params, "timeout", "0") &&
             checkParam(params, "clientSocketClass", "org.jboss.jms.client.remoting.ClientSocketWrapper") &&
             checkParam(params, "numberOfCallRetries", "1") &&
             checkParam(params, "pingFrequency", "214748364") &&
             checkParam(params, "pingWindowFactor", "10");
          
           if (!cont)
           {
             throw new IllegalArgumentException("Failed to deploy connection factory since remoting configuration seems incorrect.");                                            
           }

           String val = (String)params.get("clientLeasePeriod");   
           if (val != null)
           {
             int i = Integer.parseInt(val);
             if (i < 5000)
             {
               log.warn("Value of clientLeasePeriod at " + i + " seems low. Normal values are >= 5000");
             }
           }
          
           val = (String)params.get("JBM_clientMaxPoolSize")
           if (val != null)
           {
             int i = Integer.parseInt(val);
             if (i < 50)
             {
               log.warn("Value of JBM_clientMaxPoolSize at " + i + " seems low. Normal values are >= 50");
             }
           }
         }

         connectionFactoryManager = serverPeer.getConnectionFactoryManager();
         connectorManager = serverPeer.getConnectorManager();
         connectionManager = serverPeer.getConnectionManager();

         int refCount = connectorManager.registerConnector(connectorObjectName.getCanonicalName());

         long leasePeriod = (Long)JMXAccessor.getJMXAttributeOverSecurity(server, connectorObjectName, "LeasePeriod");
View Full Code Here


      try
      {
         TransactionManager tm = getTransactionManagerReference();

         ServerPeer serverPeer = (ServerPeer) JMXAccessor.getJMXAttributeOverSecurity(server, serverPeerObjectName, "Instance");

         MessageStore ms = serverPeer.getMessageStore();
        
         PersistenceManager pm = serverPeer.getPersistenceManagerInstance();
        
         TransactionRepository tr = serverPeer.getTxRepository();
        
         IDManager idManager = serverPeer.getChannelIDManager();
        
         int nodeId = serverPeer.getServerPeerID();
        
         ClusterNotifier clusterNotifier = serverPeer.getClusterNotifier();

         ConditionFactory cf = new JMSConditionFactory();
                 
         FilterFactory ff = new SelectorFactory();
        
         if (clustered)
         {       
            ChannelFactory jChannelFactory = null;

           if (channelFactoryName != null)
            {
               Object info = null;
               try
               {
                  info = server.getMBeanInfo(channelFactoryName);
               }
               catch (Exception e)
               {
                  // log.error("Error", e);
                  // noop... means we couldn't find the channel hence we should use regular
                  // XMLChannelFactories
               }

               if (info != null)
               {
                  log.debug(this + " uses MultiplexerJChannelFactory");

                  jChannelFactory =
                     new MultiplexerChannelFactory(server, channelFactoryName, channelPartitionName,
                                                    controlChannelName, dataChannelName);
               }
               else
               {
                  log.debug(this + " uses XMLJChannelFactory");
                  jChannelFactory = new XMLChannelFactory(controlChannelConfig, dataChannelConfig);
               }
            }
            else
            {
               log.debug(this + " uses XMLJChannelFactory");
               jChannelFactory = new XMLChannelFactory(controlChannelConfig, dataChannelConfig);
            }
          
           postOffice =  new MessagingPostOffice(ds, tm, sqlProperties,
                                                 createTablesOnStartup,
                                                 nodeId, officeName, ms,
                                                 pm,
                                                 tr, ff, cf, idManager,
                                                 clusterNotifier,
                                                 groupName,
                                                 jChannelFactory,
                                                 stateTimeout, castTimeout,
                                                  serverPeer.isSupportsFailover(),
                                                  maxConcurrentReplications);
         }
         else
         {
           postOffice =  new MessagingPostOffice(ds, tm, sqlProperties,
View Full Code Here

      if (destination.isTopic())
      {
         PostOffice postOffice = sessionEndpoint.getConnectionEndpoint().getServerPeer().getPostOfficeInstance();
                 
         ServerPeer sp = sessionEndpoint.getConnectionEndpoint().getServerPeer();
        
         Queue queue = postOffice.getBindingForQueueName(queueName).queue;       
        
         ManagedDestination mDest = sp.getDestinationManager().getDestination(destination.getName(), false);
        
         if (!queue.isRecoverable())
         {
            postOffice.removeBinding(queueName, false);           

            if (!mDest.isTemporary())
            {
              String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + queueName;
 
              MessageCounter counter = sp.getMessageCounterManager().unregisterMessageCounter(counterName);
 
              if (counter == null)
              {
                 throw new IllegalStateException("Cannot find counter to remove " + counterName);
              }
View Full Code Here

      if (destination.isTopic())
      {
         PostOffice postOffice = sessionEndpoint.getConnectionEndpoint().getServerPeer().getPostOfficeInstance();
                 
         ServerPeer sp = sessionEndpoint.getConnectionEndpoint().getServerPeer();
        
         Binding binding = postOffice.getBindingForQueueName(queueName);
        
         //https://jira.jboss.org/jira/browse/JBMESSAGING-1801
         if (binding == null) return;
        
         Queue queue = binding.queue;       
        
         ManagedDestination mDest = sp.getDestinationManager().getDestination(destination.getName(), false);
        
         if (!queue.isRecoverable())
         {
            postOffice.removeBinding(queueName, false);           

            if (!mDest.isTemporary())
            {
              String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + queueName;
 
              MessageCounter counter = sp.getMessageCounterManager().unregisterMessageCounter(counterName);
 
              if (counter == null)
              {
                 throw new IllegalStateException("Cannot find counter to remove " + counterName);
              }
View Full Code Here

      if (destination.isTopic())
      {
         PostOffice postOffice = sessionEndpoint.getConnectionEndpoint().getServerPeer().getPostOfficeInstance();
                 
         ServerPeer sp = sessionEndpoint.getConnectionEndpoint().getServerPeer();
        
         Binding binding = postOffice.getBindingForQueueName(queueName);
        
         //https://jira.jboss.org/jira/browse/JBMESSAGING-1801
         if (binding == null) return;
        
         Queue queue = binding.queue;       
        
         ManagedDestination mDest = sp.getDestinationManager().getDestination(destination.getName(), false);
        
         if (!queue.isRecoverable())
         {
            postOffice.removeBinding(queueName, false);           

            if (!mDest.isTemporary())
            {
              String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + queueName;
 
              MessageCounter counter = sp.getMessageCounterManager().unregisterMessageCounter(counterName);
 
              if (counter == null)
              {
                 throw new IllegalStateException("Cannot find counter to remove " + counterName);
              }
View Full Code Here

         Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
        
         conn2 = (JBossConnection)cf.createConnection();
         Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
        
         ServerPeer peer = ServerManagement.getServer().getServerPeer();
        
         SimpleConnectionManager cm = (SimpleConnectionManager)peer.getConnectionManager();
        
         //Simulate failure on connection
        
         Map jmsClients = cm.getClients();
         assertEquals(1, jmsClients.size());
View Full Code Here

   }
  

   public void testCFWithMock() throws Exception
   {
      ServerPeer mockPeer = new ServerPeer();
      SimpleConnectionManager cm = new SimpleConnectionManager();
     
      // Instead of exposing setConnectionManager just for this test, we are doing this hack
      // to set the ConnectionManager
      Field  field = ServerPeer.class.getDeclaredField("connectionManager");
View Full Code Here

      if (destination.isTopic())
      {
         PostOffice postOffice = sessionEndpoint.getConnectionEndpoint().getServerPeer().getPostOfficeInstance();
                 
         ServerPeer sp = sessionEndpoint.getConnectionEndpoint().getServerPeer();
        
         Binding binding = postOffice.getBindingForQueueName(queueName);
        
         //https://jira.jboss.org/jira/browse/JBMESSAGING-1801
         if (binding == null) return;
        
         Queue queue = binding.queue;       
        
         ManagedDestination mDest = sp.getDestinationManager().getDestination(destination.getName(), false);
        
         if (!queue.isRecoverable())
         {
            postOffice.removeBinding(queueName, false);           

            if (!mDest.isTemporary())
            {
              String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + queueName;
 
              MessageCounter counter = sp.getMessageCounterManager().unregisterMessageCounter(counterName);
 
              if (counter == null)
              {
                 throw new IllegalStateException("Cannot find counter to remove " + counterName);
              }
View Full Code Here

      try
      {
         TransactionManager tm = getTransactionManagerReference();

         ServerPeer serverPeer = (ServerPeer) JMXAccessor.getJMXAttributeOverSecurity(server, serverPeerObjectName, "Instance");

         MessageStore ms = serverPeer.getMessageStore();
        
         PersistenceManager pm = serverPeer.getPersistenceManagerInstance();
        
         TransactionRepository tr = serverPeer.getTxRepository();
        
         IDManager idManager = serverPeer.getChannelIDManager();
        
         int nodeId = serverPeer.getServerPeerID();
        
         ClusterNotifier clusterNotifier = serverPeer.getClusterNotifier();

         ConditionFactory cf = new JMSConditionFactory();
                 
         FilterFactory ff = new SelectorFactory();
        
         if (clustered)
         {
            ChannelFactory jChannelFactory = null;

           if (channelFactoryName != null)
            {
               Object info = null;
               try
               {
                  info = server.getMBeanInfo(channelFactoryName);
               }
               catch (Exception e)
               {
                  // log.error("Error", e);
                  // noop... means we couldn't find the channel hence we should use regular
                  // XMLChannelFactories
               }

               if (info != null)
               {
                  log.debug(this + " uses MultiplexerJChannelFactory");

                  jChannelFactory =
                     new MultiplexerChannelFactory(server, channelFactoryName, channelPartitionName,
                                                    controlChannelName, dataChannelName);
               }
               else
               {
                  log.debug(this + " uses XMLJChannelFactory");
                  jChannelFactory = new XMLChannelFactory(controlChannelConfig, dataChannelConfig);
               }
            }
            else
            {
               log.debug(this + " uses XMLJChannelFactory");
               jChannelFactory = new XMLChannelFactory(controlChannelConfig, dataChannelConfig);
            }
          
           // http://jira.jboss.org/jira/browse/JBMESSAGING-1244
           // if the channelPartitionName is set, we use it to identify the control and
           // data channels. Otherwise, we fall back to use groupName
           String channelName = (channelPartitionName != null)? channelPartitionName : groupName;
          
           postOffice =  new MessagingPostOffice(ds, tm, sqlProperties,
                                                 createTablesOnStartup,
                                                 nodeId, officeName, ms,
                                                 pm,
                                                 tr, ff, cf, idManager,
                                                 clusterNotifier,
                                                 channelName,
                                                 jChannelFactory,
                                                 stateTimeout, castTimeout,
                                                  serverPeer.isSupportsFailover(),
                                                  maxConcurrentReplications,
                                                  failoverOnNodeLeave,
                                                  maxRetry,
                                                  retryInterval,
                                                  retryOnConnectionFailure,
View Full Code Here

                                               "each Connection Factory");
         }
     
         String locatorURI = (String)JMXAccessor.getJMXAttributeOverSecurity(server, connectorObjectName, "InvokerLocator");

         ServerPeer serverPeer = (ServerPeer)JMXAccessor.getJMXAttributeOverSecurity(server, serverPeerObjectName, "Instance");

         if (!serverPeer.isSupportsFailover())
         {
            this.supportsFailover = false;
         }
        
         InvokerLocator locator = new InvokerLocator(locatorURI);
        
         String protocol = locator.getProtocol();
        
         if (!disableRemotingChecks && (protocol.equals("bisocket") || protocol.equals("sslbisocket")))
         {        
           //Sanity check - If users are using the AS Service Binding Manager to provide the remoting connector
           //configuration, it is quite easy for them to end up using an old version depending on what version on
           //the AS they are running in - e.g. if they have forgotten to update it.
           //This can lead to subtle errors - therefore we do a sanity check by checking the existence of some properties
           //which should always be there
           Map params = locator.getParameters();          
          
           //The "compulsory" parameters
           boolean cont =
             checkParam(params, "marshaller", "org.jboss.jms.wireformat.JMSWireFormat") &&              
             checkParam(params, "unmarshaller", "org.jboss.jms.wireformat.JMSWireFormat") &&
             checkParam(params, "dataType", "jms") &&
             checkParam(params, "clientSocketClass", "org.jboss.jms.client.remoting.ClientSocketWrapper");

           if (!cont)
           {
             throw new IllegalArgumentException("Failed to deploy connection factory since remoting configuration seems incorrect.");                                            
           }

           String val = (String)params.get("clientLeasePeriod");   
           if (val != null)
           {
             int i = Integer.parseInt(val);
             if (i < 5000)
             {
               log.warn("Value of clientLeasePeriod at " + i + " seems low. Normal values are >= 5000");
             }
           }
          
           val = (String)params.get("JBM_clientMaxPoolSize")
           if (val != null)
           {
             int i = Integer.parseInt(val);
             if (i < 50)
             {
               log.warn("Value of JBM_clientMaxPoolSize at " + i + " seems low. Normal values are >= 50");
             }
           }
         }

         connectionFactoryManager = serverPeer.getConnectionFactoryManager();
         connectorManager = serverPeer.getConnectorManager();
         connectionManager = serverPeer.getConnectionManager();

         int refCount = connectorManager.registerConnector(connectorObjectName.getCanonicalName());

         long leasePeriod = (Long)JMXAccessor.getJMXAttributeOverSecurity(server, connectorObjectName, "LeasePeriod");

         // if leasePeriod <= 0, disable pinging altogether

         boolean enablePing = leasePeriod > 0;
        
         if (refCount == 1 && enablePing)
         {
            // install the connection listener that listens for failed connections           
            server.invoke(connectorObjectName, "addConnectionListener",
                  new Object[] {connectionManager},
                  new String[] {"org.jboss.remoting.ConnectionListener"});
         }
        
         // We use the MBean service name to uniquely identify the connection factory
        
         connectionFactoryManager.
            registerConnectionFactory(getServiceName().getCanonicalName(), clientID, jndiBindings,
                                      locatorURI, enablePing, prefetchSize, slowConsumers,
                                      defaultTempQueueFullSize, defaultTempQueuePageSize,                                     
                                      defaultTempQueueDownCacheSize, dupsOKBatchSize, supportsFailover, supportsLoadBalancing,
                                      loadBalancingFactory, strictTck, sendAcksAsync, enableOrderingGroup, defaultOrderingGroupName,
                                      maxRetryChangeRate, retryChangeRateInterval);              
        
         String info = "Connector " + locator.getProtocol() + "://" +
            locator.getHost() + ":" + locator.getPort();
                
         if (enablePing)
         {
            info += " has leasing enabled, lease period " + leasePeriod + " milliseconds";
         }
         else
         {
            info += " has lease disabled";
         }
     
         log.info(info);
        
         serverPeer.registerCFForRecovery(serviceName);
         log.info(this + " started");
      }
      catch (Throwable t)
      {
         throw ExceptionUtil.handleJMXInvocation(t, this + " startService");
View Full Code Here

TOP

Related Classes of org.jboss.jms.server.ServerPeer

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.