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...
...
}
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()
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.