This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 58374 - Poor threading in DD2beansDataObject
Summary: Poor threading in DD2beansDataObject
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Code (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Pavel Fiala
URL:
Keywords: PERFORMANCE, THREAD
Depends on:
Blocks:
 
Reported: 2005-04-27 14:31 UTC by _ rkubacki
Modified: 2005-09-05 10:01 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ rkubacki 2005-04-27 14:31:52 UTC
Init method creates a timer that executes a method in AWT thread that only posts
some job to RP and later invokes another Runnable in AWT thread. The first
replanning should be avoided the latter is OK.

Invalid use of RequestProcessor - DD2beansDataObject has its own instance of
RequestProcessor but tasks are actully post to an old default RP using static
(and deprecated) postRequest method.
Comment 2 _ rkubacki 2005-08-02 12:18:52 UTC
v
Comment 3 Petr Nejedly 2005-08-02 12:22:29 UTC
Even better would be to use a single runnable for both RP and swing task,
the code won't get uglier anyway ;-)
Comment 4 Pavel Fiala 2005-08-02 12:43:03 UTC
I don't think so. We do not want to run generateDocument() in AWT thread.
Comment 5 _ rkubacki 2005-08-02 13:01:04 UTC
I think it is possible to have only one Runnable as Petr suggested however I
agree that generateDocument() should not run in EDT.
Comment 6 Petr Nejedly 2005-08-02 14:53:55 UTC
Just to be clear, the pattern is like:
...
new Runnable() {
  String value;
  public void run() {
    if (value == null) { // first round in RP
      value = generateValue();
      assert value != null;
      SwingUtilities.invokeLater(this);
    } else { // second round in AWT
      component.setValue(value);
    }
  }
};

It might be inapplicable to your very case, but generally we use this pattern.