Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Declare a variable value during running Java RMI server  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
own vote
favorite
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?
 
Sheriff
Posts: 23700
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Paul Clapham
Sheriff
Posts: 23700
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!