This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Modern JavaScript for the Impatient and have Cay Horstmann on-line!
See this thread for details.
Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!

Baris Dere

Ranch Hand
+ Follow
since Mar 23, 2004
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 Baris Dere


I used only synchronized blocks in my code and not as method modifier.

I call lock/unlock methods only from the server side and inside update and delete methods. Example:

public void update() {
try {
} finally {

I didn't set my update (none) method as synchronized because you must lock that record what must be updated and not whole implementation or whole records. If I use locking calls inside my update method and I set also the method modifier as synchronized then I use locking TWICE. And so it can be happening that you get DEADLOCK because of that.

Update method implementation:

I seek that record (recNo) with + recordLength * (recNo - 1));

then I check this recNo is marked as deleted, if so then throw RecordNotFoundException else continue processing.

With a for statement I make a new String with new values, like so:

String newValue;

for (i=0;i<fieldsCount;i++) {
//copy the value of data[i] to your newValue
// but watch out, each field has own size.
// example:

// the size of the field name in database is 30 characters
// and I give a new value 'Michael'. Then you must fill your new value
// 'Michael' and 23 times white space. I did so.

at last dbFile.write(newValue);

In your create method you must do like this:

create(newRecordData) {
// if ( AND newRecordData.location) exists in database.
// then throw DuplicateKeyException.

I hope it is clear for you.


Baris Dere

answer 1
There are many ways to implement your assignment. So if you think your desicion is correct, then you must do that. In my code I also used only my own interface and not DBMain interface to retrieve data from the database(local or server).

answer 2
I implemented 3 classes which implements Serializable interface. I used them everywhere I need. It doesn't mean if you use a serializable object without calling any RMI code it is serialized. Serializing is only done by RMI protocol when that object must be send or received by using by RMI server.

I hope my answer is clear. My english is not so good



Baris Dere

I used for my assignment RMI.

I have next classes/interfaces: (class names are not exactly so)

- DataMain (interface)
- Data (class) implements DataMain
- MyDataInterface (interface) (exact all methods of DataMain interface with RMIExceptions.
- ServerDataClass implements MyDataInterface.
- LocalDataClass implements MyDataInterface.
- ClassChooser (class with factory method)
- ServerClass (class that returns MyDataInterface object "ServerDataClass implementation")

factory method returns MyDataInterface
if (start argument == SERVER) {
// make connection with the server
// server returns MyDataInterface object
} else {
return a new instance of LocalDataClass.


I didn't send any UML diagrams or something else. But you must describe all designpatterns you used in your code. If you think it is more clearlier to send some UML diagrams, then I say DO IT!


Baris Dere

I already passed for this exam and I want to give some hints for you.

Locking: I had 80/80 points for.

I have a LockManager class I implemented record locking and I call that class instance inside my Data class. I call lock/unlock methods only in update and delete methods by the server side.

I have a array of WeakHashMap objects with size as recordcounts.

WeakHashMap[i] i = maxRecNo

In my lock method I do so:

in my unlock method I do so:

GUI DESIGN: lost 20 points
I have not imlemented JMenu and JComboBox. I think (maybe) because of that I have lost 20 points for GUI part.

I have implemented a new Interface named MyDataInterface and I redefined all methods of my Data class inside and other extra methods like bookRoom ...

I have implemented 2 classes that implements MyDataInterface. 1 class for client side and 1 class for my server side.

I have used Factory pattern to check which interface it must use.

MyDataInterface getInterface(Command arguments)
if (clientargument)
return new ClientClass
if (serverargument)
return new ServerClass

I hope its clear.



Baris Dere
[ June 23, 2004: Message edited by: Baris Dere ]
Thanks Thanks Alll

Tesekkurler Serkan Cok SUKUR

I am very happy for this... I was worried about some points but it was not necessary I see now

Thanks for all again

Baris Dere
16 years ago


I did like you did. I made a class LockManager where I implemented all my lock code.

And in my Data class I call the lockManager instantion like.


Baris Dere
16 years ago

This report shows the total number of points awarded for each section. The maximum number of points is 400, to pass you need a score of 320. Section

Summary: Section Max Actual Points Points
General Con: 100 77
Documentation: 70 66
OOD: 30 30
GUI: 40 28
Locking: 80 80
Data Store: 40 40
Network Server: 40 33
Total: 400 354

Thanks for everything !!!

Baris Dere
16 years ago
Tebrikler Serkan,

What a score !!!

Did you see your score at CertManager? or somewhere else?


Baris Dere

I Hope you are right.

So still waiting for the results...



When a client requests a DataInterface then my server will return DataInterfcae class that includes a reference to my Data class. This Data class instance exists just one time. So when 2 clients working on it, if client 1 set the pointer of my RandomAccessFile to some where else and the client 2 somewhere else. I mean this:

client 1 (read);

and at the same time

client 2 (read);

I don't know more...

I am getting crazy

We will see when I get my score.

Thanks for all


Baris Dere
Merhaba guvens

Ok thanks...

I got taken the essay examen yesterday and I don't know which score I get.

I did a BIGGG mistake in my code.. So I think I will fail

I forgot to make the Data class method modifiers 'synchronized' and I give just ONE instance to the clients... very stupid...

Succes guys


Baris Dere
Hi guys,

I have a question to you. Must I take the essay examen again if I fail? Or must I just resubmit my assignment and that's it.

Can you help me???

Thank you.


Baris Dere
Hi guys,

I implemented lock and unlock methods with synchronized blocks. And locking called within update and delete methods of the Data class on the server side. On the client side I didn't implement locking. My question is now.. Must I also set the modifier of all methods of the Data class as synchronized? Some of people did. But why should I do that?

Can someone help me to splve this problem?



Baris Dere
Hi guys,

I am writing the userguide.html file. But must I also write how to install the JRE and set path like so:

1.1 Installation the Database Server

To install the Database Server you have to need Java Runtime Environment. You can download the Java Runtime Environment from the site

Once you have installed the Java Runtime Environment you are ready to start the database server.

1.2 Starting the Database Server

When you unpack the project.jar to a directory, you will find see a runme.jar file. This is the file that you must to execute to. When starting the server you have to do as next:

java -jar runme.jar server

When it can't find the runme.jar this means that runme.jar file is not in your current directory, so you must give the gie the whole path of the file. Just so (Example: runme.jar is in your C:\Windows directory):

java -jar "c:\Windows\runme.jar" server

When it can't find "java.exe" you have to set the PATH environment of the system to your Java Runrime Environment directory. Like so:

set path="c:\jre\bin\"

If you try now, it will start the server.

Or knows the examiner how to do this all?


Hi vishwa,

You are right:-))

My english is not so good

SO I didn't understand the assignment so good.

But now is all clear.

Thank you