我需要将多线程应用于groovy类的帮助

问题描述

我有一个创建问题的常规类,但是当我需要创建2个以上的问题时,我面临着性能问题,这就是为什么我想使用线程来获得更好的性能

这是我的代码示例。请帮助我在此代码添加多线程(我想将多线程应用于静态void主要部分):

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...
...
}

解决方法

我使用thread.start()和thread.join()