FileDocCategorySizeDatePackage
PersistentFileStoreManager.javaAPI DocGlassfish v2 API4464Fri May 04 22:32:56 BST 2007com.sun.ejb.base.sfsb

PersistentFileStoreManager

public class PersistentFileStoreManager extends AbstractFileStoreManager
author
Mahesh Kannan

Fields Summary
private com.sun.ejb.spi.sfsb.SFSBUUIDUtil
uuidGenerator
Constructors Summary
public PersistentFileStoreManager()
No arg constructor

    
Methods Summary
public com.sun.ejb.spi.sfsb.SFSBUUIDUtilgetUUIDUtil()

        return uuidGenerator;
    
protected voidonInitialization()


        try {
	    uuidGenerator = new SimpleKeyGenerator();
    
	    if (baseDir.isDirectory()) {
		String[] fileNames = baseDir.list();
		_logger.log(Level.FINE, storeManagerName
		    + "; removing: " + fileNames.length + " sessions");

		removeExpiredPassivatedSessions(fileNames);     
	    }
	} catch (Exception ex) {
	    _logger.log(Level.WARNING, "ejb.sfsb_persistmgr_oninit_failed",
		    new Object[] {storeManagerName});
	    _logger.log(Level.WARNING, "ejb.sfsb_persistmgr_oninit_failed_exception", ex);
	}
    
private voidremoveExpiredPassivatedSessions(java.lang.String[] fileNames)

	if (fileNames.length > 0) {
	    AsyncFileRemovalTask  task = new AsyncFileRemovalTask(
		    this, fileNames);
	    try {
		ContainerService service = ContainerFactoryImpl.getContainerService();

		//scheduleWork performs the task on the same thread
		//  if it cannot schedule the task for async execution
		service.scheduleWork(super.getClassLoader(), task);
	    } catch (Throwable th) {
		//We would be here only if containerService is null

		_logger.log(Level.FINE, storeManagerName
			+ ": Cannot execute file removal aynchronously", th);

		//Execute in the current thread
		task.run(); //Doesn't throw any exception
	    }
	}
    
public voidshutdown()

        super.shutdown();