Patrick Jansen

Greenhorn
+ Follow
since Jan 30, 2009
Merit badge: grant badges
For More
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 Patrick Jansen

Hi,

I have a doubt about if the flag of the record is considered as a field of a record or not.
For example, my "read" method:

have to return:
String[0] = record's flag
String[1] = name
String[2] = location
...
or:
String[0] = name
String[1] = location
...
?

So, "fields of a record" means flag+name+location... or name+location... (I think name+location... without the flag).

Thank you.
Hi,

I want to be sure if I understood correctly what means "recNo" in the "read" method signature.

In my DBMain interface "read" method has the following signature:

My assignment says Any methods that throw RecordNotFoundException should do so if a specified record does not exist or is marked as deleted in the database file.

If a have in my file:

not deleted first record
not deleted second record
not deleted third record
not deleted fourth record

then
read(0) return "first record"
read(1) return "second record"

If the record 1 is deleted then the file has the following structure:

not deleted first record
DELETED second record
not deleted third record
not deleted fourth record

Now, if I call read(1) again, the method returns "third record" (because this record is logically after "first record" as not beeing deleted) or returns "RecordNotFoundException" because "second record" has its flag marked as "DELETED"?

I think that "recNo" refers to the physical position of a record in the database file and each record has its own recNo forever as long as the records are not physically deleted.
So, I think read(1) throws "RecordNotFoundException".
What do you think?

Thanks.
What is the truth? I downloaded my assignment on January 21, 2009 and after that I mailed to SUN asking them to tell me what is the time limit to complete the assignment. Here is what I received:


From:
"Sun Certification Support" <certification@educationservicesgroup.com>, Tuesday, January 27, 2009 9:01 PM

Dear Patrick Jansen,

Thank you for contacting Sun Certification Customer Support. We are happy to assist you.

You have one year to complete the assignment. We are working on updating our website. We aplolgize for the confusion.

Please let us know if we may be of further assistance. Thank you for choosing Sun products and services.

Sincerely,

Michele Castle

Sun Certification Customer Support
who2contact@sun.com



What do you think?
After I read this topic it is clear that all people that downloaded their assisgnments after May 2009 have 1 year time limit, or NOT?!. I still have a doubt because I downloaded my assignment on January 21, 2009 and after that I mailed to SUN asking them to tell me what is the time limit to complete the assignment. Here is what I received:


From:
"Sun Certification Support" <certification@educationservicesgroup.com>, Tuesday, January 27, 2009 9:01 PM

Dear Patrick Jansen,

Thank you for contacting Sun Certification Customer Support. We are happy to assist you.

You have one year to complete the assignment. We are working on updating our website. We aplolgize for the confusion.

Please let us know if we may be of further assistance. Thank you for choosing Sun products and services.

Sincerely,

Michele Castle

Sun Certification Customer Support
who2contact@sun.com


What do you think?
Hi Yucca,
I don't understand exactly what do you mean with the following:

Yucca Nel wrote:A singleton is perfectly fine as long as you make sure that each DB implementation gets its own singleton.


and

Yucca Nel wrote:
You are only working with a small database and having a singleton facade design IOW a single class that does all the DB implementaion (data accessing and record locking) is a good choice.


You mean that if my Data class is a singleton I have to implement data accessing and record locking directly in the methods of Data class and not use composition having two classes for data accessing and record locking?
BTW: in a class that is a singleton, make sense to declare its fields as statics if we have only one instance of that class? I think no, only when that fields is used in static methods.
Thanks.
Thanks Roel for your reply. Now is clear for me how can I use the getInstance method without any parameters.
Now I am working on the database layer and I hope to finish my assignment until January 2010 (my deadline). After reading some stuff(Head First OOAD, Head First Design Patterns, SCJD Study Guide by Kathy SierraandBert Bates, Sun tutorials for Threads, RMI and the Adrew book) I decided to start designing my assignment. I have no experience in applications design so I am still confused, but finally I decided to start the job.
Thanks in advance to all ranchers that will guide me.
Hi everyone,

I decided to implement the Data class in my B&S 2.3.2 asssignment as a singleton. So I will have only one instance of Data at any given time. In almost everywhere I saw examples in which getInstance method have no parameters. Because I need to initialize the databaseLocation field of my Data class I need to define getInstance method with one String parameter. Still am I conform to singleton pattern if my getInstance method has a parameter?
My code is:

Many thanks.
Thanks Adrew for your explanation. Finally I understood how read/write locks work. Is no sense to use them individually. They always must be used toghether because they exclude each other. Previously I was testing only a readLock (as I was used to work with one single mutex, using synchronized blocks) and I was not understanding why readLock is used while many threads can own that lock. But the main ideea is that in case of ReentrantReadWriteLock always make sense to work with both read and write locks. As you mentioned, if I understood right, we assure that:

1. While many threads own a read lock -> no thread own a write lock;
(threads that own the read lock execute code block between readLock().lock() and readLock().unlock() interchangeably until they finish executing that block while no thread can execute code block between writeLock().lock() and writeLock().unlock());

2. While only one thread own a write lock -> no other threads own a read lock.
(while only one thread execute code block between writeLock().lock() and writeLock().unlock() until it finish that block code no other threads can execute code block between readLock().lock() and readLock().unlock()).
Hi J,

The writeLock is exclusive.

J Flew wrote:
Does it mean no other thread can access this block of code until the lock is unlocked?


Yes.


So any code within that block is protected not just the recordNumbers map that it is intending to protect?


Yes.

What I didn't understand from Sun Java API documentation is when the readLock is used?
If a readLock can be accessed by multiple threads why this readLock is used at all in Andrew's book in the method getDvd(String upc)?
Maybe some other people can clarify this.
Hi all,

The database schema in my B&S assignment from SUN is:

name 32 - The name of the subcontractor this record relates to.
location 64 - The locality in which this contractor works
specialties 64 - Comma separated list of types of work this contractor can perform.
size 6 - The number of workers available when this record is booked
rate 8 - Charge per hour for the subcontractor. This field includes the currency symbol
owner 8 - The id value (an 8 digit number) of the customer who has booked this...

I'm not sure if "subcontractor" is the same thing with "contractor". I think SUN want to say "contractor" in all fields. If not, what do "subcontractor" mean?
Thank you.