Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #1336

calling SwingWorker cance

From "yancheng.cheok" <yancheng.cheok@THRWHITE.remove-dii-this>
Subject calling SwingWorker cance
Message-ID <1175356201.064989.263820@p15g2000hsd.googlegroups.com> (permalink)
Newsgroups comp.lang.java.gui
Date 2011-04-27 15:32 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
hello,

i realize that when after i call SwingWorker cancel and try to wait
until the task is really canceled (through SwingWorker.get), i will
get exception as stated in http://java.sun.com/docs/books/tutorial/uiswing/concurrency/cancel.html

Note: If get is invoked on a SwingWorker object after its background
task has been cancelled, java.util.concurrent.CancellationException is
thrown.

Hence, i was wondering after the CancellationException caught, when
the time the next statement is executed, does the task is really
cancelled?

thanks

    private void formWindowClosing(java.awt.event.WindowEvent evt)
{
// TODO add your handling code here:
        try
        {
            marketTask.cancel(false);
            marketTask.get();
        }
        catch(InterruptedException exp) {
        }
        catch(java.util.concurrent.ExecutionException exp)
{
        }
        catch(java.util.concurrent.CancellationException exp)
{
        }

// So, does market Task really cancelled???
    }

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextNext in thread | Find similar | Unroll thread


Thread

calling SwingWorker cance "yancheng.cheok" <yancheng.cheok@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000
  Re: calling SwingWorker c "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000
    Re: calling SwingWorker c "yancheng.cheok" <yancheng.cheok@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000
      Re: calling SwingWorker c "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000

csiph-web