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

com.scudata.util.FileSyncManager Maven / Gradle / Ivy

Go to download

SPL(Structured Process Language) A programming language specially for structured data computing.

There is a newer version: 20241126
Show newest version
package com.scudata.util;

import java.io.File;
import java.util.HashMap;

import com.scudata.dm.FileObject;


/**
 * ????ȡ?ļ???ͬ??????
 * ???߳??޸??ļ?ʱ?????????ͬ?????????ļ?ȡ??ͬ??????????ͬ??
 * @author RunQian
 *
 */
public final class FileSyncManager {
	// ?ļ???ͬ??????ӳ??
	private static HashMap fileMap = new HashMap();
	
	/**
	 * ȡ???ļ???ͬ?????󣬷????ļ?ʱ?ڴ˶????ϼ???
	 * @param fo ?ļ?????
	 * @return Object ????ͬ??????
	 */
	public static Object getSyncObject(FileObject fo) {
		//LocalFile lf = fo.getLocalFile();
		//File file = lf.file();
		//return getSyncObject(file);
		return fo;
	}
	
	/**
	 * ȡ???ļ???ͬ?????󣬷????ļ?ʱ?ڴ˶????ϼ???
	 * @param file ?ļ?
	 * @return Object ????ͬ??????
	 */
	public static Object getSyncObject(File file) {
		synchronized(fileMap) {
			File f = fileMap.get(file);
			if (f == null) {
				fileMap.put(file, file);
				return file;
			} else {
				return f;
			}
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy