Re: grinder java test code

Marc Holden <[email protected]> Wed, 18 Mar 2015 11:03:55 -0400
Newsgroups gmane.comp.java.grinder.user
Message-ID <CADV_OVWVprG5AxsVTqS7dx1YeDRYCLS7aN-g56h4ONCVYddScw@mail.gmail.com>
This is untested but...

Change the scope of genThreads to public
Add the compiled class file to the grinder jvm classpath
In the TestRunner __call__ method, call the genThreads method
(TestThreadStackOverflow.genThreads();)

That should be it.

-Marc.

On Wed, Mar 18, 2015 at 3:52 AM, Gang Yan <[email protected]> wrote:

> Hi all
>
>
>
> I test jvm threads stack test . I use follow java test code: I want to use
> grinder execute JVM threads test. How to call java test code in Grinder?
>
>
>
> Java test code:
>
>
>
> public class TestThreadStackOverFlow {
>
>
>
>       private static void genThreads(){
>
>            int count = 0;
>
>            while (true) {
>
>                  Thread thread = new Thread(new Runnable() {
>
>                       public void run() {
>
>                             try{
>
>                                   Thread.sleep(20 * 60 * 1000);
>
>                             }catch(Exception e){
>
>
>
>                             }
>
>                       }
>
>                  });
>
>                  thread.start();
>
>                  System.out.println("~~~~ Thread's name is : ["+
> thread.getName() +
>
>                             "] Total threads count is : ["+ ++count +"]");
>
>
>
>                  try{
>
>                       Thread.currentThread().sleep(50);
>
>                  }catch(Exception e){
>
>                       e.printStackTrace();
>
>                  }
>
>            }
>
>       }
>
>
>
>       public static void main(String[] args) {
>
>            genThreads();
>
>       }
>
>
>
> }
>
>
>
> Test result:
>
>
>
> ~~~~ Thread's name is : [Thread-33] Total threads count is : [34]
>
> ~~~~ Thread's name is : [Thread-34] Total threads count is : [35]
>
> ~~~~ Thread's name is : [Thread-35] Total threads count is : [36]
>
> ~~~~ Thread's name is : [Thread-36] Total threads count is : [37]
>
>
>
>
>
>
>
>
>
>
>
> --
> [image: Oracle] <http://www.oracle.com/>
> Yan Gang
>
>
> ORACLE China
>
> [image: Green Oracle] <http://www.oracle.com/commitment>
>
> Oracle is committed to developing practices and products that help protect
> the environment
>
>
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website,
> sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for
> all
> things parallel software development, from weekly thought leadership blogs
> to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> grinder-use mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/grinder-use
>
>

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/

_______________________________________________
grinder-use mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/grinder-use
image002.gif (image/gif, 356 B) - not displayed
image001.gif (image/gif, 658 B) - not displayed