本文整理汇总了Java中com.ebay.jetstream.notification.AlertListener类的典型用法代码示例。如果您正苦于以下问题:Java AlertListener类的具体用法?Java AlertListener怎么用?Java AlertListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AlertListener类属于com.ebay.jetstream.notification包,在下文中一共展示了AlertListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: open
import com.ebay.jetstream.notification.AlertListener; //导入依赖的package包/类
public void open() throws EventException {
//LOGGER.info( "Opening Inbound File Channel");
logger.info( "Openning Inbound File Channel");
/* put my name Event/FileChannel to the page */
Management.addBean(getBeanName(), this);
m_eventsReceivedPerSec = new LongEWMACounter(60, MessageServiceTimer.sInstance().getTimer());
m_eventsSentPerSec = new LongEWMACounter(60, MessageServiceTimer.sInstance().getTimer());
/* open the event file, be ready for play*/
try {
m_fcHelper.openForRead();
} catch (EventException ee) {
//LOGGER.error( "InboundFileChannel open() get e=" + ee);
logger.error( "--InboundFileChannel open() get e=" + ee);
/*** instead of forcing application to exit, we choose to post an error status at dashboard */
if (m_AlertListener != null) {
m_AlertListener.sendAlert(getBeanName(), "InboundFileChannel open() get e=" + ee, AlertListener.AlertStrength.RED);
} else {
throw ee;
}
}
}
示例2: afterPropertiesSet
import com.ebay.jetstream.notification.AlertListener; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
if (getAlertListener() != null) {
getAlertListener().sendAlert(this.getBeanName(), "INIT", AlertListener.AlertStrength.GREEN);
}
Management.addBean(getBeanName(), this);
for (EventSink eventSink : ((EventSinkList)getEventSinks()).getSinks()) {
if (!m_esperEventListener.getEventSinks().contains(eventSink))
m_esperEventListener.addEventSink(eventSink);
}
m_esperEventListener.setAdviceListener(getAdviceListener());
m_esperEventListener.setPropagateEventOnFailure(getConfiguration().isPropagateEventOnFailure());
m_esperEventListener.setAnnotationConfig(getConfiguration().getAnnotationConfigMap());
// check the exception status at the intervals if it's in exception, submit stop replay command;
m_watchDog.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
try {
if (getEsperExceptionHandler() != null) {
if (getEsperExceptionHandler().IsInException()) {
getAdviceListener().stopReplay();
}
}
} catch (Exception ex) {
logger.error( ex.getLocalizedMessage() , ex);
}
}
}, 5, m_checkIntervalInSeconds, TimeUnit.SECONDS);
super.afterPropertiesSet();
/* if it is placed in the base class, then we may end up no update if the
* subclass does not report status. so leave it here
*/
if (getAlertListener() != null) {
getAlertListener().sendAlert(this.getBeanName(), "OK", AlertListener.AlertStrength.GREEN);
}
}
示例3: rollback
import com.ebay.jetstream.notification.AlertListener; //导入依赖的package包/类
private void rollback(EPL oldEPL, EPL epl) {
setEpl(oldEPL);
Management.removeBeanOrFolder(epl.getBeanName(), epl);
Management.addBean(oldEPL.getBeanName(), oldEPL);
logger
.error( "New EPL is not Working out...So reverting to OLD EPL");
/*** send out an alert and update the dashboard */
if (getAlertListener() != null) {
getAlertListener().sendAlert(this.getBeanName(), "New EPL is not Working out...So reverting to OLD EPL",
AlertListener.AlertStrength.RED);
}
}
示例4: init
import com.ebay.jetstream.notification.AlertListener; //导入依赖的package包/类
boolean init() {
try{
compile(true);
for (EventType type : m_epAdmin.getConfiguration().getEventTypes())
m_setKnownEvent.add(type.getName());
m_esperService.getEPRuntime().getEventSender("EsperStartup").sendEvent(new Object());
return true;
}
catch (Throwable e) {
if (getAlertListener() != null) {
getAlertListener().sendAlert(getBeanName(), " Esper Processor: init failed with e=" +e, AlertListener.AlertStrength.RED);
}
if (getEsperExceptionHandler() != null) {
getEsperExceptionHandler().setLastException(e.getMessage());
}
registerError(e);
e.printStackTrace(System.err);
logger.error( "Processor " + getBeanName()
+ " failed to prepare. The application will be shut down immediately. Exception: " + e.getMessage());
return false;
}
}
示例5: setAlertListener
import com.ebay.jetstream.notification.AlertListener; //导入依赖的package包/类
public void setAlertListener(AlertListener al) {
if (al == null) {
logger.error( "AlertListener is null unexpectedly");
return;
}
m_AlertListener = al;
}
示例6: setAlertListener
import com.ebay.jetstream.notification.AlertListener; //导入依赖的package包/类
public void setAlertListener(AlertListener al) {
if (al == null) {
LOGGER.error( "AlertListener is null unexpectedly");
return;
}
m_AlertListener = al;
}
示例7: open
import com.ebay.jetstream.notification.AlertListener; //导入依赖的package包/类
/**
* ChannelBinging.afterPropertiesSet() calls channel.open()
*/
public void open() throws EventException {
LOGGER.info( "Opening Outbound File Channel");
/* put my name Event/FileChannel to the page */
if (!m_restart) {
Management.addBean(getBeanName(), this);
}
m_eventsReceivedPerSec = new LongEWMACounter(60, MessageServiceTimer.sInstance().getTimer());
m_eventsSentPerSec = new LongEWMACounter(60, MessageServiceTimer.sInstance().getTimer());
/* open the event file, be ready for writing*/
/* close the files for each stream */
for (String type:m_streamTypeToHelperMap.keySet() ) {
try {
m_streamTypeToHelperMap.get(type).openForWrite();
} catch (EventException ee) {
LOGGER.error( "open() get e=" + ee.getLocalizedMessage(), ee);
/*** instead of forcing application to exit, we choose to post an error status at dashboard */
if (m_AlertListener != null) {
m_AlertListener.sendAlert(getBeanName(), "OutboundFileChannel open() get e=" + ee, AlertListener.AlertStrength.RED);
} else {
throw ee;
}
}
}
}
示例8: getAlertListener
import com.ebay.jetstream.notification.AlertListener; //导入依赖的package包/类
@Hidden
public AlertListener getAlertListener() {
return m_alertListener;
}
示例9: setAlertListener
import com.ebay.jetstream.notification.AlertListener; //导入依赖的package包/类
public void setAlertListener(AlertListener alertListner) {
this.m_alertListener = alertListner;
}
示例10: getAlertListener
import com.ebay.jetstream.notification.AlertListener; //导入依赖的package包/类
@Hidden
public AlertListener getAlertListener() {
return m_alertListener;
}
示例11: setAlertListener
import com.ebay.jetstream.notification.AlertListener; //导入依赖的package包/类
public void setAlertListener(AlertListener alertListener) {
this.m_alertListener = alertListener;
}
示例12: getAlertListener
import com.ebay.jetstream.notification.AlertListener; //导入依赖的package包/类
public AlertListener getAlertListener() {
return m_alertListener;
}
示例13: getAlertListener
import com.ebay.jetstream.notification.AlertListener; //导入依赖的package包/类
/**
* @return
*/
public AlertListener getAlertListener() {
return m_alertListener;
}
示例14: setAlertListener
import com.ebay.jetstream.notification.AlertListener; //导入依赖的package包/类
/**
* @param alertListener
*/
public void setAlertListener(AlertListener alertListener) {
this.m_alertListener = alertListener;
}
示例15: expiredTimeoutSessions
import com.ebay.jetstream.notification.AlertListener; //导入依赖的package包/类
private void expiredTimeoutSessions(JetstreamEvent event) {
if (TIMER_EVENT == event) {
int pending = this.requestQueue.size();
if (pending >= warnThresHold && pending < errorThresHold && lastPendingSize < warnThresHold) {
postAlert("High pending event on sessionizer", AlertListener.AlertStrength.YELLOW);
} else if (pending >= errorThresHold && lastPendingSize < errorThresHold) {
postAlert("Sessionizer is stuck", AlertListener.AlertStrength.RED);
}
lastPendingSize = pending;
eventSentInLastSecond = eventSentInCurrentSecond;
if (eventSentInLastSecond > maxEventsSentPerSecond) {
maxEventsSentPerSecond = eventSentInLastSecond;
}
eventSentInCurrentSecond = 0;
cleanRecentlyExpiredCache();
checkTimeOutPendingRequests();
} else {
hasPendingExpiration = false;
}
long currentNanoTime = System.nanoTime();
long timestamp = System.currentTimeMillis();
if (event == CONTINUE_EXPIRATION_EVENT || !hasPendingExpiration) {
int count = 0;
Session session = localSessionCache.removeExpired(timestamp);
while (session != null) {
String identifier = session.getIdentifier();
Sessionizer sessionizer = getSessionizer(session.getType());
String uid = sessionizer.getUniqueSessionIdentifier(identifier);
long ts = session.getFirstExpirationTime();
if (clusterManager.hasOwnership(session.getAffinityKey())) {
sessionizer.checkSubSessions(identifier, session, ts);
if (session.getExpirationTime() <= ts) {
sessionizer.sessionEnd(identifier, session);
if (clusterManager.isOwnershipChangedRecently(session.getAffinityKey())) {
recentlyExpiredSessions.put(session.getSessionId(), currentNanoTime + ":" + session.getExpirationTime());
}
RemoteStoreProvider remoteDAO = provider;
if (remoteDAO != null) {
remoteDAO.delete(session, uid);
}
} else {
updateSessionOnStore(uid, session);
}
} else {
loopbackEventProducer.forwardSessionEndEvent(identifier, session, uid);
}
if (++ count > 100) { // Check when send 100 expiration events.
// Avoid run session expiration for long time when there are long GC pause.
// Avoid request queue build up.
if ((requestQueue.size() + responseQueue.size()) > 200) {
if (!hasPendingExpiration) {
hasPendingExpiration = this.requestQueue.offer(CONTINUE_EXPIRATION_EVENT);
}
break;
} else {
count = 0;
}
}
session = localSessionCache.removeExpired(timestamp);
}
}
expirationInfo[taskId] = timestamp;
if (taskId == 0 && TIMER_EVENT == event) {
RemoteStoreProvider l = provider;
if (l != null) {
l.updateHeartbeat(timestamp);
}
// Only need one thread send it.
}
}