# How to define pause

**URL:** <https://community.gatling.io/t/how-to-define-pause/130>\
**Category:** Gatling (Open-Source)\
**Created:** [September 4, 2012, 6:53pm UTC](https://community.gatling.io/t/how-to-define-pause/130 "2012-09-04T18:53:19Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Henri\_Gomez](https://avatars.discourse-cdn.com/v4/letter/h/e79b87/32.png) [@Henri\_Gomez](https://community.gatling.io/u/Henri_Gomez)\
**Post date:** [September 4, 2012, 6:53pm UTC](https://community.gatling.io/t/how-to-define-pause/130/1 "2012-09-04T18:53:19Z")

</div>

Hi to all,

I’m new to Gatling and a pure noob in Scala.

I’ve this code :

def apply = {

val extUsers = Integer.getInteger(“users”, 1)

val extRampup = Integer.getInteger(“rampup”, 0)

val extPause = Long.getLong(“pause”, 1L)

…

val chain\_0 = chain

.exec(

http(“request\_1”)

.get(extWebapp + “/libs-release/com/me/parent/parent/3/parent-3.pom”)

.headers(headers\_1)

)

.exec(

http(“request\_2”)

.get(extWebapp + “/libs-release/com/me/parent/parent/3/parent-3.pom.sha1”)

.headers(headers\_1)

)

.pause(extPause, MILLISECONDS)

.exec(

http(“request\_3”)

.get(extWebapp + “/libs-release/com/me//web/1.0.0-12/web-1.0.0-12.pom”)

.headers(headers\_1)

)

.pause(extPause, MILLISECONDS)

pause require Long but I wonder how to get Long from parms ?

Error was :

```auto
Collecting simulations...
Exception in thread "main" java.lang.RuntimeException: Compilation failed:
simulations/com/me/Clean.scala:13: error: value getLong is not a member of object Long
               val extPause = Long.getLong("pause", 1L)
                                    ^
simulations/com/me/Clean.scala:13: error: value getLong is not a member of object Long
        val extPause = Long.getLong("pause", 1L)

```

Thanks for your help 🙂

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [September 4, 2012, 7:10pm UTC](https://community.gatling.io/t/how-to-define-pause/130/2 "2012-09-04T19:10:39Z")

</div>

val extPause = System.getProperty(“pause”).toLong if you want to be able to pass a number \> Integer.MAX\_VALUE

or val extPause = Integer.getInteger(“pause”, 1).toLong if you want a default value

Cheers,

Stéphane

2012/9/4 Henri Gomez \<[henri.gomez@gmail.com](mailto:henri.gomez@gmail.com)\>

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [September 4, 2012, 7:11pm UTC](https://community.gatling.io/t/how-to-define-pause/130/3 "2012-09-04T19:11:52Z")

</div>

Actually, I wonder if Duration might be Integers instead of Longs.

2012/9/4 Stéphane Landelle \<[slandelle@excilys.com](mailto:slandelle@excilys.com)\>

---

<div class="post-metadata">

**Author:** ![Henri\_Gomez](https://avatars.discourse-cdn.com/v4/letter/h/e79b87/32.png) [@Henri\_Gomez](https://community.gatling.io/u/Henri_Gomez)\
**Post date:** [September 4, 2012, 7:22pm UTC](https://community.gatling.io/t/how-to-define-pause/130/4 "2012-09-04T19:22:47Z")

</div>

> val extPause = System.getProperty("pause").toLong if you want to be able to  
> pass a number \> Integer.MAX\_VALUE
> 
> or val extPause = Integer.getInteger("pause", 1).toLong if you want a  
> default value

Thanks, I used this.

Now, I should refactor generated .scala, got class too large error at  
compile time ;-/

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [September 4, 2012, 7:24pm UTC](https://community.gatling.io/t/how-to-define-pause/130/5 "2012-09-04T19:24:39Z")

</div>

Really? Wow

What’s your stacktrace? You can maybe edit the JVM options so it can compile.

2012/9/4 Henri Gomez \<[henri.gomez@gmail.com](mailto:henri.gomez@gmail.com)\>

---

<div class="post-metadata">

**Author:** ![Henri\_Gomez](https://avatars.discourse-cdn.com/v4/letter/h/e79b87/32.png) [@Henri\_Gomez](https://community.gatling.io/u/Henri_Gomez)\
**Post date:** [September 4, 2012, 7:27pm UTC](https://community.gatling.io/t/how-to-define-pause/130/6 "2012-09-04T19:27:26Z")

</div>

> Really? Wow
> 
> What's your stacktrace? You can maybe edit the JVM options so it can  
> compile.

I collected a maven build with about 1250 HTTP requests 🙂

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [September 4, 2012, 7:34pm UTC](https://community.gatling.io/t/how-to-define-pause/130/7 "2012-09-04T19:34:42Z")

</div>

Ouch!

Well, you could probably refactor your Simulation (for example, build file and sha1 requests together), but I’m not sure it would help from a maintenance standpoint.

You can probably tweak some JVM options so Gatling can compile your Simualtion.  
What’s your stacktrace exactly?

2012/9/4 Henri Gomez \<[henri.gomez@gmail.com](mailto:henri.gomez@gmail.com)\>

---

<div class="post-metadata">

**Author:** ![Henri\_Gomez](https://avatars.discourse-cdn.com/v4/letter/h/e79b87/32.png) [@Henri\_Gomez](https://community.gatling.io/u/Henri_Gomez)\
**Post date:** [September 5, 2012, 7:49am UTC](https://community.gatling.io/t/how-to-define-pause/130/8 "2012-09-05T07:49:29Z")

</div>

> Ouch!
> 
> Well, you could probably refactor your Simulation (for example, build file  
> and sha1 requests together), but I'm not sure it would help from a  
> maintenance standpoint.
> 
> You can probably tweak some JVM options so Gatling can compile your  
> Simualtion.  
> What's your stacktrace exactly?

I didn't keep it but it was a message about Class of 96kb tool large error

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [September 5, 2012, 7:55am UTC](https://community.gatling.io/t/how-to-define-pause/130/9 "2012-09-05T07:55:18Z")

</div>

I wasn’t aware of this kind of limit.  
Feel free to send it to me so I can have a look.

2012/9/5 Henri Gomez \<[henri.gomez@gmail.com](mailto:henri.gomez@gmail.com)\>

---

<div class="post-metadata">

**Author:** ![Henri\_Gomez](https://avatars.discourse-cdn.com/v4/letter/h/e79b87/32.png) [@Henri\_Gomez](https://community.gatling.io/u/Henri_Gomez)\
**Post date:** [September 5, 2012, 8:50am UTC](https://community.gatling.io/t/how-to-define-pause/130/10 "2012-09-05T08:50:58Z")

</div>

> I wasn't aware of this kind of limit.  
> Feel free to send it to me so I can have a look.

> <https://stackoverflow.com/questions/4342072/what-is-the-maximum-number-of-methods-a-java-class-can-have>

64k max 🙂

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [September 5, 2012, 9:04am UTC](https://community.gatling.io/t/how-to-define-pause/130/11 "2012-09-05T09:04:38Z")

</div>

OK,

So you can do something very simple: move all your chains definitions out of the method.

You have something like:

class MySimulation extends Simulation {

def apply = {  
val chain1 = …  
val chain2 = …

val scn = scenario("foo)  
.insertChain(chain1)  
.insertChain(chain2)  
…

List(scn…)  
}  
}

Transform it into:

class MySimulation extends Simulation {

**lazy val chain1 = …**  
**lazy val chain2 = …**

def apply = {  
val scn = scenario("foo)  
.insertChain(chain1)  
.insertChain(chain2)  
…

List(scn…)  
}  
}

and you should be fine

2012/9/5 Henri Gomez \<[henri.gomez@gmail.com](mailto:henri.gomez@gmail.com)\>

---

<div class="post-metadata">

**Author:** ![Henri\_Gomez](https://avatars.discourse-cdn.com/v4/letter/h/e79b87/32.png) [@Henri\_Gomez](https://community.gatling.io/u/Henri_Gomez)\
**Post date:** [September 5, 2012, 12:48pm UTC](https://community.gatling.io/t/how-to-define-pause/130/12 "2012-09-05T12:48:53Z")

</div>

Tremendous.

That's what I call a strong and reactive support.

Thanks Stéphane !

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [September 5, 2012, 2:47pm UTC](https://community.gatling.io/t/how-to-define-pause/130/13 "2012-09-05T14:47:20Z")

</div>

You’re welcome.

That was a funny one, I’ll add it to the FAQ.

2012/9/5 Henri Gomez \<[henri.gomez@gmail.com](mailto:henri.gomez@gmail.com)\>
