This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Svelte and Sapper in Action and have Mark Volkmann on-line!
See this thread for details.
Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Joel Mata

Greenhorn
+ Follow
since Oct 31, 2009
Joel likes ...
Oracle Spring Java
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Joel Mata

John McParland wrote:Hi,

the exam went quite well thanks. There were four questions, each of which asked me something about which I'd already invested significant time and effort into during the design and implementation of the assignment. I would say the exam is straightforward but not easy. I feel it is best to have prepared for it, such as re-reading your choices.txt and taking on some practice questions were a great help to me.

Now just to badger Oracle to allow me to upload my assignment.

Many thanks,

John



I'm going to do the essay tomorrow. The link you sent seams like a Great resource

Robin van Riel wrote:Since no required jar file name was mentioned in my version of the Bodgitt & Scarper assignment, I assumed it didn't matter much.
I called it "rvriel_bodgittandscarper.jar".

But then again, I'm not sure yet if I passed ;)



…well, did you?

I'm having the same problem, i used the ant builder in here and it creates a runme.jar inside a runme.jar (i cracked my head for two days until i figure it out this :S).

Is it true that the "inner" jar has to be called runme.jar but the submission package can have any name?
Just to revive this post

What to do with the properties file?
Where to put it inside the Jar?
Should it be created automatically if not present?
Just a note.

Is was receiving these multiple errors...


in order to solve this i had to:
1) create a lib folder
2) download and save in 1) the junit4 jar
3) edit the ant build properties (right click, "Ant Debug Build…", and edit the class path in order to add the file 2)

Hope it helps.

Roel De Nijs wrote:First of all, I changed your post a bit and removed the implementation of the bookAccomodation method. We prefer pseudo-code when complete methods are posted, because we try to prevent providing complete solution/logic (otherwise someone else can just copy/paste everything he/she needs to complete the assignment).


Fair enough

Let's start with the easy one. My main reason to implement record cache was: I don't have to handle the IOException in each CRUD-method. Another reason is that if 2-3 people say: "hey, I implement(ed) the record cache and that was so easy", it might influence people which are just starting their assignment. Because if they use this strategy, they will find more people to help them if they have an issue. In the Sun(ny) days (before Oracle acquisition) this certification was a lot more popular, so you had 5-10 people which were working on the assignment simultaneously, so much more traffic/questions in this forum. Nowadays it's just 1 or (if you are lucky) 2, sometimes even none for a couple of weeks. So people (have to) make more decisions on their own.


For the prices Oracle charges I can understand...


In order to answer the server side question, I need to know which methods do you expose to the client? The methods from the given interface? Or business methods like bookAccommodation and findAccommodations? If you expose business methods you'll have a thin client, otherwise it's a thick client. In a thin client starvation will never happen, because the server code always completes (unless a developer makes a mistake and forgets to unlock record for example).


For your words I'm sure I have a thin client.

Another question, being that I have only one server instance doing the synchronization at method level should be sufficient, right. I understand that I don't require the synchronization to be done in a unique object(like a static class in the Data class).

Many thanks for your comments.

Roel De Nijs wrote:First of all in the createRMIServer method I would expect a return of server instead of the creation of another object. Secondly lock and unlock should only be used for updating/deleting a record, not for reading one.


Am i not doing that already? That is, if the server already exists than i return the same instance. I only create the server once.
(some minutes passed…)
Yes, you are right, there is a typo in the code:


Roel De Nijs wrote:On the starvation subject. Based on the RMI server factory pattern I assume you opted for a thick client. One of the drawbacks of this approach is when a client which owns a lock crashes for some reason this record will be locked forever and can never be locked by another thread/client. This is a drawback you should definitely consider (as you do at this moment ). But it's not always necessary to handle this in the code, you have a choices.txt (the decision document) where you can list this as one of the drawbacks and give some possible solutions to this problem. And that will be fine, you don't have to implement any of them. Just considering and showing that you put a lot of thinking into your design is enough.


Think it i not the case, the lock/unlock is done in the server side (i say "think" i totally accept that i might be seeing things wrong):




Similarly I implemented a solution with a record cache (so reading file in memory). Of course with a very big file I can ran into memory issues. So I mentioned this in choices.txt and provide some alternatives to solve this issue (e.g. ignoring the records in the past). I didn't implement any of these alternatives (just my simple record cache) and passed with a perfect score.


By the way, why are so many people implementing the cache? I found manipulating the file very easy… Am i missing something?


(I moved your posts in a new thread, they deserve a thread of their own )




[edit] removed complete code snippet

Glen Iris wrote:

Joel Mata wrote:

Hi Glen, not much to add, just an confirmation that i did receive the same answer from Oracle. I did the Java SE7 fundamentals, it seamed to be the cheapest option.



Hey Joel,

Did you get much / learn much from the course?



700-800e for some pdfs that you get from any site explaining the new features. Is was really disturbing for me.
If it is to gain access to the certification than do it, if it is for learning don't spend your money.

Roel De Nijs wrote:In my application design I just have 1 Data instance (which is responsible for both locking and file manipulatons). If you have by design multiple server instances you'll need to share some information. Otherwise you won't have a multi-threaded application and you'll definitely fail for violating a must requirement.

Marking the locking manager as static is one of the possible scenarios.



I implemented a RMIServerFactory that is the object i register, in turn it contains a createRMIServer() :



The locking mechanism is a static class, which seamed to be correct… What made me doubt about my implementation is the fact that if the server does not unlock a record, by any reason, then all other clients will be blocked leading to "starvation", is this correct?

Everytime i call a lock i make the unlock inside finally, which i think will make sure that the unlock is always executed, still would "i don't like it"


Thanks for your comments.
Hi, I know this is a very old post…

When you have more than one thread, each thread has its own server instance which contains its own locking hash table mechanism, so my problem is, if you have two threads how the second knows that a record is locked if the first locked that same record in its own locking manager? Is the locking manager static?

Glen Iris wrote:I got some clarification from Oracle on this today:

Thank you very much for your email.

Each course you take will be recognized for one certification only.

For example, if you take the UML course and complete the course submission form asking Oracle to attach this training to the OCJMD certification, you will have to do an additional one from the list of approved trainings for the OCMJEA.

Please let me know, should you have any additional questions.



I guess thats a no then



Hi Glen, not much to add, just an confirmation that i did receive the same answer from Oracle. I did the Java SE7 fundamentals, it seamed to be the cheapest option.

Roel De Nijs wrote:And one other important note: due to the mandatory course requirement this certification is significantly more expensive than the other certifications (like OCPJP7, OCPJWSD,...)



The cheapest option will be the Java 7 Fundamentals.

Roel De Nijs wrote:With a RMI factory I would expect something like:



HI Roel. The problem was that my RMIServerImpl was not extending UnicastRemoteObject, instead was implementing Serializable.
Solved! Thanks.

Roel De Nijs wrote:How can a file be opened on the client if this fily is physically residing on the server



yes, thats my problem :S. The factory is returning the RMIServerImpl which then creates a DB on the client. If i disconnect the server the client keeps working.

What data could i provide to help you guys to track what am i doing wrong?

Roel De Nijs wrote:

Joel Mata wrote:is this acceptable?


Of course! That's what RMI is all about.

And if you think about it? If the database is shared among the clients, what would happen with the database file? This file only exists server side...



Hi Roel, could you explain yourself again?
I understand RMI but with the RMI factory design pattern the remote call brings all server implementation and then it opens the file on the client. The idea of having multiple clients where each one has his own database file seams odd to me.

I was more expecting having the client calling methods locally but being run on the server, that is that all clients would share the same database file.

Rehan Zahoor wrote:The RMI creates a skeleton and a stub. RMIImpl would be on the server the client would just have a shadow of it. So factory pattern works alright.


I undestand, but then
in this context the database is not shared among other clients, is this acceptable?