Solved

Help wanted with Filewatcher Java

Posted on 2015-01-28
3
66 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
3 Comments
 
LVL 20

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
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…
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.

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now