File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Threads and Synchronization and the fly likes Thread dysfunctioning in swing application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Thread dysfunctioning in swing application" Watch "Thread dysfunctioning in swing application" New topic
Author

Thread dysfunctioning in swing application

ajay kumair
Greenhorn

Joined: Apr 03, 2013
Posts: 2
Hi,

We have a desktop application developed in swings, for sending and receiving files between servers using threads, one thread polls the source folder every 1 minute for the specific extention files, if found it send files to the destination server, and copy the sent files to another folder in the local server and delete them from the source folder and vice versa for receiving, the application runs non stop on the server.
Ideally at any point of time only one thread (as the sendfile() function is synchronized) should be running for seding,moving and deleting the files every minute which is getting logged into a log file, but a few days ago a file was sent twice with in the same polling interval, after checking the logs we found that the the file could not be deleted by the running thread as it was being used by another process and that process seems to send it for the second time. If one thread is functioning at a time what could be the reason behind this discrepancies, is it OS related thread malfunctioning.

Server configuration -
we are using Windows 2003 and JRE1.5.
application exe has been developed using jdk 1.5
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Before placing blame on the OS or thread issues, I would look at
1) Your code: is it properly synchronized
2) Your environment: is it possible there are multiple versions of the app running?
3) Possible the app crashed or restarted in the process of claiming or moving that file?

Steve
ajay kumair
Greenhorn

Joined: Apr 03, 2013
Posts: 2
We thought of OS or thread issue as the same version of application is running on the server since last two years and it never behaved like that, and after taking a restart of the server now its working fine till date .... only one version and one instance of application is running on the server.. third point is not clear to me please explain because when we checked after the incident the app for running on the server ... still wondering what could be the reason of this unexpacted behaviour of the app ..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Thread dysfunctioning in swing application