X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.server.jcr%2Fsrc%2Forg%2Fargeo%2Fjcr%2FThreadBoundJcrSessionFactory.java;h=9662e221b026ecd7eda1257af1e7c44fd61ffb29;hb=3a0d866fbeea3f78c293212f4b4fbaeba7dfe2bd;hp=193f22c48c99780e72af4c70a7956cab8ed07370;hpb=cf3a914f6fbf31b43be5cb86e54d05e8543be6a9;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.server.jcr/src/org/argeo/jcr/ThreadBoundJcrSessionFactory.java b/org.argeo.server.jcr/src/org/argeo/jcr/ThreadBoundJcrSessionFactory.java index 193f22c48..9662e221b 100644 --- a/org.argeo.server.jcr/src/org/argeo/jcr/ThreadBoundJcrSessionFactory.java +++ b/org.argeo.server.jcr/src/org/argeo/jcr/ThreadBoundJcrSessionFactory.java @@ -34,9 +34,9 @@ import javax.jcr.SimpleCredentials; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.argeo.ArgeoException; /** Proxy JCR sessions and attach them to calling threads. */ +@Deprecated public abstract class ThreadBoundJcrSessionFactory { private final static Log log = LogFactory .getLog(ThreadBoundJcrSessionFactory.class); @@ -73,7 +73,7 @@ public abstract class ThreadBoundJcrSessionFactory { /** Logs in to the repository using various strategies. */ protected synchronized Session login() { if (!isActive()) - throw new ArgeoException("Thread bound session factory inactive"); + throw new ArgeoJcrException("Thread bound session factory inactive"); // discard session previously attached to this thread Thread thread = Thread.currentThread(); @@ -95,7 +95,7 @@ public abstract class ThreadBoundJcrSessionFactory { // invalid credentials, go to the next step } catch (RepositoryException e1) { // other kind of exception, fail - throw new ArgeoException("Cannot log in to repository", e1); + throw new ArgeoJcrException("Cannot log in to repository", e1); } // log using default username / password (useful for testing purposes) @@ -105,7 +105,7 @@ public abstract class ThreadBoundJcrSessionFactory { defaultPassword.toCharArray()); newSession = repository().login(sc, workspace); } catch (RepositoryException e) { - throw new ArgeoException("Cannot log in to repository", e); + throw new ArgeoJcrException("Cannot log in to repository", e); } session.set(newSession); @@ -125,13 +125,14 @@ public abstract class ThreadBoundJcrSessionFactory { } public void init() throws Exception { + log.error("SHOULD NOT BE USED ANYMORE"); monitoringThread = new MonitoringThread(); monitoringThread.start(); } - public synchronized void dispose() throws Exception { - if (activeSessions.size() == 0) - return; + public void dispose() throws Exception { + // if (activeSessions.size() == 0) + // return; if (log.isTraceEnabled()) log.trace("Cleaning up " + activeSessions.size() @@ -212,7 +213,7 @@ public abstract class ThreadBoundJcrSessionFactory { if (it.hasNext()) return it.next(); } - throw new ArgeoException("No repository injected"); + throw new ArgeoJcrException("No repository injected"); } // /** Useful for declarative registration of OSGi services (blueprint) */