user3388324
user3388324

Reputation: 572

Blocking call in Swing event listener

In my swing application I have implemented a listener for key up. For each call to the listener, a connection is made to a database on connected over internet. In my development environment I'm using the server on the same machine, so not experiencing any latency. In real scenario with this setup, what will be the implications when one key up is called before the earlier one has completed its fetching ? Will it make my application unresponsive or the call to listener method is queued on a separate thread ?

P.S: New to swing development.

Upvotes: 1

Views: 107

Answers (1)

York Xtrem
York Xtrem

Reputation: 58

Mmmm ... depends. If internally every time you do a query when you press a key you have something like this:

worker = new WorkerSQL (query); worker.execute ();

Pulsed consultation provided key will be made as part of the "worker" a new connection is made ​​to the database but only a request will be made. If you have only one connection and worker inside there's a Wait () until you have a connection available. A query will be made after another. Look for "pool of connections" to make several queries at once.

sorry for my English.

Upvotes: 1

Related Questions