当前位置: 首页>>代码示例>>Java>>正文


Java AlertStrength类代码示例

本文整理汇总了Java中com.ebay.jetstream.notification.AlertListener.AlertStrength的典型用法代码示例。如果您正苦于以下问题:Java AlertStrength类的具体用法?Java AlertStrength怎么用?Java AlertStrength使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AlertStrength类属于com.ebay.jetstream.notification.AlertListener包,在下文中一共展示了AlertStrength类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: notifyProducer

import com.ebay.jetstream.notification.AlertListener.AlertStrength; //导入依赖的package包/类
void notifyProducer(Signal signal) {
      List<JetstreamTopic> channelTopics = m_address
		.getChannelJetstreamTopics();

for (JetstreamTopic topic : channelTopics) {
	try {
	    if (Signal.PAUSE.equals(signal)) {
	        MessageService.getInstance().pause(topic);
	    } else {
	        MessageService.getInstance().resume(topic);
	    }
	} catch (Throwable e) {
		registerError(e);
		throw new EventException(e.getMessage());
	}
}

if (Signal.PAUSE.equals(signal)) {
    postAlert(this.getBeanName() + " is being paused ", AlertStrength.RED);

    LOGGER.warn( " Inbound Messaging Channel paused.");
} else {
    postAlert(getBeanName() + " is being resumed", AlertStrength.YELLOW);
       LOGGER.warn( "Resuming Inbound Messaging Channel");
}
  }
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:27,代码来源:InboundMessagingChannel.java

示例2: afterPropertiesSet

import com.ebay.jetstream.notification.AlertListener.AlertStrength; //导入依赖的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.AlertStrength; //导入依赖的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.AlertStrength; //导入依赖的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: increment

import com.ebay.jetstream.notification.AlertListener.AlertStrength; //导入依赖的package包/类
/**
 * 
 */
public void increment() {
	m_queueBackLog.incrementAndGet();
	if (m_queueBackLog.get() >= m_highWaterMark.get()) {
		m_queueFull.set(true);
		if (m_queueOverflowTimeStamp.get() == 0) {
			m_queueOverflowTimeStamp.set(System.currentTimeMillis());
			m_overflowCount.incrementAndGet();
		}
		else {
			if (System.currentTimeMillis() - m_queueOverflowTimeStamp.get() < m_measurementInterval.get()) {
				
									
				m_queueOverflowTimeStamp.set(System.currentTimeMillis());
				if (m_overflowCount.incrementAndGet() > m_overflowCountThreshold.get()) {
					// we should Alert now
					m_overflowCount.set(0);
					m_queueOverflowTimeStamp.set(0);
					if (m_alertListener != null) {
						m_alertListener.sendAlert("NettyEventProducer", "Slow consumer detected at host :" + getConsumerHost(), AlertStrength.RED);
					}
				}
			}
			else {
				m_queueOverflowTimeStamp.set(System.currentTimeMillis());
			}
		}
	}
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:32,代码来源:NettyVirtualQueueMonitor.java

示例6: sendEvent

import com.ebay.jetstream.notification.AlertListener.AlertStrength; //导入依赖的package包/类
@Override
public void sendEvent(JetstreamEvent event) throws EventException {
    //When the replay happens, put it into event backMap map so that it will be serialized into Kafka.
    if (event.getMetaData(Constants.REPLAY_INITIAL_TS) != null) {
        long initTs = (Long) event.getMetaData(Constants.REPLAY_INITIAL_TS);
        event.put(Constants.REPLAY_INITIAL_TS, initTs);
    }
    if (event.getMetaData(Constants.REPLAY_LAST_TS) != null) {
        long lastTs = (Long) event.getMetaData(Constants.REPLAY_LAST_TS);
        event.put(Constants.REPLAY_LAST_TS, lastTs);
    }

    super.sendEvent(event);

    long current = System.currentTimeMillis();
    if (lastSentTimeStamp == 0) {
        lastSentTimeStamp = current;
        this.stopReplay();
        postAlert(
                "The topic: "
                        + event.get(JetstreamReservedKeys.EventReplayTopic.toString())
                        + " has issue, replay occurs on replay agent",
                        AlertStrength.RED);
        return;
    }

    if (lastSentTimeStamp +  getCheckIntervalInMilliseconds() < current) {
        lastSentTimeStamp = current;
        this.stopReplay();
        postAlert(
                "The topic: "
                        + event.get(JetstreamReservedKeys.EventReplayTopic.toString())
                        + " has issue, replay occurs on replay agent",
                        AlertStrength.RED);
    }
}
 
开发者ID:pulsarIO,项目名称:realtime-analytics,代码行数:37,代码来源:ReplayAdviceProcessor.java

示例7: queueEvent

import com.ebay.jetstream.notification.AlertListener.AlertStrength; //导入依赖的package包/类
/**
 * - When Exception reaches beyond threshold, don't submit event to queue. Drop the event.
 */
protected void queueEvent(JetstreamEvent event) throws EventException {
	
	if (getEsperExceptionHandler() != null) {
		if (getEsperExceptionHandler().IsInException()) {

			if (!getEsperExceptionHandler().isAlertPosted()) {
				postAlert(getEsperExceptionHandler().getLastException(),
						AlertStrength.RED);
				getEsperExceptionHandler().setAlertPostedStatus(true);
				if (logger.isDebugEnabled())
						logger
						.debug( 
								"Esper Exception threshold reached...Sending Alert..");
								
					
				// if we have an advice listener we will advice them to stop replay
				// they will be adviced to start replay when new EPL is deployed

				if(getAdviceListener() != null)
					getAdviceListener().stopReplay();
			} 
				
			if(getAdviceListener() != null){
					getAdviceListener().retry(event, RetryEventCode.MSG_RETRY,getEsperExceptionHandler().getLastException());
					
			}else{
				//AdviseListener not available. no further submission to engine... drop it..
				if (logger.isDebugEnabled())
					logger.debug( 
							"Esper Exception threshold reached...Dropping events");
				incrementEventDroppedCounter();
			}	
		} else {
			queueEventInternal(event);
		}
	} else {
		queueEventInternal(event);
	}

}
 
开发者ID:pulsarIO,项目名称:jetstream-esper,代码行数:44,代码来源:EsperProcessor.java

示例8: postAlert

import com.ebay.jetstream.notification.AlertListener.AlertStrength; //导入依赖的package包/类
protected void postAlert(String msg, AlertStrength strength) {
	if (m_alertListener != null) {
		m_alertListener.sendAlert(this.getBeanName(), msg, strength);
	}
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:6,代码来源:AbstractOutboundChannel.java

示例9: onMessage

import com.ebay.jetstream.notification.AlertListener.AlertStrength; //导入依赖的package包/类
public void onMessage(JetstreamMessage m) {
	if (m instanceof AdvisoryMessage) {
		AdvisoryMessage advise = (AdvisoryMessage) m;

		if (advise.isStopSending()
				&& matchesMyPublishingContexts(advise.getAdvisoryTopic()
						.getRootContext())) {
			LOGGER.warn(
					"Outbound Messaging Channel raising alarm");
			setTopicAlarmState(advise.getAdvisoryTopic().getRootContext());

			incrementAlarmsRaisedCounter();

			if (areAllContextsInAlarmCondition()) {
				m_alarmRaised.set(true);
				getAlarmListener().alarm(ChannelAlarm.OVERRUN);
				postAlert("All Contexts in Alarm Condition - ", AlertStrength.ORANGE);

			}
		} else if (advise.isResumeSending()
				&& matchesMyPublishingContexts(advise.getAdvisoryTopic()
						.getRootContext())) {
			LOGGER.info(
					"Outbound Messaging Channel clearing alarm for topic-> "
							+ advise.getAdvisoryTopic().getRootContext());

			resetTopicAlarmState(advise.getAdvisoryTopic().getRootContext());

			if (!areAllContextsInAlarmCondition()) {
				m_alarmRaised.set(false);
				getAlarmListener().alarm(ChannelAlarm.CLEAR);
				postAlert("Alarm Condition Cleared - ", AlertStrength.YELLOW);
				incrementAlarmsClearedCounter();
			}
		}
		else if (advise.isResendMessage()) {

			JetstreamEvent evt = (JetstreamEvent) ((Any) ((AdvisoryMessage) m)
					.getUndeliveredMsg()).getObject();

			try {
				evt = evt.clone();
			} catch (CloneNotSupportedException e) {
				m_errors.registerError(e);
				LOGGER.debug( "Failed to clone event : Exception = " + e.getLocalizedMessage());
				this.incrementEventDroppedCounter();
				return;
			}

			List<String> topics = m_address.getChannelTopics();
			String topic = ((AdvisoryMessage) m).getAdvisoryTopic().toString();
			// Fix issue when multiple OMCs subscribe different topics under same context.
			// Each OMC will receive broadcast advisory events.
			if (topic == null || topics.contains(topic)) {
				evt.put(JetstreamReservedKeys.EventReplayTopic.toString(), topic);

				Integer retryCount = 1;
				if (evt != null) {
					if (evt.containsKey(JetstreamReservedKeys.RetryCount
							.toString())) {
						retryCount = (Integer) evt
								.get(JetstreamReservedKeys.RetryCount
										.toString());
						retryCount++;
					}
					evt.put(JetstreamReservedKeys.RetryCount.toString(),
							retryCount);
					sendToAdviceListener(evt, RetryEventCode.MSG_RETRY,
							AdvisoryCode.RESEND_MESSAGE.toString());
					incrementRetryAdvisoryEvents();
				}
			}
		}

	}
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:77,代码来源:OutboundMessagingChannel.java

示例10: expiredTimeoutSessions

import com.ebay.jetstream.notification.AlertListener.AlertStrength; //导入依赖的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

示例11: sendAlert

import com.ebay.jetstream.notification.AlertListener.AlertStrength; //导入依赖的package包/类
public void sendAlert(String name, String msg, AlertListener.AlertStrength strength) {
    if (this.getAlertListener() != null) {
        getAlertListener().sendAlert(name, msg, strength);
    }
}
 
开发者ID:pulsarIO,项目名称:realtime-analytics,代码行数:6,代码来源:SessionizerProcessor.java

示例12: sendRemoteStoreAlert

import com.ebay.jetstream.notification.AlertListener.AlertStrength; //导入依赖的package包/类
@Override
public void sendRemoteStoreAlert(String message, AlertStrength severity) {
    this.sendAlert("RemoteStore", message, severity);

}
 
开发者ID:pulsarIO,项目名称:realtime-analytics,代码行数:6,代码来源:SessionizerProcessor.java

示例13: sendRemoteStoreAlert

import com.ebay.jetstream.notification.AlertListener.AlertStrength; //导入依赖的package包/类
/**
 * Send alert for remote store. Utilized the sessionizer alert listener.
 * 
 * @param message
 * @param severity
 */
void sendRemoteStoreAlert(String message, AlertStrength severity);
 
开发者ID:pulsarIO,项目名称:realtime-analytics,代码行数:8,代码来源:RemoteStoreCallback.java


注:本文中的com.ebay.jetstream.notification.AlertListener.AlertStrength类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。