This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

recognising rmi client  RSS feed

 
naga venna
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI
I want to recognise the client in my RMI server, so that I can create new objects for each client on the server side.
Can some one suggest how to do that
thanks
Nagamani
 
Raj Chila
Ranch Hand
Posts: 128
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nagamani,
I am not sure why would you want to recognise the client to create a new Object for each client? it would be difficult to maintain the timeouts and garbage collection...inturn could put more burden on the server.
you could create some Cached Objects and use that to service the client calls using a flyweight pattern or something.
Hope this satisfies your Query....
 
Chris Shepherd
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RB is right if you were planning on storing separate objects for each unique client. Of course it could depend totally on your application. If you had given us some more info on your project, it might change the answer. If you have a limited number of clients possible/expected, you could hold independant objects for different clients and then reference them based on an assigned ID number. You would have to hold them in a global array to keep them live, but if your server can handle the memory issues, then its certainly possible. But you didn't tell us that. How about some background info if you really want some help.
Chris
 
naga venna
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chris Shepherd:
RB is right if you were planning on storing separate objects for each unique client. Of course it could depend totally on your application. If you had given us some more info on your project, it might change the answer. If you have a limited number of clients possible/expected, you could hold independant objects for different clients and then reference them based on an assigned ID number. You would have to hold them in a global array to keep them live, but if your server can handle the memory issues, then its certainly possible. But you didn't tell us that. How about some background info if you really want some help.
Chris
 
naga venna
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the responses Chris and Rajanikanth
Yeah I didn't explain my problem in detail.
Chris
The earlier suggestion you gave me for the connection b/w NT client and unix server( to use rmi.codebase) worked very much.
But Now My Application went for UAT.So Multiple users will use my server program at a time.
What I do in my server program is the check in and check out, add element operations to the clearcase vobs by using a java program(CCConnection.java) (In CCConnection I do a setview viewname, change to corresponding vob directory)
The thing is for all the users I am creating one single java object(CCConnection) in my server program and it went to hanged state.I am doing a one time initialisation of CCConnection object, inititalisation consists of setting view and changing to vob directory).and my server has to run all the while.
The server is not responding to the requests of the user(for the CCConnection methods).So for that I want to create a CCConnection object for every Client.I can't afford for creating a object for every Client call( because it takes time for setting view and changing directory).I want to create one CCConnection object for every client.
For us there will be clear case maintenance activities scheduled every day for one hour in the night
I couldn't understand the reason why the server is not responding for that CCConnection object's method call. and I tried a normal method call which is in the server.It succeeded.When I reboot the server it works normally again.
Do I need to create and delete objects every time.
How long created objects can stay in the memory in the server program.Can some one give me an idea on this.Because I am assuming that created object stays in the memory all the while.
Can some Advice
thanks
Nagamani
 
Raj Chila
Ranch Hand
Posts: 128
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont understand , dont the clients use ClearCase Explorer and other such inbuilt tools to check in and check out the code accross the network.
any way, the problem I see here is that of Connection pooling in JDBC, I have not worked with the ClearCase API ( if there was one for JAVA, I thought there was Clear Case API for Perl only). I have used the GUI tools for Administering Clear Case and Clear Quest, and there was on dedicated worker managing the same...that is for creating featuresets, baselines and featureset merging etc....
I think you will probably manage the connections to the ClearCase Server, and let the Client who is trying to create the VOB or check out and check in, will provide the information of the VIEW and if I am not mistaken there is one View per client isnt it?
Hope I tried to hit on the point.
 
Chris Shepherd
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm I haven't worked with clearcase, so I'm not sure how much I can help other thatn just general java stuff.
You can keep objects in memory for as long as you hold a live reference to them in your server object either as a named reference(global variable) or as an unnamed reference in a globally defined array/arrayList/map/collection. Keeping the objects around won't be a problem as long as they don't claim a system resource that the other objects need to operate. I think RB is probably right about it being a connection sharing problem. Just curious,but are you making calls on the connection using string commands or are they true method calls? Is there any way to batch the calls? Do you know for sure that setting the view and changing the directory is so time consuming that you can't do it every time you have a client call? What kind of user load do you expect - like how many concurrent users do you expect to see at a time?
Chris
 
naga venna
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
My class is JServer - the serverprogram
public class JGServer extends UnicastRemoteObject implements JRemoteInterface
{
public JGDAOClearcase ccConnection= null;
public boolean Init(vobname1,vobname2,viewname,adminview,dirpath)
{
ccConnection = new ccConnection(vobname1,vobname2,viewname,adminview,dirpath);
}
public boolean JRemoteCheckin(vobname1,vobname2,viewname,adminview,dirpath,clearcasefileelement)
{
if(ccConnection ==null)
{
Init(vobname1,vobname2,viewname,adminview,dirpath);
}
ccConnection.JGCheckIn(elementName);
}
public boolean JRemoteCheckOut(vobname1,vobname2,viewname,adminview,dirpath,clearcasefileelement)
{
if(ccConnection ==null)
{
Init(vobname1,vobname2,viewname,adminview,dirpath);
}
ccConnection.JGCheckOut(elementName);
}
public boolean JRemoteCheckElement(vobname1,vobname2,viewname,adminview,dirpath,clearcasefileelement)
{
if(ccConnection ==null)
{
Init(vobname1,vobname2,viewname,adminview,dirpath);
}
ccConnection.JGCheckElement(elementName);
}
public boolean JRemoteUnCheckout(vobname1,vobname2,viewname,adminview,dirpath,clearcasefileelement)
{
if(ccConnection ==null)
{
Init(vobname1,vobname2,viewname,adminview,dirpath);
}
ccConnection.JGUnCheckout(elementName);
}
public boolean ExportTemplate(vobname1,vobname2,viewname,adminview,dirpath,clearcasefileelement,dbuserid,password)
{
lrconnection = new lrconnection(userid,pawwsord)
ccConnection.exportTemplate(lrconnection,elementName);
}
}
public static void main(Stirng s[])
{
JServer jgser = new JServer();
Registry r=java.rmi.registry.LocateRegistry.createRegistry(1099);
Naming.rebind(..............);
}
}
Can you look thru the code and let me know I am doing any thing wrong
The vobs and views are same for every user.SO I need not initialise the ccConnection
This is the actual class I have. Apart form this I have few more methods may be 2 or 3 more.CCConection object does the actual checkin and chekout
by using a IClearcase.cleartool which is in a pacakage supplied by net.sourceforge.clearcase.simple.IClearcase. The cleartool method of the Clearcase does the actual command line given the parameters
The thing is this single ccConnection object is used by n number of users
at a time.Then the client may be
I am expecting a max of ten users at a time and ten users may invoke any method of the server.which obviously use the global ccConection object again.
So I feel some thing wrong with my design of the program.
The hangout happened once .Probalby at that time may be three or more users might have used the server methods
The reason why we are using java program for check in/check out is we want to automatise the check in/check out process rather than doing a manual one and more over the information to the file element will be written using the information in the GUI.Not a amnual write out
ok thats all I think I covered every thing
Can some one advice what is the feasible way of the instantiating ccConnetion object every time with every method call?
or one time intitialisation serves and do I really need to use any modifiers for the object. go for an array of objects?
thanks
Nagamani
 
Raj Chila
Ranch Hand
Posts: 128
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Naga,
Well what I see here is, the ccConnection is not a true Global Variable, you try to create a ccConnection Object every time a client makes a call to the server...
what would happen if two clients try to check in at the same time? while a connection is already open wont there be a problem if the second client tries to create a connection to the same location,
We are talking about the IO resources, the Connection, and thread management.
I dont know if I am misguiding you, but I would think of creating a Factory for creating the connections which take care, if the Connection with the given criteria already is created, if yes is it being used...
second thing is it is practically not possible to write into the same file element by two clients.. because there could be a merging / conflict when you check into the baseline. so that means I would try to synchronize the methods.
Hope this helps, and I am sorry if I am totally missing the point. but I learned that there are APIs for Clearcase in Java...thanks
[ March 31, 2004: Message edited by: RajaniKanth Bhargava ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!