Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[dsdp-tm-dev] Problem with Mutex in FTPService (and probably others)

Hi Javier and other users of the Mutex class,

this is an important notice for everyone using the Mutex class.

When reviewing your recent change to FTPService, I noticed a potential problem
with the _commandMutex in FTPService.download() and probably others:

If an exception occurs after you acquired the mutex through
_commandMutex.waitForLock(), the mutex will not be released
and thus NO MORE FTP WORK WILL BE POSSIBLE for
the rest of the Eclipse session.

YOU MUST EMBED ALL USE OF THE MUTEX in a construct
like this:
  if(mutex.waitForLock() {
     try {
        //do some work
     } finally {
        mutex.release()
     }
In order to ensure it is released no matter what happens.
In your case, the try...finally construct is there, but it is too late!

Everyone: Please make sure that all use of Mutex follows
this boilerplate pattern. I'm kind of sorry that this makes using
the Mutext not totally straightforward, but with the current
Java language there is no other way to properly do it --
hopefully things get better with Java7, I heard they are working
on constructs to improve this.

Tanks,
Martin

-------- Original-Nachricht --------
Betreff: [dsdp-tm-cvs-commit] jmontalvo org.eclipse.tm.rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp FTPService.java
Datum: Wed, 16 May 2007 19:22:15 +0000
Von: Eclipse CVS Genie <genie@xxxxxxxxxxx>
Antwort an: CVS individual commit notification list <dsdp-tm-cvs-commit@xxxxxxxxxxx>
An: dsdp-tm-cvs-commit@xxxxxxxxxxx


Update of /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp
In directory node2:/tmp/cvs-serv28774/src/org/eclipse/rse/internal/services/files/ftp

Modified Files:
	FTPService.java 
Log Message:
[187096] Drag&Drop + Copy&Paste shows error message on FTP connection


-- 
Martin Oberhuber
Wind River Systems, Inc.
Target Management Project Lead, DSDP PMC Member
http://www.eclipse.org/dsdp/tm

Back to the top