Package com.google.code.or.binlog.impl.event

Examples of com.google.code.or.binlog.impl.event.BinlogEventV4HeaderImpl


            throw new NestableRuntimeException("assertion failed, invalid packet marker: " + packetMarker);
          }
        }
       
        // Parse the event header
        final BinlogEventV4HeaderImpl header = new BinlogEventV4HeaderImpl();
        header.setTimestamp(is.readLong(4) * 1000L);
        header.setEventType(is.readInt(1));
        header.setServerId(is.readLong(4));
        header.setEventLength(is.readInt(4));
        header.setNextPosition(is.readLong(4));
        header.setFlags(is.readInt(2));
        header.setTimestampOfReceipt(System.currentTimeMillis());
        if(isVerbose() && LOGGER.isInfoEnabled()) {
          LOGGER.info("received an event, sequence: {}, header: {}", packetSequence, header);
        }
       
        // Parse the event body
        if(this.eventFilter != null && !this.eventFilter.accepts(header, context)) {
          this.defaultParser.parse(is, header, context);
        } else {
          BinlogEventParser parser = getEventParser(header.getEventType());
          if(parser == null) parser = this.defaultParser;
          parser.parse(is, header, context);
        }
       
        // Ensure the packet boundary
        if(is.available() != 0) {
          throw new NestableRuntimeException("assertion failed, available: " + is.available() + ", event type: " + header.getEventType());
        }
      } finally {
        is.setReadLimit(0);
      }
    }
View Full Code Here


    //
    final Context context = new Context(this.binlogFileName);
    while(isRunning() && is.available() > 0) {
      try {
        //
        final BinlogEventV4HeaderImpl header = new BinlogEventV4HeaderImpl();
        header.setTimestamp(is.readLong(4) * 1000L);
        header.setEventType(is.readInt(1));
        header.setServerId(is.readLong(4));
        header.setEventLength(is.readInt(4));
        header.setNextPosition(is.readLong(4));
        header.setFlags(is.readInt(2));
        header.setTimestampOfReceipt(System.currentTimeMillis());
        is.setReadLimit((int)(header.getEventLength() - header.getHeaderLength())); // Ensure the event boundary
        if(isVerbose() && LOGGER.isInfoEnabled()) {
          LOGGER.info("read an event, header: {}", header);
        }
       
        //
        if(this.stopPosition > 0 && header.getPosition() > this.stopPosition) {
          break;
        }
       
        // Parse the event body
        if(this.eventFilter != null && !this.eventFilter.accepts(header, context)) {
          this.defaultParser.parse(is, header, context);
        } else {
          BinlogEventParser parser = getEventParser(header.getEventType());
          if(parser == null) parser = this.defaultParser;
          parser.parse(is, header, context);
        }
       
        // Ensure the packet boundary
        if(is.available() != 0) {
          throw new NestableRuntimeException("assertion failed, available: " + is.available() + ", event type: " + header.getEventType());
        }
      } catch(Exception e) {
        IOUtils.closeQuietly(is);
        throw e;
      } finally {
View Full Code Here

    //
    final Context context = new Context(this.binlogFileName);
    while(isRunning() && is.available() > 0) {
      try {
        //
        final BinlogEventV4HeaderImpl header = new BinlogEventV4HeaderImpl();
        header.setTimestamp(is.readLong(4) * 1000L);
        header.setEventType(is.readInt(1));
        header.setServerId(is.readLong(4));
        header.setEventLength(is.readInt(4));
        header.setNextPosition(is.readLong(4));
        header.setFlags(is.readInt(2));
        header.setTimestampOfReceipt(System.currentTimeMillis());
        is.setReadLimit((int)(header.getEventLength() - header.getHeaderLength())); // Ensure the event boundary
        if(isVerbose() && LOGGER.isInfoEnabled()) {
          LOGGER.info("read an event, header: {}", header);
        }
       
        //
        if(this.stopPosition > 0 && header.getPosition() > this.stopPosition) {
          break;
        }
       
        // Parse the event body
        if(this.eventFilter != null && !this.eventFilter.accepts(header, context)) {
          this.defaultParser.parse(is, header, context);
        } else {
          BinlogEventParser parser = getEventParser(header.getEventType());
          if(parser == null) parser = this.defaultParser;
          parser.parse(is, header, context);
        }
       
        // Ensure the packet boundary
        if(is.available() != 0) {
          throw new RuntimeException("assertion failed, available: " + is.available() + ", event type: " + header.getEventType());
        }
      } catch(Exception e) {
        IOUtils.closeQuietly(is);
        throw e;
      } finally {
View Full Code Here

            throw new RuntimeException("assertion failed, invalid packet marker: " + packetMarker);
          }
        }
       
        // Parse the event header
        final BinlogEventV4HeaderImpl header = new BinlogEventV4HeaderImpl();
        header.setTimestamp(is.readLong(4) * 1000L);
        header.setEventType(is.readInt(1));
        header.setServerId(is.readLong(4));
        header.setEventLength(is.readInt(4));
        header.setNextPosition(is.readLong(4));
        header.setFlags(is.readInt(2));
        header.setTimestampOfReceipt(System.currentTimeMillis());
        if(isVerbose() && LOGGER.isInfoEnabled()) {
          LOGGER.info("received an event, sequence: {}, header: {}", packetSequence, header);
        }
       
        // Parse the event body
        if(this.eventFilter != null && !this.eventFilter.accepts(header, context)) {
          this.defaultParser.parse(is, header, context);
        } else {
          BinlogEventParser parser = getEventParser(header.getEventType());
          if(parser == null) parser = this.defaultParser;
          parser.parse(is, header, context);
        }
       
        // Ensure the packet boundary
        if(is.available() != 0) {
          throw new RuntimeException("assertion failed, available: " + is.available() + ", event type: " + header.getEventType());
        }
      } finally {
        is.setReadLimit(0);
      }
    }
View Full Code Here

TOP

Related Classes of com.google.code.or.binlog.impl.event.BinlogEventV4HeaderImpl

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.