我想知道線程在nifi中的工作方式我的意思是一個處理器有一個線程或者它們在一個主線程中?也許是我想從處理器獲得一個文件,然後我想更新Nifi:nifi中的線程
- 我怎麼能防止幾個處理器獲取文件數據,以一定的時間 除了使用保留文件=假動作?
- 是否有可能在內部使用Thread.sleep執行腳本處理器代碼?
- Groovy有可能製作相同的邏輯嗎?
我試圖用Java文件鎖,但它似乎沒有工作好,這裏是我的代碼,
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);