stateless session bean is caching data ???
tfulton Jul 13, 2006 1:50 PMHi,
I've got a stateless session bean that appears to be indeed caching data between clients. Its really bumming me out. Can anyone at all see why?
Anyone?
Todd
CODE
-----------------------------------------------------------------
package com.bgi.kmdp.aqs.commands.simplefeed;
. . . .
import org.apache.log4j.Logger;
import org.apache.xmlbeans.XmlObject;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;
import java.util.Vector;
/**
* Created by IntelliJ IDEA.
* User: fulttod
* Date: May 11, 2006
* Time: 1:39:23 PM
* To change this template use File | Settings | File Templates.
*/
public class SimpleFeedBean
extends BaseEJBSessionBean {
private static Logger logger = Logger.getLogger(SimpleFeed.class);
private Vector results = new Vector();
/**
* Implemented method from BaseCommand.
*
* @param args
* @param commandConfig
* @return int status
* @throws RemoteException
* @throws BaseException
*/
public int execute(XmlObject args, CommandConfig commandConfig)
throws RemoteException, BaseException {
logger.info("BEGIN: SimpleFeedBean.execute");
try {
// get our args
GetfeedRequest request = (GetfeedRequest) args;
request.validate();
String feedName = request.getFeedName();
// get our feed configurations
ServiceConfig svcConfig = ConfigLoader.getInstance().getServiceConfig();
FeedConfig feedConfig = svcConfig.findFeedConfig(feedName);
logger.info("FeedConfig acquired for feedname = '" + feedName + "'");
logger.info("\tConfig name: " + feedConfig.getName());
logger.info("\tConfig url: " + feedConfig.getUrl());
logger.info("\tConfig file base: " + feedConfig.getFileBase());
logger.info("\tConfig file extension: " + feedConfig.getFileExtension());
// get our service adapter and process it
RetrievalLogger rLogger = new RetrievalLogger(request, feedConfig);
rLogger.start(); // start the logger
BaseServiceAdapterFactory adapterFactory = new BaseServiceAdapterFactory();
BaseServiceAdapter adapter = adapterFactory.getProtocolAdapter(new URL(feedConfig.getUrl()).getProtocol());
adapter.process(request, feedConfig);
String filePath = (String) adapter.getServiceResult();
// DEBUG ONLY !!!
logger.info("\tFilepath from Adapter: " + filePath);
// DEBUG ONLY !!!
// generate a url which an external system may use to access the file
ArgumentConfig arg = commandConfig.findArgumentConfig("httpbase");
String httpBase = arg.getValue();
int index = filePath.lastIndexOf('/');
String fileName = filePath.substring(index + 1);
String strUrl = httpBase + fileName;
URL url = new URL(strUrl);
results.add(url);
// DEBUG ONLY!!!
logger.info("\tURL passed to rLogger: " + url.toString());
logger.info("\tResults size: " + results.size());
// DEBUG ONLY!!!
rLogger.stop(new File(filePath), url); // stop the logger (which also catalogs the feed instance)
}
catch (MalformedURLException ue) {
logger.error(ue);
return BaseCommand.ERROR;
}
catch (BaseException e) {
logger.error(e);
return BaseCommand.ERROR;
}
logger.info("END: SimpleFeedBean.execute");
return BaseCommand.SUCCESS;
}
/**
* Implemented method from BaseCommand.
*
* @return An instance of AQSResult
* @throws RemoteException
*/
public Object getResults()
throws RemoteException {
return results;
}
}
OUTPUT FROM CONSOLE (each line is different client/invocation -- see timestamp of log)
----------------------------------------------------------------
10:44:52,374 INFO [SimpleFeed] URL passed to rLogger: http://localhost:8080/aqs/20060713_1044_52kmdp_bb18_20060601.dat.EUR
10:44:52,374 INFO [SimpleFeed] Results size: 1
10:45:07,812 INFO [SimpleFeed] URL passed to rLogger: http://localhost:8080/aqs/20060713_1045_7kmdp_bb18_20060601.dat.EUR
10:45:07,812 INFO [SimpleFeed] Results size: 2
10:45:32,626 INFO [SimpleFeed] URL passed to rLogger: http://localhost:8080/aqs/20060713_1045_32kmdp_bb18_20060601.dat.EUR
10:45:32,626 INFO [SimpleFeed] Results size: 3
CONFIG SNIPPETS
------------------------------------------------------------------
EJB-JAR.XML
<display-name>SimpleFeedCommand Session Bean</display-name>
<ejb-name>SimpleFeed</ejb-name>
com.bgi.kmdp.aqs.commands.simplefeed.SimpleFeedHome
com.bgi.kmdp.aqs.commands.simplefeed.SimpleFeed
<ejb-class>com.bgi.kmdp.aqs.commands.simplefeed.SimpleFeedBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
JBOSS.XML
[nothing in this file for this bean]