Package com.dianping.cat.message.io

Examples of com.dianping.cat.message.io.DefaultMessageQueue


  @Test
  public void testUpload() throws Exception {
    MessageAnalyzerManager manager = lookup(MessageAnalyzerManager.class);
    long now = System.currentTimeMillis();
    int num = 10000;
    DefaultMessageQueue queue = new DefaultMessageQueue(num);

    for (int i = 0; i < num; i++) {
      queue.offer(newMessageTree(i, now + i * 10L));
    }

    MessageAnalyzer analyzer = manager.getAnalyzer("dump", now);

    analyzer.analyze(queue);
View Full Code Here


    Map<String, MessageAnalyzer> analyzers = new LinkedHashMap<String, MessageAnalyzer>();

    m_tasks = new ArrayList<PeriodTask>(names.size());
    for (String name : names) {
      MessageAnalyzer analyzer = m_analyzerManager.getAnalyzer(name, startTime);
      MessageQueue queue = new DefaultMessageQueue(QUEUE_SIZE);
      PeriodTask task = new PeriodTask(m_serverStateManager, analyzer, queue, startTime);

      analyzers.put(name, analyzer);
      task.enableLogging(m_logger);
      m_tasks.add(task);
View Full Code Here

public class AbstractMessageAnalyzerTest extends ComponentTestCase {

  @Test
  public void testTimeOut() throws InterruptedException {
    int queueSize = 1000;
    MessageQueue queue = new DefaultMessageQueue(queueSize);
    long time = System.currentTimeMillis();
    long start = time - time % (3600 * 1000L);

    MockAnalyzer analyzer = new MockAnalyzer();
    analyzer.initialize(start, 1000, 1000);

    Assert.assertEquals(true, analyzer.isActive());
    Assert.assertEquals(true, analyzer.isTimeout());

    int count = 2000;
    for (int i = 0; i < count; i++) {
      queue.offer(new DefaultMessageTree());
    }

    analyzer.analyze(queue);

    Assert.assertEquals(Math.min(queueSize, count), analyzer.m_count);
View Full Code Here

    Assert.assertEquals(start, analyzer.getStartTime());
  }

  @Test
  public void testNotTimeOut() throws InterruptedException {
    MessageQueue queue = new DefaultMessageQueue(1000);
    long time = System.currentTimeMillis();
    long start = time - time % (3600 * 1000L);

    MockAnalyzer analyzer = new MockAnalyzer();
    analyzer.initialize(start, 60 * 60 * 1000, 1000);

    Assert.assertEquals(true, analyzer.isActive());
    Assert.assertEquals(false, analyzer.isTimeout());

    int count = 1000;
    for (int i = 0; i < count; i++) {
      queue.offer(new DefaultMessageTree());
    }
    Threads.forGroup().start(new ShutDown(analyzer));

    analyzer.analyze(queue);

View Full Code Here

  @Test
  public void test() throws Exception {
    long time = System.currentTimeMillis();
    long start = time - time % (3600 * 1000L);
    int size = 100;
    MessageQueue queue = new DefaultMessageQueue(size);
    MockAnalyzer analyzer = new MockAnalyzer();
    ServerStatisticManager serverStateManager = lookup(ServerStatisticManager.class);
    String domain = "cat";

    analyzer.initialize(start, 1000, 1000);
View Full Code Here

TOP

Related Classes of com.dianping.cat.message.io.DefaultMessageQueue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.