javax.jms.Connection.getMetaData()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(206)

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

Connection.getMetaData介绍

[英]Gets the metadata for this connection.
[中]获取此连接的元数据。

代码示例

代码示例来源:origin: openzipkin/brave

@Override public ConnectionMetaData getMetaData() throws JMSException {
 return delegate.getMetaData();
}

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

@Test
public void testWithConnectionFactoryAndLocalExceptionListenerWithReconnect() throws JMSException {
  ConnectionFactory cf = mock(ConnectionFactory.class);
  TestConnection con = new TestConnection();
  given(cf.createConnection()).willReturn(con);
  TestExceptionListener listener0 = new TestExceptionListener();
  TestExceptionListener listener1 = new TestExceptionListener();
  TestExceptionListener listener2 = new TestExceptionListener();
  SingleConnectionFactory scf = new SingleConnectionFactory(cf);
  scf.setReconnectOnException(true);
  scf.setExceptionListener(listener0);
  Connection con1 = scf.createConnection();
  con1.setExceptionListener(listener1);
  assertSame(listener1, con1.getExceptionListener());
  con1.start();
  Connection con2 = scf.createConnection();
  con2.setExceptionListener(listener2);
  assertSame(listener2, con2.getExceptionListener());
  con.getExceptionListener().onException(new JMSException(""));
  con2.close();
  con1.getMetaData();
  con.getExceptionListener().onException(new JMSException(""));
  con1.close();
  scf.destroy();  // should trigger actual close
  assertEquals(2, con.getStartCount());
  assertEquals(2, con.getCloseCount());
  assertEquals(2, listener0.getCount());
  assertEquals(2, listener1.getCount());
  assertEquals(1, listener2.getCount());
}

代码示例来源:origin: org.springframework.boot/spring-boot-actuator

@Override
protected void doHealthCheck(Health.Builder builder) throws Exception {
  try (Connection connection = this.connectionFactory.createConnection()) {
    new MonitoredConnection(connection).start();
    builder.up().withDetail("provider",
        connection.getMetaData().getJMSProviderName());
  }
}

代码示例来源:origin: com.bbossgroups.rpc/bboss-rpc

public ConnectionMetaData getMetaData() throws JMSException
{
  // TODO Auto-generated method stub
  return con.getMetaData();
}

代码示例来源:origin: jboss-fuse/fabric8

private boolean checkConnection() {
  if (connection == null) {
    return false;
  }
  try {
    connection.getMetaData();
    return true;
  } catch (JMSException e) {
    return false;
  }
}

代码示例来源:origin: org.apache.openejb/openejb-core

@Override
public ConnectionMetaData getMetaData() throws JMSException {
  return con.getMetaData();
}

代码示例来源:origin: bitronix/btm

@Override
public ConnectionMetaData getMetaData() throws JMSException {
  return nonXaConnection.getMetaData();
}

代码示例来源:origin: com.axway.ats.framework/ats-actionlibrary

@Override
public ConnectionMetaData getMetaData() throws JMSException {
  return connection.getMetaData();
}

代码示例来源:origin: com.github.marcus-nl.btm/btm

@Override
public ConnectionMetaData getMetaData() throws JMSException {
  return nonXaConnection.getMetaData();
}

代码示例来源:origin: org.seedstack.addons.jms/jms

@Override
public ConnectionMetaData getMetaData() throws JMSException {
  return getConnection().getMetaData();
}

代码示例来源:origin: org.seedstack.seed/seed-jms-support-core

@Override
public ConnectionMetaData getMetaData() throws JMSException {
  return getConnection().getMetaData();
}

代码示例来源:origin: org.seedstack.addons.jms/jms-core

@Override
public ConnectionMetaData getMetaData() throws JMSException {
  return getConnection().getMetaData();
}

代码示例来源:origin: org.apache.activemq/activemq-all

@Override
public ConnectionMetaData getMetaData() throws JMSException {
  return getConnection().getMetaData();
}

代码示例来源:origin: org.jboss.pnc/messaging

@PostConstruct
public void init() {
  try {
    connection = connectionFactory.createConnection();
    logger.info("JMS client ID {}.", connection.getClientID());
    logger.info("JMSXPropertyNames {}.", connection.getMetaData().getJMSXPropertyNames());
  } catch (Exception e) {
    logger.error("Failed to initialize JMS.", e);
  }
}

代码示例来源:origin: org.apache.tomee/openejb-core

@Override
public ConnectionMetaData getMetaData() {
  try {
    return connection().getMetaData();
  } catch (final JMSException e) {
    throw toRuntimeException(e);
  }
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * Return the provider version
 *
 * @return the JMS provider version
 * @throws EISException
 */
public String getEISProductVersion() throws EISException {
  try {
    return connection.getConnection().getMetaData().getProviderVersion();
  } catch (Exception exception) {
    throw EISException.createException(exception);
  }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.nosql

/**
 * Return the product name
 *
 * @return the JMS provider name
 * @throws EISException
 */
public String getEISProductName() throws EISException {
  try {
    return connection.getConnection().getMetaData().getJMSProviderName();
  } catch (Exception exception) {
    throw EISException.createException(exception);
  }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.nosql

/**
 * Return the provider version
 *
 * @return the JMS provider version
 * @throws EISException
 */
public String getEISProductVersion() throws EISException {
  try {
    return connection.getConnection().getMetaData().getProviderVersion();
  } catch (Exception exception) {
    throw EISException.createException(exception);
  }
}

代码示例来源:origin: apache/activemq-artemis

@Test
public void testGetMetadataOnClosedConnection() throws Exception {
 Connection connection = createConnection();
 connection.close();
 try {
   connection.getMetaData();
   ProxyAssertSupport.fail("should throw exception");
 } catch (javax.jms.IllegalStateException e) {
   // OK
 }
}

代码示例来源:origin: apache/activemq-artemis

@Test
public void testSetClientIdAfterGetMetadata() throws Exception {
 try (Connection connection = createConnection()) {
   connection.getMetaData();
   connection.setClientID("clientId");
 }
}

相关文章