Examples of DbusEventInternalWritable


Examples of com.linkedin.databus.core.DbusEventInternalWritable

        int maxEventSize = 100;
        int payloadSize = 5;
        events.clear();
        DbusEventGenerator eventGen = new DbusEventGenerator(startScn+1);
        long newScn = eventGen.generateEvents(numEvents, _maxWindowSize, maxEventSize, payloadSize, true, events);
        DbusEventInternalWritable p = null;
        for (DbusEvent e : events)
        {
          if (p != null && (p.sequence() != e.sequence()))
          {
            //control event for prev sequence;
            p.setSrcId((short)-1);
            _stats.registerDataEvent(p);
          }
          _stats.registerDataEvent((DbusEventInternalReadable)e);
          try
          {
            p = DbusEventCorrupter.makeWritable(e)// for testing only!
          }
          catch (InvalidEventException iee)
          {
            LOG.fatal("makeWritable() should not have thrown exception: " + iee);
          }
        }
        if (p != null)
        {
          p.setSrcId((short)-1);
          _stats.registerDataEvent(p);
        }
        _stats.registerBufferMetrics(startScn+1, newScn , prevScn, RngUtils.randomPositiveInt());
        startScn = newScn;
        if (!_shutdown)
View Full Code Here

Examples of com.linkedin.databus.core.DbusEventInternalWritable

      public void close() throws IOException {}

      @Override
      public void onEvent(DbusEvent event, long offset, int size)
      {
        DbusEventInternalWritable e = (DbusEventInternalWritable)event;
        assertTrue("endEvents() gave us an invalid event! (offset = " + offset + ", size = " + size + ")",
                   e.isValid(true));
        eventOfs.add(e.getRawBytes().position() - e.size())// FIXME: is this correct?  position() == offset; why subtract size?
      }
    };
    buf.addInternalListener(ofsTracker);

    for (int i = 0; i < eventInfos.length; ++i)
View Full Code Here

Examples of com.linkedin.databus.core.DbusEventInternalWritable

                                  eventsPerWindow,
                                  maxEventSize,
                                  payloadSize,
                                  true,
                                  events);
      DbusEventInternalWritable p = null;
      for (DbusEvent e : events)
      {
        if (p != null && (p.sequence() != e.sequence()))
        {
          // control event for prev sequence;
          p.setSrcId((short) -1);
          _stats.registerDataEvent(p);
        }
        _stats.registerDataEvent((DbusEventInternalReadable) e);
        try
        {
          p = DbusEventCorrupter.makeWritable(e); // for testing only!
        }
        catch (InvalidEventException iee)
        {
          throw new RuntimeException(iee);
        }
      }

      // Add window boundary at the end
      if (p != null)
      {
        p.setSrcId((short) -1);
        _stats.registerDataEvent(p);
      }
      _stats.registerBufferMetrics(startScn + 1,
                                   newScn,
                                   prevScn,
View Full Code Here

Examples of com.linkedin.databus.core.DbusEventInternalWritable

    int posIndex = 0;
    boolean onlyDataEvents = (type==EventCorruptionType.PAYLOAD);
    for (Iterator<DbusEventInternalWritable> di = _buffer.iterator();
         (posIndex < positions.length) && di.hasNext(); )
    {
      DbusEventInternalWritable ev = di.next();
      if (!onlyDataEvents || !ev.isControlMessage())
      {
        if (count == positions[posIndex])
        {
          DbusEventCorrupter.toggleEventCorruption(type, ev);
          ++tarnishedEvents;
View Full Code Here

Examples of com.linkedin.databus.core.DbusEventInternalWritable

  public static void toggleEventCorruption(EventCorruptionType type, DbusEvent event)
  throws InvalidEventException
  {
    // Regardless of the underlying event type (e.g., readable), we're writing to its
    // internal state, so "convert" it to a writable event.
    DbusEventInternalWritable writableEvent = makeWritable(event)// bruuuuuuutal...

    switch (type)
    {
      case LENGTH:
        int newSize = writableEvent.size() ^ CORRUPTION_PATTERN;
        writableEvent.setSize(newSize);
        break;
      case HEADERCRC:
        long headerCrc = writableEvent.headerCrc() ^ CORRUPTION_PATTERN;
        writableEvent.setHeaderCrc(headerCrc);
        break;
      case PAYLOAD:
        if (writableEvent.payloadLength() > 0)
        {
          byte[] payload = new byte[writableEvent.payloadLength()];
          writableEvent.value().get(payload);
          payload[0] ^= CORRUPTION_PATTERN;
          writableEvent.setValue(payload);
        }
        break;
      case PAYLOADCRC:
        long payloadCrc = writableEvent.bodyCrc() ^ CORRUPTION_PATTERN;
        writableEvent.setValueCrc(payloadCrc);
        break;
    }
  }
View Full Code Here

Examples of com.linkedin.databus.core.DbusEventInternalWritable

    }
    else
    {
      throw new UnsupportedDbusEventVersionRuntimeException(version);
    }
    DbusEventInternalWritable event = eventFactory.createWritableDbusEventFromBuffer(buf, position);
    event.setSequence(seq);
    event.applyCrc();
    return event;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.