>> You cannot kill or
terminate thread in java 

Not directly no, but there are work arounds - this link seems to fit
your request.
http://forum.java.sun.com/thread.jspa?threadID=231781&messageID=829622


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 25 January 2005 14:44
To: [EMAIL PROTECTED]
Subject: Re: abort call.invoke (SOAP client call)

Oh, sorry for doublepost, I had some problems with gmail..

Thanks for your reply, but it's not so simple. You cannot kill or
terminate thread in java. You can only set some boolean value, that
you want to terminate and the thread have to terminate on it's own.

Like this:

public void run() {
  doSomething();
  if (wantToExit) {
    return;
  }
  doAnything();
  if (wantToExit) {
    return;
  }
  doSomething();
}

in my example with SOAP:

public void run() {
  Service  service = new Service();
  Call call = (Call) service.createCall();
  // set params
  String ret = (String) call.invoke( new Object[] { "Hello!" } );
  // invoke is blocking 15 seconds
  if (isInterrupted()) {
    // too late
    return;
  }
}

I need to break somewhere inside Axis, when it's reading from socket
for 15 seconds. There (last level deep inside HTTP socket part) should
be something like

while (moreSocketData && userStillNeedsThatData) {
  readSocketData();
}

The only thing I need is setting userStillNeedsThatData to false
somehow. Or some callback function to set like this:

while (moreSocketData) {
  readSocketData();
  if (askUserIfHewantsToContinueCallback() == false) {
    break;
  }
}

Or there can be other way to archive this. I don't know, I was
searching the sources, but this library is huge.

Petr


----------------------------------------------------------------------------------------------
Did you know?

Xchanging manage over 450,000 claims a year for the London Insurance Market, to 
a combined value of 10 billion pounds.

Xchanging settle over 62 billion pounds of insurance business between over 300 
companies in a global customer network.

Visit www.xchanging.com for more details
----------------------------------------------------------------------------------------------



-----------------------------------------------------
THE INFORMATION IN THIS E-MAIL AND IN ANY ATTACHMENTS IS CONFIDENTIAL

AND MAY BE PRIVILEGED OR OTHERWISE PROTECTED FROM DISCLOSURE. 
IF YOU ARE NOT THE INTENDED RECIPIENT AND HAVE RECEIVED IT IN ERROR YOU ARE ON 
NOTICE OF ITS STATUS. 
PLEASE NOTIFY THE SENDER IMMEDIATELY BY RETURN EMAIL AND THEN DELETE THIS EMAIL 
AND ANY ATTACHMENT FROM YOUR SYSTEM. 
YOU MUST NOT RETAIN, COPY OR USE THIS E-MAIL OR ANY ATTACHMENT FOR ANY PURPOSE, 
NOR DISCLOSE ALL OR ANY PART OF ITS CONTENTS TO ANY OTHER PERSON: 

TO DO SO COULD BE A BREACH OF CONFIDENCE

EMAIL MAY BE SUSCEPTIBLE TO DATA CORRUPTION, INTERCEPTION AND UNAUTHORISED 
AMENDMENT, 
AND WE DO NOT ACCEPT LIABILITY FOR ANY SUCH CORRUPTION, INTERCEPTION OR 
AMENDMENT OR THE CONSEQUENCES THEREOF. 

WE MAY MONITOR THE CONTENT OF EMAILS SENT AND RECEIVED VIA OUR NETWORK FOR 
VIRUSES OR UNAUTHORISED USE AND FOR OTHER LAWFUL BUSINESS PURPOSES. 
WE DO NOT ACCEPT RESPONSIBILITY FOR ANY LOSS OR DAMAGE ARISING FROM A VIRUS IN 
ANY EMAIL OR ATTACHMENT.

-----------------------------------------------
[EMAIL PROTECTED]

Reply via email to