@Override public TopicConnection createTopicConnection(String username, String password) throws JMSException { throw new javax.jms.IllegalStateException( "SingleConnectionFactory does not support custom username and password"); }
@Override public Connection createConnection(String username, String password) throws JMSException { throw new javax.jms.IllegalStateException( "SingleConnectionFactory does not support custom username and password"); }
@Override public QueueConnection createQueueConnection(String username, String password) throws JMSException { throw new javax.jms.IllegalStateException( "SingleConnectionFactory does not support custom username and password"); }
public Session getSession() throws JMSException { if (!xa) { throw new IllegalStateException("Isn't an XASession"); } return this; }
@Override public QueueConnection createQueueConnection() throws JMSException { Connection con; synchronized (this.connectionMonitor) { this.pubSubMode = Boolean.FALSE; con = createConnection(); } if (!(con instanceof QueueConnection)) { throw new javax.jms.IllegalStateException( "This SingleConnectionFactory does not hold a QueueConnection but rather: " + con); } return ((QueueConnection) con); }
@Override public TopicConnection createTopicConnection() throws JMSException { Connection con; synchronized (this.connectionMonitor) { this.pubSubMode = Boolean.TRUE; con = createConnection(); } if (!(con instanceof TopicConnection)) { throw new javax.jms.IllegalStateException( "This SingleConnectionFactory does not hold a TopicConnection but rather: " + con); } return ((TopicConnection) con); }
/** * Resolve this accessor's target queue. * @param session the current JMS Session * @return the resolved target Queue * @throws JMSException if resolution failed */ protected Queue resolveQueue(Session session) throws JMSException { if (this.queue instanceof Queue) { return (Queue) this.queue; } else if (this.queue instanceof String) { return resolveQueueName(session, (String) this.queue); } else { throw new javax.jms.IllegalStateException( "Queue object [" + this.queue + "] is neither a [javax.jms.Queue] nor a queue name String"); } }
@Override public QueueConnection createQueueConnection(String username, String password) throws JMSException { ConnectionFactory target = obtainTargetConnectionFactory(); if (target instanceof QueueConnectionFactory) { return ((QueueConnectionFactory) target).createQueueConnection(username, password); } else { Connection con = target.createConnection(username, password); if (!(con instanceof QueueConnection)) { throw new javax.jms.IllegalStateException("'targetConnectionFactory' is not a QueueConnectionFactory"); } return (QueueConnection) con; } }
@Override public TopicConnection createTopicConnection(String username, String password) throws JMSException { ConnectionFactory target = obtainTargetConnectionFactory(); if (target instanceof TopicConnectionFactory) { return ((TopicConnectionFactory) target).createTopicConnection(username, password); } else { Connection con = target.createConnection(username, password); if (!(con instanceof TopicConnection)) { throw new javax.jms.IllegalStateException("'targetConnectionFactory' is not a TopicConnectionFactory"); } return (TopicConnection) con; } }
@Override public QueueConnection createQueueConnection() throws JMSException { ConnectionFactory target = obtainTargetConnectionFactory(); if (target instanceof QueueConnectionFactory) { return ((QueueConnectionFactory) target).createQueueConnection(); } else { Connection con = target.createConnection(); if (!(con instanceof QueueConnection)) { throw new javax.jms.IllegalStateException("'targetConnectionFactory' is not a QueueConnectionFactory"); } return (QueueConnection) con; } }
@Override public TopicConnection createTopicConnection() throws JMSException { ConnectionFactory target = obtainTargetConnectionFactory(); if (target instanceof TopicConnectionFactory) { return ((TopicConnectionFactory) target).createTopicConnection(); } else { Connection con = target.createConnection(); if (!(con instanceof TopicConnection)) { throw new javax.jms.IllegalStateException("'targetConnectionFactory' is not a TopicConnectionFactory"); } return (TopicConnection) con; } }
/** * This implementation delegates to the {@code createQueueConnection(username, password)} * method of the target QueueConnectionFactory, passing in the specified user credentials. * If the specified username is empty, it will simply delegate to the standard * {@code createQueueConnection()} method of the target ConnectionFactory. * @param username the username to use * @param password the password to use * @return the Connection * @see javax.jms.QueueConnectionFactory#createQueueConnection(String, String) * @see javax.jms.QueueConnectionFactory#createQueueConnection() */ protected QueueConnection doCreateQueueConnection( @Nullable String username, @Nullable String password) throws JMSException { ConnectionFactory target = obtainTargetConnectionFactory(); if (!(target instanceof QueueConnectionFactory)) { throw new javax.jms.IllegalStateException("'targetConnectionFactory' is not a QueueConnectionFactory"); } QueueConnectionFactory queueFactory = (QueueConnectionFactory) target; if (StringUtils.hasLength(username)) { return queueFactory.createQueueConnection(username, password); } else { return queueFactory.createQueueConnection(); } }
/** * This implementation delegates to the {@code createTopicConnection(username, password)} * method of the target TopicConnectionFactory, passing in the specified user credentials. * If the specified username is empty, it will simply delegate to the standard * {@code createTopicConnection()} method of the target ConnectionFactory. * @param username the username to use * @param password the password to use * @return the Connection * @see javax.jms.TopicConnectionFactory#createTopicConnection(String, String) * @see javax.jms.TopicConnectionFactory#createTopicConnection() */ protected TopicConnection doCreateTopicConnection( @Nullable String username, @Nullable String password) throws JMSException { ConnectionFactory target = obtainTargetConnectionFactory(); if (!(target instanceof TopicConnectionFactory)) { throw new javax.jms.IllegalStateException("'targetConnectionFactory' is not a TopicConnectionFactory"); } TopicConnectionFactory queueFactory = (TopicConnectionFactory) target; if (StringUtils.hasLength(username)) { return queueFactory.createTopicConnection(username, password); } else { return queueFactory.createTopicConnection(); } }
@Override public QueueConnection createQueueConnection(String username, String password) throws JMSException { ConnectionFactory target = getTargetConnectionFactory(); if (!(target instanceof QueueConnectionFactory)) { throw new javax.jms.IllegalStateException("'targetConnectionFactory' is no QueueConnectionFactory"); } QueueConnection targetConnection = ((QueueConnectionFactory) target).createQueueConnection(username, password); return (QueueConnection) getTransactionAwareConnectionProxy(targetConnection); }
@Override public QueueConnection createQueueConnection() throws JMSException { ConnectionFactory target = getTargetConnectionFactory(); if (!(target instanceof QueueConnectionFactory)) { throw new javax.jms.IllegalStateException("'targetConnectionFactory' is no QueueConnectionFactory"); } QueueConnection targetConnection = ((QueueConnectionFactory) target).createQueueConnection(); return (QueueConnection) getTransactionAwareConnectionProxy(targetConnection); }
@Override public TopicConnection createTopicConnection(String username, String password) throws JMSException { ConnectionFactory target = getTargetConnectionFactory(); if (!(target instanceof TopicConnectionFactory)) { throw new javax.jms.IllegalStateException("'targetConnectionFactory' is no TopicConnectionFactory"); } TopicConnection targetConnection = ((TopicConnectionFactory) target).createTopicConnection(username, password); return (TopicConnection) getTransactionAwareConnectionProxy(targetConnection); }
@Override public TopicConnection createTopicConnection() throws JMSException { ConnectionFactory target = getTargetConnectionFactory(); if (!(target instanceof TopicConnectionFactory)) { throw new javax.jms.IllegalStateException("'targetConnectionFactory' is no TopicConnectionFactory"); } TopicConnection targetConnection = ((TopicConnectionFactory) target).createTopicConnection(); return (TopicConnection) getTransactionAwareConnectionProxy(targetConnection); }
@Test public void testIllegalStateException() throws Exception { doTestJmsException(new javax.jms.IllegalStateException(""), org.springframework.jms.IllegalStateException.class); }
private void checkClosed() throws JMSException { if (consumer.isClosed() || session.getCoreSession().isClosed()) { throw new IllegalStateException("Consumer is closed"); } }
public static JMSException convertFromActiveMQException(final ActiveMQInterruptedException me) { JMSException je = new javax.jms.IllegalStateException(me.getMessage()); je.setStackTrace(me.getStackTrace()); je.initCause(me); return je; }