#115 Release problem if you've got two threads with the same name

This commit is contained in:
clay_shooter
2013-07-23 23:54:49 +00:00
parent e2a337f189
commit 29fdc76236
3 changed files with 22 additions and 25 deletions

View File

@@ -41,7 +41,7 @@ using the example build.xml as a template.
<li> Microsoft Visual C++ 8.0 and it's included library. (to C:\ProgramFiles in my case) <li> Microsoft Visual C++ 8.0 and it's included library. (to C:\ProgramFiles in my case)
<li> Eclipse 3.4 or later from www.eclipse.org as the Java IDE. <li> Eclipse 3.4 or later from www.eclipse.org as the Java IDE.
<li> Eclipse 3.4 or later with the C/C++ plugin can be used for C coding in place of VC++ IDE. <li> Eclipse 3.4 or later with the C/C++ plugin can be used for C coding in place of VC++ IDE.
<li> Java JDK 1.5 (1.15 was built using 1.5.0.16) <li> Java JDK 1.5 (1.17 was built using 1.5.0.22)
</ul> </ul>
<p> <p>
<p> <p>
@@ -57,6 +57,8 @@ using the example build.xml as a template.
<TR><TD>1.13</TD><TD>VC 2005</TD><TD>1.4.2</TD><TD>1.7.0</TD><TD>3.3</TD><TD>32 and 64 bit</TD></TR> <TR><TD>1.13</TD><TD>VC 2005</TD><TD>1.4.2</TD><TD>1.7.0</TD><TD>3.3</TD><TD>32 and 64 bit</TD></TR>
<TR><TD>1.14</TD><TD>VC 2005</TD><TD>1.5.0</TD><TD>1.7.0</TD><TD>3.3</TD><TD>32 and 64 bit</TD></TR> <TR><TD>1.14</TD><TD>VC 2005</TD><TD>1.5.0</TD><TD>1.7.0</TD><TD>3.3</TD><TD>32 and 64 bit</TD></TR>
<TR><TD>1.15</TD><TD>VC 2005</TD><TD>1.5.0</TD><TD>1.7.0</TD><TD>3.4</TD><TD>32 and 64 bit</TD></TR> <TR><TD>1.15</TD><TD>VC 2005</TD><TD>1.5.0</TD><TD>1.7.0</TD><TD>3.4</TD><TD>32 and 64 bit</TD></TR>
<TR><TD>1.17</TD><TD>VC 2005</TD><TD>1.5.0</TD><TD>1.8.4 Eclipse Embedded</TD><TD>4.3</TD><TD>32 and 64 bit</TD></TR>
</table> </table>
Microsoft Visual C++ 8.0 supports 64 bit builds. so no additional tools are required. Microsoft Visual C++ 8.0 supports 64 bit builds. so no additional tools are required.
@@ -112,6 +114,10 @@ Open up the project properties and go to the "Java Build Path" properties panel.
<h2> Troubleshooting Build Problems </h2> <h2> Troubleshooting Build Problems </h2>
<ul> <ul>
<li> <li>
Symptom: Build Failed can't find javac compiler. JAVA_HOME does not point to the JDK
Problem: The java library is pointed at a jre insted of the jdk. Update Project..Properties..Java Build Path to point at the JDK
</li>
<li>
Symptom: The jar is built but no dlls were compiled.<p> Symptom: The jar is built but no dlls were compiled.<p>
Problem: compilation_tools.properties does not have the correct location for the Microsoft tools.<p> Problem: compilation_tools.properties does not have the correct location for the Microsoft tools.<p>
</li> </li>

View File

@@ -22,6 +22,10 @@
<td width="13%" valign="top">3436102</td> <td width="13%" valign="top">3436102</td>
<td width="87%" valign="top">(M1)Fix memory pointer that was 32 bit. Causes defects in 64 bit systems above 2GB</td> <td width="87%" valign="top">(M1)Fix memory pointer that was 32 bit. Causes defects in 64 bit systems above 2GB</td>
</tr> </tr>
<tr>
<td width="13%" valign="top">115 (new system numbering)</td>
<td width="87%" valign="top">(M3)#115 Release problem if you've got two threads with the same name</td>
</tr>
<tr> <tr>
<td width="13%" valign="top">&nbsp;</td> <td width="13%" valign="top">&nbsp;</td>
<td width="87%" valign="top">&nbsp;</td> <td width="87%" valign="top">&nbsp;</td>

View File

@@ -75,11 +75,9 @@ public abstract class ROT {
protected static String PUT_IN_ROT_SUFFIX = ".PutInROT"; protected static String PUT_IN_ROT_SUFFIX = ".PutInROT";
/** /**
* A hash table where each element is another HashMap that represents a * ThreadLocal with the com objects created in that thread
* thread. Each thread HashMap contains the com objects created in that
* thread
*/ */
private static HashMap<String, Map<JacobObject, String>> rot = new HashMap<String, Map<JacobObject, String>>(); private static ThreadLocal<Map<JacobObject, String>> rot = new ThreadLocal<Map<JacobObject, String>>();
/** /**
* adds a new thread storage area to rot * adds a new thread storage area to rot
@@ -87,13 +85,8 @@ public abstract class ROT {
* @return Map corresponding to the thread that this call was made in * @return Map corresponding to the thread that this call was made in
*/ */
protected synchronized static Map<JacobObject, String> addThread() { protected synchronized static Map<JacobObject, String> addThread() {
// should use the id here instead of the name because the name can be Map<JacobObject, String> tab = rot.get();
// changed if (tab == null) {
String t_name = Thread.currentThread().getName();
if (rot.containsKey(t_name)) {
// nothing to do
} else {
Map<JacobObject, String> tab = null;
if (JacobObject.isDebugEnabled()) { if (JacobObject.isDebugEnabled()) {
JacobObject.debug("ROT: Automatic GC flag == " JacobObject.debug("ROT: Automatic GC flag == "
+ USE_AUTOMATIC_GARBAGE_COLLECTION); + USE_AUTOMATIC_GARBAGE_COLLECTION);
@@ -103,9 +96,9 @@ public abstract class ROT {
} else { } else {
tab = new WeakHashMap<JacobObject, String>(); tab = new WeakHashMap<JacobObject, String>();
} }
rot.put(t_name, tab); rot.set(tab);
} }
return getThreadObjects(false); return tab;
} }
/** /**
@@ -118,11 +111,11 @@ public abstract class ROT {
*/ */
protected synchronized static Map<JacobObject, String> getThreadObjects( protected synchronized static Map<JacobObject, String> getThreadObjects(
boolean createIfDoesNotExist) { boolean createIfDoesNotExist) {
String t_name = Thread.currentThread().getName(); Map<JacobObject, String> tab = rot.get();
if (!rot.containsKey(t_name) && createIfDoesNotExist) { if (tab == null && createIfDoesNotExist) {
addThread(); tab = addThread();
} }
return rot.get(t_name); return tab;
} }
/** /**
@@ -133,11 +126,6 @@ public abstract class ROT {
* tear down and provides a synchronous way of releasing memory * tear down and provides a synchronous way of releasing memory
*/ */
protected static void clearObjects() { protected static void clearObjects() {
if (JacobObject.isDebugEnabled()) {
JacobObject.debug("ROT: " + rot.keySet().size()
+ " thread tables exist");
}
Map<JacobObject, String> tab = getThreadObjects(false); Map<JacobObject, String> tab = getThreadObjects(false);
if (tab != null) { if (tab != null) {
if (JacobObject.isDebugEnabled()) { if (JacobObject.isDebugEnabled()) {
@@ -189,8 +177,7 @@ public abstract class ROT {
* Removes the map from the rot that is associated with the current thread. * Removes the map from the rot that is associated with the current thread.
*/ */
private synchronized static void removeThread() { private synchronized static void removeThread() {
// should this see if it exists first? rot.remove();
rot.remove(Thread.currentThread().getName());
} }
/** /**