Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Multithreading

Jamil Rahimov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 6, 2020

Hello everybody!
Could you tell me good and simple documentation for Multi-threading in groovy?
I have one groovy class which creates issue but when I need create issue more than 2, I'm facing with performance problems that's why I would like to use threads for better performance.

Here is my code example. Please help me adding mutli-threading to this code.

import // some libraries
class NotificationIssue
{
NotificationIssue()
{
//Some codes
}

def getCustomFieldsValues (issueid)
{
//Some codes
}

def Check3cxPhone()
{
//Some codes
}
def CheckNetworkFolder()
{
//Some codes
}

def setIQLFacadeAndObjectFacade()
{
//Some codes
}

def CheckServerSystemAndUserAccount()
{
//Some codes
}

def CheckService()
{
//Some codes
}

def setIssueInputParameter()
{
//Some codes
}
}

public static void main(String[] args)
{

//1st Notification issue for IT
NotificationIssue NotificationForIT = new NotificationIssue()
def key1 = NotificationForIT.getCustomFieldsValues(issue.key)
NotificationForIT.setIQLFacadeAndObjectFacade()
NotificationForIT.Check3cxPhone()
NotificationForIT.CheckNetworkFolder()
NotificationForIT.CheckServerSystemAndUserAccount()
NotificationForIT.CheckService()
NotificationForIT.setIssueInputParameter(customerRtype, "Notification Issue-", issueType, user,"SD",10200)

//2nd Notification for another department
NotificationIssue StampNotification = new NotificationIssue()
def key2 = StampNotification.getCustomFieldsValues(issue.key)
StampNotification.setIQLFacadeAndObjectFacade()


//3rd Notification issue for...
...
}

 

1 answer

1 accepted

0 votes
Answer accepted
Jamil Rahimov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 8, 2020

I did it like this:

public static void main(String[] args)
{
Thread thread = new Thread()
thread.start
{

//1st Notification issue for IT
NotificationIssue NotificationForIT = new NotificationIssue()
def key1 = NotificationForIT.getCustomFieldsValues(issue.key)
NotificationForIT.setIQLFacadeAndObjectFacade()
NotificationForIT.Check3cxPhone()
NotificationForIT.CheckNetworkFolder()
NotificationForIT.CheckServerSystemAndUserAccount()
NotificationForIT.CheckService()
NotificationForIT.setIssueInputParameter(customerRtype, "Notification Issue-", issueType, user,"SD",10200)

//2nd Notification for another department
NotificationIssue StampNotification = new NotificationIssue()
def key2 = StampNotification.getCustomFieldsValues(issue.key)
StampNotification.setIQLFacadeAndObjectFacade()


//3rd Notification issue for...
...
}
thread.join()
}

Suggest an answer

Log in or Sign up to answer