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 188741

Summary: Warn if ConnectionManager.showConnectionDialog is called outside EDT
Product: db Reporter: Eduardo.m Costa <_m4c0_>
Component: CodeAssignee: Libor Fischmeistr <lfischmeistr>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description Eduardo.m Costa 2010-07-16 21:28:32 UTC
Following this recipe:

DatabaseConnection dbc = ConnectionManager.getDefault().getConnection(databaseConnectionName);
ConnectionManager.getDefault().showConnectionDialog(dbc);
Connection conn = dbc.getJDBCConnection(true);

When running on EDT, DatabaseConnection.getJDBCConnection emits a warning about not calling it on EDT. OK.

When running outside EDT (a RequestProcessor or similar), ConnectionManager.showConnectionDialog runs fine, but creates a race condition, since its dialog's setVisible is not called on EDT and returns immediately.

Since DatabaseConnection.getJDBCConnection warns me about using EDT, ConnectionManager.showConnectionDialog must do the same (IMHO), since this behaviour is not explicit on its documentation.
Comment 1 matthias42 2014-10-05 18:40:43 UTC
In DatabaseConnection#showConnectionDialog (around line 1233) the EDT relevant part is dispatched into the EDT via Mutex.EVENT#readAccess.