Java Reference
In-Depth Information
L ISTING 12.3
Continued
public Float getCurrentInterestRate() throws RemoteException {
Float yearlyInt = null;
try {
// Obtain the enterprise bean's environment
// naming context.
Context initCtx = new InitialContext();
Context myEnv =
(Context)initCtx.lookup(“java:comp/env”);
12
// Obtain the yearly interest rate from the
// bean's environment
yearlyInt = (Float)myEnv.lookup(“interestRate”);
}
catch (javax.naming.NamingException nex) {
// If there was a problem with JNDI,
// getting the yearly interest
// rate, we will just default it to 8%
yearlyInt = new Float(8.0f);
}
return yearlyInt;
}
public void ejbCreate() throws javax.ejb.CreateException,
java.rmi.RemoteException {
}
public void ejbActivate() throws javax.ejb.EJBException,
java.rmi.RemoteException {
}
public void ejbPassivate() throws javax.ejb.EJBException,
java.rmi.RemoteException {
}
public void ejbRemove() throws javax.ejb.EJBException,
java.rmi.RemoteException {
}
 
Search WWH ::




Custom Search