You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2016/08/23 16:03:44 UTC
svn commit: r1757402 -
/uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/vinci/VinciCasProcessorDeployer.java
Author: schor
Date: Tue Aug 23 16:03:43 2016
New Revision: 1757402
URL: http://svn.apache.org/viewvc?rev=1757402&view=rev
Log:
no Jira - fix findbugs issue with multi-threaded initialization of static vns variable
Modified:
uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/vinci/VinciCasProcessorDeployer.java
Modified: uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/vinci/VinciCasProcessorDeployer.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/vinci/VinciCasProcessorDeployer.java?rev=1757402&r1=1757401&r2=1757402&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/vinci/VinciCasProcessorDeployer.java (original)
+++ uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/container/deployer/vinci/VinciCasProcessorDeployer.java Tue Aug 23 16:03:43 2016
@@ -117,7 +117,7 @@ public class VinciCasProcessorDeployer i
// Local VNS is a shared instance across all instances of VinciCasProcessorDeployer. It uses
// shared
// portQueue (defined below). VNS and the queue are instantiated once.
- private static LocalVNS vns = null;
+ private static volatile LocalVNS vns = null;
private int restartCount = 0;
@@ -1130,16 +1130,18 @@ public class VinciCasProcessorDeployer i
}
- if (vns == null) {
- try {
- vns = new LocalVNS(startPort, maxPort, vnsPort);
- vns.setConnectionPool(portQueue);
-
- localVNSThread = new Thread(vns);
- localVNSThread.start();
-
- } catch (Exception e) {
- throw new CasProcessorDeploymentException(e);
+ synchronized (VinciCasProcessorDeployer.class) {
+ if (vns == null) {
+ try {
+ vns = new LocalVNS(startPort, maxPort, vnsPort);
+ vns.setConnectionPool(portQueue);
+
+ localVNSThread = new Thread(vns);
+ localVNSThread.start();
+
+ } catch (Exception e) {
+ throw new CasProcessorDeploymentException(e);
+ }
}
}
}