INFO: JACTIVEX /X:m- DISABLES Automarshaling of COM INTERFACESID: Q177167
|
When using COM objects in Java, there are threading issues that can cause
unusual behavior. Depending on the threading model of the COM object, the
Virtual Machine will either freely make calls to the COM object or use a
special marshalling thread to make the calls to the COM object.
In certain scenarios, calls using the special thread can cause call
blocking problems.
Using switches on the JActiveX tool, you can choose to not marshal the COM
object on a special thread.
JACTIVEX produces Java interface source files for COM interfaces and
inserts comments that tell the compiler and Java VM how to handle them. The
following example of the @COM comment tells the compiler and VM that the
interface is a COM interface, has a specific IID, is a dual interface, and
its threading model is to be determined automatically at runtime.
/** @com.interface(iid=12345678-ABCD-12AB-A1B2-123412341234,
thread=AUTO, type=DUAL) */
public interface IFoo extends IUnknown
{
...
When the thread property of the @com.interface comment equals AUTO, the
Virtual Machine determines at runtime whether or not to use a special
thread to marshal the call.
/** @com.interface(iid=12345678-ABCD-12AB-A1B2-123412341234,
thread=NO, type=DUAL) */
public interface IFoo extends IUnknown
{
...
This tells the Virtual Machine to not use a marshaler thread to make calls
to the COM object. Calls will directly enter the COM object from the Java
code.
For information about when a COM object should and shouldn't be marshaled by a custom thread, look at the Microsoft SDK for Java documentation's article "Apartment Model and Threading Issues" in the "Low-Level Java/COM Integration" section. The SDK for Java documentation can be found at the following Web site:
http://www.microsoft.com/java/For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, please see the following pages on the Microsoft Technical Support site:
http://support.microsoft.com/support/visualj/
http://support.microsoft.com/support/java/
Additional query words:
Keywords : kbSDKJava300 kbSDKJava310 JCOM JVM kbSDKJava320
Version : WINDOWS:2.0,2.01,2.02,3.0,3.1,3.2
Platform : WINDOWS
Issue type : kbinfo
Last Reviewed: July 13, 1999