javax.jms.IllegalStateException.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(9.8k)|赞(0)|评价(0)|浏览(163)

本文整理了Java中javax.jms.IllegalStateException.<init>()方法的一些代码示例,展示了IllegalStateException.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IllegalStateException.<init>()方法的具体详情如下:
包路径:javax.jms.IllegalStateException
类名称:IllegalStateException
方法名:<init>

IllegalStateException.<init>介绍

[英]Constructs an IllegalStateException with the specified reason. The error code defaults to null.
[中]构造具有指定原因的IllegalStateException。错误代码默认为null。

代码示例

代码示例来源:origin: spring-projects/spring-framework

@Override
public TopicConnection createTopicConnection(String username, String password) throws JMSException {
  throw new javax.jms.IllegalStateException(
      "SingleConnectionFactory does not support custom username and password");
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public Connection createConnection(String username, String password) throws JMSException {
  throw new javax.jms.IllegalStateException(
      "SingleConnectionFactory does not support custom username and password");
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public QueueConnection createQueueConnection(String username, String password) throws JMSException {
  throw new javax.jms.IllegalStateException(
      "SingleConnectionFactory does not support custom username and password");
}

代码示例来源:origin: wildfly/wildfly

public Session getSession() throws JMSException {
 if (!xa) {
   throw new IllegalStateException("Isn't an XASession");
 }
 return this;
}

代码示例来源:origin: spring-projects/spring-framework

@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);
}

代码示例来源:origin: spring-projects/spring-framework

@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);
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * 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");
  }
}

代码示例来源:origin: spring-projects/spring-framework

@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;
  }
}

代码示例来源:origin: spring-projects/spring-framework

@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;
  }
}

代码示例来源:origin: spring-projects/spring-framework

@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;
  }
}

代码示例来源:origin: spring-projects/spring-framework

@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;
  }
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * 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();
  }
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * 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();
  }
}

代码示例来源:origin: spring-projects/spring-framework

@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);
}

代码示例来源:origin: spring-projects/spring-framework

@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);
}

代码示例来源:origin: spring-projects/spring-framework

@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);
}

代码示例来源:origin: spring-projects/spring-framework

@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);
}

代码示例来源:origin: spring-projects/spring-framework

@Test
public void testIllegalStateException() throws Exception {
  doTestJmsException(new javax.jms.IllegalStateException(""), org.springframework.jms.IllegalStateException.class);
}

代码示例来源:origin: wildfly/wildfly

private void checkClosed() throws JMSException {
 if (consumer.isClosed() || session.getCoreSession().isClosed()) {
   throw new IllegalStateException("Consumer is closed");
 }
}

代码示例来源:origin: wildfly/wildfly

public static JMSException convertFromActiveMQException(final ActiveMQInterruptedException me) {
 JMSException je = new javax.jms.IllegalStateException(me.getMessage());
 je.setStackTrace(me.getStackTrace());
 je.initCause(me);
 return je;
}

相关文章