本文整理汇总了Java中org.apache.mina.core.filterchain.IoFilterChain.fireExceptionCaught方法的典型用法代码示例。如果您正苦于以下问题:Java IoFilterChain.fireExceptionCaught方法的具体用法?Java IoFilterChain.fireExceptionCaught怎么用?Java IoFilterChain.fireExceptionCaught使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.mina.core.filterchain.IoFilterChain
的用法示例。
在下文中一共展示了IoFilterChain.fireExceptionCaught方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeNow
import org.apache.mina.core.filterchain.IoFilterChain; //导入方法依赖的package包/类
private boolean removeNow(S session) {
clearWriteRequestQueue(session);
try {
destroy(session);
return true;
} catch (Exception e) {
IoFilterChain filterChain = session.getFilterChain();
filterChain.fireExceptionCaught(e);
} finally {
clearWriteRequestQueue(session);
((AbstractIoService) session.getService()).getListeners().fireSessionDestroyed(session);
}
return false;
}
示例2: flush
import org.apache.mina.core.filterchain.IoFilterChain; //导入方法依赖的package包/类
/**
* Write all the pending messages
*/
private void flush(long currentTime) {
if (flushingSessions.isEmpty()) {
return;
}
do {
S session = flushingSessions.poll(); // the same one with firstSession
if (session == null) {
// Just in case ... It should not happen.
break;
}
// Reset the Schedule for flush flag for this session,
// as we are flushing it now
session.unscheduledForFlush();
SessionState state = getState(session);
switch (state) {
case OPENED:
try {
boolean flushedAll = flushNow(session, currentTime);
if (flushedAll && !session.getWriteRequestQueue().isEmpty(session)
&& !session.isScheduledForFlush()) {
scheduleFlush(session);
}
} catch (Exception e) {
scheduleRemove(session);
IoFilterChain filterChain = session.getFilterChain();
filterChain.fireExceptionCaught(e);
}
break;
case CLOSING:
// Skip if the channel is already closed.
break;
case OPENING:
// Retry later if session is not yet fully initialized.
// (In case that Session.write() is called before addSession()
// is processed)
scheduleFlush(session);
return;
default:
throw new IllegalStateException(String.valueOf(state));
}
} while (!flushingSessions.isEmpty());
}