Return-Path: Delivered-To: apmail-camel-dev-archive@www.apache.org Received: (qmail 86377 invoked from network); 22 Sep 2010 10:02:07 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 22 Sep 2010 10:02:07 -0000 Received: (qmail 78433 invoked by uid 500); 22 Sep 2010 10:02:07 -0000 Delivered-To: apmail-camel-dev-archive@camel.apache.org Received: (qmail 78333 invoked by uid 500); 22 Sep 2010 10:02:05 -0000 Mailing-List: contact dev-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list dev@camel.apache.org Received: (qmail 78325 invoked by uid 500); 22 Sep 2010 10:02:05 -0000 Delivered-To: apmail-activemq-camel-dev@activemq.apache.org Received: (qmail 78317 invoked by uid 99); 22 Sep 2010 10:02:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Sep 2010 10:02:05 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Sep 2010 10:02:02 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o8MA1e4x005850 for ; Wed, 22 Sep 2010 10:01:40 GMT Message-ID: <29212885.27881285149700806.JavaMail.jira@thor> Date: Wed, 22 Sep 2010 06:01:40 -0400 (EDT) From: "Lars Gohlke (JIRA)" To: camel-dev@activemq.apache.org Subject: [jira] Updated: (CAMEL-3146) FileComponent maybe use inotify interface implemented by jnotify In-Reply-To: <15645603.27871285149700441.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: ae95407df07c98740808b2ef9da0087c X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/activemq/browse/CAMEL-3146?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Lars Gohlke updated CAMEL-3146: ------------------------------- Description: What about using jnotify? JNotify java API JNotify is a java library that allow java application to listen to file system events, such as: * File created * File modified * File renamed * File deleted Supported platforms * Windows (2000 or newer) Windows notes * Linux with INofity support (2.6.14 or newer) Linux notes * Mac OS X (10.5 or newer) Mac OS notes The fallback could be always the old behaviour, but in case it could be used it would be an really good improvement in terms of performance sample from http://jnotify.sourceforge.net/sample.html public void sample() throws Exception { // path to watch String path = System.getProperty("user.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 = true; // add actual watch int watchID = JNotify.addWatch(path, mask, watchSubtree, new Listener()); // sleep a little, the application will exit if you // don't (watching is asynchronous), depending on your // application, this may not be required Thread.sleep(1000000); // to remove watch the watch boolean res = JNotify.removeWatch(watchID); if (!res) { // invalid watch ID specified. } } class Listener implements JNotifyListener { public void fileRenamed(int wd, String rootPath, String oldName, String newName) { print("renamed " + rootPath + " : " + oldName + " -> " + newName); } public void fileModified(int wd, String rootPath, String name) { print("modified " + rootPath + " : " + name); } public void fileDeleted(int wd, String rootPath, String name) { print("deleted " + rootPath + " : " + name); } public void fileCreated(int wd, String rootPath, String name) { print("created " + rootPath + " : " + name); } void print(String msg) { System.err.println(msg); } } was: What about using jnotify? The fallback could be always the old behaviour, but in case it could be used it would be an really good improvement in terms of performance sample from http://jnotify.sourceforge.net/sample.html public void sample() throws Exception { // path to watch String path = System.getProperty("user.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 = true; // add actual watch int watchID = JNotify.addWatch(path, mask, watchSubtree, new Listener()); // sleep a little, the application will exit if you // don't (watching is asynchronous), depending on your // application, this may not be required Thread.sleep(1000000); // to remove watch the watch boolean res = JNotify.removeWatch(watchID); if (!res) { // invalid watch ID specified. } } class Listener implements JNotifyListener { public void fileRenamed(int wd, String rootPath, String oldName, String newName) { print("renamed " + rootPath + " : " + oldName + " -> " + newName); } public void fileModified(int wd, String rootPath, String name) { print("modified " + rootPath + " : " + name); } public void fileDeleted(int wd, String rootPath, String name) { print("deleted " + rootPath + " : " + name); } public void fileCreated(int wd, String rootPath, String name) { print("created " + rootPath + " : " + name); } void print(String msg) { System.err.println(msg); } } > FileComponent maybe use inotify interface implemented by jnotify > ---------------------------------------------------------------- > > Key: CAMEL-3146 > URL: https://issues.apache.org/activemq/browse/CAMEL-3146 > Project: Apache Camel > Issue Type: Improvement > Components: camel-core > Affects Versions: 2.4.0 > Reporter: Lars Gohlke > Priority: Minor > Original Estimate: 1 day > Remaining Estimate: 1 day > > What about using jnotify? > JNotify java API > JNotify is a java library that allow java application to listen to file system events, such as: > * File created > * File modified > * File renamed > * File deleted > Supported platforms > * Windows (2000 or newer) Windows notes > * Linux with INofity support (2.6.14 or newer) Linux notes > * Mac OS X (10.5 or newer) Mac OS notes > The fallback could be always the old behaviour, but in case it could be used it would be an really good improvement in terms of performance > sample from http://jnotify.sourceforge.net/sample.html > public void sample() throws Exception { > // path to watch > String path = System.getProperty("user.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 = true; > // add actual watch > int watchID = JNotify.addWatch(path, mask, watchSubtree, new Listener()); > // sleep a little, the application will exit if you > // don't (watching is asynchronous), depending on your > // application, this may not be required > Thread.sleep(1000000); > // to remove watch the watch > boolean res = JNotify.removeWatch(watchID); > if (!res) { > // invalid watch ID specified. > } > } > class Listener implements JNotifyListener { > public void fileRenamed(int wd, String rootPath, String oldName, > String newName) { > print("renamed " + rootPath + " : " + oldName + " -> " + newName); > } > public void fileModified(int wd, String rootPath, String name) { > print("modified " + rootPath + " : " + name); > } > public void fileDeleted(int wd, String rootPath, String name) { > print("deleted " + rootPath + " : " + name); > } > public void fileCreated(int wd, String rootPath, String name) { > print("created " + rootPath + " : " + name); > } > void print(String msg) { > System.err.println(msg); > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.