ITworld.com
  Search  
ITworld Home Page ITworld Webcasts ITworld White Papers ITworld Newsletters ITworld News ITworld Topics Careers ITworld Voices ITwhirled Changing the way you view IT
It Takes a Client...
JAVA IN THE ENTERPRISE --- 08/06/2002

David Wall

Last week, we looked at a way (recommended in "Core J2EE Patterns: Best Practices and Design Strategies," new from O'Reilly & Associates) to optimize Java Naming and Directory Interface (JNDI) lookup by implementing a singleton object in Enterprise JavaBeans (EJB) systems. Such a ServiceLocator object makes possible some economies of scale in JNDI activity and eases the process of requesting objects from the EJB environment. 

On this topic

A client makes requests of the ServiceLocator class by first instantiating it:

ServiceLocator serviceLocator = ServiceLocator.getInstance();

Then, the client requests an EJBHome object from the ServiceLocator class:

ProjectHome projectHome = (ProjectHome) serviceLocator.getHome(ServiceLocator.Services.PROJECT );

After that, you have an EJBHome object ready for interaction with the client. All of the tedious JNDI stuff is out of the way.

 

David Wall works as a freelance writer, programmer, lecturer, and consultant. Based near Washington, D.C., David has written and co- written several books, including Graphics Programming with JFC. David can be reached at David.Wall@itworld.com.



Advertisements
Sponsored links
Bring harmony to your mix of UNIX-Linux-Windows computing environments
KODAK i1400 Series Scanners stand up to the challenge
Top 5 Reasons to Combine App Performance and Security
Locate Hidden Software on business PCs with this free tool
 Home   Newsletters  JAVA IN THE ENTERPRISE
www.itworld.com    open.itworld.com     security.itworld.com     smallbusiness.itworld.com
storage.itworld.com     utilitycomputing.itworld.com     wireless.itworld.com

 
Contact Us   About Us   Privacy Policy    Terms of Service   Reprints  

CIO   Computerworld   CSO   GamePro   Games.net   IDG Connect   IDG World Expo   Industry Standard   Infoworld   ITworld   JavaWorld   LinuxWorld  MacUser   Macworld   Network World   PC World   Playlist  

Copyright © Computerworld, Inc. All rights reserved

Reproduction in whole or in part in any form or medium without express written permission of Computerworld Inc. is prohibited. Computerworld and Computerworld.com and the respective logos are trademarks of International Data Group Inc.