FAQ of Assignment 2 of comp6231
> 1.In the programming problem, I have to impelment all communication among > e-traders using the UDP/IP datagram protocol, but as I know, the IIOP used > by ORB is built on TCP/IP, How should we switch to use UDP/IP in CORBA?
1. Using a UDP is irrelevant with whatever CORBA is implemented. You are working completely outside CORBA architecture which means you are just exchange some information between e-traders so that they can fulfill a request in CORBA. So, you simply implement a socket communication by yourself inside a "buyitem" or "sellitem".
> 2.All data operations must be performed atomically (in a both-or-none > fashion) without > any interference from other operations, is this because the communication > among e-traders based on UDP/IP, which gives no gurantee to commuication? > Does this require I have to use transcation in my application? and if that > is true, should I use JTA?
2. This is not because of what communication mechanism
you are using. Even
you are using a reliable communication channel like TCP, still you are
facing this "atomic" issue because it is the business logic. Surely you
should treat them as a remote transaction. And you are not supposed to use
JTA because you are actually implememt it by yourself.
> Just as the first assignment, in this assignment,I still need to run
> several server in the same host for testing. Therefore, I need to change
> the server port number. However, in the example, I didn't see
> corresponding commands. Maybe it use the default port number. Also, I
> didn't see any corresponding articles to change the server port number on
> internet( not the central orbd port number,which can be change in the
> command line.).
1. You don't have to use different port number to
differenciate different
servers.
2. Different servers do not conflict with port number, at least we cannot
see it.
3. Each server register with different "server-name" or "registery-name" so
that client can talk with them by using this "registery-name". Try to run
several servers in same host with a command line parameter so that each
"binds" with a different "registery name".
> I got a question about the new function in assignment 2. Since e-traders
> can trader both the items bought and the items they manage, how can we
> decide the re-selling price for the items bought. 'coz the selling price
> is changing, one can buy the same item at different prices. We can sum the
> quantity for each kind of items, but I don't think we should simply take
> the average of the prices.
The purpose of adding the pricing change periodically
is for fault-tolerance
project to force you to take timing factor into consideration. So, let's
stick to a simple way with common-sense. Assume you buy some item and try to
resell them, then there is no reason to treat them differently from your own
item. My suggestion is just average selling price whenever you buy in some
item with different price. And periodically changing the price as if they
are items you manage.
In one sentence, using the buying price to average your current selling
price by weight of quantity. And then changing the selling price like your
own item.
> Hi, in your tips, you said that we cannot change the parameters in
> sellItem function. If we transfer parameters like the teacher's
> requirement, we need more functions in interface to make sure whether the
> buyer has enough money in the account based the current seller's price,
> and we need to consider more things about the synchronization. Do you mean
> that we can define more functions in the interface and only not to change
> the function parameters that the teacher give us?
>
Obviously this is not a good idea because professor define
the interface
with reasons and we should follow strictly. But how should we solve the
negative balance trouble? It is simple, just let us assume negative balance
is acceptable. Please read requirement and tell me if professor asks us to
check balance? No, he only asks to check quantity. So, we don't care about
whether balance is negative or not.
> Second question is that some student said that only the tradeItems
> function use UDP, the buyItem, sellItem and printreport function still
> need to be through central ORB, is it like that?
In fact, all functions are CORBA function or interfaces.
Only in the
"tradeitem", the server between server part is done by UDP instead of CORBA
RPC because performance reason.
> In assignment2, the teacher said"Furthermore, for performance reasons,
> implement all communication among e-traders using the UDP/IP datagram
> protocol."
> Does it mean each server has the address of other servers?Then, when the
> client send the requirement, this server can directly communicate with
> other servers, which needn't through the central orb.
>
Yes. Only for "tradeItem" we don' t have to ask e-trader
to communicate with
other e-trader by CORBA. Instead the server-server communicates with UDP.
And it is purely for performance reason.
> According to that, need we still define the sell function in the orb
> interface. The sell function is just the function used among etrader
> servers. It is more like a private function, used by buy function.
> Urgent for your write back.
Yes, you still keep the sell function as RMI. In face you
can almost keep
most of your A1, but only change the RPC part of CORBA.
So, let me repeat it here:
1. All functions "buyItem, sellItem, printReport, tradeItem" are all and only methods in IDL. Please follow strictly the NAME AND PARAMETER given by professor because this acts as a contract between you and professor. If you really want to define some "help interface" used between servers, please justify yourself with following reasons:
a) simplicity: Say, why cannot we assume negative balance while professor doesn't explicitly required for?
b) efficiency: Is more communication really worthwhile? Distributed system view efficiency as one of top priority, so we should avoid multi-rounds communication within one operation.
2. Let's keep as much A1 as possible. So, "buyItem" will still internally call other e-trader's sellItem via CORBA.
3. Instead of using "buyItem"+"sellItem", tradeItem is implemented completely differently. That is to say, the server-server communication is using UDP instead CORBA RPC so that we don't have to define extra methods in interface.
> Using a UDP is irrelevant with whatever CORBA is implemented. You are
And the understatement of using UDP is that the UDP listener or server must run within a thread. Otherwise you cannot listen incoming UDP requests. And the introduction of UDP not only introduce more synchronization problem, but also deadlock issues here. So, apart from solving the "remote transaction" problem, also try to tackle the "deadlock" problem.
... we don't have much information about the synchronizing solution and therefore we can assume some wrong ideas which will ends to lossing marks, like " Synchronizing(this) " which I tought is a good solution but later one it came wrong.If you send us some samples or some solution like other parts, I will really appritiate that.