Alan Morgan

Ranch Hand
+ Follow
since Apr 18, 2005
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 Alan Morgan

A project to work on at home is exactly what I am looking for.
I was just wondering if there was a project out there (in a book or anywhere else) that would suit being implemented in an EE environment.

thanks.
I have 9 years of Java, know my design patterns, have looked at J2EE architecture.

Its the familiarize yourself with Struts, Hibernate, Spring that gets me. I can read about them alright but not until I do something real with them will I feel I know them
Hi Tsang,

What kind of app did you build ?
Was it big enough to give you experience of a good lot of the technologies ?

thanks.
Thanks for the replies guys

I have been reading about the technologies.
I guess what I was hoping for was maybe a book or something that had a sample project running the whole way through it as a means of practical experience

thanks
hello all,

I am interested in learning about java ee technologies but I do not work in the area.

I am not quite sure how to go about getting experience in the area.
Does anyone have any ideas ?

I was thinking along the lines of sample projects that I could work in to give me as real world an example as possible and touches as many of the related technologies as possible.
Any ideas greatly appreciated.

thanks.
Folks,

Sorry if this has been asked before but I have just booked my exam after submitting my project and I am freaking out a little.

I'm happy with the project as submitted but I spaced it out over more than a year so I'm worried I'll forget stuff for the exam.

How did u guys prepare for it ?
Was the choices.txt the basis of your revision ?

Thanks.
Hello all,

I was just reviewing my choices.txt and I was looking at my reason given for synchronizing the create method.

I say the following:


The requirements state that the create method:
"Creates a new record in the database (possibly reusing a
deleted entry)...."
So if possible a deleted record should be reused if one exists.
The need for synchronization here is best explained using an example
Say we have two clients accessing a remote db.
ClientA finds that record 2 is deleted and so concludes that they should
create their new record in place of this.
ClientA's thread loses the CPU and ClientB's thread gains the CPU.
ClientB deletes record 1.
According to the requirements ClientA should now be creating
the new record in place of record 1 and not record 2. To prevent this I
synchronized the create method.



Looking at it now I'm no longer convinced of the wisdom of synching the whole method.
In all other methods that use the RAF I just synch access to that.
Am I right in saying that synching create is still not stopping someone deleting record 1 and therefore my create still not using the first deleted record ?

Thanks,
Alan.

Originally posted by Zhixiong Pan:
Hi Alen,
Could you please give out an example for such error?



RemoteExceptions that are thrown are just repackaged as RemoteDataExceptions.

Does this make sense ?
Ok folks the day has finally come...I reckon I'm finished.
About to start running my tests for the last time and then send the app for testing to my chosen testers.

Any last minute advice from people who have done this certification as to things I should be careful about\watching out for ?

Thanks,
Alan.
Well if 80/80 can be achieved they I reckon I'm gonna leave it the way it is.

Thanks for the input Andrew.
Ok I guess strictly speaking you could say that I am not fulfilling thhe requirements.


Any attempt to lock a resource that is already locked should cause the current thread to give up the CPU, consuming no CPU cycles until the desired resource becomes available.



I guess I do consume some CPU cycles when checking if the resource I require is available.

Could you explain a bit more how your solution works ?
Not a bother Alan.
Glad you got 50000...I was delighted to see that myself.

Originally posted by Oricio Ocle:
Ok think about that:


.... But it's record has not been unlocked ...

Regards



My lock code has a while loop.
The first thing C does when he wakes up is to check if the record he is looking for is locked.
If it is he gives up the CPU again.

Does this solve the problem ?

Originally posted by Alan Mc Kernan:
Hey Alan,

I don't quiet understand the solution presented. I also have a business layer encapsulating the 48-hour rule, and exact matches on searches etc.

How do you allow a client to book one record at a time? You mention "blocking".. do you mean that your book method is synchronized? I don't really understand why we need to do this. I can't see how any client could book more than one record at a time.

The test that john mentions, I dont understand this either. You create a Thread runner that will get a Service instance form the server and then try to book a specified record ? This thread runner will have a static field, which all of the threads will try to decrement? Or do you mean that you modify your book method to update a decrement a field (integer) in the database? And disable the 48 hour rule/allow the booking to be re-booked? And then fire the 50 threads?

I'd appreciate if you could ellaborate a bit.

Alan



No my book method is not synched....what I mean by blocking is that when I call DB.update(..) my client waits for a response before he continues.
More than one record ? - theoretically I could spawn another thread to do the update for me and therefore the UI would still be able to function while the update was occuring. So now the user can choose to update another record and therefore in theory have two records locked at the same time.


The test is something like:



So I am getting 50000 threads (50 clients times 1000 attempts) to change record 1. The outcome should be that the name is 50000 at the end.

The 48 hour rule is irrelevant here.
That rule is business logic and my test is run on the data layer thereby bypassing the business logic layer.

Sorry if I am not explaining this correctly...its been a very long day

Have a look here:

https://coderanch.com/t/187926/java-developer-SCJD/certification/Locking-Approach

and the thread I linked to for Andrew in my post above for fuller discussions.

Thanks,
Alan.

Originally posted by Oricio Ocle:
Hello all
First of all, sorry for posting without reading the whole thread...
Alan, you are right:

But think what happens in notification...
What do your specs says about locking methods?



My spec says the following:


Your server must be capable of handling multiple concurrent requests, and as part of this capability, must provide locking functionality as specified in the interface provided above. You may assume that at any moment, at most one program is accessing the database file; therefore your locking system only needs to be concerned with multiple concurrent clients of your server. Any attempt to lock a resource that is already locked should cause the current thread to give up the CPU, consuming no CPU cycles until the desired resource becomes available.



Ok I synch on lockMap but if the record is already locked then I call wait which means that I give up my hold on lockMap so other clients can delete/update as they see fit.

In unlock I call lockMap.notifyAll so all threads waiting on it get a chance.
Granted you don't know which one will get it but they do get a chance.

I reckon I'm still missing something ?