當前位置: 首頁>>代碼示例>>Java>>正文


Java AlertListener類代碼示例

本文整理匯總了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;
}
	
	}


}
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:27,代碼來源:InboundFileChannel.java

示例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);
	}
}
 
開發者ID:pulsarIO,項目名稱:jetstream-esper,代碼行數:40,代碼來源:EsperProcessor.java

示例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);

	}
}
 
開發者ID:pulsarIO,項目名稱:jetstream-esper,代碼行數:14,代碼來源:EsperProcessor.java

示例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;
	}
}
 
開發者ID:pulsarIO,項目名稱:jetstream-esper,代碼行數:29,代碼來源:EsperProcessor.java

示例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;
}
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:8,代碼來源:InboundFileChannel.java

示例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;
}
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:8,代碼來源:OutboundFileChannel.java

示例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;
 				}
 			}
 		}

}
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:35,代碼來源:OutboundFileChannel.java

示例8: getAlertListener

import com.ebay.jetstream.notification.AlertListener; //導入依賴的package包/類
@Hidden
public AlertListener getAlertListener() {
	return m_alertListener;
}
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:5,代碼來源:AbstractOutboundChannel.java

示例9: setAlertListener

import com.ebay.jetstream.notification.AlertListener; //導入依賴的package包/類
public void setAlertListener(AlertListener alertListner) {
	this.m_alertListener = alertListner;
}
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:4,代碼來源:AbstractOutboundChannel.java

示例10: getAlertListener

import com.ebay.jetstream.notification.AlertListener; //導入依賴的package包/類
@Hidden	
public AlertListener getAlertListener() {
	return m_alertListener;
}
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:5,代碼來源:AbstractBatchInboundChannel.java

示例11: setAlertListener

import com.ebay.jetstream.notification.AlertListener; //導入依賴的package包/類
public void setAlertListener(AlertListener alertListener) {
	this.m_alertListener = alertListener;
}
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:4,代碼來源:AbstractEventProcessor.java

示例12: getAlertListener

import com.ebay.jetstream.notification.AlertListener; //導入依賴的package包/類
public AlertListener getAlertListener() {
	return m_alertListener;
}
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:4,代碼來源:NettyTransportConfig.java

示例13: getAlertListener

import com.ebay.jetstream.notification.AlertListener; //導入依賴的package包/類
/**
 * @return
 */
public AlertListener getAlertListener() {
	return m_alertListener;
}
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:7,代碼來源:NettyVirtualQueueMonitor.java

示例14: setAlertListener

import com.ebay.jetstream.notification.AlertListener; //導入依賴的package包/類
/**
 * @param alertListener
 */
public void setAlertListener(AlertListener alertListener) {
	this.m_alertListener = alertListener;
}
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:7,代碼來源:NettyVirtualQueueMonitor.java

示例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.
    }
}
 
開發者ID:pulsarIO,項目名稱:realtime-analytics,代碼行數:75,代碼來源:SessionizerProcessor.java


注:本文中的com.ebay.jetstream.notification.AlertListener類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。