Win a copy of Secure Financial Transactions with Ansible, Terraform, and OpenSCAP this week in the Cloud/Virtualization forum!

Mehmet Atlihan

Greenhorn
+ Follow
since Mar 03, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mehmet Atlihan

Hi Thanks for your reply
So how did you get your result. Did they send you a email as well?
One thing I forget to mention in the previous thread.
I have taken the essay exam 2 days after the submission of the project so its still 3 weeks period.
Hi Guys
I have submitted my project 3 weeks ago yet I have not recieved anything from Sun. So how does this thing work? Do they notify me via e-mail ?
Shall I be worried and contact them or be patient instead?
(PS: I live in USA )
Thanks
Mehmet
It would be a terrible news for me if auto failure occurs for 48 hours specification as I have just uploaded UrLyBird without handling nor documenting this spec. However

This application fails because it does not meet the application specifications. The sepcification states that "URLyBird" is a broker of discount hotel rooms. They take bookings only within 48 hours of the start of room occupancy. The submission does not meet this requirement. The application allows bookings for any rom an any time with no date checking. It even allows users to book rooms for dates in the past."


This reason does not make sense. For example the database file I was given is full of records whose date fields belong to 2001 or 2002 years. It didnt have a single record whose date field is in 2004. In other words a date checking before booking will result in no booking at all thus make the application useless.
I will post my result and I hope I wont fail because of this.
Regards
Mehmet
Hi guys
I feel like to join the conversation as I uploaded my assignment today as well. I appreciate if someone can give me a feedback as to how to register for essay exam and the context of it.
Regards
Mehmet
Thanks Andrew
It worked. I appreciate giving your time. I learnt a tiny but a vital detail. I can comfortably upload the project now.
Regards,
Mehmet
Hi Andrew . Thanks for giving your time
Yes I guess Manifest File is correct as I can succesffuly build and launch runme.jar.
When I try to execute from a different directory I got the error
>java -jar D:\home\Certification Studies\SCJD\sr1538587\runme.jar alone
exception in thread "main" java.util.zip.ZipException: The system cannot find file specified
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:112)
at java.util.jar.JarFile.<init>(JarFile.java:127)
at java.util.jar.JarFile.<init>(JarFile.java:65)
I am probably making a stupid syntax error. But thats what the specification says :
java -jar <path_name_and_filename> [<mode>]
so it should be executed from a different directory as well right
Thanks
Mehmet
Hi Nathaniel
Thanks for your quick reply.
Can you be a little bit specific about Manifest File. Cause I can launch the application within the directory where runme.jar is located. The problem occurs when I try to launch it with a fullpath. So do you mean
it has to do with the Manifest file and I should look for information about that ?
Regards
Mehmet
Hi
Before uploading the project, I want to confirm something about a specification

When you submit your assignment, each part (client and server) must be executable using a command of this exact form:
java -jar <path_and_filename> [<mode>]


So what exactly does this refer to? After unzipping the submitted "jar" file
can we launch the application from console by giving the fullpath of "runme.jar" like this :
java -jar D:\home\Certification Studies\SCJD\sr1538587\runme.jar alone
If so do we have to do something special to support this behavior ?
Thanks
Mehmet
Hi Long

Should I write user guide for server mode?


According to specifications your user guide should involve the steps to launch the application. That should be simple and clear enough for a naive user for him to follow. Since in both modes (alone & server) the user needs to do some configurations at least once, you should document them. So yes I think your user guide should involve server mode too.

Can I change the DBAccess interface comments from sun?


Although I dont see a practical reason to do so, I think it does not hurt to change the comments of the DB interface.
Regards
Mehmet
Hi Eric
Your configuration seems fine to me. To clarify let me tell what I did

When Running in Network Mode
Client Settings

-Save Server IP
-Save Server Port
Server Settings
-Choose a database file and save its path to properties file
-save Host IP and Port
When Running in Alone Mode
Client Settings

-Choose and Save DataBase file name and its path
Regards
Mehmet
Hi Maria

The first point is that I don't understand why we should implement explicitly locking



When clients do a searching or booking ( may be create or delete for administrators) what you internally do is to operate on the database file you are given and display a search result or accomplish a booking by writing to database file. As the database is accessed concurrently ,you must preserve the database files integrity at all time during the execution of your application. At that point you should consider the following fact :
You must not allow two different clients to book the same room or the same seat at the same time otherwise it would be a disaster
So how would you implement this logical behaviour? Thats what locking mechanism is needed for. Before booking a room/seat your application first asks for a permission from the database via a lock() call over a specific record. That is the record which holds the information about the seat or room you are attempting to book. If the permission is granted then you keep going on. If any other client attempts to book the same room at that time, the application again asks for a permission from the database via a lock() call on the same record. But since the record is locked by some other client earlier, lock() call is denied for that client and he is put into a quee and starts to idle until the thread who owns the lock finishes and frees the record by invoking an unlock() call. This is simply accomplished by object.wait() and object.notifyAll() methods where in this instance Object denotes a data structure possibly a hash map which holds the locked records information.
It might be confusing for you if you are not familiar with Threads or writing multi threaded code. If none of these make sense to you then I would take any Java book or visit a java tutorial site and study Threads in detail.

Or the explicit locking is necessary to avoid deadlocks? Please clarify me


Answer is no. As a matter of fact your lock mechanism may cause a deadlock. So you should come up with a deadlock free locking implementation.
This has to do with Threads knowledge as well. So if you have problem with following this you really need to study Threads very well.



I have no idea how I can test the locking functionality.Please give me some advices and usefull links to read about this.


Well again Threads is your answer. What I did was to create sufficient amount of different Threads say 50, and log every threads actions.That way
I was able to keep track of my locking mechanism.You should try different inputs. For example you create say 10 Write Threads, that is booking a room/seat threads for the same record, and you monitor them during the application.
For usefull links , if you are confident with your basic Thread knowledge
this forum is an invaluable resource. Just do a search for a lock/unlock topic you will recieve hunderends of links. Other than that , Suns web site has a rich tutorial about other topics that you should be familiar with such as Swing,RMI.
Regards
Mehmet
Hi Andrew
I mean WAN not LAN. So I start the server with the current WAN IP adress of his. Thats the same IP which client tries to connect to. I know 192.168.0.1 is not routable but it can be assigned and used locally. My guess is, upon connection RMI resolves the local IP of the server and attempts to gain access to it ?
I am trying to launch the server on another puter and have run in to problems again. This puter is connected to internet via a router. Whenever I attempt to start the server with the WAN IP , I am getting an error like this :

java.rmi.ServerException: RemoteException occurred in server thread; nested exce ption is:
java.rmi.AccessException: Registry.Registry.rebind disallowed; origin /192.168.1.1 is non-local host


where 192.168.1.1 is the default gateway ,that is the routers local IP adress. Did anyone test his application over WAN where his server was behind a router ?
Last of all, as my application seems working on localhost and testing it on two different computers turned out to be too troublesome does it hurt to give up on it ? Did anyone submit his/her application without testing it over WAN and passed anyway ?
Your suggestions/experiences will be appreciated
Regards
Mehmet
Hello all
I was wondering whether any of you tested your application other than localhost?
My application runs fine on localhost. But when I test it over internet
I got the following RMI error:

java.rmi.ConnectException: Connection refused to host: 192.168.0.1; nested exception is: java.net.ConnectException: Connection timed out: connect


This happens when a Remote Method is Invoked. Interestingly the application successfully looksup that is gets the remote objects reference
Does anyone know why this exception occurs ? Is it at server and or client end? The server has no firewall running so I dont see a practical reason
for a connection time out as the client can retrieve remote reference successfully.
Thank you
Mehmet
Hi George thanks for giving your time

So you start your server in one window: java -jar runme.jar server
And then you start your network client in another window: java -jar runme.jar
Then you configure the network client to use localhost as the network server
Everything seems to work correctly, searches and bookings.
Then you kill the server (that is, the java -jar runme.jar server application), but the network client continues to work correctly?
You're still able to do searches and bookings?


Yes thats exactly what is happening.

Are you absolutely sure that your network client is running in network client mode rather than standalone mode. If it's running in standalone mode that would explain the symptoms (although not the logging?!?)


Yes. I am sure it is running in network mode as I provide logging for
"binding" stuff and according to it ,the client first thing is to lookup for the service and retrieve the reference to it when running in network mode.
For the rest of your questions let me briefly more talk about the design I have may be the problem is hidden somewhere there and I cant realize it.
The application (server )which is responsible for starting the server does not actually extend UnicastRemoteObject because it already extends Observable in order to notify his listeners when an update occurs. I implemented it in that way to stick with MVC pattern.The server handles the requests(read,update,delete,create) by invoking "Data" classs corresponding methods In other words I used Data class as an adapter in server.
Furthermore I have created a singleton RemoteProxy Class which actually extends the UnicastRemoteObject which is capable of doing everything that the server does and implement them via referencing Server class localy. Its methods again implemented as an Adapter. RemoteProxy reference is the reference returned when the client does a lookup. And that is the class name I get during Log.
So what Server class does is to get the singleton RemoteProxy reference
and bind it.
It might be a silly question but as I have run out of ideas could it be because the class who starts the server is not the one who actually is the remote object ? I highly doubt it but anyways..
Thanks
Mehmet