Results 1 to 1 of 1
- 11-24-2013, 06:01 PM #1Senior Member
- Join Date
- Oct 2011
- Rep Power
Structure of a distributed application using RMI
I'm taking an advanced course in Java Networking, and I have an assignment where I am to create distributed application that acts as a marketplace where clients can buy and sell items. The task is focused on getting to understand RMI, and should be built without a GUI.
Given is a bank interface and an implementation class that implements that bank interface, as well as a server that registers the bank to the RMI-registry, and a client class that communicates with the bank remote instance.
The general idea is that I shall implement a marketplace on which the client can register/unregister, and buy/sell items of a non specific type. When an item is bought, the client who is the seller should be notified with an RMI callback function, and the marketplace should make a transaction in the bank to/from the buyer/seller.
So, what is my problem?
I'm having a hard time understanding the correct way to structure this application, aswell as where I am supposed to use the RMI calls. The existing client can communicate with the bank, and I have implemented a marketplace that looks somewhat the below class diagram shows.
The UML may not properly describe my structure since UML isn't my strongest competence...
This is how I was thinking of implementing my application.
The client registers an account with the bank and deposits some money to it, using RMI, Client -> Bank, Client -> Account.
The client then registers to the marketplace using RMI, Client -> Marketplace, and the marketplace makes sure that the client has a bank account, Marketplace -> Bank.
The client registers an item to be sold using RMI, Client -> Marketplace, the marketplace creates a new item and places it in a list of items to be sold.
The client buys an item from the marketplace, Client -> Marketplace, marketplace checks that the buyer has money, Marketplace -> Bank, and then makes the transactions.
The marketplace calls the notifyItemSold() using RMI, Marketplace -> Client.
So my questions are as follows:
- Would this be a proper way of using RMI to build a distributed application, where I also use RMI to communicate between the Marketplace and the Bank, or is this an unnecessary complicated structure?
- Must the Client interface also implement the Remote interface, so that I can create a "proxy" client on the Marketplace side, to invoke the method notifyItemSold()?
- What is a RMI callback function really? Is it just the fact the client side is an implementation of the Remote interface, and thus makes it possible to create a remote instance of that too, or is there some magic callback function that I have missed?
Any assistance to make the concepts of RMI a bit more clear would be helpful!
(Note: I wasn't sure if I were to put this in Advanced Java or Networking. I apologize if it's misplaced!)
- By mohit_pipariya in forum EclipseReplies: 2Last Post: 01-23-2013, 10:31 AM
- By Return 0 in forum New To JavaReplies: 5Last Post: 03-04-2011, 08:15 PM
- By tssutha in forum Threads and SynchronizationReplies: 1Last Post: 03-16-2009, 03:07 PM
- By sujithc34 in forum Advanced JavaReplies: 1Last Post: 02-05-2008, 07:52 PM