Tomcat hosting - Inside the Handle Different vendors define their concrete
Inside the Handle Different vendors define their concrete implementations of the EJB handle differently. However, thinking about a hypothetical implementation of handles will give you a better understanding of how they work. In this example, we define the implementation of a handle for an entity bean. Our implementation encapsulates the JNDI lookup and use of the home s findByPrimaryKey() method so that any change that invalidates the key invalidates preserved handles that depend on that key. Here s the code for our hypothetical implementation of a Handle: package com.titan.cabin; import javax.naming.InitialContext; import javax.naming.Context; import javax.naming.NamingException; import javax.ejb.EJBObject; import javax.ejb.Handle; import java.rmi.RemoteException; import java.util.Properties; import javax.rmi.PortableRemoteObject public class VendorX_CabinHandle implements javax.ejb.Handle, java.io.Serializable { private Integer primary_key; private String home_name; private Properties jndi_properties; public VendorX_CabinHandle(Integer pk, String hn, Properties p) { primary_key = pk; home_name = hn; jndi_properties = p; } public EJBObject getEJBObject() throws RemoteException { try { Context ctx = new InitialContext(jndi_properties); Object ref = ctx.lookup(home_name); CabinHomeRemote home =(CabinHomeRemote) PortableRemoteObject.narrow(ref,CabinHomeRemote.class); return home.findByPrimaryKey(primary_key); } catch (javax.ejb.FinderException fe) { throw new RemoteException(”Cannot locate EJB object”,fe); } catch (javax.naming.NamingException ne) { throw new RemoteException(”Cannot locate EJB object”,ne); } } } Copyright (c) 2001 O’Reilly & Associates
The UK has been a member of the European Union since 1973. The attitude of the present government towards further integration is conservative, with the official opposition favoring a return of some powers and competencies to the UK.From our experience, we can recommend Cheap UK Web Hosting services.