You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jmeter.apache.org by bu...@apache.org on 2018/05/20 21:38:21 UTC

[Bug 62390] jmeter threads use overloaded run method but not CachedThreadPool

https://bz.apache.org/bugzilla/show_bug.cgi?id=62390

--- Comment #1 from Srijon <sr...@gmail.com> ---
/* This is the original way multithreading was implemented in jMeter by
implementing the Runnable interface

    public void runTest() throws JMeterEngineException {
        if (host != null){
            long now=System.currentTimeMillis();
            System.out.println("Starting the test on host " + host + " @ "+new
Date(now)+" ("+now+")"); // NOSONAR Intentional
        }
        try {
            Thread runningThread = new Thread(this, "StandardJMeterEngine");
            runningThread.start();
        } catch (Exception err) {
            stopTest();
            throw new JMeterEngineException(err);
        }
    }

  */

  /*This is the proposed way to implentation using executors, this will allow
jmeter threads to be paused during execution*/

      @Override
    public void runTest() throws JMeterEngineException {
        if (host != null){
            long now=System.currentTimeMillis();
            System.out.println("Starting the test on host " + host + " @ "+new
Date(now)+" ("+now+")"); // NOSONAR Intentional
        }

        ExecutorService execService = Executors.newCachedThreadPool(); //using
newCachedThreadPool to implement multi-threading in jMeter
        execService.execute(this);

    }

-- 
You are receiving this mail because:
You are the assignee for the bug.