• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

Issue with the thread when calling third party Web service

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have an issue when i call a third party web service from thread. The example code I have given below.
This code is used to process incoming file. First process method will validate the inputs. then it will do virus scan on the file. for which we have to call a third party webs service.
I am starting the thread because I have to return to caller whether file valid or not and processing is done inside the thread. I have added debug statements inside the thread and virus scan method.
It coming inside the virus scan method, but stops in between without doing virus scan.

Please anybody can help me on this issue.


public class ProcessWS {
public ProcessWS() {
}

public String process(String filename,String srno){

if (filename==null || "".equals(filename) || srno==null || "".equals(srno)){
//log input values are invalid.

return "Invalid input parameters";

}

new Thread(new MyThread(filename,srno)).start();

return "Validations done.Process is started.";


}

class MyThread implements Runnable{

String fn=null;
String srnumber = null;
MyThread(String filename, String srno){
fn = filename;
srnumber = srno;
}

public void run() {
VirusScan vs = new VirusScan();
vs.doVirusScan(fn,srnumber);
// .doVirusScan(fn,srnumber);

}
}

}


Thanks ,
Rakesh
 
Bartender
Posts: 4108
72
Hibernate Fedora Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rakesh Am wrote:.. It coming inside the virus scan method, but stops in between without doing virus scan.


How, Any exceptions?
 
Rakesh Am
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Virus scan or virus scan method is not throwing any exceptions.

I did stand alone test on Virus scan. It worked properly. When I tried to call thru thread then only I got this issue.
 
Vijitha Kumara
Bartender
Posts: 4108
72
Hibernate Fedora Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rakesh Am wrote:Virus scan or virus scan method is not throwing any exceptions.
I did stand alone test on Virus scan. It worked properly. When I tried to call thru thread then only I got this issue.


Best way to find out would be to put those debug statements inside all those method(s) (i.e: in the begining/end/middle etc..) and see up to which point it gets executed. If you done that up to which point it executes?
 
Rakesh Am
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a scenario like this:
Inside a method, I have to validate the input parameters and also need to start a process independently to do file process. This process will take 4-5 mins. So it should not impact the return value/method.

Can you suggest some ways to implement it?

 
Vijitha Kumara
Bartender
Posts: 4108
72
Hibernate Fedora Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another approach would be to use JMS ? as this looks like asynchronous communication between components. But that depends on the environment/what you are allowed to use etc..
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic