import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.argeo.ArgeoException;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.beans.factory.FactoryBean;
-import org.springframework.beans.factory.InitializingBean;
/** Proxy JCR sessions and attach them to calling threads. */
-public class ThreadBoundJcrSessionFactory implements FactoryBean,
- InitializingBean, DisposableBean {
+public abstract class ThreadBoundJcrSessionFactory {
private final static Log log = LogFactory
.getLog(ThreadBoundJcrSessionFactory.class);
}
/** Logs in to the repository using various strategies. */
- protected Session login() {
+ protected synchronized Session login() {
if (!isActive())
throw new ArgeoException("Thread bound session factory inactive");
return proxiedSession;
}
- public void afterPropertiesSet() throws Exception {
+ public void init() throws Exception {
monitoringThread = new MonitoringThread();
monitoringThread.start();
}
- public synchronized void destroy() throws Exception {
+ public synchronized void dispose() throws Exception {
if (activeSessions.size() == 0)
return;
/** Monitors registered thread in order to clean up dead ones. */
private class MonitoringThread extends Thread {
+ public MonitoringThread() {
+ super("ThreadBound JCR Session Monitor");
+ }
+
@Override
public void run() {
while (isActive()) {