当前位置: 首页>>代码示例>>Java>>正文


Java DefaultFileMonitor.stop方法代码示例

本文整理汇总了Java中org.apache.commons.vfs2.impl.DefaultFileMonitor.stop方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultFileMonitor.stop方法的具体用法?Java DefaultFileMonitor.stop怎么用?Java DefaultFileMonitor.stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.vfs2.impl.DefaultFileMonitor的用法示例。


在下文中一共展示了DefaultFileMonitor.stop方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testFileModified

import org.apache.commons.vfs2.impl.DefaultFileMonitor; //导入方法依赖的package包/类
public void testFileModified() throws Exception
{
    writeToFile(testFile);
    FileObject fileObj = fsManager.resolveFile(testFile.toURL().toString());
    DefaultFileMonitor monitor = new DefaultFileMonitor(new TestFileListener());
    monitor.setDelay(100);
    monitor.addFile(fileObj);
    monitor.start();
    // Need a long delay to insure the new timestamp doesn't truncate to be the same as
    // the current timestammp. Java only guarantees the timestamp will be to 1 second.
    Thread.sleep(1000);
    long value = System.currentTimeMillis();
    boolean rc = testFile.setLastModified(value);
    assertTrue("setLastModified succeeded",rc);
    Thread.sleep(300);
    assertTrue("No event occurred", changeStatus != 0);
    assertTrue("Incorrect event", changeStatus == 1);
    monitor.stop();
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:20,代码来源:DefaultFileMonitorTests.java

示例2: testFileRecreated

import org.apache.commons.vfs2.impl.DefaultFileMonitor; //导入方法依赖的package包/类
public void testFileRecreated() throws Exception
{
    FileObject fileObj = fsManager.resolveFile(testFile.toURL().toString());
    DefaultFileMonitor monitor = new DefaultFileMonitor(new TestFileListener());
    monitor.setDelay(100);
    monitor.addFile(fileObj);
    monitor.start();
    writeToFile(testFile);
    Thread.sleep(300);
    assertTrue("No event occurred", changeStatus != 0);
    assertTrue("Incorrect event " + changeStatus, changeStatus == 3);
    changeStatus = 0;
    testFile.delete();
    Thread.sleep(300);
    assertTrue("No event occurred", changeStatus != 0);
    assertTrue("Incorrect event " + changeStatus, changeStatus == 2);
    changeStatus = 0;
    Thread.sleep(500);
    monitor.addFile(fileObj);
    writeToFile(testFile);
    Thread.sleep(300);
    assertTrue("No event occurred", changeStatus != 0);
    assertTrue("Incorrect event " + changeStatus, changeStatus == 3);
    monitor.stop();
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:26,代码来源:DefaultFileMonitorTests.java

示例3: testFileCreated

import org.apache.commons.vfs2.impl.DefaultFileMonitor; //导入方法依赖的package包/类
public void testFileCreated() throws Exception
{
    FileObject fileObj = fsManager.resolveFile(testFile.toURL().toString());
    DefaultFileMonitor monitor = new DefaultFileMonitor(new TestFileListener());
    monitor.setDelay(100);
    monitor.addFile(fileObj);
    monitor.start();
    writeToFile(testFile);
    Thread.sleep(300);
    assertTrue("No event occurred", changeStatus != 0);
    assertTrue("Incorrect event", changeStatus == 3);
    monitor.stop();
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:14,代码来源:DefaultFileMonitorTests.java

示例4: testFileDeleted

import org.apache.commons.vfs2.impl.DefaultFileMonitor; //导入方法依赖的package包/类
public void testFileDeleted() throws Exception
{
    writeToFile(testFile);
    FileObject fileObj = fsManager.resolveFile(testFile.toURL().toString());
    DefaultFileMonitor monitor = new DefaultFileMonitor(new TestFileListener());
    monitor.setDelay(100);
    monitor.addFile(fileObj);
    monitor.start();
    testFile.delete();
    Thread.sleep(300);
    assertTrue("No event occurred", changeStatus != 0);
    assertTrue("Incorrect event", changeStatus == 2);
    monitor.stop();
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:15,代码来源:DefaultFileMonitorTests.java

示例5: shutdown

import org.apache.commons.vfs2.impl.DefaultFileMonitor; //导入方法依赖的package包/类
@Override
public void shutdown() {
	for(DefaultFileMonitor fm: this.fileMonitors) {
		fm.stop();
		fm = null;
	}
}
 
开发者ID:vauvenal5,项目名称:pieShare,代码行数:8,代码来源:ApacheFileWatcherService.java


注:本文中的org.apache.commons.vfs2.impl.DefaultFileMonitor.stop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。