Jon Entwistle

Ranch Hand
+ Follow
since Feb 20, 2003
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 Jon Entwistle

Hi all,

I was looking throough the chapter on CMT in EJB 3 in action (P. 196), and was suprised to see this advice:

"in such cases [when a system exception is thrown] the container will assume that the bean is inconsistent and will destroy the instance. Because unnecessarily destroying bean instances is costly, you should never deliberately use system exceptions."

Is this correct? Surely this only applies to SFSB instances?

Also, based on my experience I would argue that SLSB methods should only throw checked exceptions if clients can reasonably be expected to take some remedial action. Otherwise (the most common case) checked exceptions should be wrapped in a runtime exception (which in turn would be wrapped in an EJBException) and interpreted in an error handler in the client to show an appropriate error message based on the exception type/message.

I want to make sure that the error handling strategies that I apply follow best practices, but this comment has left me wondering. Any comments/opinions appreciated!

Regards

Jon


Hi Katrin,

We were lucky enough to have the courses SL-425 (Designing Architectures for Enterprise Java Applications) and SL-500 (Java EE Patterns) as part of our education program at work.

They are both very good courses, although Jeanne is right in that SL-425 is the most relevant (the course books alone are very valuable preparing for the exam).

Good luck!

Jon
Hi Quincy,

I am guessing that you have installed using eclipse ganymede. The plugin is only compatible with version M5 and not the final release. This is due to the incorporation of BEA into Oracle, as they are incorportating this plugin into the oracle set of tools instead of updating the BEA set.

http://forums.bea.com/thread.jspa?threadID=5700001945

Solution: downgrade to eclipse europa, or use the BEA workschop eclipse release that comes with the weblogic server (or downloaded seperately for free).

Cheers,

Jon
Thanks for the tip. I followed your advice and created and initialised the form bean in the preceeding Action and added it to the scope needed, it all works fine.

Cheers,

Jon
13 years ago
Hi all,

I am having a bit of a problem getting to grips with checking dynamically generated multiboxes by default, and any pointers would be very much appreciated.

I understand that in order to check a multibox option, the value of the multibox item should be inlcuded in the array of values for the multibox (this is explained quite nicely at http://husted.com/struts/tips/007.html).

In order to check a value by default as I understand it, the value could be added to the array in the Form's constructor.

My problem is that I am creating the multibox items on the fly, and so do not know the values to add to the array when I construct the Form bean. How can I get around this?

Again, any insight appreciated.

Regards,

Jon
[ December 05, 2004: Message edited by: Jon Entwistle ]
13 years ago
Hi Nikolai,

Just toi add to what Theodore has said, the exam is just to check that it was you who took the exam - it doesn't effect you grade.

Regards,

Jon
Hi Alain,


Every client has to have the remote server stub classes stored locally to enable operatibility without a HTTP server or dynamic class downloading.

Is this correct?


Yes.


Regards,

Jon
Hi Burk,

I developed my assignment on FreeBSD with the port of JDK 1.4_4. I found some serious bugs in the JDK such as writing to a non-existant file doesn't throw an exception to name just one.

I decided the best option was to switch to Linux were the bugs did not show and use this as the development platform in version.txt.

If I were you I would put windows in the version.txt, upload, and let Sun stress about their bugs

Regards,

Jon
[ July 28, 2004: Message edited by: Jon Entwistle ]
Hi Ole,

The way most people approach this is not to try to dynamicaly update the view, but check for dirty reads when updating the database and showing an error message if this is the case.

Regards,

Jon
Hi Anton,



that each Data object has to be able to access the file concurrently, i.e., lock a portion of the file via a static controlling Map, say, in the Data class, and then write to the locked region. I mean, using RandomAccessFile it can be accomplished concurrently.


It is your call, but is seems a pretty complex solution to me. Have you considered having just one Data class instance which is accessed by the server to service all client requests?


What I now think I should do is just specify in the static Map structure that a certain record is being used so that another Data object would not proceed to modify it at the same time. All the locking is in that Map structure. In that way, all I have to do is synchronize on the Map,


If I see this right more than one thread could be writing to the file at the same time here (even though on different records) which would corrupt the file.


1) Do I need to use a synchronized Collection, or can I get away with unsynchronized one?


If you are going to be accessing the collection with more than one thread concurrenly then yes.


2) Do I need to make the Data class thread-safe?


You need to make all objects accessed by more than one thread concurrently thread-safe.


Regards,

Jon
Hi Anton,

That's how I read it at first: that only one client at a time can access the file.

Please tell me if I am wrong but I think that this is where you might be having problems conceptualy with this - the client actualy never accesses the file. The only thing any client does is to ask the server to access the file on its behalf - it is up to the server to manage these requests from any number of concurrent clients, which it must do without violating the record (i.e. cookie) locking contract and without corrupting the file or any shared variables.

Regards,

Jon
Hi James,

I took this to mean that we need to allow the user to search by criteria or return all records in the database, i.e. two search functions in the interface.

Regards,

Jon
Hi Along,


In JTable, two rows, which is set date is 25/07/2004 and 26/07/2004 respectively, relate to the same room? or one row individually represent a room?



I would look at it as each row in the table represents a 'vacancy' on a particular date at a particular hotel/hostel rather than a particular room (the data we are given does not distinguish between rooms).

So two rows at the same hotel for dates 25/07/2004 and 26/07/2004 just says that there is a vacancy at the given hotel on these two dates (this could be the same room or different rooms).

Does this clear it up for you?

Regards,

Jon
Ah - I see. The danger I see with that is if you delete one record from the database file (rather than mark it as deleted), all of your cookies will point to the wrong records - I would go for something simpler if I were you like incrementing a variable.

Regards,

Jon
Hi Anton,

There are two issues which need locking in the assignment and I am not too sure which you are refering to - remember that they are both seperate issues:

The first issue is to prevent concurrent writes on the database file. On my instructions (and I think it is the same with all asignments) I was told to assume that only the app I was developing would access the file. With that assumption you can use synchronisation to ensure that db writes are not corrupted.

The second issue is record locking controlled by the locking cookie. You mentioned using the byte at the begining of the record to track the cookie - this byte is just a deleted flag (1 or 0) so it is not suitable. The way the majority of people do this is using a Map (possibly using a seperate lock manager class) to relate a cookie to a record number - you can use this object as the monitor for the wait() in lock() and notifyall() in unlock(). I just used a long starting at 0 and incremented by one each time a cookie was needed as the cookie value.

Hope this clears it up a bit....

Regards,

Jon
[ July 25, 2004: Message edited by: Jon Entwistle ]