我有一些带有 JNotify 的 jython 代码,如下所示:
mask = JNotify.FILE_CREATED | JNotify.FILE_DELETED | \
JNotify.FILE_MODIFIED | JNotify.FILE_RENAMED
class Listener(JNotifyListener):
def fileRenamed(self, wd, rootPath, oldName, newName):
pass
def fileModified(self, wd, root, name):
add_file(root, name)
def fileDeleted(self, wd, root, name):
add_file(root, name)
def fileCreated(self, wd, root, name):
add_file(root, name)
st = time.time()
JNotify.addWatch("some_path", mask, True, Listener())
print time.time - st
完成代码大约需要 98.4 秒。
但是当我运行time java -jar jnotify-0.94.jar
命令时,它非常快并且花费不到 1 秒。
Jython 和 JNotify 有什么问题?