Monitoring native threads using JNI

  • Thread starter Nataraj M Basppa
  • Start date
N

Nataraj M Basppa

Hi All,
I have simple java application which monitors a directory (on
windows). Monitoring part is in c++ and i want to call that from java
using JNI. I search web, but couldn't get a reasonable response. Is
there a way to listen or monitor a native thread. Coz c++ part of the
code runs a thread which monitors and notifies the listen if there is
change in directory. any pointers
Nataraj
 
D

dagarwal82

Hi All,
I have simple java application which monitors a directory (on
windows). Monitoring part is in c++ and i want to call that from java
using JNI. I search web, but couldn't get a reasonable response. Is
there a way to listen or monitor a native thread. Coz c++ part of the
code runs a thread which monitors and notifies the listen if there is
change in directory. any pointers
Nataraj
What is the problem here?
Assuming your C++ is running quite fine and whenever there is a change
in directory it is notifing the code in java. rite?
Monitoring part is in c++ and i want to call that from java
using JNI.
You want the help in C++ part or Java part? I mean are you able to
monitor the native thread in C++?
 
N

Nataraj M Basppa

What is the problem here?
Assuming your C++ is running quite fine and whenever there is a change
in directory it is notifing the code in java. rite?
You want the help in C++ part or Java part? I mean are you able to
monitor the native thread in C++?
I am sorry my mistake... C++ notifies in C++ part of the code. Is
there a way to get
the notification from C++ code to java Code. Like making a Java thread
an observer for C++ directory change notification
 
G

Gordon Beaton

C++ notifies in C++ part of the code. Is there a way to get the
notification from C++ code to java Code. Like making a Java thread
an observer for C++ directory change notification

You can invoke any Java methods from the C++ code.

For example, pass a reference to your observer object when you make
the initial native call to set up the directory watcher. When it's
time to notify, call the appropriate method.

/gordon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top