• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JNotify类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.contentobjects.jnotify.JNotify的典型用法代码示例。如果您正苦于以下问题:Java JNotify类的具体用法?Java JNotify怎么用?Java JNotify使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



JNotify类属于net.contentobjects.jnotify包,在下文中一共展示了JNotify类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: start

import net.contentobjects.jnotify.JNotify; //导入依赖的package包/类
@Override
public void start(Callback callback) throws IOException {
	checkEnabled();
	List<Integer> watches = new ArrayList<>();
	int mask = JNotify.FILE_CREATED;
	for (String path : getPathsToWatch()) {
		if (new File(path).exists())
			watches.add(JNotify.addWatch(path, mask, false, this));
	}
	lock.lock();
	try {
		if (started) throw new AssertionError();
		if (this.callback != null) throw new AssertionError();
		started = true;
		this.callback = callback;
		this.watches.addAll(watches);
	} finally {
		lock.unlock();
	}
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:21,代码来源:UnixRemovableDriveMonitor.java


示例2: stop

import net.contentobjects.jnotify.JNotify; //导入依赖的package包/类
@Override
public void stop() throws IOException {
	checkEnabled();
	List<Integer> watches;
	lock.lock();
	try {
		if (!started) throw new AssertionError();
		if (callback == null) throw new AssertionError();
		started = false;
		callback = null;
		watches = new ArrayList<>(this.watches);
		this.watches.clear();
	} finally {
		lock.unlock();
	}
	for (Integer w : watches) JNotify.removeWatch(w);
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:18,代码来源:UnixRemovableDriveMonitor.java


示例3: addWatch

import net.contentobjects.jnotify.JNotify; //导入依赖的package包/类
private void addWatch(BatchClass batchClass) throws DCMABusinessException {
	try {
		int watchID = JNotify.addWatch(batchClass.getUncFolder(), JNotify.FILE_CREATED, false, listner);
		this.batchClassIdVsWatchIdMap.put(batchClass.getIdentifier(), watchID);
	} catch (JNotifyException e) {
		LOGGER.error(e.getMessage(), e);
		throw new DCMABusinessException(e.getMessage(), e);
	}
}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:10,代码来源:FolderMonitorServiceImpl.java


示例4: removeWatch

import net.contentobjects.jnotify.JNotify; //导入依赖的package包/类
private void removeWatch() throws DCMABusinessException {
	try {
		for (Integer watchID : batchClassIdVsWatchIdMap.values()) {
			JNotify.removeWatch(watchID);
		}
	} catch (JNotifyException e) {
		LOGGER.error(e.getMessage(), e);
		throw new DCMABusinessException(e.getMessage(), e);
	}
}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:11,代码来源:FolderMonitorServiceImpl.java


示例5: removeWatchFromBatchClass

import net.contentobjects.jnotify.JNotify; //导入依赖的package包/类
/**
 * This method is used to remove the watch form batch class with given id.
 * @param batchClassID {@link BatchClassID}
 */
@Override
public void removeWatchFromBatchClass(BatchClassID batchClassID) {
	Integer watchId = batchClassIdVsWatchIdMap.get(batchClassID.getID());
	if (watchId != null) {
		try {
			LOGGER.info("Removing watch on Batch Class:" + batchClassID.getID());
			JNotify.removeWatch(watchId);
			LOGGER.info("Watch successfully removed");
		} catch (JNotifyException e) {
			LOGGER.error("Unable to remove watch on batch class: " + batchClassID.getID(), e);
		}
	}
}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:18,代码来源:FolderMonitorServiceImpl.java


示例6: monitor

import net.contentobjects.jnotify.JNotify; //导入依赖的package包/类
public static void monitor() throws Exception {
	// path to watch
	String path = HandleHome.getTrackplus_Home();

	// watch mask, specify events you care about,
	// or JNotify.FILE_ANY for all events.
	int mask = JNotify.FILE_CREATED  | 
			JNotify.FILE_DELETED  | 
			JNotify.FILE_MODIFIED | 
			JNotify.FILE_RENAMED;

	// watch subtree?
	boolean watchSubtree = false;

	// add actual watch
	try {		

		if (System.getProperty("os.name").startsWith("Win") && 
				System.getProperty("os.arch").equals("amd64"))
		{
			System.loadLibrary("jnotify_64bit");
		}
		else
		{
			System.loadLibrary("jnotify");
		}
		LOGGER.info("Watching files in " + path);
		watchID = JNotify.addWatch(path, mask, watchSubtree, new Listener());
	}
	catch (UnsatisfiedLinkError e)
	{
		LOGGER.info("Could not find jnotify library in java.library.path=" + System.getProperty("java.library.path"));
		LOGGER.info("This means configuration files in TRACKPLUS_HOME are not monitored for changes.");
		LOGGER.info("You can avoid having to restart the server after configuration changes by ");
		LOGGER.info("placing the library from WEB-INF/classes/plugins/filemonitor into any of the above directories.");
	}
}
 
开发者ID:trackplus,项目名称:Genji,代码行数:38,代码来源:FileMonitor.java


示例7: removeFileWatcher

import net.contentobjects.jnotify.JNotify; //导入依赖的package包/类
public static void removeFileWatcher() {
	// to remove watch the watch
	try {
		boolean res = JNotify.removeWatch(watchID);
	} catch (Exception e) {
		System.err.println("Could not stop file monitor");
	}
}
 
开发者ID:trackplus,项目名称:Genji,代码行数:9,代码来源:FileMonitor.java


示例8: dispose

import net.contentobjects.jnotify.JNotify; //导入依赖的package包/类
@Override
public void dispose() {
  listeners.clear();
  try {
    JNotify.removeWatch(jnotifyWatchId);
  } catch (Exception e) {
    //e.printStackTrace();
  }
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:10,代码来源:DirectoryWatchJob.java


示例9: start

import net.contentobjects.jnotify.JNotify; //导入依赖的package包/类
public void start() {
  try {
    ForgE.log(TAG, "Watching: " + path);
    this.jnotifyWatchId = JNotify.addWatch(path, JNotify.FILE_CREATED | JNotify.FILE_DELETED | JNotify.FILE_MODIFIED | JNotify.FILE_RENAMED, true, this);
  } catch (JNotifyException e) {
    e.printStackTrace();
  }
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:9,代码来源:DirectoryWatchJob.java


示例10: AssetsChangeWatcher

import net.contentobjects.jnotify.JNotify; //导入依赖的package包/类
public AssetsChangeWatcher(JobManager jobs) {
  this.jobs = jobs;
  try {
    String path = Gdx.files.internal(".").path();
    ForgE.log(TAG, "Watching: " + path);
    this.shaderWatchID = JNotify.addWatch(path, JNotify.FILE_CREATED | JNotify.FILE_DELETED | JNotify.FILE_MODIFIED | JNotify.FILE_RENAMED, true, this);
  } catch (JNotifyException e) {
    e.printStackTrace();
  }
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:11,代码来源:AssetsChangeWatcher.java


示例11: dispose

import net.contentobjects.jnotify.JNotify; //导入依赖的package包/类
@Override
public void dispose() {
  try {
    JNotify.removeWatch(shaderWatchID);
  } catch (Exception e) {
    e.printStackTrace();
  }
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:9,代码来源:AssetsChangeWatcher.java


示例12: stop

import net.contentobjects.jnotify.JNotify; //导入依赖的package包/类
@Override
public void stop() {
	for (int ids : this.watchids)
		try {
			JNotify.removeWatch(ids);
		} 
		catch (JNotifyException x) {
		}
	
	super.stop();
}
 
开发者ID:Gadreel,项目名称:divconq,代码行数:12,代码来源:FileWatcher.java


示例13: stop

import net.contentobjects.jnotify.JNotify; //导入依赖的package包/类
public void stop(OperationResult or) {
	try {
		if (this.watchID == null)
			return;
		
		JNotify.removeWatch(this.watchID);
	} 
	catch (Exception x) {
		// unimportant
	}
}
 
开发者ID:Gadreel,项目名称:divconq,代码行数:12,代码来源:LocalFileStore.java


示例14: ClassWatcher

import net.contentobjects.jnotify.JNotify; //导入依赖的package包/类
/**
 * Watch this directory for any modifications like file removing,
 * adding or modifying files
 *
 * @param path The selected directory to watch
 */
public ClassWatcher(String path) {
    // check firs if this path is a directory, if not, than it is a file
    // therefore we can extract a directory location from the file
    File f = new File(path);
    if (!f.isDirectory()) {
        path = f.getParentFile().getName();
    }
    this.path = path;
    // what kind of modification this watcher should notify
    this.mask = JNotify.FILE_ANY;
    this.alive = false;
    logger.setLevel(ClassUtil.logLevel);
}
 
开发者ID:fioan89,项目名称:coldswap,代码行数:20,代码来源:ClassWatcher.java


示例15: stopWatcher

import net.contentobjects.jnotify.JNotify; //导入依赖的package包/类
/**
 * Stop this daemon thread from watching directories
 */
public synchronized void stopWatcher() {
    this.alive = false;
    try {
        JNotify.removeWatch(this.watchID);
    } catch (JNotifyException e) {
        // just ignore
    }
}
 
开发者ID:fioan89,项目名称:coldswap,代码行数:12,代码来源:ClassWatcher.java



注:本文中的net.contentobjects.jnotify.JNotify类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConfigGuiType类代码示例发布时间:2022-05-23
下一篇:
Java AbstractActionExt类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap