Monitoring native threads using JNI

Discussion in 'Java' started by Nataraj M Basppa, Feb 5, 2007.

  1. 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
    Nataraj M Basppa, Feb 5, 2007
    #1
    1. Advertising

  2. Nataraj M Basppa

    Guest

    On Feb 5, 10:01 am, "Nataraj M Basppa" <> wrote:
    > 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++?
    , Feb 5, 2007
    #2
    1. Advertising

  3. wrote:
    > On Feb 5, 10:01 am, "Nataraj M Basppa" <> wrote:
    > > 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++?

    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
    Nataraj M Basppa, Feb 5, 2007
    #3
  4. On 5 Feb 2007 04:29:35 -0800, Nataraj M Basppa wrote:
    > 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

    --
    [ don't email me support questions or followups ]
    g o r d o n + n e w s @ b a l d e r 1 3 . s e
    Gordon Beaton, Feb 5, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Abhishek Singh

    JVM crashes: Native method, JNI

    Abhishek Singh, Jul 23, 2003, in forum: Java
    Replies:
    2
    Views:
    791
    Nigel Wade
    Jul 23, 2003
  2. nicolas edel
    Replies:
    5
    Views:
    3,053
    Gordon Beaton
    Jul 31, 2003
  3. Replies:
    16
    Views:
    1,017
    Chris Uppal
    Apr 6, 2006
  4. bgabrhelik
    Replies:
    0
    Views:
    797
    bgabrhelik
    Sep 29, 2009
  5. Deb 123
    Replies:
    2
    Views:
    120
    Deb 123
    Feb 20, 2008
Loading...

Share This Page