Click here to Skip to main content
15,918,889 members
Home / Discussions / Java
   

Java

 
QuestionNeed to improve performance Multi-Threading code Pin
Abhi_aec15-Mar-15 21:07
Abhi_aec15-Mar-15 21:07 
I need to improve performace, which is implementing Multi-Threading.
My problem is:
1. future.get(); is taking too much time.
2. executor.shutdown(); also taking much time.
Below is my piece of code code we are using below code:
Java
Map<String, List<? extends Object>> entirelist = null;
							ExecutorService executor = Executors.newFixedThreadPool(maxThread);
							
							entirelist = manageCJObject.populateCS(cJGroup, load
					
					future = executor.submit(new CsThread(clDAO, entirelist, isUpdate, dbList));
							
					 try {
                  if (future != null) {
            	long startTime = Calendar.getInstance().getTimeInMillis();
                String result = future.get();
                System.out.println("Total Time in future.get "+ (Calendar.getInstance().getTimeInMillis()-startTime));
            }
            long startTime1 = Calendar.getInstance().getTimeInMillis();
            executor.shutdown();
            executor.awaitTermination(
                    Constants.INT_VALUE_THIRTY,
                    TimeUnit.MINUTES);
            System.out.println("Total Time in exec shutdown "+ (Calendar.getInstance().getTimeInMillis()-startTime1));
        } 
        catch (ExecutionException execp) {
            logger.error("Error dering Thread execution :: " + execp.getMessage());
            throw new CLException(execp.getMessage());

        }


Kindly let me know how to improve performance. And what way we can provide any alternate of future.get() and executor.shutdown()
AnswerRe: Need to improve performance Multi-Threading code Pin
Eli Zaslavchik13-Apr-15 3:04
Eli Zaslavchik13-Apr-15 3:04 
QuestionCristal Report Pin
Manjeet Kumar Nai14-Mar-15 1:22
professionalManjeet Kumar Nai14-Mar-15 1:22 
Questionecc diffie hellman Pin
Member 1152168512-Mar-15 22:45
Member 1152168512-Mar-15 22:45 
AnswerRe: ecc diffie hellman Pin
Richard MacCutchan12-Mar-15 23:53
mveRichard MacCutchan12-Mar-15 23:53 
GeneralRe: ecc diffie hellman Pin
harold aptroot14-Mar-15 2:21
harold aptroot14-Mar-15 2:21 
QuestionSubstitution Cipher Cryptanalysis Pin
nicolas El Khoury410-Mar-15 12:06
nicolas El Khoury410-Mar-15 12:06 
SuggestionRe: Substitution Cipher Cryptanalysis Pin
Richard MacCutchan10-Mar-15 21:50
mveRichard MacCutchan10-Mar-15 21:50 
QuestionThread Creation Pin
Sarita S9-Mar-15 23:21
Sarita S9-Mar-15 23:21 
AnswerRe: Thread Creation Pin
Richard MacCutchan10-Mar-15 21:51
mveRichard MacCutchan10-Mar-15 21:51 
AnswerRe: Thread Creation Pin
Eli Zaslavchik13-Apr-15 3:11
Eli Zaslavchik13-Apr-15 3:11 
QuestionMethod Calling Pin
William O'Neil9-Mar-15 7:05
William O'Neil9-Mar-15 7:05 
AnswerRe: Method Calling Pin
Richard MacCutchan9-Mar-15 7:56
mveRichard MacCutchan9-Mar-15 7:56 
GeneralRe: Method Calling Pin
William O'Neil9-Mar-15 8:35
William O'Neil9-Mar-15 8:35 
GeneralRe: Method Calling Pin
Richard MacCutchan9-Mar-15 8:40
mveRichard MacCutchan9-Mar-15 8:40 
QuestionNeed Help Adding Image onto Applet Pin
VietAnh1627-Mar-15 10:09
VietAnh1627-Mar-15 10:09 
AnswerRe: Need Help Adding Image onto Applet Pin
Richard MacCutchan7-Mar-15 22:17
mveRichard MacCutchan7-Mar-15 22:17 
AnswerRe: Need Help Adding Image onto Applet Pin
PeraDll14-Mar-15 9:42
PeraDll14-Mar-15 9:42 
Question7 Pin
VietAnh1626-Mar-15 15:44
VietAnh1626-Mar-15 15:44 
AnswerRe: Need Help Adding Image onto Applet Pin
Richard MacCutchan6-Mar-15 21:43
mveRichard MacCutchan6-Mar-15 21:43 
QuestionMAC theme used at java interface in Windows Pin
Member 115037696-Mar-15 3:10
Member 115037696-Mar-15 3:10 
AnswerRe: MAC theme used at java interface in Windows Pin
Richard MacCutchan6-Mar-15 6:35
mveRichard MacCutchan6-Mar-15 6:35 
QuestionSoftware Architekture With Design Pattern Pin
Member 114986694-Mar-15 7:03
Member 114986694-Mar-15 7:03 
AnswerRe: Software Architekture With Design Pattern Pin
jschell4-Mar-15 9:06
jschell4-Mar-15 9:06 
Questionabout java program for vfdt algorithm in data stream Pin
Member 114432123-Mar-15 22:28
Member 114432123-Mar-15 22:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.