+ Follow
since Jan 28, 2001
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by davidlong

Peter is right. you get to be synchronize the data structure, not the method(lock/unlock). The reason is if you synchronized on metnod, then you actually put lock/unlock methods into the same monitor as all public methods in Data class except you create a inner class to hold the lock/unlock methods, thus never have the effect of different record having its own lock.
But you could still use the Vector to hold the record lock, the vector is a synchronized data structure, it is thread-safe and will save you a lot if you use proporly. In matter fact, I used the Vector to store the locks in my SCJD assignment, and get a good score on it.
The critical points about the implementation of lock/unlock is that you must make locks data threads-safe, and could be unlocked even the exception occured.
Hi maja
The answer is yes, except that i did not implement lock/unlock methords in my server system. I left lock/unlock in Data class, and unimplemented anywhere else.
Hi, luis
I am very happy to give me solution for you concerns as below:
1. I had three packages
client: 7 classes
db: 4 origin classes
server 4 classes(RMI approach)
I put "booking logic" in both server and client, which both have some public mothods as required, but I add a special booking methods in those classes.
hope this will help.
Hi all
I passed the assignment with the result 146:
General Considerations(Total 58) 54
Documentation (Total 20) 18
User Interface (Total 24) 22
Server Design (Total 53) 52
It took 10 days for this result after I finished fellow-up exam, but it wasn't too long.
I was very thankful for all of you here. Indeed this site was very helpful site, and I had gained a lot here, althought this is first time I do posting my own.
Hope you all doing well in SCJD project, which really imporve and test your abilities to be java developer.
Thank you all again
David :-)
Hi guys
Has any of you used inner rmigegistry to start the server. I used it, and it saves me a lot to do with classpath or codebase. I just wonder if my approach is unpopular.
Hi Lisa
You will never be able to pass the value, you want, to another class because you did not pass the right value to your newint variable.
The problems was that you pass "intvalue" to "newint" too early that it had recieved "intvalue" initialization value and unable to change it in later code. you should know that declaring newint=intvalue never make "newint" automatically change with "intvalue". The declaration was just passing the init value of "intvalue" to "newint", this is why you got always zero, or 99 when you changed init value.
To solve your problem, you may try assign newint right after;
intvalue = Integer.parseInt(args[0]);
By the way, why do you not directly pass intvalue to another classes, it is static and pass it should be more easy.
B Alexander
If I am right, you need clarify two things first in order to find your problems
1. Did you use a seperate rmiregistery or a localregistry in your server class. These are diffierent. if use the formaer, then you need provide rmi server every information it needs like codebase, classpath etc.
2. when you did not pack your class files into a jar file, then your codebase default is classpath, but after you packed, classpath has no any meaning all to codebase.
you may try redefine your classpath or codebase to include the jar file. if you use rmiregeistry, then try start your server application like following:
classpath c:\you_jarfile_home\you_jarfile_name.jar
or provide (......)codebase=c:\you_jarfile_home\you_jarfile_name.jar
Hope it will help

The problem was that you used the readLine() method, the db.db do not hava line format at all.
check the Data class second constructor to see how it does for creating a new database file, refer that to create your own.
Hi Ram
the JVM security policy file resides in
yourjdkhomedirectory/jre/lib/security/java.policy, which is a pure text file. try to add following as one line to this file:
permission java.net.SocketPermission "*:1024-65535", "connect, accept";
but i really think your problem is wrong IP address to be used.
20 years ago
Hi Lisa
I think you problem is too early declare your array size. try declare you array size after you vector get all elements like this:
DataInfo[] rv=null;//are you really need declare it here?
. //the code
build.addElement(new DataInfo(r, description, values);

//outside of forloop
DataInfo[] rv=new DataInfo[vectorName.size()];
//how about to declare it here?
rv =DataInfo[] vectorname.toArray();//heres my conversion to Array
return rv;
In this way, should solve your problem
Hope this will help.
Hi Swati:
I hardly to find the problems with the code you gave. Is it possible the problem related with the runing command when you start Java VM.
Did you start the executing your coding like this:
java suncertify.db.FbnModel
It should start the class with it's package name, not the directory structure name like: java suncertify/db/FbnModel, which definitely gave your ClassNotFoundExceptions in you case
if you want sperate your client application with stub, there a couple of things you need to do.
First, in server side, make sure where is stub location. in a jar or in class pacakge or just in a directory, which is not related any packages.
Second, every time you start the server, you should refer this location to the rmi.server by following syntex commands:
java -Djava.rmi.server.codebase=file:/c:\your firl location
check for this to see if you can get it or not.
20 years ago
I also assuming the IP address you gave your friend is your computer IP, not the your ISP IP, from your post, it looks like you used your ISP's IP.
For how to find your persional computer IP, your can use MS netmeeting(help menu: about), or other tools. Note: every time you sign up internet, your ISP reassigns you a new IP.
For other things, you may check your friend if his JVM has setup a security to refuse him use the socket connection which is greater than 1024. meak sure he get all permissions.
hope this help.

20 years ago
For your information, did you know when you declare:
File lockFile=new File();
the lockFile dose not really exist in any sense, if you delete such a file, you never get "true".
hope this will remind you some thought
Hi all
I also had the problem before discussed here. But, after trying many times, i finally gave up to implements setValue()method in table model, i just used a vector to hold my table Data, every time the vector get a new element, i just call fireTableRowInserted() method. in this way table will auto increse a new row. of couse the vector initialed as null and table initialed with two empty rows. using fireXXXXXX method will help lot, because it made tabe reload data with calling getValue() method(a key method)
help this help