[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Help wanted with Filewatcher Java

Posted on 2015-01-28
3
Medium Priority
?
81 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 21

Expert Comment

by:Amitkumar P
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 1500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
A solution for Fortify Path Manipulation.
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.

831 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