All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.zendesk.maxwell.schema..PositionStoreThread.swp Maven / Gradle / Ivy

There is a newer version: 1.8.0
Show newest version
b0VIM 8.0??lZ?'?Abenalpha21~ben/src/maxwell/src/main/java/com/zendesk/maxwell/schema/PositionStoreThread.java
3210#"! Utp?ad??????fFE'&???p?
?

^
@
(
???]G-
?????~lih]H@2?
?
?
?
?
?
?
?
?
t
^
[
Z
O
0



?	?	?	?	?	?	?	]		?????????L+????SC?????_(????lQ0,+????x;62/.????{vron,?????????}	}		return position;		position = store.get();			return position;		if ( position != null )	public synchronized Position getPosition() throws SQLException {	}		}			}				storedPosition = p;			if (storedPosition == null) {			position = p;		if ( position == null || p.newerThan(position) ) {	public synchronized void setPosition(Position p) {	}		}			}				lastHeartbeatSentFrom = newPosition.getBinlogPosition();			if (newPosition != null) {			lastHeartbeatSent = store.heartbeat();		if ( shouldHeartbeat(newPosition) )  {		try { Thread.sleep(1000); } catch (InterruptedException e) { }		}			storedPosition = newPosition;			store.set(newPosition);		if ( newPosition != null && newPosition.newerThan(storedPosition) ) {		Position newPosition = position;	public void work() throws Exception {	}		return false;		}			return true;			// during quiet times, heartbeat at least every 10s		if ( secondsSinceHeartbeat >= 10 ) {		long secondsSinceHeartbeat = (System.currentTimeMillis() - lastHeartbeatSent) / 1000;		}			return true;		if ( currentBinlog.getOffset() - lastHeartbeatSentFrom.getOffset() > 1000 ) {			return true;		if ( !lastHeartbeatSentFrom.getFile().equals(currentBinlog.getFile()) )		BinlogPosition currentBinlog = currentPosition.getBinlogPosition();			return true;		if ( lastHeartbeatSentFrom == null )			return true;		if ( currentPosition == null )	boolean shouldHeartbeat(Position currentPosition) {	}		store.heartbeat();	public void heartbeat() throws Exception {	}		}			store.set(position);			LOGGER.info("Storing final position: " + position);		if ( position != null && !position.equals(storedPosition) ) {	void storeFinalPosition() throws SQLException {	}		}			}				LOGGER.error("error storing final position: " + e);			} catch ( Exception e ) {				storeFinalPosition();			try {		if ( exception == null ) {	protected void beforeStop() {	@Override	}		thread.interrupt();		super.requestStop();	public void requestStop() {	@Override	}		}			this.taskState.stopped();		} finally {			context.terminate(e);			this.exception = e;		} catch ( Exception e ) {			runLoop();		try {	public void run() {	@Override	}		thread.start();		this.thread.setDaemon(true);		this.thread = new Thread(this, "Position Flush Thread");	public void start() {	}		lastHeartbeatSent = 0L;		lastHeartbeatSentFrom = null;		this.context = context;		this.store = store;	public PositionStoreThread(MysqlPositionStore store, MaxwellContext context) {	private long lastHeartbeatSent;	private BinlogPosition lastHeartbeatSentFrom; // last position we sent a heartbeat from	private Thread thread;	private Exception exception;	private MaxwellContext context;	private final MysqlPositionStore store;	private Position storedPosition; // position as flushed to storage	private Position position; // in memory position	static final Logger LOGGER = LoggerFactory.getLogger(PositionStoreThread.class);public class PositionStoreThread extends RunLoopProcess implements Runnable {import com.zendesk.maxwell.util.RunLoopProcess;import com.zendesk.maxwell.replication.BinlogPosition;import java.sql.SQLException;import org.slf4j.LoggerFactory;import org.slf4j.Logger;import com.zendesk.maxwell.replication.Position;import com.zendesk.maxwell.MaxwellContext;package com.zendesk.maxwell.schema;




© 2015 - 2025 Weber Informatics LLC | Privacy Policy