JAVA Program as a Service

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

JAVA Program as a Service

Nayak, Soumya R.
Hi All,

I have written a java program. So when i run a script in JMeter, the java program has to be invoked from the script and the java program runs independently in the background without JMeter waiting for it to complete execution. The program when running independently completes the task and stops automatically.
So how can I invoke a java program from JMeter which runs independently in the background. Please help.

Regards,
Soumya

******************************************************************************************
This message may contain confidential or proprietary information intended only for the use of the
addressee(s) named above or may contain information that is legally privileged. If you are
not the intended addressee, or the person responsible for delivering it to the intended addressee,
you are hereby notified that reading, disseminating, distributing or copying this message is strictly
prohibited. If you have received this message by mistake, please immediately notify us by
replying to the message and delete the original message and any copies immediately thereafter.

If you received this email as a commercial message and would like to opt out of future commercial
messages, please let us know and we will remove you from our distribution list.

Thank you.~
******************************************************************************************
FAFLD
Reply | Threaded
Open this post in threaded view
|

Re: JAVA Program as a Service

Kiran Badi
Take a look at custom java sampler.Embed your script in that sampler that way jmeter knows what script/program is doing.by Just invoking a script I am not sure as what it solves and if you need to just invoke it why do you need jmeter?. Also take a look at java process api and see if you can implement  verification on exit codes. I quess you want to know if background program or process does what it is suppose to be doing.

Sent from Yahoo Mail for iPad


On Friday, August 10, 2018, 11:00 AM, Nayak, Soumya R. <[hidden email]> wrote:

Hi All,

I have written a java program. So when i run a script in JMeter, the java program has to be invoked from the script and the java program runs independently in the background without JMeter waiting for it to complete execution. The program when running independently completes the task and stops automatically.
So how can I invoke a java program from JMeter which runs independently in the background. Please help.

Regards,
Soumya

******************************************************************************************ustomr 
This message may contain confidential or proprietary information intended only for the use of the
addressee(s) named above or may contain information that is legally privileged. If you are
not the intended addressee, or the person responsible for delivering it to the intended addressee,
you are hereby notified that reading, disseminating, distributing or copying this message is strictly
prohibited. If you have received this message by mistake, please immediately notify us by
replying to the message and delete the original message and any copies immediately thereafter.

If you received this email as a commercial message and would like to opt out of future commercial
messages, please let us know and we will remove you from our distribution list.

Thank you.~
******************************************************************************************
FAFLD


Reply | Threaded
Open this post in threaded view
|

Re: JAVA Program as a Service

Kirk Pepperdine
In reply to this post by Nayak, Soumya R.
Runtime.exec in a bean shell???

> On Aug 10, 2018, at 11:00 AM, Nayak, Soumya R. <[hidden email]> wrote:
>
> Hi All,
>
> I have written a java program. So when i run a script in JMeter, the java program has to be invoked from the script and the java program runs independently in the background without JMeter waiting for it to complete execution. The program when running independently completes the task and stops automatically.
> So how can I invoke a java program from JMeter which runs independently in the background. Please help.
>
> Regards,
> Soumya
>
> ******************************************************************************************
> This message may contain confidential or proprietary information intended only for the use of the
> addressee(s) named above or may contain information that is legally privileged. If you are
> not the intended addressee, or the person responsible for delivering it to the intended addressee,
> you are hereby notified that reading, disseminating, distributing or copying this message is strictly
> prohibited. If you have received this message by mistake, please immediately notify us by
> replying to the message and delete the original message and any copies immediately thereafter.
>
> If you received this email as a commercial message and would like to opt out of future commercial
> messages, please let us know and we will remove you from our distribution list.
>
> Thank you.~
> ******************************************************************************************
> FAFLD


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: JAVA Program as a Service

sebb-2-2
Or

http://jmeter.apache.org/usermanual/component_reference.html#OS_Process_Sampler

On 10 August 2018 at 17:00, Kirk Pepperdine <[hidden email]> wrote:

> Runtime.exec in a bean shell???
>
>> On Aug 10, 2018, at 11:00 AM, Nayak, Soumya R. <[hidden email]> wrote:
>>
>> Hi All,
>>
>> I have written a java program. So when i run a script in JMeter, the java program has to be invoked from the script and the java program runs independently in the background without JMeter waiting for it to complete execution. The program when running independently completes the task and stops automatically.
>> So how can I invoke a java program from JMeter which runs independently in the background. Please help.
>>
>> Regards,
>> Soumya
>>
>> ******************************************************************************************
>> This message may contain confidential or proprietary information intended only for the use of the
>> addressee(s) named above or may contain information that is legally privileged. If you are
>> not the intended addressee, or the person responsible for delivering it to the intended addressee,
>> you are hereby notified that reading, disseminating, distributing or copying this message is strictly
>> prohibited. If you have received this message by mistake, please immediately notify us by
>> replying to the message and delete the original message and any copies immediately thereafter.
>>
>> If you received this email as a commercial message and would like to opt out of future commercial
>> messages, please let us know and we will remove you from our distribution list.
>>
>> Thank you.~
>> ******************************************************************************************
>> FAFLD
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: JAVA Program as a Service

shettyd
Hi Soumya
Note that if you want to use the OS process sampler and you genuinely have
a need for "the java program runs independently in the background without
JMeter waiting for it to complete execution" then you have to write a
wrapper script to run the process in the background and call that wrapper
script from the OS process sampler. Its a different matter that launching a
executable from JMeter and then not caring what it does and when it
finishes is typically not a good thing!

On Sat, Aug 11, 2018 at 7:11 AM sebb <[hidden email]> wrote:

> Or
>
>
> http://jmeter.apache.org/usermanual/component_reference.html#OS_Process_Sampler
>
> On 10 August 2018 at 17:00, Kirk Pepperdine <[hidden email]>
> wrote:
> > Runtime.exec in a bean shell???
> >
> >> On Aug 10, 2018, at 11:00 AM, Nayak, Soumya R. <[hidden email]>
> wrote:
> >>
> >> Hi All,
> >>
> >> I have written a java program. So when i run a script in JMeter, the
> java program has to be invoked from the script and the java program runs
> independently in the background without JMeter waiting for it to complete
> execution. The program when running independently completes the task and
> stops automatically.
> >> So how can I invoke a java program from JMeter which runs independently
> in the background. Please help.
> >>
> >> Regards,
> >> Soumya
> >>
> >>
> ******************************************************************************************
> >> This message may contain confidential or proprietary information
> intended only for the use of the
> >> addressee(s) named above or may contain information that is legally
> privileged. If you are
> >> not the intended addressee, or the person responsible for delivering it
> to the intended addressee,
> >> you are hereby notified that reading, disseminating, distributing or
> copying this message is strictly
> >> prohibited. If you have received this message by mistake, please
> immediately notify us by
> >> replying to the message and delete the original message and any copies
> immediately thereafter.
> >>
> >> If you received this email as a commercial message and would like to
> opt out of future commercial
> >> messages, please let us know and we will remove you from our
> distribution list.
> >>
> >> Thank you.~
> >>
> ******************************************************************************************
> >> FAFLD
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

JAVA Program as a Service

Nayak, Soumya R.
Hi Deepak ,

Thanks for the reply.
There are two parts to my script running from JMeter.
The first part will submit HTTP requests and based on some parameters the second part is the java executable file which will validate in the backend some parameters for about ETA of 4 hours from the start of the test.
My first part from JMeter might complete in 5-10 minutes , so I did not want the Jmeter to be kept on running for the next 4 hours with respect to the second part, so that's why thought of making the second part as an independent backend process.

So I checked the OS Process Sampler, to "launch" a java executable file as per  but I guess OS Process Sampler will wait till the binary execution completes to record execution time, return code, any output, etc.
So below you are talking of the wrapper script , can you help me with it so that test continues and the executable is just executed in the backend.

Regards,
Soumya

-----Original Message-----
From: Deepak Shetty <[hidden email]>
Sent: Saturday, August 11, 2018 10:40 PM
To: JMeter Users List <[hidden email]>
Subject: Re: JAVA Program as a Service

Hi Soumya
Note that if you want to use the OS process sampler and you genuinely have a need for "the java program runs independently in the background without JMeter waiting for it to complete execution" then you have to write a wrapper script to run the process in the background and call that wrapper script from the OS process sampler. Its a different matter that launching a executable from JMeter and then not caring what it does and when it finishes is typically not a good thing!

On Sat, Aug 11, 2018 at 7:11 AM sebb <[hidden email]> wrote:

> Or
>
>
> http://jmeter.apache.org/usermanual/component_reference.html#OS_Proces
> s_Sampler
>
> On 10 August 2018 at 17:00, Kirk Pepperdine
> <[hidden email]>
> wrote:
> > Runtime.exec in a bean shell???
> >
> >> On Aug 10, 2018, at 11:00 AM, Nayak, Soumya R. <[hidden email]>
> wrote:
> >>
> >> Hi All,
> >>
> >> I have written a java program. So when i run a script in JMeter,
> >> the
> java program has to be invoked from the script and the java program
> runs independently in the background without JMeter waiting for it to
> complete execution. The program when running independently completes
> the task and stops automatically.
> >> So how can I invoke a java program from JMeter which runs
> >> independently
> in the background. Please help.
> >>
> >> Regards,
> >> Soumya
> >>
> >>
> **********************************************************************
> ********************
> >> This message may contain confidential or proprietary information
> intended only for the use of the
> >> addressee(s) named above or may contain information that is legally
> privileged. If you are
> >> not the intended addressee, or the person responsible for
> >> delivering it
> to the intended addressee,
> >> you are hereby notified that reading, disseminating, distributing
> >> or
> copying this message is strictly
> >> prohibited. If you have received this message by mistake, please
> immediately notify us by
> >> replying to the message and delete the original message and any
> >> copies
> immediately thereafter.
> >>
> >> If you received this email as a commercial message and would like
> >> to
> opt out of future commercial
> >> messages, please let us know and we will remove you from our
> distribution list.
> >>
> >> Thank you.~
> >>
> **********************************************************************
> ********************
> >> FAFLD
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: JAVA Program as a Service

shettyd
Hi
>So below you are talking of the wrapper script ,
That is a OS specific question. In *nix you'd just do something like
$JAVA_HOME/bin/java stufftorunyourclass &
(where & represents run in background)
In windows you'd probably use windows scripting host
Google how do i run my process in the background for your operating system
of choice

Kirks suggestion of Runtime.exec works (invoked from any Java) too

regards
deepak

On Tue, Aug 14, 2018 at 11:57 PM Nayak, Soumya R. <[hidden email]>
wrote:

> Hi Deepak ,
>
> Thanks for the reply.
> There are two parts to my script running from JMeter.
> The first part will submit HTTP requests and based on some parameters the
> second part is the java executable file which will validate in the backend
> some parameters for about ETA of 4 hours from the start of the test.
> My first part from JMeter might complete in 5-10 minutes , so I did not
> want the Jmeter to be kept on running for the next 4 hours with respect to
> the second part, so that's why thought of making the second part as an
> independent backend process.
>
> So I checked the OS Process Sampler, to "launch" a java executable file as
> per  but I guess OS Process Sampler will wait till the binary execution
> completes to record execution time, return code, any output, etc.
> So below you are talking of the wrapper script , can you help me with it
> so that test continues and the executable is just executed in the backend.
>
> Regards,
> Soumya
>
> -----Original Message-----
> From: Deepak Shetty <[hidden email]>
> Sent: Saturday, August 11, 2018 10:40 PM
> To: JMeter Users List <[hidden email]>
> Subject: Re: JAVA Program as a Service
>
> Hi Soumya
> Note that if you want to use the OS process sampler and you genuinely have
> a need for "the java program runs independently in the background without
> JMeter waiting for it to complete execution" then you have to write a
> wrapper script to run the process in the background and call that wrapper
> script from the OS process sampler. Its a different matter that launching a
> executable from JMeter and then not caring what it does and when it
> finishes is typically not a good thing!
>
> On Sat, Aug 11, 2018 at 7:11 AM sebb <[hidden email]> wrote:
>
> > Or
> >
> >
> > http://jmeter.apache.org/usermanual/component_reference.html#OS_Proces
> > s_Sampler
> >
> > On 10 August 2018 at 17:00, Kirk Pepperdine
> > <[hidden email]>
> > wrote:
> > > Runtime.exec in a bean shell???
> > >
> > >> On Aug 10, 2018, at 11:00 AM, Nayak, Soumya R. <[hidden email]>
> > wrote:
> > >>
> > >> Hi All,
> > >>
> > >> I have written a java program. So when i run a script in JMeter,
> > >> the
> > java program has to be invoked from the script and the java program
> > runs independently in the background without JMeter waiting for it to
> > complete execution. The program when running independently completes
> > the task and stops automatically.
> > >> So how can I invoke a java program from JMeter which runs
> > >> independently
> > in the background. Please help.
> > >>
> > >> Regards,
> > >> Soumya
> > >>
> > >>
> > **********************************************************************
> > ********************
> > >> This message may contain confidential or proprietary information
> > intended only for the use of the
> > >> addressee(s) named above or may contain information that is legally
> > privileged. If you are
> > >> not the intended addressee, or the person responsible for
> > >> delivering it
> > to the intended addressee,
> > >> you are hereby notified that reading, disseminating, distributing
> > >> or
> > copying this message is strictly
> > >> prohibited. If you have received this message by mistake, please
> > immediately notify us by
> > >> replying to the message and delete the original message and any
> > >> copies
> > immediately thereafter.
> > >>
> > >> If you received this email as a commercial message and would like
> > >> to
> > opt out of future commercial
> > >> messages, please let us know and we will remove you from our
> > distribution list.
> > >>
> > >> Thank you.~
> > >>
> > **********************************************************************
> > ********************
> > >> FAFLD
> > >
> > >
> > > --------------------------------------------------------------------
> > > - To unsubscribe, e-mail: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>