Freigeben über


JLCA 3.0 - Threads

In Java, there are two ways to create a new thread of execution. One is to declare a class inheriting java.lang.Thread and overriding the method run(). The other way is to create a class implementing java.lang.Runnable and passing it to a new instance of java.lang.Thread. Java Threads are mainly converted to .NET framework through System.Threading API.

 

JLCA 3.0 takes into account the following Java Threading features: Thread subclassing, Thread Runnable implementation, Thread Priorities and Thread Synchronization.

 

Table 31 and Table 32 show the most relevant details about Java Threads conversion. In a summarized manner, they enunciate the Java Threads features preserved in converted applications. On the other hand, they suggest the issues that the user should take care while converting applications using threads.

Coverage Details

Java Threads

JLCA 3.0 Coverage

Description

Runnable Implementation

Converted

Java threads performed by implementing interface java.lang.Runnable are converted to .NET Framework through a Compatibility Interface (SupportClass).

Thread Groups

Not Converted

Thread Groups are not converted to .NET Framework as .NET Framework does not provide an equivalent to manage threads hierarchies, groups and relationships.

A workaround could require adapting the converted application to use the most likely .NET Framework features such as Thread Pools (System.Threading.ThreadPool).

Thread Inheritance

Converted

Java threads performed by inheriting class java.lang.Thread are converted to .NET through a Compatibility Class (SupportClass). A majority of thread’s features are converted to .NET Framework.

Thread Priorities

Converted

Thread Priorities are converted to enum System.Threading.ThreadPriority.

Thread Synchronization

Converted

Thread Synchronization performed by java.lang.Object’s method such as notify, notifyAll and wait, and by synchronized method is converted to .NET Framework through class System.Threading.Monitor and lock statement.

Table 31: Java Threads Conversion Coverage

Issues

Issue

Description

Checking whether a Thread Is Interrupted

Checks around whether a thread that has been interrupted is converted to .NET or not[ME1] . However, a workaround could involve the use of property System.Threading.Thread.ThreadState.

General Issues

Java Threads are converted to .NET Framework through API System.Threading. Most of features of Java threads are converted to .NET Framework. The functionality not converted could require the use of the documentation of JLCA warnings.

Thread Groups

Most of the functionality related with Thread Groups is not converted as .NET Framework does not provide a similar one.

A workaround could require adapting the converted application to use the most likely features of .NET Framework such as Thread Pools (System.Threading.ThreadPool).

Table 32: Java Threads Conversion Issues

 


 [ME1]By???