}
public SFSBBeanState getState(Object sessionKey) {
String fileName = sessionKey.toString();
SFSBBeanState beanState = null;
if(_logger.isLoggable(TRACE_LEVEL)) {
_logger.log(TRACE_LEVEL, "[SFSBStore] Attempting to load session: "
+ sessionKey);
}
if (passivatedSessions.remove(fileName) == null) {
if(_logger.isLoggable(TRACE_LEVEL)) {
_logger.log(TRACE_LEVEL, "[SFSBStore] Could not find "
+ "state for session: " + sessionKey);
}
return null;
}
File file = new File(baseDir, fileName);
if (file.exists()) {
int dataSize = (int) file.length();
byte[] data = new byte[dataSize];
BufferedInputStream bis = null;
FileInputStream fis = null;
try {
loadCount++;
fis = new FileInputStream(file);
bis = new BufferedInputStream(fis);
int offset = 0;
for (int toRead = dataSize; toRead > 0; ) {
int count = bis.read(data, offset, toRead);
offset += count;
toRead -= count;
}
beanState = new SFSBBeanState(sessionKey, -1, false, data);
loadSuccessCount++;
if(_logger.isLoggable(TRACE_LEVEL)) {
_logger.log(TRACE_LEVEL, "[SFSBStore] Successfully Loaded "
+ "session: " + sessionKey);
}