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

Reply via email to