Re: Jenkins Pipeline with custom class does hang forever

2016-10-17 Thread thomas . lehmann
Yeah ... found out that too ... "Thread dumps" link in Jenkins job has 
shown the multiplle calls.
Wasn't aware of the property cabability.

Thank you

On Monday, October 17, 2016 at 10:50:39 AM UTC+2, Daniel Beck wrote:
>
> > def setMessage(String message) { 
> > this.message = message 
> > } 
>
> This looks like a potential infinite loop, because Groovy allows calling 
> setters by just setting the property. Probably something getting messed up 
> in one of the Groovy transformations (because this is supposed to only 
> happen for fields without access modifier, and only outside the class[1]). 
>
> Try this: 
>
> > this.@message = message 
>
> Or just skip the getters/setters while you don't need them. 
>
> 1: http://groovy-lang.org/objectorientation.html#properties 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/358437a9-d3e0-4814-935c-6a028809b96a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Jenkins Pipeline with custom class does hang forever

2016-10-17 Thread thomas . lehmann
Hi,

I were trying to write custom class in Jenkinsfile.

With following example the JOb does hang after the line "echo hi:2". I have 
to click to abort the build and then click twice
on provided links in the Jenkins Console to fully cancel it. On our server 
- even after kill - Jenkins remains 200 and more percentage of CPU.
We were forced to shutdown the Service and to restart. Locally I'm running 
Jenkins inside a Docker container. No CPU problems there.
I'm using a 2.8 and on our server we have a 2.23.

The Console output looks like this:

hi:2
Aborted by Thomas Lehmann 

Click here to forcibly terminate running steps 


Terminating node

Click here to forcibly kill entire build 


Hard kill!
Finished: ABORTED


And ideas?

Kind Regards,
Thomas

class Project implements Serializable {
static final serialVersionUID = 1L

private String message = ""

def setMessage(String message) {
this.message = message
}

def getMessage() {
return this.message
}
}

node {
echo "hi:1"
def project = new Project()

stage("Using a class") {
echo "hi:2"
project.setMessage("some message")
echo "hi:3"
echo project.getMessage()
echo "hi:4"
}
}



-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/48fca903-6d35-4852-ade9-38688f2663f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.