Eben Hewitt

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

Recent posts by Eben Hewitt

I posted an article on using web service operations that throw exceptions and how those get translated into SOAP faults using JAX-WS here:


The code listings in this article were tested on WebLogic 10.3. It shows you how to build fault info beans on the service side and then retrieve the SOAP fault information and fault details in a JUnit test on the client side.

Hopefully this helps!
12 years ago

Unless the instructions you received in your assignment download explicitly state otherwise, you _are_ free to use NIO for reading and writing your data file.

Peter is correct that there is a statement on Sun Ed's web page (at http://suned.sun.com/AU/catalog/courses/AU-CX-310-252A.html) that NIO is not allowed. But that is a general statement, is inconsistent with other communications from Sun (such as some instructions that come with the assignment), and since it is not necessary to have read that page on Sun's site before taking the test, they can't really hold you to that. And therefore, Sun doesn't hold you to that.

I agree with Peter that it is probably not a good idea to use NIO for the networking component.

However, NIO for reading and writing the data file on the server side was not explicitly forbidden in my instructions, and so I did use NIO for fast reading and writing, had a lovely time doing so, and got full credit on the data and server sections where it was used.

It depends on what your aims are in doing the SCJD. If you want to use it as an opportunity to learn about NIO, and have some time, that is probably not a bad idea. If you don't want to deal with another unknown in an important aspect of your project, blow it off.

But make sure you check your instructions if you think you might want to go that direction. I had Bodgitt and Scarper, which is newer.

I feel pretty comfortable asserting that you will defintely not _lose_ points for using traditional IO.
Hi Engin
This is incorrect. A factory is not used to prevent having too many instances of a class. There is a pattern that ensures that you have no more than one instance of a class--that pattern is called singleton.

A factory is used as an interface for object creation that allows subclasses to decide which object to instantiate. It is typically used when it cannot be anticipated what specific class needs to be created, or when you want to delegate responsibility of object creation to a helper.

The advantage of this is that the client code only has to deal with the interface, and not rely on some specific implementation. The design can then be more open.

A typical example of a factory is a when a container hands out datasource connections.
Nice job Derek. That's terrifc.
17 years ago
There has been an issue with the SCEA and SCJD exams database. Some people were sent certificates without their exams having been graded by Sun, and I believe others passed without receiveing certificates (as you indicate).

While their site was down for a while yesterday, they are aware of the problem at Prometric, and will hopefully resolve this quickly.
For EJBs, I like Kevin Boone's book Applied Enterprise JavaBeans Technology.

For servlets and JSP, I like Marty Hall's Core Servlets and JSP book.
I agree that passing a certification test will help you pass a technical interview for a programmer position.

I think an important aspect of certification is the focused studying it encourages, especially with respect to corners of the language that you might not readily encounter (such as logical operators).
Another good book that is specific on details is Applied Enterprise JavaBeans Technology by Kevin Boone (Sun Microsystems Press).
I know developers who passed with only writing comments for the public methods and constructors, when given the same instructions. So I would imagine that that would be okay.

I wrote Javadoc for private helper methods if their purpose or relation to the rest of the class wasn't immediately self-evident. But that was more for me, in case I wanted to refer to it later.

Eclipse is terrific. NetBeans works too. Both are free.

I don't think either of these does too much for you at all. I agree with Max that it is important to know what's going on.

For me, it was very useful in the project to use Ant, and both of these IDEs have built-in integration with Ant.
Note that when using singletons it is important to make them thread safe. I think the best way to do this is like this:

This way the code is both thread-safe and lazy-loading. It doesn't use the common solution, which is to make a getInstance method, and make it synchronized. But that can hurt performance, especially since the call only needs to be synchronized the first time.

The SCJD does not make you choose between RMI and NIO, as I think you suggest. The choice is between RMI and net sockets.

There are a few reasons that it makes sense to read the entire SCJD db file into a byte buffer given the character encoding--_if_ the test taker is implementing the database in a way that calls for reading in all the records. Many people don't do that, and do quite well on the exam.

I think NIO is fast and reliable. If people are interested working with areas of Java technology that might be new to them, then the SCJD offers an excellent opporunity to do that. Maybe people don't have occasion to learn NIO at their jobs; they can do so here. I think this sort of use of the cert exams is better than just getting through the thing as quickly as possible just to get the paper.

So I have a couple of questions.

What's the part where NIO is "flakey"?

How is it "clever" to use a standard Java library in the exact way it is intended to be used, to do something standard like reading bytes from a file?

I believe the SCJD project is not marked on the basis of cleverness, but rather on straight forward understandable maintainable results.

That is true. However, I fail to see what is not maintainable or understandable about using a standard library in a standard way.

NIO was included, as you know, in SDK 1.4.0, which was released 2 years ago. Since you "have used it a great deal for a long time", how exactly is NIO "bleeding edge stuff"?

I am just asking, because that is a fairly common question in this forum it seems ("Can I use NIO?", "Is it a good idea?", etc.). It is good for test takers have an understanding of the advantages and disadvantages of why/how/when to employ something.

Perhaps you have more specific reasons why test takers should avoid it?

I didn't interpret that as meaning I must not lock if in non-networked mode. But it would reduce overhead if your app recognized that you were in non-networked mode and did not lock as a consequence.

"At a minimum you must be concerned X" != "You must do only and precisely X". That is, X is a subset of things with which you might be concerned.

That's how I interpreted it, but defensively didn't lock the records in non-networked mode, since it is not necessary to do so.