my dog learned polymorphism
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes java NIO in B&S Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "java NIO in B&S" Watch "java NIO in B&S" New topic

java NIO in B&S

Samuel Ittera

Joined: Jun 09, 2006
Posts: 9
I was reading the instructions of my assignment, and it does not restrict me from using java.nio. This makes life a whole lot easier ( I am glad I do not need to re-invent the wheel ).

1. I can use a file channel for every record.
2. The locking/unlocking feature is already built in with FileLock.
3. I don't see any need to cache, because I can directly map a ByteBuffer to a single record in the database file.

Can someone give me a reason not to go down this path.

Thank you,
Samuel Ittera SCJP 1.4
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Referring to your second point: how do you get around this (from the FileLock API)?

File locks are held on behalf of the entire Java virtual machine. They are not suitable for controlling access to a file by multiple threads within the same virtual machine.

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.

Joined: May 10, 2006
Posts: 11
From :

The following APIs and facilities may not be used:

* Enterprise JavaBeans
* Servlets, JSP technology, or any other web-oriented APIs
* NIO, the New IO facilities
I agree. Here's the link:
subject: java NIO in B&S
It's not a secret anymore!