本文整理汇总了Java中com.ebay.jetstream.counter.LongEWMACounter类的典型用法代码示例。如果您正苦于以下问题:Java LongEWMACounter类的具体用法?Java LongEWMACounter怎么用?Java LongEWMACounter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LongEWMACounter类属于com.ebay.jetstream.counter包,在下文中一共展示了LongEWMACounter类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: open
import com.ebay.jetstream.counter.LongEWMACounter; //导入依赖的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: open
import com.ebay.jetstream.counter.LongEWMACounter; //导入依赖的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;
}
}
}
}
示例3: EventBatcher
import com.ebay.jetstream.counter.LongEWMACounter; //导入依赖的package包/类
public EventBatcher(HttpClient client) {
m_client = client;
m_eventsSentPerSec = new LongEWMACounter(60, MessageServiceTimer.sInstance().getTimer());
m_highWaterMark.set((long) (0.85 * m_maxQueueSize));
m_lowWaterMark.set((long) (0.25 * m_maxQueueSize));
}
示例4: open
import com.ebay.jetstream.counter.LongEWMACounter; //导入依赖的package包/类
public void open() throws EventException {
LOGGER.info( "Opening Outbound File Channel");
m_eventsReceivedPerSec = new LongEWMACounter(60, MessageServiceTimer.sInstance().getTimer());
m_eventsSentPerSec = new LongEWMACounter(60, MessageServiceTimer.sInstance().getTimer());
}
示例5: init
import com.ebay.jetstream.counter.LongEWMACounter; //导入依赖的package包/类
/**
* @param context
* @param tl
* @param addrList
* @param port
* @param msp
* @throws Exception
*/
public void init(ContextConfig cc, ITransportListener tl,
List<InetAddress> addrList, int port,
TransportConfig transportConfig, MessageServiceProxy proxy)
throws Exception {
m_tl = tl;
m_context = cc.getContextname();
m_contextConfig = (NettyContextConfig) cc;
m_messageServiceProxy = proxy;
m_avgMsgsRcvdPerSec = new LongEWMACounter(30, MessageServiceTimer
.sInstance().getTimer());
m_tke = (NettyTransportConfig) transportConfig;
if (m_tke.getAdvertisementTopic() != null) {
m_ecdvertisement = new JetstreamTopic(m_tke.getAdvertisementTopic());
LOGGER.info(
"Using Topic : " + m_tke.getAdvertisementTopic()
+ " for advertisements messages");
}
if (m_tke.getDiscoverTopic() != null) {
m_ecdiscover = new JetstreamTopic(m_tke.getDiscoverTopic());
LOGGER.info( "Using Topic : " + m_tke.getDiscoverTopic()
+ " for discover messages");
}
m_producerSessionHandler = new EventProducerSessionHandler(this);
m_threadPoolExecutor = Executors.newFixedThreadPool(m_tke
.getConsumerThreadPoolSize(), new NameableThreadFactory(
"Jetstream-EventConsumer"));
if (m_tke.isEnableCompression())
MessageDecompressionHandler.initSnappy();
Iterator<InetAddress> itr = addrList.iterator();
while (itr.hasNext()) {
InetAddress addr = itr.next();
Acceptor acceptor = new Acceptor(m_tke);
acceptor.setIpAddress(addr.getHostAddress());
acceptor.setTcpPort(port);
acceptor.setEnableCompression(m_tke.isEnableCompression());
acceptor.setTcpKeepAlive(m_tke.getTcpKeepAlive());
if (m_tke.getTcpKeepAlive())
acceptor.setReadIdleTimeout(0);
else
acceptor.setReadIdleTimeout(m_tke.getIdleTimeoutInSecs());
acceptor.bind(m_producerSessionHandler);
m_acceptorList.add(acceptor);
}
subscribeToDiscoveryEvent();
printInfo("Initialized event consumer for context - " + m_context);
}
示例6: open
import com.ebay.jetstream.counter.LongEWMACounter; //导入依赖的package包/类
public void open() throws EventException {
m_eventsReceivedPerSec = new LongEWMACounter(60, MessageServiceTimer.sInstance().getTimer());
m_eventsSentPerSec = new LongEWMACounter(60, MessageServiceTimer.sInstance().getTimer());
}
示例7: open
import com.ebay.jetstream.counter.LongEWMACounter; //导入依赖的package包/类
public void open() throws EventException {
m_eventsReceivedPerSec = new LongEWMACounter(60, MessageServiceTimer.sInstance().getTimer());
m_eventsSentPerSec = new LongEWMACounter(60, MessageServiceTimer.sInstance().getTimer());
}
示例8: init
import com.ebay.jetstream.counter.LongEWMACounter; //导入依赖的package包/类
/**
* @param context
* @param port
*/
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="BC_UNCONFIRMED_CAST")
public void init(ContextConfig cc, int port,
TransportConfig transportConfig,
MessageServiceProxy proxy,
NettyTransport nt) throws Exception {
if (m_hostName == null) throw new Exception("hostname not initialized");
if (!m_initialized.get()) {
m_nt = nt;
m_ncc = (NettyContextConfig) cc;
setupRegistry();
m_context = cc.getContextname();
m_avgMsgsSentPerSec = new LongEWMACounter(60, MessageServiceTimer
.sInstance().getTimer());
m_messageServiceProxy = proxy;
m_transportConfig = (NettyTransportConfig) transportConfig;
Scheduler scheduler = m_ncc.getScheduler();
if (scheduler != null)
m_scheduler = scheduler.clone();
LOGGER.info( "Provisioned event scheduler is "
+ m_scheduler.getClass().getName());
// instantiate affinity calculator
m_workQueueCapacity = m_transportConfig
.getDownstreamDispatchQueueSize();
if (m_transportConfig.getAdvertisementTopic()!= null) {
m_eventConsumerAdvertisement = new JetstreamTopic(m_transportConfig.getAdvertisementTopic());
LOGGER.info( "Using Topic : " + m_transportConfig.getAdvertisementTopic() + " for advertisements messages");
}
if (m_transportConfig.getDiscoverTopic() != null) {
m_ecdiscover = new JetstreamTopic(m_transportConfig.getDiscoverTopic());
LOGGER.info( "Using Topic : " + m_transportConfig.getDiscoverTopic() + " for discover messages");
}
// m_dataQueue = new LinkedBlockingQueue<Request>(m_workQueueCapacity);
m_dataQueue = new SingleConsumerDisruptorQueue<Request>(m_workQueueCapacity);
m_deadConsumerQueue = new LinkedBlockingQueue<EventConsumerInfo>(
200); // 200 elements
m_ecSessionHandler = new EventConsumerSessionHandler(this);
if (m_transportConfig.installAutoFlushHandler())
m_autoFlushHandler = new NettyAutoFlushBatcher(m_transportConfig.getAutoFlushSz(), m_transportConfig.getAutoFlushTimeInterval());
//Always attach compression handler, based on consumer handshake, decide on compress/decompress
MessageCompressionHandler.initSnappy();
createChannelPipeline();
m_initialized.set(true);
printInfo("Initalized event producer for context - " + m_context);
}
}