• Post Reply Bookmark Topic Watch Topic
  • New Topic

Object.notify() Wrong Context  RSS feed

 
Isaac Hewitt
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My method gets the file path in the JTree and feeds it to my outgoing email program MailDialog. The email program cannot send the file because it is locked while open in the JTree. With my method below, it is able to be sent, but the line ob.notify(); gives me a hint in NetBeans "invoking Object outside a synchronized context". This method resides in the subclass of JTree so the line synchronized(this) means this tree. Does anyone know what needs to be done to straighten this out? Thanks.



 
Henry Wong
author
Sheriff
Posts: 23280
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The notify() method requires that the lock of the object be held. In your example, you are locking one object, and using a different object to notify.

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!