Solved

Help wanted with Filewatcher Java

Posted on 2015-01-28
3
76 Views
Last Modified: 2015-07-07
Hi experts. I'm working on a code to handle files with the java file watcher. Got it working, except sometimes it's throwing on exception saying the file is in use. strangely this is always the last of the pasted files. I'm sure it is not in use..well not be me anyway.

Any ideas?
0
Comment
Question by:HPvH
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 21

Expert Comment

by:Amitkumar Panchal
ID: 40576693
Generally, it comes when a file (a handle to a file) is in use by some other process. So, you will need to check for which file the exception is encountered and see if it used by another process.

By the way, can I ask what the file watcher do ? Any associated activity (or file processing) with file watcher ?
0
 

Author Comment

by:HPvH
ID: 40583476
hi Panchal,

Thank you for your response and sorry for my late reaction. I'm using file watcher, because I want a program to watch a folder and act immediately when a file is dropped there. After picking up the file I look at the content and put it in a other folder, after some DB actions, for further handling.

I prefer not to use a cronjob to start program and handle file.
0
 
LVL 13

Accepted Solution

by:
George K. earned 500 total points
ID: 40629473
Hi,
Create a handle:
public void handle(FileSystemEvent event)

......

then get the info you need:
new Object[]{event.getFileInfo(), actionName}
0

Featured Post

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question