This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ResourceBundle instead of I/O in EJB

 
paul wheaton
Trailboss
Pie
Posts: 21664
Firefox Browser IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know that I/O violates "bean law", but it looks like using the ResourceBundle stuff does not.
Is using ResourceBundle within EJB following bean law?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, the reason listed in the spec is because java.io.* isn't "well-suited" compared to things like JDBC for business data access. Sounds a little murky to me.
If you use the resource bundle manager you wouldn't (directly) be using java.io, but the access is read-only.
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And I guess that there's nothing stopping you from using a JDBC-backed ResourceBundle.
 
sandy gupta
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is JDBC backed ResourceBundle.....First time i am hearing of such a thing and would like to know more :roll:
Simon, Out with all the kitties in that bag
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by sandy ind:
Simon, Out with all the kitties in that bag


Well a ResourceBundle is an abstract class, with concrete implementations including a properties file backed bundle, where the resources are loaded from a properties file. So why not write another concrete implementation that loads the resources from a database?
[seems a little off-topic from J2EE/EJB now!]
Simon
 
Reid M. Pinchback
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tim Holloway:
[QB]Actually, the reason listed in the spec is because java.io.* isn't "well-suited" compared to things like JDBC for business data access. Sounds a little murky to me.
I'm not sure what the wording of the spec is, but I can think of a practical reason for avoiding I/O in EJB. I/O operations can block. Blocking makes threads unrunnable. You aren't managing the threads, the EJB container is. The container won't know what you did (at least not without a lot of introspective effort). Doesn't sound like a great situation for holding a container responsible for managing resources.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic