Package javax.jms

Examples of javax.jms.IllegalStateException


      }
   }
  
   protected final void checkIfOpen(String methodName) throws IllegalStateException {
      if (!this.open)
         throw new IllegalStateException(ME + " the session has been closed, operation '" + methodName + "' not permitted");
   }
View Full Code Here


         throw new IllegalStateException(ME + " the session has been closed, operation '" + methodName + "' not permitted");
   }

   protected final void checkIfTransacted(String methodName) throws IllegalStateException {
      if (!this.transacted)
         throw new IllegalStateException(ME, "the session is not transacted, operation '" + methodName + "' not permitted");
   }
View Full Code Here

      checkAndRollbackJMS(tx, xid);
     
      // Invalid xid
      if (tx == null)
      {
         throw new IllegalStateException("Cannot find transaction " + xid);
      }
                 
      TransactionRequest request =
         new TransactionRequest(TransactionRequest.ONE_PHASE_COMMIT_REQUEST, null, tx);
     
      try
      {
         connection.sendTransaction(request, false);
        
         // If we get this far we can remove the transaction
        
         if (this.removeTxInternal(xid) == null)
         {
            throw new IllegalStateException("Cannot find xid to remove " + xid);
         }
      }
      catch (Throwable t)
      {
         // If a problem occurs during commit processing the session should be rolled back
View Full Code Here

     
      ClientTransaction ts = removeTxInternal(xid);
     
      if (ts == null)
      {     
         throw new IllegalStateException("Cannot find transaction with xid:" + xid);        
      }
     
      // don't need messages for rollback
      // We don't clear the acks since we need to redeliver locally
      ts.clearMessages();
View Full Code Here

   {
      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]);
View Full Code Here

   {
      try
      {
         if (closed)
         {
            throw new IllegalStateException("Session is closed");
         }
        
         ManagedDestination dest = (ManagedDestination)dm.getDestination(name, true);
        
         if (dest == null)
View Full Code Here

   {
      try
      {
         if (closed)
         {
            throw new IllegalStateException("Session is closed");
         }
        
         ManagedDestination dest = (ManagedDestination)dm.getDestination(name, false);
                 
         if (dest == null)
View Full Code Here

      try
      {
         if (postOffice.isLocal())
         {
            throw new IllegalStateException("Recovering deliveries but post office is not clustered!");
         }
        
         long maxDeliveryId = 0;
                 
         //Sort into different list for each channel
         Map ackMap = new HashMap();
                 
         for (Iterator iter = deliveryRecoveryInfos.iterator(); iter.hasNext(); )
         {
            DeliveryRecovery deliveryInfo = (DeliveryRecovery)iter.next();
               
            String queueName = deliveryInfo.getQueueName();

            List acks = (List)ackMap.get(queueName);
           
            if (acks == null)
            {
               acks = new ArrayList();
              
               ackMap.put(queueName, acks);
            }
           
            acks.add(deliveryInfo);
        
        
         Iterator iter = ackMap.entrySet().iterator();
        
         while (iter.hasNext())
         {
            Map.Entry entry = (Map.Entry)iter.next();
           
            String queueName = (String)entry.getKey();
           
            //Look up channel
            Binding binding = postOffice.getBindingForQueueName(queueName);
           
            if (binding == null)
            {
               throw new IllegalStateException("Cannot find channel with queue name: " + queueName);
            }
           
            List acks = (List)entry.getValue();
           
            List ids = new ArrayList(acks.size());
           
            for (Iterator iter2 = acks.iterator(); iter2.hasNext(); )
            {
               DeliveryRecovery info = (DeliveryRecovery)iter2.next();
              
               ids.add(new Long(info.getMessageID()));
            }
           
            Queue queue = binding.getQueue();
           
            JMSCondition cond = (JMSCondition)binding.getCondition();                       
           
            ManagedDestination dest =
               sp.getDestinationManager().getDestination(cond.getName(), cond.isQueue());
           
            if (dest == null)
            {
               throw new IllegalStateException("Cannot find managed destination with name " +
                  cond.getName() + " isQueue" + cond.isQueue());
            }
           
            Queue dlqToUse =
               dest.getDLQ() == null ? defaultDLQ : dest.getDLQ();
View Full Code Here

   {
      try
      {
         if (closed)
         {
            throw new IllegalStateException("Session is closed");
         }
         if (!dest.isTemporary())
         {
            throw new InvalidDestinationException("Destination:" + dest +
               " is not a temporary destination");
View Full Code Here

   {
      try
      {
         if (closed)
         {
            throw new IllegalStateException("Session is closed");
         }
  
         if (!dest.isTemporary())
         {
            throw new InvalidDestinationException("Destination:" + dest +
               " is not a temporary destination");
         }
        
         ManagedDestination mDest = dm.getDestination(dest.getName(), dest.isQueue());
        
         if (mDest == null)
         {
            throw new InvalidDestinationException("No such destination: " + dest);
         }
                 
         if (dest.isQueue())
         {
            //Unbind
            postOffice.unbindQueue(dest.getName());
           
            String counterName = TEMP_QUEUE_MESSAGECOUNTER_PREFIX + dest.getName();
           
            connectionEndpoint.removeTemporaryDestination(dest);
           
            MessageCounter counter =
               sp.getMessageCounterManager().unregisterMessageCounter(counterName);
           
            if (counter == null)
            {
               throw new IllegalStateException("Cannot find counter to unregister " + counterName);
            }
         }
         else
         {
            //Topic           
            Collection bindings =
               postOffice.getBindingsForCondition(new JMSCondition(false, dest.getName()));
           
            if (!bindings.isEmpty())
            {
               throw new IllegalStateException("Cannot delete temporary destination, " +
                  "since it has active consumer(s)");
            }
         }
        
         dm.unregisterDestination(mDest);                            
View Full Code Here

TOP

Related Classes of javax.jms.IllegalStateException

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.