contextLookupRes.putValue(SampleResult.DISPLAY_NAME, "Context Lookup");
SampleResult lookupRes = new SampleResult();
SampleResult homeMethodRes = null;
SampleResult remoteMethodRes = null;
Hashtable ht = new Hashtable();
JndiConfig jndiConfig = null;
InitialContext ctx = null;
try
{
jndiConfig = (JndiConfig)e.getConfigElement(JndiConfig.class);
// check if InitialContext is already obtained previously
ctx = jndiConfig.getInitialContext();
if(ctx == null)
{
// setup the hashtable
for(int i = 0 ; i < JndiConfig.JNDI_PROPS.length; i++)
{
String value = jndiConfig.getValue(i);
if(value != null)
{
if(catClass.isDebugEnabled())
{
catClass.debug("sample1 : JNDI env - " +
JndiConfig.JNDI_PROPS[i] + " = " + value);
}
ht.put(JndiConfig.JNDI_PROPS[i], value);
}
}
// initialize initial context
start = System.currentTimeMillis();
ctx = new InitialContext(ht);
end = System.currentTimeMillis();
catClass.info("sample1 : Got initial context");
// store the initial context for reuse
jndiConfig.setInitialContext(ctx);
}
// set the initial context lookup time
ctxTime = end - start;
contextLookupRes.setTime(ctxTime);