Hi, I am new in Java RMI and trying to do some learning in different condition. I don't know what I am trying to do is appropriate or not. So far I have developed an RMI application where client gives an input & get the factorial for that. I have 4 class for the application.
Those along with code are following.
Server class - FacServer
Client class - FacClient
Implementation class - FacImpl
Interface class - FacInt
It works fine. Now I want to set some limitation in server side. For example server won't calculate the factorial value for more than 5. I know I can do it in implementation class easily. But I want to declare it when I start the server. For example to set limitation 5 I should start the server in following way.
Java FacServer 5
So if client input a value more than 5 it will get an error reply. Is it possible to do so?
Also can I show the factorial value in server side also if client provide an accepted value?
I don't see why not. You'd have to pass the upper bound number into the FacImpl constructor, of course, so FacImpl would know what the upper bound was. And I suppose you'd have to have FacImpl throw an exception of some type if that upper bound was exceeded.
Shihab Hazari wrote:Also can I show the factorial value in server side also if client provide an accepted value?
I don't understand that question. First of all I don't understand what you mean by "show" in the server side, because servers are normally not designed for people to be watching them. I suppose you could log that value, or something like that. And I don't understand what an "accepted" value is for the client. Is that a value which is not above the upper bound?
A timing clock, fuse wire, high explosives and a tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database