Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

22
LINES

< > BotCompany Repo | #1019349 // Recursive File Watch Service Spike [OK]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (10907L/78K).

!7

module RecursiveFileWatchServiceSpike > DynPrintLog {
  switchable File dir;
  switchable bool verbose;
  
  transient bool started;
  
  start {
    if (dir == null) dir = javaxDataDir();
    thread "Starting" {
      print("Starting watch service on " + dir);
      WatchService watchService = jdk_watchService_start();
      jdk_watchService_registerRecursivePath(dir, voidfunc(File f) enter {
        if (verbose) print("File changed: " + f);
        vmBus_send('fileChanged, f);
      });
      print("Listening to changes in " + dir);
      started = true;
    }
  }
}

Author comment

Began life as a copy of #1019346

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1019349
Snippet name: Recursive File Watch Service Spike [OK]
Eternal ID of this version: #1019349/9
Text MD5: 2d77298961eb15e273481851f058292a
Transpilation MD5: 8c060454773dd9ff57d9485e20730a51
Author: stefan
Category: javax / io
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-22 15:10:56
Source code size: 599 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 315 / 5895
Version history: 8 change(s)
Referenced in: [show references]