Advertisement

10.20.2007 at 07:43AM PDT, ID: 22906564
[x]
Attachment Details

Convert code to Multi threading

Asked by jagadeesh_motamarri in Java Programming Language, New to Java Programming, Java Standard Edition

Tags: java, multithreading, threads

Hi -

The below code published some content into the database. I need to turn this code into a mutithreaded code so that the operation happens fastly. And the reason i need to have this is because my lineid[] contains more than 5000+ values.

public class PublishPropertyObjects {
             public static void main(String[] args) {
              
              String lineId[]={"4983462","1232134234","1234214","1234214","12342134"};             
              
              String localeCd = "de-DE";
                System.out.println("Length : "+lineId.length);
          for(int i = 0 ; i < lineId.length ;i++){
          try {
                                  
                      ServiceInvocation serviceInv = ServiceInvocation.getInstance();
                      PDNAGlobalLinkPort proxy = (PDNAGlobalLinkPort)serviceInv.create(PDNAGlobalLinkPort.class);
               
                      ApproveTranslationRequestDTO reqDTO = new ApproveTranslationRequestDTO();
                      reqDTO.setRequestContextBean(MercuryUtil.buildRequestContext());
                reqDTO.setItemId(new Long(lineId[i]).longValue());
                reqDTO.setLocalCode(localeCd);
                boolean success = proxy.approveTranslation(reqDTO);
               
                if(success)
                      System.out.println(i+"  "+lineId[i] + " " + localeCd +" -->>> approved");
                else
                      System.out.println(lineId[i] + " " + localeCd +" failed to approve");
                      
                }catch (Exception e) {
                      System.out.println("Exception -->> "+e.getMessage()+ ">> has been generated");
                      
                }
                }
          
                System.out.println(">>>>>>>>>>>>DONE<<<<<<<<<<<<<<<");
                
                
          }
    }


Is this possible?

Thank youStart Free Trial
[+][-]10.20.2007 at 07:45AM PDT, ID: 20114919

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.20.2007 at 07:59AM PDT, ID: 20114973

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.20.2007 at 08:04AM PDT, ID: 20114993

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.20.2007 at 08:07AM PDT, ID: 20115005

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.20.2007 at 08:14AM PDT, ID: 20115050

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.20.2007 at 12:48PM PDT, ID: 20115863

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Java Programming Language, New to Java Programming, Java Standard Edition
Tags: java, multithreading, threads
Sign Up Now!
Solution Provided By: Bart_Cr
Participating Experts: 2
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_EXPERT_20070906