private ObjectServerImpl(LocalObjectContainer container, ServerConfigurationImpl 
			serverConfig, int port, bool isEmbeddedServer)
		{
			_isEmbeddedServer = isEmbeddedServer;
			_container = container;
			_serverConfig = serverConfig;
			_socketFactory = serverConfig.Networking.SocketFactory;
			_transactionPool = new ClientTransactionPool(container);
			_port = port;
			_name = "db4o ServerSocket FILE: " + container.ToString() + "  PORT:" + _port;
			_container.SetServer(true);
			ConfigureObjectServer();
			_classInfoHelper = new Db4objects.Db4o.CS.Internal.ClassInfoHelper(Db4oClientServerLegacyConfigurationBridge
				.AsLegacy(serverConfig));
			_container.ClassCollection().CheckAllClassChanges();
			bool ok = false;
			try
			{
				EnsureLoadStaticClass();
				StartCommittedCallbackThread(_committedInfosQueue);
				StartServer();
				if (_serverConfig != null)
				{
					_serverConfig.ApplyConfigurationItems(this);
				}
				ok = true;
			}
			finally
			{
				if (!ok)
				{
					Close();
				}
			}
		}
		public virtual void TestHandles()
		{
			IConfiguration config = Db4oFactory.NewConfiguration();
			config.Storage = new MemoryStorage();
			LocalObjectContainer db = (LocalObjectContainer)Db4oFactory.OpenFile(config, ClientTransactionTestUtil
				.MainfileName);
			ClientTransactionPool pool = new ClientTransactionPool(db);
			try
			{
				ClientTransactionHandle handleA = new ClientTransactionHandle(pool);
				Assert.AreEqual(db, handleA.Transaction().Container());
				ClientTransactionHandle handleB = new ClientTransactionHandle(pool);
				Assert.AreNotEqual(handleA.Transaction(), handleB.Transaction());
				Assert.AreEqual(db, handleB.Transaction().Container());
				Assert.AreEqual(2, pool.OpenTransactionCount());
				Assert.AreEqual(1, pool.OpenFileCount());
				handleA.AcquireTransactionForFile(ClientTransactionTestUtil.FilenameA);
				Assert.AreEqual(3, pool.OpenTransactionCount());
				Assert.AreEqual(2, pool.OpenFileCount());
				Assert.AreNotEqual(db, handleA.Transaction().Container());
				handleB.AcquireTransactionForFile(ClientTransactionTestUtil.FilenameA);
				Assert.AreEqual(4, pool.OpenTransactionCount());
				Assert.AreEqual(2, pool.OpenFileCount());
				Assert.AreNotEqual(handleA.Transaction(), handleB.Transaction());
				Assert.AreEqual(handleA.Transaction().Container(), handleB.Transaction().Container
					());
				handleA.ReleaseTransaction(ShutdownMode.Normal);
				Assert.AreEqual(db, handleA.Transaction().Container());
				Assert.AreNotEqual(db, handleB.Transaction().Container());
				Assert.AreEqual(3, pool.OpenTransactionCount());
				Assert.AreEqual(2, pool.OpenFileCount());
				handleB.ReleaseTransaction(ShutdownMode.Normal);
				Assert.AreEqual(db, handleB.Transaction().Container());
				Assert.AreEqual(2, pool.OpenTransactionCount());
				Assert.AreEqual(1, pool.OpenFileCount());
				handleB.Close(ShutdownMode.Normal);
				Assert.AreEqual(1, pool.OpenTransactionCount());
				handleA.Close(ShutdownMode.Normal);
				Assert.AreEqual(0, pool.OpenTransactionCount());
			}
			finally
			{
				pool.Close();
			}
		}
		public virtual void TestPool()
		{
			IConfiguration config = Db4oFactory.NewConfiguration();
			config.Storage = new MemoryStorage();
			LocalObjectContainer db = (LocalObjectContainer)Db4oFactory.OpenFile(config, ClientTransactionTestUtil
				.MainfileName);
			ClientTransactionPool pool = new ClientTransactionPool(db);
			try
			{
				Assert.AreEqual(0, pool.OpenTransactionCount());
				Assert.AreEqual(1, pool.OpenFileCount());
				Transaction trans1 = pool.Acquire(ClientTransactionTestUtil.MainfileName);
				Assert.AreEqual(db, trans1.Container());
				Assert.AreEqual(1, pool.OpenTransactionCount());
				Assert.AreEqual(1, pool.OpenFileCount());
				Transaction trans2 = pool.Acquire(ClientTransactionTestUtil.FilenameA);
				Assert.AreNotEqual(db, trans2.Container());
				Assert.AreEqual(2, pool.OpenTransactionCount());
				Assert.AreEqual(2, pool.OpenFileCount());
				Transaction trans3 = pool.Acquire(ClientTransactionTestUtil.FilenameA);
				Assert.AreEqual(trans2.Container(), trans3.Container());
				Assert.AreEqual(3, pool.OpenTransactionCount());
				Assert.AreEqual(2, pool.OpenFileCount());
				pool.Release(ShutdownMode.Normal, trans3, true);
				Assert.AreEqual(2, pool.OpenTransactionCount());
				Assert.AreEqual(2, pool.OpenFileCount());
				pool.Release(ShutdownMode.Normal, trans2, true);
				Assert.AreEqual(1, pool.OpenTransactionCount());
				Assert.AreEqual(1, pool.OpenFileCount());
			}
			finally
			{
				Assert.IsFalse(db.IsClosed());
				Assert.IsFalse(pool.IsClosed());
				pool.Close();
				Assert.IsTrue(db.IsClosed());
				Assert.IsTrue(pool.IsClosed());
				Assert.AreEqual(0, pool.OpenFileCount());
			}
		}
        private ObjectServerImpl(LocalObjectContainer container, ServerConfigurationImpl
                                 serverConfig, int port, bool isEmbeddedServer)
        {
            _isEmbeddedServer = isEmbeddedServer;
            _container        = container;
            _serverConfig     = serverConfig;
            _socketFactory    = serverConfig.Networking.SocketFactory;
            _transactionPool  = new ClientTransactionPool(container);
            _port             = port;
            _name             = "db4o ServerSocket FILE: " + container.ToString() + "  PORT:" + _port;
            _container.SetServer(true);
            ConfigureObjectServer();
            _classInfoHelper = new Db4objects.Db4o.CS.Internal.ClassInfoHelper(Db4oClientServerLegacyConfigurationBridge
                                                                               .AsLegacy(serverConfig));
            _container.ClassCollection().CheckAllClassChanges();
            bool ok = false;

            try
            {
                EnsureLoadStaticClass();
                StartCommittedCallbackThread(_committedInfosQueue);
                StartServer();
                if (_serverConfig != null)
                {
                    _serverConfig.ApplyConfigurationItems(this);
                }
                ok = true;
            }
            finally
            {
                if (!ok)
                {
                    Close();
                }
            }
        }
 public ClientTransactionHandle(ClientTransactionPool transactionPool)
 {
     _transactionPool = transactionPool;
     _mainTransaction = _transactionPool.AcquireMain();
     _rollbackOnClose = true;
 }
		public ClientTransactionHandle(ClientTransactionPool transactionPool)
		{
			_transactionPool = transactionPool;
			_mainTransaction = _transactionPool.AcquireMain();
			_rollbackOnClose = true;
		}