• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

Unable to design a solution

 
Ranch Hand
Posts: 40
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to Java world. Here is my scenario:

I have to keep checking for a creation of a file of certain format say <file-name>.ppt in predefined directory. And it has to happen continuously. Once it gets created then I have to update the status in a table. Updating in a table is fine. But I don't know what is the good way to keep checking in a path for this file. The requirement is to check for the file existence continuously for 1 hour with 30 seconds of interval. Once it gets created within that time, then it is fine (where I update the table with 'COMPLETED' status). Else, it is a time out (and I will update same table with 'FAILURE').

I request forum veterans here to guide me to proceed with good way to achieve this.

I am on Java 8 and using SpringBoot

Regards,
Ranagal
 
Marshal
Posts: 4914
624
VSCode Eclipse IDE Redhat MicroProfile Quarkus Java Linux
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Take a look at A Guide to WatchService by baeldung and see if it helps.
 
Marshal
Posts: 6209
501
IntelliJ IDE Python TypeScript Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would also consider whether Spring Boot is needed for such a small application. I propose not.
 
Ranagal Adapla
Ranch Hand
Posts: 40
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Cooke wrote:I would also consider whether Spring Boot is needed for such a small application. I propose not.



This requirement is part of bigger application. I am just handling one of the many requirements. I just told what I am using so that experts offering solutions will know what I am using.
 
Sheriff
Posts: 17735
302
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Definitely consider Ron's suggestion before trying to roll your own solution which is probably going to be inferior to WatchService.
 
Tim Cooke
Marshal
Posts: 6209
501
IntelliJ IDE Python TypeScript Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh yea I second what Junilu says. Definitely do not try and implement your own solution when you have utilities built in such as WatchService.
 
Ranagal Adapla
Ranch Hand
Posts: 40
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ron McLeod wrote:Take a look at A Guide to WatchService by baeldung and see if it helps.



Thanks for guiding me in the right direction. I am considering this.
 
What are you doing in my house? Get 'em tiny ad!
Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders
https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing
reply
    Bookmark Topic Watch Topic
  • New Topic