MattTheHack
MattTheHack

Reputation: 1384

Running a JAR multiple times with concurrent requests

I have a JAR that uses the new WatchService API to monitor a folder for uploads. Currently, when I execute the JAR, it detects the first upload, does it's task, exits but never runs again even with more uploads coming in. I want my JAR to run permanently, so every time an upload happens the task gets run but the JAR still checks for new uploads and will run the tasks on them also.

Any ideas on how I can do this?

Cheers, Matt

Upvotes: 0

Views: 301

Answers (1)

John B
John B

Reputation: 32969

Use a loop. I assume you have a Main method that that it executes once. You need to build a mechanism that this action repeats until some command is received to stop.

Upvotes: 1

Related Questions