title: Nifi: Threads in nifi
body: <p><strong>I want to know how threads work in nifi i mean one processor has one thread or they are in one main thread?</strong> perhaps i want to get one file from processor and then i want to update it</p>
  
  <ol>
  <li>how can i prevent getting file data by several processor at a time
  except using keep file =false action?</li>
  <li>Is  it  possible  to  use  Thread.sleep  inside   Execute  script processor  code?</li>
  <li>Is  it  possible  to make  same   logic  by  groovy?</li>
  </ol>
  
  <p>I  tried  to  use   java  File  locks but  it  doesn't seem  to  work  good  here  is my  code, </p>
  
  <pre><code>     File file = new File("C://Users//user//Desktop//try2//nifi-
        1.3.0//4//conf2.xml");
          String content = "";
          String material = "";
          BufferedReader s;
          BufferedWriter w;
          int m;
          RandomAccessFile ini = new RandomAccessFile(file, "rwd");
          FileLock lock = ini.getChannel().lock();
          DocumentBuilder dBuilder;
          Document document, doc;
          String date="";
          String data="";
          boolean make = false;
          try {
  
              String sCurrentLine;
              s = new BufferedReader(Channels.newReader(ini.getChannel(), "UTF-8"));
              while ((sCurrentLine = s.readLine()) != null) {
                  content += sCurrentLine;
              }
              ini.seek(0);
  </code></pre>