mark
mark

Reputation: 62746

Passing a signal from a .NET app to a Java app

I need to pass a signal from a .NET app to a Java app. No data is required, the signal itself is enough.

The most simple way that comes to my mind is by using a named synchronization object like this:

  1. The .NET app creates a certain named synchronization object A.
  2. The Java app creates a certain named synchronization object A - the name is the same as in (1).
  3. The Java app has a thread waiting on the object to become signaled.
  4. The .NET app signals the object.
  5. The Java app thread awakens and acts upon the signal reception.

At least, this how I would do it if I knew how to create a named synchronization object in Java.

But looks like Java does not have any, which I find hard to believe. Does it mean that only Windows has named synchronization objects?

So, my question is this - how do I pass a simple signal (no data) from a non Java app to a Java app on Windows? Both processes run on the same host.

EDIT

Motivation - I want to signal to our headless Java process to terminate itself gracefully as soon as it can do so.

Upvotes: 0

Views: 195

Answers (3)

mark
mark

Reputation: 62746

For God's sake, I just want a single 1 bit signal from a C++/C# process to a Java process and there is no simple way to do it. I can't believe it.

Forget about it, I'll just use the file system. The C++/C# code is going to create an empty file at a well known location, which the Java code is going to poll every second.

Finito, end of story.

Upvotes: 0

kazem
kazem

Reputation: 3749

I second thought, that i had done before by using ICE Framework, you can download and learn the ICE Framework from here, ICE Framework is a cross framework for communication between processes a local system or on a network.

Download Ice Framework

Upvotes: 0

kazem
kazem

Reputation: 3749

you can create a socket connection between your programs, and by send and receive specific pattern you can detect signal

Upvotes: 3

Related Questions