Package org.jboss.jms.client.state

Examples of org.jboss.jms.client.state.ConnectionState


        
         JBossConnection jbConn = (JBossConnection)conn;
        
         ClientConnectionDelegate del = (ClientConnectionDelegate)jbConn.getDelegate();
        
         ConnectionState state = (ConnectionState)del.getState();
        
         ResourceManager rm = state.getResourceManager();
        
         Session session = conn.createSession(true, Session.SESSION_TRANSACTED);
        
        
         for (int i = 0; i < 100; i++)
View Full Code Here


        
         JBossConnection jbConn = (JBossConnection)conn;
        
         ClientConnectionDelegate del = (ClientConnectionDelegate)jbConn.getDelegate();
        
         ConnectionState state = (ConnectionState)del.getState();
        
         ResourceManager rm = state.getResourceManager();
        
         Session session = conn.createSession(true, Session.SESSION_TRANSACTED);
        
        
         for (int i = 0; i < 100; i++)
View Full Code Here

            {
               // valid connection

               log.debug(this + " got local connection delegate " + cd);

               ConnectionState state = (ConnectionState)((DelegateSupport)cd).getState();

               state.initializeFailoverCommandCenter();

               FailoverCommandCenter fcc = state.getFailoverCommandCenter();

               // add a connection listener to detect failure; the consolidated remoting connection
               // listener must be already in place and configured
               state.getRemotingConnection().getConnectionListener().
                  addDelegateListener(new ConnectionFailureListener(fcc, state.getRemotingConnection()));

               log.debug(this + " installed failure listener on " + cd);

               // also cache the username and the password into state, useful in case
               // FailoverCommandCenter needs to create a new connection instead of a failed on
               state.setUsername(username);
               state.setPassword(password);

               // also add a reference to the clustered ConnectionFactory delegate, useful in case
               // FailoverCommandCenter needs to create a new connection instead of a failed on
               state.setClusteredConnectionFactoryDeleage(clusteredDelegate);

               return new CreateConnectionResult(cd);
            }
            else
            {
View Full Code Here

      m.setJMSDestination(destination);
     
      SessionState sessionState = (SessionState)producerState.getParent();
                 
      // Generate the message id
      ConnectionState connectionState = (ConnectionState)sessionState.getParent();
     
      long id =
         connectionState.getIdGenerator().getId((ConnectionDelegate)connectionState.getDelegate());
   
      JBossMessage messageToSend;
      boolean foreign = false;

      if (!(m instanceof MessageProxy))
View Full Code Here

      boolean isCC = ((Boolean)mi.getArguments()[4]).booleanValue();

      // Create the message handler
      SessionState sessionState =
         (SessionState)((DelegateSupport)invocation.getTargetObject()).getState();
      ConnectionState connectionState = (ConnectionState)sessionState.getParent();
      SessionDelegate sessionDelegate = (SessionDelegate)invocation.getTargetObject();
      ConsumerState consumerState = (ConsumerState)((DelegateSupport)consumerDelegate).getState();
      int consumerID = consumerState.getConsumerID();
      int prefetchSize = consumerState.getBufferSize();
      QueuedExecutor sessionExecutor = sessionState.getExecutor();
      int maxDeliveries = consumerState.getMaxDeliveries();
     
      //We need the queue name for recovering any deliveries after failover
      String queueName = null;
      if (consumerState.getSubscriptionName() != null)
      {
         queueName = MessageQueueNameHelper.
            createSubscriptionName(connectionState.getClientID(),
                                   consumerState.getSubscriptionName());
      }
      else if (consumerState.getDestination().isQueue())
      {
         queueName = consumerState.getDestination().getName();
      }
     
      MessageCallbackHandler messageHandler =
         new MessageCallbackHandler(isCC, sessionState.getAcknowledgeMode(),
                                    sessionDelegate, consumerDelegate, consumerID, queueName,
                                    prefetchSize, sessionExecutor, maxDeliveries);
     
      sessionState.addCallbackHandler(messageHandler);
     
      CallbackManager cm = connectionState.getRemotingConnection().getCallbackManager();
      cm.registerHandler(consumerID, messageHandler);
        
      consumerState.setMessageCallbackHandler(messageHandler);
     
      //Now we have finished creating the client consumer, we can tell the SCD
View Full Code Here

      // First we call close on the messagecallbackhandler which waits for onMessage invocations     
      // to complete and the last delivery to arrive
      consumerState.getMessageCallbackHandler().close(lastDeliveryId);
               
      SessionState sessionState = (SessionState)consumerState.getParent();
      ConnectionState connectionState = (ConnectionState)sessionState.getParent();
                
      sessionState.removeCallbackHandler(consumerState.getMessageCallbackHandler());

      CallbackManager cm = connectionState.getRemotingConnection().getCallbackManager();
      cm.unregisterHandler(consumerState.getConsumerID());
        
      //And then we cancel any messages still in the message callback handler buffer    
      consumerState.getMessageCallbackHandler().cancelBuffer();
                                  
View Full Code Here

  
   // Interceptor implementation ------------------------------------
  
   public Object handleGetClientID(Invocation invocation) throws Throwable
   {
      ConnectionState currentState = getConnectionState(invocation);
     
      currentState.setJustCreated(false);
     
      if (currentState.getClientID() == null)
      {
         //Get from the server
         currentState.setClientID((String)invocation.invokeNext());
      }
      return currentState.getClientID();
   }
View Full Code Here

      return currentState.getClientID();
   }
  
   public Object handleSetClientID(Invocation invocation) throws Throwable
   {
      ConnectionState currentState = getConnectionState(invocation);
     
      if (currentState.getClientID() != null)
      {
         throw new IllegalStateException("Client id has already been set");
      }
      if (!currentState.isJustCreated())
      {
         throw new IllegalStateException("setClientID can only be called directly after the connection is created");
      }
     
      MethodInvocation mi = (MethodInvocation)invocation;
     
      currentState.setClientID((String)mi.getArguments()[0]);
     
      currentState.setJustCreated(false);
     
      // this gets invoked on the server too
      return invocation.invokeNext();
   }
View Full Code Here

      return invocation.invokeNext();
   }
  
   public Object handleGetExceptionListener(Invocation invocation) throws Throwable
   {
      ConnectionState state = getConnectionState(invocation);
      state.setJustCreated(false);
     
      return state.getRemotingConnection().getConnectionListener().getJMSExceptionListener();
   }
View Full Code Here

      return state.getRemotingConnection().getConnectionListener().getJMSExceptionListener();
   }
  
   public Object handleSetExceptionListener(Invocation invocation) throws Throwable
   {
      ConnectionState state = getConnectionState(invocation);
      state.setJustCreated(false);
     
      MethodInvocation mi = (MethodInvocation)invocation;
      ExceptionListener exceptionListener = (ExceptionListener)mi.getArguments()[0];
      state.getRemotingConnection().getConnectionListener().
         addJMSExceptionListener(exceptionListener);

      return null;
   }
View Full Code Here

TOP

Related Classes of org.jboss.jms.client.state.ConnectionState

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.