Custom Email have degraded CLM Performance (while Saving Work Items)
Mohan Krishna Vanapalli (11●1)
| asked Sep 25 '18, 2:53 a.m.
edited Sep 25 '18, 8:59 a.m. by Ralph Schoon (63.5k●3●36●46) We have introduced a plugin which will trigger customized emails to specific users (for any change within Work Items)
This has degraded the performance of CLM server. I mean, It is taking around 5 to 8 minutes for saving the changes.
Can anyone plz help me to rectify this issue (We are on CLM 5.0.1)
|
4 answers
Thanks for your quick reply Kenny & Ralph.
Kindly find the below code
public void automaticemailtoFPMContentTeam(IWorkItem workingCopy1,
IMailerService mailService, IWorkItemServer wis,
IWorkItemCommon wiCommon, IParticipantInfoCollector collector) {
// TODO Auto-generated method stub
try
{
IWorkItem workingCopy = (IWorkItem) wis.getAuditableCommon().resolveAuditable(workingCopy1, IWorkItem.FULL_PROFILE,null).getWorkingCopy();
IProjectAreaHandle iProjectAreaHandle = workingCopy.getProjectArea();
IProjectArea iProjectArea=(IProjectArea)wis.getAuditableCommon().resolveAuditable(iProjectAreaHandle, ItemProfile.PROJECT_AREA_DEFAULT, null);
String emailsubject=null;
String emailBody=null;
IAttribute attribute_packstatus=wis.findAttribute(workingCopy.getProjectArea(), "PackStatus", null);
IEnumeration packstatusenum1 =wis.resolveEnumeration(attribute_packstatus, null);
Identifier<? extends ILiteral> iliteral_packstatus= (Identifier<? extends ILiteral>) workingCopy.getValue(attribute_packstatus);
List literal_all = packstatusenum1.getEnumerationLiterals();
String PackStatus = null;
for (Iterator iterator = literal_all.iterator(); iterator.hasNext();)
{
ILiteral iLiteral = (ILiteral) iterator.next();
if (iLiteral.getIdentifier2().equals(iliteral_packstatus))
{
PackStatus = iLiteral.getName();
//System.out.println("its value is "+displayvalue);
}
}
emailsubject="Frontend Pack Master state Change Notification";
IContributorHandle Ownedbyhandle=workingCopy.getOwner();
IContributor contributor = (IContributor)wis.getAuditableCommon().resolveAuditable(Ownedbyhandle, ItemProfile.CONTRIBUTOR_DEFAULT, null);
String projectarea11=iProjectArea.getName();
String projarea=projectarea11.replaceAll(" ", "");
// System.out.println(projarea);
long datecur= System.currentTimeMillis();
Timestamp mdate = new Timestamp(datecur);
emailBody = "A new workitem pack (Task):"+workingCopy.getHTMLSummary().getPlainText()";
List<ICategory> findCategories=wis.findCategories(iProjectAreaHandle, ICategory.FULL_PROFILE, null);
for (ICategory category11 : findCategories) {
ICategory catttt=category11;
// System.out.println(catttt);
String catname = catttt.getName();
// System.out.println(catname);
if(catname.equalsIgnoreCase("Pending with EMS") || catname.equalsIgnoreCase("Pending with Dev") ||catname.equalsIgnoreCase("Pending with "))
{
List<ITeamAreaHandle> allteamareas=catttt.getAssociatedTeamAreas();
for(ITeamAreaHandle teamAreaHandle : allteamareas)
{
ITeamArea allteamarea11=(ITeamArea) wis.getAuditableCommon().resolveAuditable(teamAreaHandle, ItemProfile.TEAM_AREA_DEFAULT, null);
// System.out.println(allteamarea11);
IContributorHandle[] teammembers1=allteamarea11.getMembers();
// System.out.println(teammembers1);
for(IContributorHandle memberHandle : teammembers1)
{
IContributor teamMember= (IContributor)wis.getAuditableCommon().resolveAuditable(memberHandle, ItemProfile.CONTRIBUTOR_DEFAULT, null);
String mailAddress = teamMember.getEmailAddress();
//System.out.println(mailAddress1);
mailService.sendMail(mailService.getDefaultSender(), mailAddress,emailsubject, emailBody ,null);
}
}
|
@ Ralph I checked the above plugin code on Jetty its taking much time while sending mail using below code: mailService.sendMail(mailService.getDefaultSender(), mailAddress,emailsubject, emailBody ,null); Kindly help us. |
Ralph Schoon (63.5k●3●36●46)
| answered Sep 26 '18, 5:16 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Sep 26 '18, 5:17 a.m. I can not help with that.
I don't know how long "much time" is.
I don't know how long it is expected/supposed to take to send such a mail and how to know this is too long.
I would try to check if there is a problem with the connection to the mail server. Create a test mail server and check if that is faster.
You have to also be aware that the follow up action blocks the UI thread. The built in mail service is not implemented as a follow up action, as far as I know. It is running in the background.
Consider to change your design to decouple the save from the mail sending and do that in the background similar to the built in service.
Last but not least, I think to send mail to all team members is not a good design. In addition your code seems to always run and send e-mail - on every singe work item save. If this is indeed the case, the whole extension is questionable in my view.
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.