Saturday, January 3, 2009

JNI Interview Questions & Answers

1)How to debug JNI code in CVM?
Porting Guide for the CDC and the Foundation Profile from SUN has a chapter on "C Debugging with GDB".

2)How can I check the status of a java Thread using JVMDI?
// ThreadTool.java class ThreadTool { public static final int THREAD_STATUS_UNKNOWN = -1; public static final int THREAD_STATUS_ZOMBIE = 0; ...

3)Is there a COM Bridge that lets Windows developers create native client applications that access Enterprise JavaBeansTM (EJBTM) components deployed on a J2EE App server?
Yes. Take a look at: JavaTM 2 Platform, Enterprise Edition Client Access Services (J2EETM CAS) COM Bridge 1.0 Early Access.

4)What is necessary to have an applet call a native method? DLL installation, code signing, specific security permissions needed.
After more tries I solved the problem. I used your posted response about such a thing for Netscape. But was difficult to use that answer because Netscape...

5)JDK 1.4 has introduced the concept of direct buffers. Where can I get more information and/or samples for manipulating direct buffers?
JNI has been enhanced in v 1.4 to reflect a new feature of the java.nio package: direct buffers. The contents of a direct buffer can, potentially, reside...

6)What are the basic techniques for debugging mixed java and C++ code?
Debugging integrated Java and C/C++ code illustrates the two basic approaches using JNI (call C/C++ code from java, embed jvm in C/C++ code) and ways to...
EJB-JNI-Legacy Integration (C++ API) we have existing System in C++.We want to use Existing in the intranet/internet. We are using JNI to use existing System. And then we are calling JNI Classes in...
EJBs are supposed to be portable between different app servers who comply with the Sun's specifications for compliant EJB containers. Because of this reason,

7)Anyone know of a way of marking a Java thread as being a demon if it was "created" through the JNI AttachCurrentThread call?
Through a new method called AttachCurrentThreadAsDaemon.

8)What is Signal Chaining mechanism that has been implemented in JDK 1.4?
Signal-chaining enables the Java Platform to better interoperate with native code that installs its own signal handlers. The facility works on both Solaris and Linux platforms.

The signal-chaining facility was introduced to remedy a problem with signal handling in previous versions of the Java Hotspot VM. Prior to version 1.4, the Java Hotspot VM would not allow application-installed signal handlers for certain signals including, for example, SIGBUS, SIGSEGV, SIGILL, etc, since those signal handlers could conflict with the signal handlers used internally by the Java Hotspot VM.
The signal-chaining facility offers:
A. Support for pre-installed signal handlers when the Hotspot VM is created.
B. Support for signal handler installation after the Hotspot VM is created, inside JNI code or from another native thread.

Pre-installed signal handlers (A) are supported by means of saving existing signal handlers, for signals that are used by the VM, when the VM is first created. Later, when any of these signals are raised and found not to be targeted at the Java Hotspot VM, the pre-installed handlers are invoked. In other words, pre-installed handlers are "chained" behind the VM handlers for these signals.

9)Is there a TCL-Java Bridge?
Yes, The Tcl/Java project currently has two packages, Jacl and Tcl Blend. Jacl, which stands for Java Command Language, is a Java implementation of Tcl..

No comments: