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 Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Standalone Client & Socket client SCJD

 
John Oconnor
Ranch Hand
Posts: 67
Java Java ME Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi for all!

I am working in the SCJD, URLyBirds, and i have choice the socket solution for comunication.
My server work fine, I can stand up many clients via sockets, and manage the registry system lock.
I have used for registry lock a HashTable, where know the registry number lock at moment and your self cookie lock.

Now, my problem is when I try run a client local, standalone client, the local client can`t see the table where are the locks for remote clients, (sockets solutions)


Q1: when sun (oracle now ) say for local client : " the networking must be bypassed entirely." so i cant create a new client via socket where the ip =localhost?
as Jboss made? (the socket solution is a mini-server finally, so i could connect locally via localhost if server ip is equals to client ip or not is apropiate solution?)

Q2: RMI is best solution for this problem? any help?

Thanks, and I sorry my level of English but my first lenguage is the Spanish , and I not use Google traductor, any times is dangerous
 
Roel De Nijs
Sheriff
Posts: 9922
111
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi John,

1/ You are not supposed to run a standalone client together with a network server. So if you run your standalone client you'll need to bypass the network code, and that's it. You are guaranteed that no other program will be using the database file, so the network server can NOT be running (your instructions clearly state: "You may assume that at any moment, at most one program is accessing the database file;")

2/ RMI or sockets: that's completely up to you. Make your choice and document this decision in choices.txt

Kind regards,
Roel
 
John Oconnor
Ranch Hand
Posts: 67
Java Java ME Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok Roel, I undertand the diference between remote and socket, my Question 1 is only bad idea.

Well, i have for remote solution the next structure (in general view):

gui - controller - remote conector - socket client - socket server - databasefileaccess - database file

and for local :

gui - controller - local conector - database file access - database file

I have a Hashtable in my database file access who work is only know who are lock any register (room in database).
When run my clien in remote mode , is fine, because i am manage every client via my server , because I use the some database file acces (final and static class)
But, when run the local client, this manage another instance for database file access (also final and static, obvious jeje), some how I will do for manage the some instance for local and remote, is this posible?, or I need a new manner for manage this problem?

Tnks!
 
Roel De Nijs
Sheriff
Posts: 9922
111
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi John,

I have just one Data class which is used in network and standalone mode. I don't think you want to develop a complete new Data class just for the standalone mode. Because it will have a lot of code duplication (and that's a bad idea, as you know)

Kind regards,
Roel
 
John Oconnor
Ranch Hand
Posts: 67
Java Java ME Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel, my database file access is the some class , for local and remote!!. I will be very dumb if create 2 diferents database file access.
The next is the correct view of my solution to urlYBird proyect

--------------------../-- local conector ------ \
------------------- /------------------------------\
gui -controller-< .-------------------------------.>---db file access-dbfile
------------------.\ -----------------------------/
--------------------.\ remote conector-socket /

Ok now?, sorry but my previus reply not is very clear.

 
Roel De Nijs
Sheriff
Posts: 9922
111
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Much better
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic