首页 > 解决方案 > 我需要帮助将多线程应用于 groovy 类

问题描述

我有一个 groovy 类会产生问题,但是当我需要创建超过 2 个问题时,我会遇到性能问题,这就是为什么我想使用线程来获得更好的性能。

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

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

标签: multithreadinggroovyjira

解决方案


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


推荐阅读