<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: jnotify - fileCreated in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/jnotify-fileCreated/m-p/2284794#M58416</link>
    <description>Hi Shong, 
&lt;BR /&gt;if you look at the code above, you can see that tJava runs in a very long Thread.sleep (in order not to waste processing power by polling the directory) while waiting for jnotify to signal the creation of a new file which happens to be in "public void fileCreated(int wd, String rootPath, String name)". 
&lt;BR /&gt;How can I interrupt the Thread.sleep from within "public void fileCreated" so that tJava ends normaly and continues with the next TOS module tFileInput? 
&lt;BR /&gt;Many thanks in advance for your support 
&lt;BR /&gt;Hannes</description>
    <pubDate>Thu, 14 Oct 2010 14:16:48 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2010-10-14T14:16:48Z</dc:date>
    <item>
      <title>jnotify - fileCreated</title>
      <link>https://community.qlik.com/t5/Talend-Studio/jnotify-fileCreated/m-p/2284791#M58413</link>
      <description>Hallo all,
&lt;BR /&gt;I finally managed to get jnotify working within TOS. 
&lt;BR /&gt;Now my problem is how to trigger a job that does the processing of the created file as tJava runs in an endless loop.
&lt;BR /&gt;I do not want to stop tJava/jnotify as I would probabely loose one file.
&lt;BR /&gt;Is there a posibility to call another TOS job from within tJava?
&lt;BR /&gt;Any help very much appreciated.
&lt;BR /&gt;kind regards
&lt;BR /&gt;Hannes
&lt;BR /&gt;----- Code within tJava (Test only) ---------------------------------------------------------------------------
&lt;BR /&gt;// to add a watch : 
&lt;BR /&gt;String path = context.WatchPath;
&lt;BR /&gt;int mask = JNotify.FILE_CREATED | 
&lt;BR /&gt; JNotify.FILE_DELETED | 
&lt;BR /&gt; JNotify.FILE_MODIFIED| 
&lt;BR /&gt; JNotify.FILE_RENAMED;
&lt;BR /&gt;boolean watchSubtree = false;
&lt;BR /&gt;int watchID = JNotify.addWatch(path, mask, watchSubtree, new JNotifyListener()
&lt;BR /&gt;{
&lt;BR /&gt; public void fileRenamed(int wd, String rootPath, String oldName, String newName)
&lt;BR /&gt; {
&lt;BR /&gt; System.out.println("JNotifyTest.fileRenamed() : wd #" + wd + " root = " + rootPath + ", " + oldName + " -&amp;gt; " + newName);
&lt;BR /&gt; }
&lt;BR /&gt; public void fileModified(int wd, String rootPath, String name)
&lt;BR /&gt; {
&lt;BR /&gt; System.out.println("JNotifyTest.fileModified() : wd #" + wd + " root = " + rootPath + ", " + name);
&lt;BR /&gt; }
&lt;BR /&gt; public void fileDeleted(int wd, String rootPath, String name)
&lt;BR /&gt; {
&lt;BR /&gt; System.out.println("JNotifyTest.fileDeleted() : wd #" + wd + " root = " + rootPath
&lt;BR /&gt; + ", " + name);
&lt;BR /&gt; }
&lt;BR /&gt; public void fileCreated(int wd, String rootPath, String name)
&lt;BR /&gt; {
&lt;BR /&gt; System.out.println("JNotifyTest.fileCreated() : wd #" + wd + " root = " + rootPath
&lt;BR /&gt; + ", " + name);
&lt;BR /&gt; }
&lt;BR /&gt;});
&lt;BR /&gt;
&lt;BR /&gt;Thread.sleep(1000000);
&lt;BR /&gt;// to remove watch:
&lt;BR /&gt;boolean res = JNotify.removeWatch(watchID);
&lt;BR /&gt;if (!res)
&lt;BR /&gt;{
&lt;BR /&gt; // invalid watch ID specified.
&lt;BR /&gt;}
&lt;BR /&gt;----end of Code -----------------------</description>
      <pubDate>Sat, 16 Nov 2024 13:15:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/jnotify-fileCreated/m-p/2284791#M58413</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T13:15:20Z</dc:date>
    </item>
    <item>
      <title>Re: jnotify - fileCreated</title>
      <link>https://community.qlik.com/t5/Talend-Studio/jnotify-fileCreated/m-p/2284792#M58414</link>
      <description>Hello
&lt;BR /&gt;Did you try to use tLoop or tInfiniteLoop to trigger the tJava ?
&lt;BR /&gt;Best regards
&lt;BR /&gt;Shong</description>
      <pubDate>Tue, 12 Oct 2010 11:16:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/jnotify-fileCreated/m-p/2284792#M58414</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-10-12T11:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: jnotify - fileCreated</title>
      <link>https://community.qlik.com/t5/Talend-Studio/jnotify-fileCreated/m-p/2284793#M58415</link>
      <description>Hi Shong, 
&lt;BR /&gt;yes, a thought about this but thats not doing the job. 
&lt;BR /&gt;jnotify creats a listner which fires up when a new file is created in a specific directory and runs "public void fileCreated(int wd, String rootPath, String name)". 
&lt;BR /&gt;I am looking for a way to start the processing job of the newly created file without leaving tJava or more precise without interrupting the listener. - Kind of writing the filepath of the created file into a pipe which another asyncronously running job reads in. 
&lt;BR /&gt;Any idea how I can achive this? 
&lt;BR /&gt;Thanks in advance and kind regards 
&lt;BR /&gt;Hannes</description>
      <pubDate>Tue, 12 Oct 2010 11:51:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/jnotify-fileCreated/m-p/2284793#M58415</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-10-12T11:51:46Z</dc:date>
    </item>
    <item>
      <title>Re: jnotify - fileCreated</title>
      <link>https://community.qlik.com/t5/Talend-Studio/jnotify-fileCreated/m-p/2284794#M58416</link>
      <description>Hi Shong, 
&lt;BR /&gt;if you look at the code above, you can see that tJava runs in a very long Thread.sleep (in order not to waste processing power by polling the directory) while waiting for jnotify to signal the creation of a new file which happens to be in "public void fileCreated(int wd, String rootPath, String name)". 
&lt;BR /&gt;How can I interrupt the Thread.sleep from within "public void fileCreated" so that tJava ends normaly and continues with the next TOS module tFileInput? 
&lt;BR /&gt;Many thanks in advance for your support 
&lt;BR /&gt;Hannes</description>
      <pubDate>Thu, 14 Oct 2010 14:16:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/jnotify-fileCreated/m-p/2284794#M58416</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-10-14T14:16:48Z</dc:date>
    </item>
  </channel>
</rss>

