• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to use multiple threads to speed processing  RSS feed

 
George Schrader
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to Java Threads. I would like to use threads to speed the processing of the following program. This is the pojo that does the work:



The bottleneck appears to be in the getHashedFileString method. This is the main class:



Is there a way to speed up the processing using threads?

Thanks in advance!
 
Chris Hurst
Ranch Hand
Posts: 443
3
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
NIO vs IO, your currently use old style blocking IO.

I'd have a look at some of the excellent comms libs , Grizzly / MINA / Netty etc and use one of them, you may find one of them has a ready made solution for this.

There's no reason why your next read can't be occurring while your last read is being processed in parallel, how much that will help with performance I can't comment. Your probably better posting in one of the IO libs forums as well.
 
Edward Harned
Ranch Hand
Posts: 291
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at this article:
Fork-Join Development in Java SE

Ed
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!