JDK-6525923 : JTable sorting blocks the AWT event thread
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P5
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2007-02-16
  • Updated: 2013-05-15
Description
FULL PRODUCT VERSION :
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

A DESCRIPTION OF THE PROBLEM :
When the user opts to sort the table, the sorting runs on the event dispatch thread.  As a result, all user input is blocked until the sort finishes.

For a small number of rows (<1000) this isn't an issue.  However on a table with 200,000 rows, once the sort has started there is no way to stop it and the user can no longer use the application (I waited 10 minutes before giving up and killing the process rather than waiting for the sort to finish.)


REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
One workaround may be to implement a new RowSorter which does all the sorting work in the background.

Comments
EVALUATION I certainly agree that since sorting occurs on the event dispatch thread, it blocks user input. But even for 200,000 rows, 10 minutes seems extremely excessive. Mailed the submitter for a test case. Wondering if there's something in their Comparator that is quite expensive.
02-03-2007