views:

262

answers:

1

Hi All

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

A: 

Below are some of the code snippets:


  1. Singleton VO class

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... .....

..


  1. Singleton initialized during J2SE startup:

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);


  1. When doing mConfigurationInfo.getter (methods) on the received obj from server, it does not show the values set by EJB, but shows the default value set during object creation.
inside ds.getNPConfigurationDetails are you updating properties on mConfigurationInfo with values from the server or just using it as a param? You seem to be overwriting your reference with a new object from the server, how are you getting it back into your singleton holder?
Affe
ds.getNPConfigurationDetails, invokes the method in EJB where i am setting the values for mConfigurationInfo.
I am creating new object for TekelecConfigurationInfo class with ref variable mConfigurationInfo, and passing to EJB in this callds.getNPConfigurationDetails(sigConfigId, tekelecConfigId, mConfigurationInfo);and assigning same ref variable to receive the updated obj.Is there any issue here?