]> source.dussan.org Git - poi.git/commitdiff
removed thread safety stuff. We still need to revisit how this is being
authorAndrew C. Oliver <acoliver@apache.org>
Sat, 6 Jul 2002 18:45:16 +0000 (18:45 +0000)
committerAndrew C. Oliver <acoliver@apache.org>
Sat, 6 Jul 2002 18:45:16 +0000 (18:45 +0000)
done.  I dislike "currentBook" and would prefer some kind of context
mechanism or directly passing the book to the PTGs etc.  Perhaps a
"PTGWorkbookContextInterface" that defines set/getWorkbook etc etc.

PR:
Obtained from:
Submitted by:
Reviewed by:

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352760 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/model/Workbook.java
src/java/org/apache/poi/hssf/record/formula/Area3DPtg.java
src/java/org/apache/poi/hssf/record/formula/FormulaParser.java
src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java
src/java/org/apache/poi/hssf/usermodel/HSSFCell.java
src/java/org/apache/poi/hssf/usermodel/HSSFName.java

index 8ae0822a54375a8779ec5d074cb4d19ddf1d8937..b0ddec207b4d903dd284794425fff814372428a5 100644 (file)
@@ -88,7 +88,7 @@ import org.apache.poi.util.POILogFactory;
 public class Workbook {
     private static final int   DEBUG       = POILogger.DEBUG;
     
-    public static ThreadLocal currentBook = new ThreadLocal();
+    public static Workbook currentBook = null;
     
     /**
      * constant used to set the "codepage" wherever "codepage" is set in records
index c68ab72643ce444bf4f77cb00e88692eb6eaf59f..b310a0531ccbe9d8e6658cba86cc70f573b8995a 100644 (file)
@@ -289,7 +289,7 @@ public class Area3DPtg extends Ptg
     public String toFormulaString()
     {
         StringBuffer retval = new StringBuffer();
-        Object book = Workbook.currentBook.get();
+        Object book = Workbook.currentBook;
         if (book != null) {
             retval.append(((Workbook) book).findSheetNameFromExternSheet(this.field_1_index_extern_sheet));
             retval.append('!');
index 49aae2d32b2f9532036971f5490f9b455302d393..e8f5d848fd7a17fae6648a6c00cff481f72d9282 100644 (file)
@@ -107,8 +107,6 @@ public class FormulaParser {
      *    later call the parse() method to return ptg list in rpn order
      *    then call the getRPNPtg() to retrive the parse results
      *  This class is recommended only for single threaded use
-     *  The parse and getPRNPtg are internally synchronized for safety, thus
-     *  while it is safe to use in a multithreaded environment, you will get long lock waits.  
      */
     public FormulaParser(String formula, Workbook book){
         formulaString = formula;
index b8db3ba666cfb6061c2695972b579b7cd8d644a2..e251cc2cbc311b596f4f543bb2de49cd520686a1 100644 (file)
@@ -192,7 +192,7 @@ public class Ref3DPtg extends Ptg {
 
     public String toFormulaString() {
         StringBuffer retval = new StringBuffer();
-        Object book = Workbook.currentBook.get();
+        Object book = Workbook.currentBook;
         if (book != null) {
             retval.append(((Workbook) book).findSheetNameFromExternSheet(this.field_1_index_extern_sheet));
             retval.append('!');
index e19e54d0020e3184d162a7b5ed1f4937c213be15..1ccb1ca46246cbdfc97b6955050c5633028bc250 100644 (file)
@@ -693,7 +693,7 @@ public class HSSFCell
     }
 
     public void setCellFormula(String formula) {
-        Workbook.currentBook.set(book);
+        Workbook.currentBook=book;
         if (formula==null) {
             setCellType(CELL_TYPE_BLANK,false);
         } else {
@@ -712,14 +712,14 @@ public class HSSFCell
                 rec.pushExpressionToken(ptg[ k ]);
             }
             rec.setExpressionLength(( short ) size);
-            Workbook.currentBook.set(null);
+            Workbook.currentBook = null;
         }
     }
     
     public String getCellFormula() {
-        Workbook.currentBook.set(book);
+        Workbook.currentBook=book;
         String retval = FormulaParser.toFormulaString(((FormulaRecord)record).getParsedExpression());
-        Workbook.currentBook.set(null);
+        Workbook.currentBook=null;
         return retval;   
     }
     
index 1ca4acfe12c4336f6806d6fdbcfd237bc8096d1a..f2f284732f2e37cab376bf716ce7ccd0cdacbe4e 100644 (file)
@@ -257,14 +257,14 @@ public class HSSFName {
      */    
 
     public String getReference() {
-        Workbook.currentBook.set(book);
+        Workbook.currentBook=book;
         String result;
 
         
 
         result = name.getAreaReference();
 
-        Workbook.currentBook.set(null);
+        Workbook.currentBook=null;
 
         return result;