本文整理汇总了Java中javax.jms.ExceptionListener.onException方法的典型用法代码示例。如果您正苦于以下问题:Java ExceptionListener.onException方法的具体用法?Java ExceptionListener.onException怎么用?Java ExceptionListener.onException使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.jms.ExceptionListener
的用法示例。
在下文中一共展示了ExceptionListener.onException方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invokeExceptionListener
import javax.jms.ExceptionListener; //导入方法依赖的package包/类
/**
* Invoke the registered JMS ExceptionListener, if any.
* @param ex the exception that arose during JMS processing
* @see #setExceptionListener
*/
protected void invokeExceptionListener(JMSException ex) {
ExceptionListener exceptionListener = getExceptionListener();
if (exceptionListener != null) {
exceptionListener.onException(ex);
}
}
示例2: onException
import javax.jms.ExceptionListener; //导入方法依赖的package包/类
@Override
public void onException(JMSException ex) {
synchronized (connectionMonitor) {
// Iterate over temporary copy in order to avoid ConcurrentModificationException,
// since listener invocations may in turn trigger registration of listeners...
for (ExceptionListener listener : new LinkedHashSet<ExceptionListener>(this.delegates)) {
listener.onException(ex);
}
}
}
示例3: testJMSExceptionWhileCrawling
import javax.jms.ExceptionListener; //导入方法依赖的package包/类
/**
* Test that a Harvester will not die immediately a JMSException is received.
*/
public void testJMSExceptionWhileCrawling() throws Exception {
if (!TestUtils.runningAs("CSR")) {
return;
}
// Get the exception handler for the connection
JMSConnection con = JMSConnectionFactory.getInstance();
Field queueConnectionField = con.getClass().getSuperclass().getDeclaredField("myQConn");
queueConnectionField.setAccessible(true);
QueueConnection qc = (QueueConnection) queueConnectionField.get(con);
ExceptionListener qel = qc.getExceptionListener();
//Start a harvest
Job j = TestInfo.getJob();
DataModelTestCase.addHarvestDefinitionToDatabaseWithId(
j.getOrigHarvestDefinitionID());
JobDAO.getInstance().create(j);
j.setStatus(JobStatus.SUBMITTED);
JobDispatcher hDisp = new JobDispatcher(con, HarvestDefinitionDAO.getInstance(), JobDAO.getInstance());
hDisp.doOneCrawl(j, "test", "test", "test", new HarvestChannel("test", false, true, ""), "unittesters",
new ArrayList<MetadataEntry>());
//Trigger the exception handler - should not try to exit
qel.onException(new JMSException("Some exception"));
// Wait for harvester to finish and try to exit
synchronized(this) {
wait();
}
// Should probably now do some tests on the state of the HCS to see
// that it has finished harvesting but not tried to upload
}
开发者ID:netarchivesuite,项目名称:netarchivesuite-svngit-migration,代码行数:32,代码来源:IntegrityTestsHCSJMSException.java
示例4: onException
import javax.jms.ExceptionListener; //导入方法依赖的package包/类
/**
* @param ex
*/
public void onException(JMSException ex) {
ExceptionListener l = this.exceptionListener;
if (l != null) {
l.onException(JmsExceptionSupport.create(ex));
}
}
示例5: onException
import javax.jms.ExceptionListener; //导入方法依赖的package包/类
@Override
public void onException(JMSException ex) {
for (ExceptionListener listener : this.delegates) {
listener.onException(ex);
}
}
示例6: onException
import javax.jms.ExceptionListener; //导入方法依赖的package包/类
public void onException(JMSException ex) {
for (ExceptionListener listener : this.delegates) {
listener.onException(ex);
}
}
示例7: closed
import javax.jms.ExceptionListener; //导入方法依赖的package包/类
public void closed(Connection conn)
{
ConnectionException exc = exception;
exception = null;
if (exc == null)
{
return;
}
ConnectionClose close = exc.getClose();
if (close == null)
{
_conn.getProtocolHandler().setFailoverLatch(new CountDownLatch(1));
try
{
if (_conn.firePreFailover(false) && _conn.attemptReconnection())
{
_conn.failoverPrep();
_conn.resubscribeSessions();
_conn.fireFailoverComplete();
return;
}
}
catch (Exception e)
{
_logger.error("error during failover", e);
}
finally
{
_conn.getProtocolHandler().getFailoverLatch().countDown();
_conn.getProtocolHandler().setFailoverLatch(null);
}
}
ExceptionListener listener = _conn._exceptionListener;
if (listener == null)
{
_logger.error("connection exception: " + conn, exc);
}
else
{
String code = null;
if (close != null)
{
code = close.getReplyCode().toString();
}
JMSException ex = new JMSException(exc.getMessage(), code);
ex.setLinkedException(exc);
ex.initCause(exc);
listener.onException(ex);
}
}
示例8: onException
import javax.jms.ExceptionListener; //导入方法依赖的package包/类
public void onException(JMSException ex) {
ExceptionListener listener = this.exceptionListener;
if (listener != null) {
listener.onException(JmsExceptionSupport.create(ex));
}
}