⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 checktimecontrolthread.java

📁 一个用于实现不同数据库数据同步的程序
💻 JAVA
字号:
import java.io.*; 
import java.util.*; 

public class checkTimeControlThread extends Thread 
{ 
	private long txtTime=0;
	private String databaseName="";private String txtAddress="";///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	

	public void run()
	{ 
		long tempTime=0;
		File file=new File(txtAddress+"new.txt");
		txtTime=file.lastModified();
		checkText ct=new checkText(databaseName);
		getUpdateTime gut=new getUpdateTime();
		for(;;)
		{ 
			
			tempTime=file.lastModified();
			if(tempTime>txtTime)
			{
				String sTime=gut.getSystemTime();
				System.out.println("have updated"); 
				txtTime=tempTime;

				//检查数据库新生成的文档
				int i=ct.checking(txtAddress,sTime);
				if(i==1)
				{
					writeText writeDaily=new writeText(databaseName,txtAddress,"Database Daily.txt");
					try
					{
						writeDaily.writingDaily(sTime+"\tLocal database have updated");
					}
					catch(IOException e){ } 
					sendBySocket ds=new sendBySocket(databaseName,txtAddress);
					ds.sendBatchMessages(sTime);
				}

				//检查任务管理文件,查看是否有已经经过一日还没有接收到确认信息的记录
				ct.checkMissionManage(txtAddress,sTime,1);
				
			} 
			else
			{
				System.out.println("no update"); 
			}

			try
			{ 
				sleep(7*1000); 
			}
			catch(Exception e)
			{ 
			} 

		} 
	}

} 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -