First page Back Continue Last page Graphics

...Continuation of Notes...


Notes:

SessionBeanBase Example
To illustrate the use of our SessionBeanBase class, here is a slightly revised version of our LegacyAppSessionBean class from earlier:
public class LegacyAppSessionBean extends SessionBeanBase {
// private SessionContext _ctxt; // No longer needed
private String _strIPAddr;
private int _iPort;
private transient Socket _socket;

// Beginning of class as before...

//================================================
// Methods required by SessionBean interface
//================================================

public void ejbPassivate() throws EJBException {
try {
disconnect();
}
catch(IOException ie) {
throw new EJBException(ie);
}
}

public void ejbActivate throws EJBException {
try {
connect(_strIPAddr, _iPort);
}
catch(IOException ie) {
throw new EJBException(ie);
}
}

public void ejbRemove() throws EJBException {
try {
disconnect(); // Close before ending session.
}
catch(IOException ie) {
throw new EJBException(ie);
}
}

// No setSessionContext() needed...
}

Continued...