diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java | 61 | ||||
-rw-r--r-- | plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (H2 offline).launch | 1 |
2 files changed, 24 insertions, 38 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java index 1c29ab2923..eaa096cf8a 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java @@ -31,8 +31,6 @@ import org.eclipse.emf.cdo.spi.server.InternalSessionManager; import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump; import org.eclipse.net4j.util.container.Container; -import org.eclipse.net4j.util.event.IEvent; -import org.eclipse.net4j.util.event.IListener; import org.eclipse.net4j.util.lifecycle.LifecycleUtil; import org.eclipse.net4j.util.om.trace.ContextTracer; import org.eclipse.net4j.util.security.IRandomizer; @@ -57,27 +55,6 @@ public class SessionManager extends Container<ISession> implements InternalSessi private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_SESSION, SessionManager.class); - private IListener repositoryListener = new IListener() - { - public void notifyEvent(IEvent event) - { - if (event instanceof CDOCommonRepository.StateChangedEvent) - { - CDOCommonRepository.StateChangedEvent e = (CDOCommonRepository.StateChangedEvent)event; - CDOCommonRepository.State state = e.getNewState(); - switch (state) - { - case INITIAL: - case OFFLINE: - case SYNCING: - case ONLINE: - - break; - } - } - } - }; - private InternalRepository repository; @ExcludeFromDump @@ -120,16 +97,7 @@ public class SessionManager extends Container<ISession> implements InternalSessi public void setRepository(InternalRepository repository) { checkInactive(); - if (this.repository != null) - { - this.repository.removeListener(repositoryListener); - } - this.repository = repository; - if (this.repository != null) - { - this.repository.addListener(repositoryListener); - } } public String getEncryptionAlgorithmName() @@ -238,11 +206,7 @@ public class SessionManager extends Container<ISession> implements InternalSessi { if (sessionProtocol != null) { - CDOID rootResourceID = repository.getRootResourceID(); - if (CDOIDUtil.isNull(rootResourceID)) - { - throw new IllegalStateException("Root resource has not been initialized in " + repository); - } + ensureRootResourceInitialized(); } int id = lastSessionID.incrementAndGet(); @@ -265,6 +229,29 @@ public class SessionManager extends Container<ISession> implements InternalSessi return session; } + protected void ensureRootResourceInitialized() + { + for (int i = 0; i < 20; i++) + { + CDOID rootResourceID = repository.getRootResourceID(); + if (!CDOIDUtil.isNull(rootResourceID)) + { + return; + } + + try + { + Thread.sleep(100); + } + catch (InterruptedException ex) + { + break; + } + } + + throw new IllegalStateException("Root resource has not been initialized in " + repository); + } + protected InternalSession createSession(int id, String userID, ISessionProtocol protocol) { return new Session(this, protocol, id, userID); diff --git a/plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (H2 offline).launch b/plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (H2 offline).launch index 5c62efd2d8..3eff4a82c0 100644 --- a/plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (H2 offline).launch +++ b/plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (H2 offline).launch @@ -15,7 +15,6 @@ <booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/> <stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/> <stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/> -<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6"/> <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.emf.cdo.tests.db.AllTestsDBH2Offline"/> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.emf.cdo.tests.db"/> <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx1024m"/> |