Package javax.resource.spi

Examples of javax.resource.spi.IllegalStateException


    * Does that mean that autentication should be redone. FIXME
    */
   public void cleanup() throws ResourceException
   {
      if (isDestroyed)
         throw new IllegalStateException("ManagedConnection already destroyed");

      // destory handles
      destroyHandles();

      // I'm recreating the lock object when we return to the pool
View Full Code Here


         JmsSession h = (JmsSession)obj;
         h.setManagedConnection(this);
         handles.add(h);
      }
      else
         throw new IllegalStateException
            ("ManagedConnection in an illegal state");
   }
View Full Code Here

    * @throws IllegalStateException    ManagedConnection already destroyed.
    */
   public ManagedConnectionMetaData getMetaData() throws ResourceException
   {
      if (isDestroyed)
         throw new IllegalStateException("ManagedConnection already destroyd");

      return new JmsMetaData(this);
   }
View Full Code Here

         if (info.getType() == JmsConnectionFactory.TOPIC)
         {
            String jndi = adapter.getTopicFactoryRef();
            if (jndi == null)
               throw new IllegalStateException("No configured 'TopicFactoryRef' on the jms provider " + mcf.getJmsProviderAdapterJNDI());
            factory = context.lookup(jndi);
            con = ConnectionFactoryHelper.createTopicConnection(factory, user, pwd);
            if (info.getClientID() != null)
               con.setClientID(info.getClientID());
            con.setExceptionListener(this);
            if (trace)
               log.trace("created connection: " + con);

            if (con instanceof XATopicConnection)
            {
               xaTopicSession = ((XATopicConnection)con).createXATopicSession();
               topicSession = xaTopicSession.getTopicSession();
               xaTransacted = true;
            }
            else if (con instanceof TopicConnection)
            {
               topicSession =
                  ((TopicConnection)con).createTopicSession(transacted, ack);
               if (trace)
                  log.trace("Using a non-XA TopicConnection.  " +
                            "It will not be able to participate in a Global UOW");
            }
            else
               throw new JBossResourceException("Connection was not recognizable: " + con);

            if (trace)
               log.trace("xaTopicSession=" + xaTopicSession + ", topicSession=" + topicSession);
         }
         else if (info.getType() == JmsConnectionFactory.QUEUE)
         {
            String jndi = adapter.getQueueFactoryRef();
            if (jndi == null)
               throw new IllegalStateException("No configured 'QueueFactoryRef' on the jms provider " + mcf.getJmsProviderAdapterJNDI());
            factory = context.lookup(jndi);
            con = ConnectionFactoryHelper.createQueueConnection(factory, user, pwd);
            if (info.getClientID() != null)
               con.setClientID(info.getClientID());
            con.setExceptionListener(this);
            if (trace)
               log.debug("created connection: " + con);

            if (con instanceof XAQueueConnection)
            {
               xaQueueSession =
                  ((XAQueueConnection)con).createXAQueueSession();
               queueSession = xaQueueSession.getQueueSession();
               xaTransacted = true;
            }
            else if (con instanceof QueueConnection)
            {
               queueSession =
                  ((QueueConnection)con).createQueueSession(transacted, ack);
               if (trace)
                  log.trace("Using a non-XA QueueConnection.  " +
                            "It will not be able to participate in a Global UOW");
            }
            else
               throw new JBossResourceException("Connection was not reconizable: " + con);

            if (trace)
               log.trace("xaQueueSession=" + xaQueueSession + ", queueSession=" + queueSession);
         }
         else
         {
            String jndi = adapter.getFactoryRef();
            if (jndi == null)
               throw new IllegalStateException("No configured 'FactoryRef' on the jms provider " + mcf.getJmsProviderAdapterJNDI());
            factory = context.lookup(jndi);
            con = ConnectionFactoryHelper.createConnection(factory, user, pwd);
            if (info.getClientID() != null)
               con.setClientID(info.getClientID());
            con.setExceptionListener(this);
View Full Code Here

        final ModelControllerClient client = ModelControllerClient.Factory.create(InetAddress.getByName("localhost"), 9999);

        try {
            // Check that the queue does not exist
            if(queueExists(queueName, sf)) {
                throw new IllegalStateException();
            }

            // Create a new core queue using the standalone client


            ModelNode op = new ModelNode();
            op.get("operation").set("add");
            op.get("address").add("subsystem", "messaging");
            op.get("address").add("queue", queueName);
            op.get("queue-address").set(queueName);
            applyUpdate(op, client);

            // Check if the queue exists
            if(! queueExists(queueName, sf)) {
                throw new IllegalStateException();
            }

            ClientSession session = null;
            try {
               session = sf.createSession();
               ClientProducer producer = session.createProducer(queueName);
               ClientMessage message = session.createMessage(false);

               final String propName = "myprop";
               message.putStringProperty(propName, "Hello sent at " + new Date());
               System.out.println("Sending the message.");

               producer.send(message);

               ClientConsumer messageConsumer = session.createConsumer(queueName);
               session.start();

               ClientMessage messageReceived = messageConsumer.receive(1000);
               System.out.println("Received TextMessage:" + messageReceived.getStringProperty(propName));
            } finally {
               if (session != null) {
                  session.close();
               }
            }

            op = new ModelNode();
            op.get("operation").set("remove");
            op.get("address").add("subsystem", "messaging");
            op.get("address").add("queue", queueName);
            applyUpdate(op, client);

            // Check that the queue does not exist
            if(queueExists(queueName, sf)) {
                throw new IllegalStateException();
            }
        } finally {
            client.close();
        }
    }
View Full Code Here

                    }
                }
            }
            userPrincipal = new SimplePrincipal(connectionUser.getName());
        } else {
            throw new IllegalStateException("Token authentication requested but no user on connection found.");
        }

        ContextStateCache stateCache = null;
        try {
            if (userPrincipal != null && connectionUser != null && authToken != null) {
View Full Code Here

                        break;
                    }
                }

            } else {
                throw new IllegalStateException("Delegation user requested but no user on connection found.");
            }
        }


        ContextStateCache stateCache = null;
View Full Code Here

         throw new SecurityException("Password credentials not the same, reauthentication not allowed");
      }

      if (isDestroyed.get())
      {
         throw new IllegalStateException("The managed connection is already destroyed");
      }

      HornetQRASession session = new HornetQRASession(this, (HornetQRAConnectionRequestInfo)cxRequestInfo);
      handles.add(session);
      return session;
View Full Code Here

         HornetQRAManagedConnection.log.trace("cleanup()");
      }

      if (isDestroyed.get())
      {
         throw new IllegalStateException("ManagedConnection already destroyed");
      }

      destroyHandles();

      inManagedTx = false;
View Full Code Here

         h.setManagedConnection(this);
         handles.add(h);
      }
      else
      {
         throw new IllegalStateException("ManagedConnection in an illegal state");
      }
   }
View Full Code Here

TOP

Related Classes of javax.resource.spi.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.