[concurrency-interest] Passing argument to start method withExecutor

David Holmes davidcholmes at aapt.net.au
Sat Jun 14 02:13:26 EDT 2014


Hi Mohan,

Tool implements Runnable but it is not intended to be used as a Runnable. It is a main application class that is intended to be subclassed. No connection to threads or executors and no connection between the fact that Thread has a start() method and so does Tool.

David
  -----Original Message-----
  From: concurrency-interest-bounces at cs.oswego.edu [mailto:concurrency-interest-bounces at cs.oswego.edu]On Behalf Of Mohan Radhakrishnan
  Sent: Friday, 13 June 2014 3:29 PM
  To: Concurrency-interest at cs.oswego.edu
  Subject: [concurrency-interest] Passing argument to start method withExecutor


  Hi,

      I am trying to work with sun.jvm.hotspot.tools.Tool which is a Runnable. But it requires the start method to be called with arguments. It looks like an older API.   

      If I use ExecutorService executor = newFixedThreadPool(4); and execute  sun.jvm.hotspot.tools.Tool then the contract is violated. 

  Is there a way to use an Executor and ensure the start method is called with arguments ?

  ThreadPoolExecutor calls 'start' deep in the code but  I am not sure how to call a custom 'start' method which calls the thread's 'start' method in turn.

  Thanks,

  Mohan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20140614/166a01d4/attachment.html>


More information about the Concurrency-interest mailing list