You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ctakes.apache.org by "Kim Ebert (JIRA)" <ji...@apache.org> on 2013/04/02 21:27:18 UTC
[jira] [Comment Edited] (CTAKES-151) LVG is not thread safe for
multiple instances inside of a single JVM.
[ https://issues.apache.org/jira/browse/CTAKES-151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13620159#comment-13620159 ]
Kim Ebert edited comment on CTAKES-151 at 4/2/13 7:26 PM:
----------------------------------------------------------
In my patch I convert the Out to be a local variable, but this still doesn't allow multiple threads to do a read at the same time.
--- old/sources/gov/nih/nlm/nls/lvg/Api/LvgCmdApi.java 2013-01-09 23:10:44 +0000
+++ new/sources/gov/nih/nlm/nls/lvg/Api/LvgCmdApi.java 2013-01-10 01:05:39 +0000
@@ -43,6 +43,9 @@
public class LvgCmdApi extends SystemOption
{
// public constructor
+
+ Out out = new Out();
+
/**
* Creates an LvgCmdApi object and initiate related data (default).
* This constructor is consider as a preprocess method.
@@ -290,10 +304,10 @@
*/
public String MutateToString(String inTerm) throws Exception
{
- Out.ResetOutString();
+ out.ResetOutString();
// Process the mutation on the input term
Process(inTerm, true);
- return Out.GetOutString();
+ return out.GetOutString();
}
=== modified file 'sources/gov/nih/nlm/nls/lvg/Util/Out.java'
--- old/sources/gov/nih/nlm/nls/lvg/Util/Out.java 2013-01-09 23:10:44 +0000
+++ new/sources/gov/nih/nlm/nls/lvg/Util/Out.java 2013-01-09 23:13:13 +0000
@@ -19,7 +19,7 @@
* @param msg massage for printing out
* @param toStringFlag a boolean flag for sending output to a String
*/
- public static void Print(BufferedWriter outWriter, String msg,
+ public void Print(BufferedWriter outWriter, String msg,
boolean fileOutput, boolean toStringFlag) throws IOException
{
if(toStringFlag == true) // output to a String
@@ -50,7 +50,7 @@
* @param msg massage for printing out
* @param toStringFlag a boolean flag for sending output to a String
*/
- public static void Println(BufferedWriter outWriter, String msg,
+ public void Println(BufferedWriter outWriter, String msg,
boolean fileOutput, boolean toStringFlag) throws IOException
{
if(toStringFlag == true) // output to a String
@@ -85,17 +85,17 @@
/**
* Reset the output string
*/
- public static void ResetOutString()
+ public void ResetOutString()
{
outString_ = null;
}
/**
* Get the output String
*/
- public static String GetOutString()
+ public String GetOutString()
{
return outString_;
}
// data member
- private static String outString_ = null;
+ private String outString_ = null;
}
was (Author: kim.ebert):
In my patch I convert the Out to be a local variable, but this still doesn't allow multiple threads to do a read at the same time.
--- old/sources/gov/nih/nlm/nls/lvg/Api/LvgCmdApi.java 2013-01-09 23:10:44 +0000
+++ new/sources/gov/nih/nlm/nls/lvg/Api/LvgCmdApi.java 2013-01-10 01:05:39 +0000
@@ -43,6 +43,9 @@
public class LvgCmdApi extends SystemOption
{
// public constructor
+
+ Out out = new Out();
+
/**
* Creates an LvgCmdApi object and initiate related data (default).
* This constructor is consider as a preprocess method.
@@ -290,10 +304,10 @@
*/
public String MutateToString(String inTerm) throws Exception
{
- Out.ResetOutString();
+ out.ResetOutString();
// Process the mutation on the input term
Process(inTerm, true);
- return Out.GetOutString();
+ return out.GetOutString();
}
> LVG is not thread safe for multiple instances inside of a single JVM.
> ---------------------------------------------------------------------
>
> Key: CTAKES-151
> URL: https://issues.apache.org/jira/browse/CTAKES-151
> Project: cTAKES
> Issue Type: Sub-task
> Components: ctakes-lvg
> Affects Versions: future enhancement, 3.0-incubating, 3.1-incubating
> Reporter: Kim Ebert
> Priority: Critical
> Attachments: lvg_static_fix.patch
>
>
> The LVG library is not thread safe. It uses global variables, so between multiple instances, the data will become corrupted.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira