2011-04-25 41 views
0

我是一个Fedora用户,目前正在使用inotify-java来实现目录轮询。我有以下代码片段:inotify - 我应该如何处理完整的事件队列?

InotifyEventListener inel = new InotifyEventListener() { 

    @Override 
    public void filesystemEventOccurred (InotifyEvent ine) { 
     // code to handle - done 
    } 

    @Override 
    public void queueFull (EventQueueFull eqf) { 
     // this is the part when I'm not sure what I should do 
    } 

} 

回答

2

您应该执行特定于您的应用程序的恢复操作。

如果您没有足够快地检索事件,就会发生“队列已满”事件。过度的事件将被丢弃,但您会收到通知。

如果您错过了一两个事件,并计划恢复操作(例如,快速清理队列并重新扫描目录),您应该考虑应用程序的后果。