Package com.linkedin.databus2.core.container.request

Examples of com.linkedin.databus2.core.container.request.DatabusRequest


    }

    @Override
    protected DatabusComponentAdmin createComponentAdmin()
    { 
      return new DatabusComponentAdmin(this, null, "fake")
    }
View Full Code Here


  }

  @Override
  protected DatabusComponentAdmin createComponentAdmin()
  {
    return new DatabusComponentAdmin(this,
                                     getMbeanServer(),
                                     BootstrapHttpServer.class.getSimpleName());
  }
View Full Code Here

      {
        eventStatsCollectors.addStatsCollector(sw.getStatsName(), sw.getEventsStatsCollector());
      }

      //aggregator thread; 250 ms poll time
      GlobalStatsCalc agg = new GlobalStatsCalc(10);
      agg.registerStatsCollector(eventStatsCollectors);
      Thread aggThread = new Thread(agg);
      aggThread.start();

      //start writers
      for (StatsWriter sw : nStatsWriters)
      {
        sw.start();
      }

      //Let the writers start
      Thread.sleep(1000);

      long startTimeMs = System.currentTimeMillis();
      long durationInMs = 5*1000; //5s
      DbusEventsTotalStats globalStats = aggregateEventStatsCollectors.getTotalStats();
      long prevValue = 0, prevSize =0;
      while (System.currentTimeMillis() < (startTimeMs+durationInMs))
      {
        //constraint checks;

        //check that readers don't have partial updates or get initialized
        long value = globalStats.getNumDataEvents();
        long size = globalStats.getSizeDataEvents();
        Assert.assertTrue(value > 0);
        if (prevValue > 0 && (value != prevValue))
        {
          Assert.assertTrue(size != prevSize);
          prevValue = value;
          prevSize = size;
        }
        Assert.assertTrue(globalStats.getMaxSeenWinScn() > 0);
        Thread.sleep(RngUtils.randomPositiveInt()%10+1);
      }
      //shut down
      for (StatsWriter sw : nStatsWriters)
      {
        sw.shutdown();
        sw.interrupt();
      }
      //Give a chance to catch up
      Thread.sleep(1000);

      agg.halt();
      aggThread.interrupt();

      //final tally aggregatedEventTotalStats = sum of all individual statsWriter objects in a thread free way

      AggregatedDbusEventsTotalStats myTotalStats = new AggregatedDbusEventsTotalStats(StatsWriter.OWNERID, "mytotal", true, false, null);
View Full Code Here

   * @param opcode          the TCP command opcode
   * @return the parser or null if no such command has been registered.
   */
  public BinaryCommandParser createParser(byte opcode, Channel channel, ByteOrder byteOrder)
  {
    BinaryCommandParserFactory factory = _binaryParsers.get(opcode);
    return (null != factory) ? factory.createParser(channel, byteOrder) : null;
  }
View Full Code Here

    LOG.info("Initializing Bootstrap HTTP Server");
    LOG.info("Config=" + _bootstrapServerConfig);
    try{
      RequestProcessorRegistry processorRegistry = getProcessorRegistry();
      processorRegistry.register(ConfigRequestProcessor.COMMAND_NAME,
                                 new ConfigRequestProcessor(null, this));
      processorRegistry.register(BootstrapRequestProcessor.COMMAND_NAME,
                                 new BootstrapRequestProcessor(null, _bootstrapServerConfig, this));
      processorRegistry.register(StartSCNRequestProcessor.COMMAND_NAME,
                                 new StartSCNRequestProcessor(null, _bootstrapServerConfig, this));
      processorRegistry.register(TargetSCNRequestProcessor.COMMAND_NAME,
View Full Code Here

      processorRegistry.register(StartSCNRequestProcessor.COMMAND_NAME,
                                 new StartSCNRequestProcessor(null, _bootstrapServerConfig, this));
      processorRegistry.register(TargetSCNRequestProcessor.COMMAND_NAME,
                                 new TargetSCNRequestProcessor(null, _bootstrapServerConfig, this));
      processorRegistry.register(ContainerOperationProcessor.COMMAND_NAME,
                                 new ContainerOperationProcessor(null, this));
    }
    catch (SQLException sqle)
    {
      throw new DatabusException("command registration failed", sqle);
    }
View Full Code Here

              throw new RequestProcessingException(msg);
            }
          }
        }

        DatabusRequest req = doProcess(request);

        if ( null != _serverHostPort)
        {
          req.getResponseContent().setMetadata(DbusConstants.SERVER_INFO_HOSTPORT_HEADER_PARAM, _serverHostPort);
        }

        return req;
    }
View Full Code Here

            {
              LOG.debug("Got command: " + cmdName);
            }


            dbusRequest = new DatabusRequest(cmdName, request.getMethod(), e.getRemoteAddress(),
                                             config);
            if (LOG.isDebugEnabled())
            {
              LOG.debug("Starting processing command [" + dbusRequest.getId() + "] " +
                        dbusRequest.getName() );
View Full Code Here

      }
    });
    EasyMock.replay(chunkedWritableByteChannel);


    DatabusRequest mockReq = EasyMock.createMock(DatabusRequest.class);
    EasyMock.expect(mockReq.getParams()).andReturn(params).anyTimes();
    EasyMock.expect(mockReq.getResponseContent()).andReturn(chunkedWritableByteChannel);
    EasyMock.replay(mockReq);

    LogicalSource lsrc1 = new LogicalSource(srcId1, srcName1);
    SourceIdNameRegistry mockSrcIdReg = EasyMock.createMock(SourceIdNameRegistry.class);
    EasyMock.expect(mockSrcIdReg.getSource(srcId1)).andReturn(lsrc1).anyTimes();
View Full Code Here

      }
    });
    EasyMock.replay(chunkedWritableByteChannel);


    DatabusRequest mockReq = EasyMock.createMock(DatabusRequest.class);
    EasyMock.expect(mockReq.getParams()).andReturn(params).anyTimes();
    EasyMock.expect(mockReq.getResponseContent()).andReturn(chunkedWritableByteChannel);
    EasyMock.replay(mockReq);

    LogicalSource lsrc1 = new LogicalSource(srcId1, srcName1);
    SourceIdNameRegistry mockSrcIdReg = EasyMock.createMock(SourceIdNameRegistry.class);
    EasyMock.expect(mockSrcIdReg.getSource(srcId1)).andReturn(lsrc1).anyTimes();
View Full Code Here

TOP

Related Classes of com.linkedin.databus2.core.container.request.DatabusRequest

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.