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

ch.sbb.releasetrain.git.GITPusherThread Maven / Gradle / Ivy

There is a newer version: 0.9.6
Show newest version
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements;
 * and to You under the Apache License, Version 2.0.
 */
package ch.sbb.releasetrain.git;

import javax.annotation.PreDestroy;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * Base Thread to initialize a GIT Connection read / write
 *
 * @author u203244 (Daniel Marthaler)
 * @version $Id: $
 * @since 0.0.1, 2016
 */
@Slf4j
@Component
public class GITPusherThread {

	@Autowired
	private GITAccessor th;

	@Scheduled(fixedRate = 2 * 60 * 1000)
	public void commit() {
		if (th.isDirty()) {
			th.addCommitPush();
			th.setDirty(false);
		}
	}

	@PreDestroy
	private void shutdown() {
		commit();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy