[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error: ExternalTransaction in a LocalDatabase



On Fri, 26 Jan 2001, Michael Keuchen wrote:
> My own solution to this is:
> 
> - in ExternalDatabase, add method:
> 
>    /** Returns true if a thread has already joined the specified
> transaction. */
>     protected final boolean txHasThread(AbstractTransaction tx)
>     { return (txTable.keyForElement(tx) != null); }
> 
> - in LocalDatabase, change method to:
> 
>   public void joinTX( AbstractTransaction tx ) throws TransactionExc {
> 	if (txHasThread(tx))
> 	    // currently the client side threads are used for server internal
> work;
> 	    // that is, DbLocalClient just calls the appropriate server method;
> but
> 	    // the server can handle only one thread per transaction, therefore
> 	    // jointTX for local connections is not allowed -> one
> (Command)Thread per
> 	    // DbLocalClient
> 	    throw new RuntimeException( "joinTX()" );
> 	else
> 	    super.joinTX(tx);
>     }

The check is okay. However, the ozone requests that are triggered by the
joining (in contrast to the beginning) threads still is not done inside the
proper thread and therefore they are done outside their proper transaction
context. 

Have a look at ExternalDatabase.send(). This calls DxClient.send() to actually
send the command (request) to the server. DbClient is the abstract
representation of a server connection. There are two implementations:
DbLocalClient and DbRemoteClient. DbLocalClient.send() just directly calls
env.transactionsManager.handleCommand() - without any thread mapping.


Falko
-- 
______________________________________________________________________
Falko Braeutigam                              mailto:falko@smb-tec.com
SMB GmbH                                        http://www.smb-tec.com