[
https://issues.apache.org/jira/browse/SYNCOPE-808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15715108#comment-15715108
]
ASF GitHub Bot commented on SYNCOPE-808:
----------------------------------------
Github user ilgrosso commented on a diff in the pull request:
https://github.com/apache/syncope/pull/39#discussion_r90640284
--- Diff:
ide/netbeans/src/main/java/org/apache/syncope/netbeans/plugin/connector/ResourceConnector.java
---
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.netbeans.plugin.connector;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import org.apache.syncope.netbeans.plugin.entity.UserProperties;
+import
org.apache.syncope.netbeans.plugin.service.MailTemplateManagerService;
+import
org.apache.syncope.netbeans.plugin.service.ReportTemplateManagerService;
+
+public final class ResourceConnector {
+
+ private ResourceConnector() {
+ }
+
+ private static MailTemplateManagerService
MAIL_TTEMPLATE_MANAGER_SERVICE;
+ private static ReportTemplateManagerService
REPORT_TEMPLATE_MANAGER_SERVICE;
+
+ public static MailTemplateManagerService
getMailTemplateManagerService() throws IOException {
+ if (MAIL_TTEMPLATE_MANAGER_SERVICE == null) {
--- End diff --
Static code can be accessed by multiple concurrent threads.
I would:
* declare a monitor object as class static field:
```java
private static final Object MONITOR = new Object();
```
* put the whole if block within a `synchronized` block, like as
```java
synchronized(MONITOR) {
if (MAIL_TTEMPLATE_MANAGER_SERVICE == null) {
UserProperties userProperties = getUserProperties();
MAIL_TTEMPLATE_MANAGER_SERVICE = new
MailTemplateManagerService(
userProperties.getUrl(), userProperties.getUserName(),
userProperties.getPassword());
}
}
return MAIL_TTEMPLATE_MANAGER_SERVICE;
```
> Netbeans plugin
> ---------------
>
> Key: SYNCOPE-808
> URL: https://issues.apache.org/jira/browse/SYNCOPE-808
> Project: Syncope
> Issue Type: Sub-task
> Components: ide
> Environment: Netbeans IDE
> Reporter: Francesco Chicchiriccò
> Assignee: Tushar Mishra
> Labels: gsoc2016, netbeans
> Fix For: 2.0.2, 2.1.0
>
>
> Develop a plug-in, according to what reported in SYNCOPE-770, working with
> latest Netbeans version.
> See Google Summer of Code project proposal at
> https://summerofcode.withgoogle.com/projects/#5722525799546880
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)