Reputation: 3065
I have a J2SE application having user threads running in a separate JVM outside JBOSS server. During startup, J2SE invokes a EJB inside jboss, by passing a new object(singleton) of simple JAVA VO class having getter/setter methods. {The VO class is a singleton and implements serialiable(as mandated by EJB)}.
EJB receives the object, reads all db configuration and uses the setter methods of new object to set all the values. It then returns back this updated object back to J2SE in the same remote call.
After J2SE receives the object(singleton/serializable), if i invoke getter methods, I could see only default values set during object creation before EJB call, and not the values set by the EJB.
Kindly throw some light on, why the received object from EJB does not see any updated values and how to rectify this.
I believe it got to do with object initialization during deserialization. And i tried overriding readResolve() in the VO class, but of no help.
With Regards, Krishna
Upvotes: 0
Views: 1358
Reputation: 3065
Below are some of the code snippets:
public class TekelecConfigurationInfo implements Serializable{ /** * */ private static final long serialVersionUID = -7518766779917305604L;
/**
*
*/
private static TekelecConfigurationInfo mObjectReference = null;
String mActiveStandby;
String mActiveIPAddress;
String mStandByIPAddress;
int mActiveLNPDBPort;
int mStandByLNPDBPort;
int mDBPort;
int mActiveSocketTimeOut;
int mStandBySocketTimeOut;
int mThreadCount;
int mRetryCount;
int mRetryInterval;
int mPublisher_Daemon_interval;
int mProvisioning_Daemon_interval;
String mCountryCode;
String serverType;
String DataPerTxn;
int maxRetryCount;
String commandMode;
String dataDir;
String fileName;
String errorCodes;
int tekelecCmdTimeOutVal;
public int getTekelecCmdTimeOutVal() {
return tekelecCmdTimeOutVal;
}
public void setTekelecCmdTimeOutVal(int tekelecCmdTimeOutVal) {
this.tekelecCmdTimeOutVal = tekelecCmdTimeOutVal;
}
public String getErrorCodes() {
return errorCodes;
}
public void setErrorCodes(String errorCodes) {
this.errorCodes = errorCodes;
}
public String getDataDir() {
return dataDir;
}
public void setDataDir(String dataDir) {
this.dataDir = dataDir;
}
private TekelecConfigurationInfo()
{
}
public static TekelecConfigurationInfo getObjectReference()
{
if(mObjectReference == null)
{
mObjectReference = new TekelecConfigurationInfo();
}
return mObjectReference;
}
/**
* @return Returns the mActiveStandby.
*/
public String getActiveStandby() {
return mActiveStandby;
}
/**
* @param activeStandby The mActiveStandby to set.
*/
public void setActiveStandby(String activeStandby) {
mActiveStandby = activeStandby;
}
//and so on... .....
..
mConfigurationInfo = TekelecConfigurationInfo.getObjectReference();
//Call to EJB from J2SE:
public TekelecConfigurationInfo getNPConfigurationDetails( long sigConfigId,long tekelecConfigId, TekelecConfigurationInfo mConfigurationInfo )throws TekelecException
{
Context ic;
try {
ic = getInitialContext();
Object obj = ic.lookup(JNDI_NAME);
ReadNPConfigurationTableEJBRemote ds = (ReadNPConfigurationTableEJBRemote) obj;
mConfigurationInfo = ds.getNPConfigurationDetails(sigConfigId, tekelecConfigId, mConfigurationInfo);
Upvotes: 0