Discussion:
Beginner CORBA question (possibly stupid): Two-way multiple communications possible with one object?
(too old to reply)
Navigateur
2010-08-21 11:49:00 UTC
Permalink
I haven't started with CORBA yet.

First question: is it possible to have one object which has some
method implementations on one side, and some on the other e.g. the
Java side can call an object's method A(), whose implementation is on
the C++ side, and the C++ can call the same object's method B(), whose
implementation is on the Java side?

Secondly: What happens exactly when you try to set up more than one
server to a client using the same object reference? If you're in
"multithreaded" mode (or "asynchronous" mode or whatever) does it
mimic a multi-server "notification" set-up? Can anybody try this and
tell me exactly what happens? If it works, I don't want to have to set
up a notification service unnecessarily. I want to keep my code as
minimal as possible.
Thomas Richter
2010-08-22 15:37:01 UTC
Permalink
Post by Navigateur
I haven't started with CORBA yet.
First question: is it possible to have one object which has some
method implementations on one side, and some on the other e.g. the
Java side can call an object's method A(), whose implementation is on
the C++ side, and the C++ can call the same object's method B(), whose
implementation is on the Java side?
An object entirely lives on a single side, but has a delegate on the
other side. Thus, you can create an object on the C++ side, for example
as a reaction from a call from the java side, and then call the methods
of this object from the C++ and/or the java side. It is of course up to
you to ensure that the calls are properly synchronized if more than one
program operate on the object. An object cannot be partially implemented
on a side. Make it two objects if you need this (but why?)
Post by Navigateur
Secondly: What happens exactly when you try to set up more than one
server to a client using the same object reference?
I don't understand what you mean by that.
Post by Navigateur
If you're in
"multithreaded" mode (or "asynchronous" mode or whatever) does it
mimic a multi-server "notification" set-up?
CORBA is not really on "notification". It "just" transparently
implements object methods (potentially) distant servers. You can call a
method of a delegate of an object, and that call returns as soon as
the round-trip to the remote server completed; otherwise, it works as
if the object would be local, just that it takes longer.
Post by Navigateur
Can anybody try this and
tell me exactly what happens? If it works, I don't want to have to set
up a notification service unnecessarily. I want to keep my code as
minimal as possible.
If minimal code is your goal, CORBA is probably not for you. Your code
might be rather small, but the overhead from linking against a Corba
ORB is usually quite big. If you want a minimal "remote function"
service, probably look into REST and implement the dispatcher yourself.
If you want a Java/C++ connection, look into the Java native interface
(JNI) which is much more lightweight.

Greetings,

Thomas
Navigateur
2010-08-23 08:18:18 UTC
Permalink
My 2nd question is about multiple server objects (i.e.
implementations) for the same interface. If the client calls e.g.
"sayHello()" I want it to invoke "sayHello()" on app 1, app 2, app 3
etc. all pretending to be the same object (but actually all being
different implementations of it).

This is for a hardware device process that needs to send events to all
applications that want to use it.

The technically right way, I'm sure, is to use "publish-subscribe"
using CORBA Notification. But if the above way works, I wouldn't have
to do that. I just wonder if you know what the exact response of a
CORBA-based system is when this is attempted?
Post by Thomas Richter
Post by Navigateur
Secondly: What happens exactly when you try to set up more than one
server to a client using the same object reference?
I don't understand what you mean by that.
Post by Navigateur
If you're in
"multithreaded" mode (or "asynchronous" mode or whatever) does it
mimic a multi-server "notification" set-up?
CORBA is not really on "notification". It "just" transparently
implements object methods (potentially) distant servers. You can call a
method of a delegate of an object, and that call returns as soon as
the round-trip to the remote server completed; otherwise, it works as
if the object would be local, just that it takes longer.
Post by Navigateur
Can anybody try this and
tell me exactly what happens? If it works, I don't want to have to set
up a notification service unnecessarily. I want to keep my code as
minimal as possible.
If minimal code is your goal, CORBA is probably not for you. Your code
might be rather small, but the overhead from linking against a Corba
ORB is usually quite big. If you want a minimal "remote function"
service, probably look into REST and implement the dispatcher yourself.
If you want a Java/C++ connection, look into the Java native interface
(JNI) which is much more lightweight.
Greetings,
Thomas
Thomas Richter
2010-08-25 20:59:13 UTC
Permalink
Post by Navigateur
My 2nd question is about multiple server objects (i.e.
implementations) for the same interface. If the client calls e.g.
"sayHello()" I want it to invoke "sayHello()" on app 1, app 2, app 3
etc. all pretending to be the same object (but actually all being
different implementations of it).
Are you mixing classes (abstract) with actual implementations (objects)?

No, if you want to perform an action on three clients, you need three
objects, each object being implemented on each client. The objects could
of the same class, though, and if their internal state is the same (or
they don't have a state), then they would do the same thing, of course.
Post by Navigateur
This is for a hardware device process that needs to send events to all
applications that want to use it.
Hardware and CORBA? Are you sure you're not overshooting a bit? CORBA
is not exactly lightweight.
Post by Navigateur
The technically right way, I'm sure, is to use "publish-subscribe"
using CORBA Notification. But if the above way works, I wouldn't have
to do that. I just wonder if you know what the exact response of a
CORBA-based system is when this is attempted?
Response? What kind of response would you expect if you would write,
say, in C++:

Object o1,o2,o2;

o1.SayHello();
o2.SayHello();
o3.SayHello();

You can expect "the same" response if o1,o2 and o3 are actually on
remote machines. Not less, not more. If "Object" has no state, then each
"SayHello" would do the same. So they would in Corba.

If you want to build a notification service yourself, well, then build
an object "notificationbroker" on the server, provide a method
"addnotificationlistener" that accepts an object of type
"notificationlistener" having a method of type "eventtrigger", and the
notificationbroker calls all "eventtrigger" methods for all objects
registered at it.

The server would provide a "notificationbroker", each client a
"notificationlistener", and each client could register for this service,
and then would get called as soon as "something" happens.

Is this what you need? Sure, been there, done that. Works. Why shouldn't it?

Greetings,

Thomas

Loading...