You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Cesar <ce...@uol.com.br> on 2004/07/06 20:36:14 UTC

Problem with PersistanceBroker

People
I am having one problem of my PersistenceBroker.....
My application(Servlet) begins to create instancias of PersistenceBroker
(this can take days as hours after the start of application) and  mine % of
the CPU increases, using everything that has available in the machine.
 I verified and i´m using PB.close() in all the my calls of bank.
 Has some bug in the version rc3?

I am using the parameters below for the PersistenceBroker.no OJB.properties

maxActive=60
maxIdle=-1
maxWait=5000
timeBetweenEvictionRunsMillis=90000
minEvictableIdleTimeMillis=60000
whenExhaustedAction=1



Log Of application

[main] INFO
 org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl - Create new
PB instance for PBKey org.apache.ojb.broker.PBKey:
repository=jobStoreConnection, user=managerubr, password=*****, already
created persistence broker instances: 0

[main] INFO
 org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl - Create new
PB instance for PBKey org.apache.ojb.broker.PBKey:
repository=jobStoreConnection, user=managerubr, password=*****, already
created persistence broker instances: 1

[main] INFO
 org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl - Create new
PB instance for PBKey org.apache.ojb.broker.PBKey:
repository=jobStoreConnection, user=managerubr, password=*****, already
created persistence broker instances: 2

[main] INFO
 org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl - Create new
PB instance for PBKey org.apache.ojb.broker.PBKey:
repository=jobStoreConnection, user=managerubr, password=*****, already
created persistence broker instances: 3
.
.
.
.

----- Original Message ----- 
From: "André Markwalder" <an...@alabus.com>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Friday, July 02, 2004 1:23 PM
Subject: RE: JBoss have to close connection in managed environment and
nested EJB calls


Hi Armin

I tried the JNDI lookup with the following code and it worked perfectly.
JBoss didn't complained about anything.


regards
André


/**
* @ejb.interface-method
* @ejb.permission  role-name="admin,user"
**/
public void test1() {
Connection conn = null;
try {

InitialContext ctx = new InitialContext();
DataSource ds =
(DataSource)ctx.lookup("java:comp/env/jdbc/AESDS_MAXDB_SALUSA_AES");
conn = ds.getConnection();

ResultSet rs =
conn.createStatement().executeQuery("SELECT COUNT(*) FROM AES_USER");
rs.first();
System.out.println("TEST1: " + rs.getInt(1));

AesUserLocalHome home =
(AesUserLocalHome)ctx.lookup(AesUserLocalHome.JNDI_NAME);
AesUserLocal tmp = home.create();
tmp.test2();

} catch (NamingException e) {
e.printStackTrace();
} catch (CreateException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
finally {
try {
if (conn != null) {
System.out.println("CLOSE CONNECTION
1");
conn.close();
}
} catch (SQLException e1) {
e1.printStackTrace();
}
}
}

/**
* @ejb.interface-method
* @ejb.permission  role-name="admin,user"
**/
public void test2() {
Connection conn = null;
try {

InitialContext ctx = new InitialContext();
DataSource ds =
(DataSource)ctx.lookup("java:comp/env/jdbc/AESDS_MAXDB_SALUSA_AES");
conn = ds.getConnection();

ResultSet rs =
conn.createStatement().executeQuery("SELECT COUNT(*) FROM AES_USER");
rs.first();
System.out.println("TEST2: " + rs.getInt(1));

} catch (NamingException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
finally {
try {
if (conn != null) {
System.out.println("CLOSE CONNECTION
2");
conn.close();
}
} catch (SQLException e1) {
e1.printStackTrace();
}
}
}




-----Original Message-----
From: Armin Waibel [mailto:arminw@apache.org]
Sent: Freitag, 2. Juli 2004 15:03
To: OJB Users List
Subject: Re: JBoss have to close connection in managed environment and
nes ted EJB calls


doh! Sorry I don't read your first post till end.
Seems we don't have a test case for your scenario. There is a session
bean using two beans in another bean (PersonArticleManagerPBBean), but
they never made nested PB calls.
It is not allowed to use nested PB instances in OJB standalone mode, so
I'm not sure about handling in managed environments. Is it possible to
use nested connections in beans? E.g. instead create a PB instance, use
a JNDI connection, do some work, obtain another bean, call bean method,
close obtained JNDI connection. Is this allowed?

regards,
Armin

André Markwalder wrote:

> Hi Armin,
>
> Yes I did.
>
> regards,
> André
>
> -----Original Message-----
> From: Armin Waibel [mailto:arminw@apache.org]
> Sent: Freitag, 2. Juli 2004 14:25
> To: OJB Users List
> Subject: Re: JBoss have to close connection in managed environment and
> nested EJB calls
>
>
> Hi Andre,
>
> do you set
>
PersistenceBrokerFactoryClass=org.apache.ojb.broker.core.PersistenceBrokerFa
> ctorySyncImpl
> in OJB.properties?
>
> regards,
> Armin
>
> André Markwalder wrote:
>
>
>>Hi,
>>
>>I've got the following problem with OJB and JBoss in a managed
>
> environment.
>
>>I do an EJB call to ejbA. Within that EJB I request a PersistenceBroker.
>>After
>>that request I call a second EJB. Let's call it ejbB. Within ejbB I
>
> request
>
>>the same PersistenceBroker. After processing ejbB I release (close) the
>>PersistenceBroker. In ejbA I release (close) also the  PersistenceBroker.
>>
>>The problem is that JBoss informs me, that it has to close a connection
>
> for
>
>>me and I should do it myself.
>>
>>If I close the PersistenceBroker before I call ejbB and reobtain the
>>PersistenceBroker afterwards everything works fine.
>>
>>It seems if I do a nested EJB call (nested retrieval of
>
> PersistenceBroker),
>
>>OJB
>>doesn't close all the connections.
>>
>>Did I something wrong or did I have misconfigured something within JBoss
>
> or
>
>>OJB?
>>
>>I configured OJB as described in the documentation (deployment section).
>>
>>Below you will find the sample source code, JBoss log and OJB.properties
>>file.
>>
>>I use JBoss 3.2.2 (tried also with 3.2.5 same effects) and OJB 1.0.0.
>>
>>
>>
>>Thanks in advance for any help.
>>
>>André
>>
>>
>>
>>
>>Sample source code from EJB:
>>
>> /**
>> * @ejb.interface-method
>> * @ejb.permission  role-name="admin,user"
>> **/
>> public void test1() {
>>
>> System.out.println("GETBROKER 1");
>> PersistenceBroker broker =
>>PersistenceBrokerFactoryFactory.instance().defaultPersistenceBroker();
>>
>> try {
>> System.out.println("TEST1");
>>
>> InitialContext ctx = new InitialContext();
>> AesUserLocalHome home =
>>(AesUserLocalHome)ctx.lookup(AesUserLocalHome.JNDI_NAME);
>> AesUserLocal tmp = home.create();
>> tmp.test2();
>>
>> } catch (NamingException e) {
>> e.printStackTrace();
>> } catch (CreateException e) {
>> e.printStackTrace();
>> }
>> finally {
>> System.out.println("BROKER CLOSED 1");
>> if (broker != null) {
>> broker.close();
>> }
>> }
>> }
>>
>> /**
>> * @ejb.interface-method
>> * @ejb.permission  role-name="admin,user"
>> **/
>> public void test2() {
>> System.out.println("GETBROKER 2");
>> PersistenceBroker broker =
>>PersistenceBrokerFactoryFactory.instance().defaultPersistenceBroker();
>>
>> try {
>> System.out.println("TEST2");
>> }
>> finally {
>> System.out.println("BROKER CLOSED 2");
>> if (broker != null) {
>> broker.close();
>> }
>> }
>> }
>>
>>
>>
>>
>>JBOSS log:
>>
>>13:58:16,232 DEBUG [PersistenceBrokerFactoryDefaultImpl] PersistenceBroker
>>pool will be setup with the following configuration
>>org.apache.commons.pool.impl.Gene
>>ricKeyedObjectPool$Config@733280[
>>  maxIdle=-1
>>  maxActive=100
>>  maxTotal=-1
>>  maxWait=2000
>>  whenExhaustedAction=0
>>  testOnBorrow=false
>>  testOnReturn=false
>>  testWhileIdle=false
>>  timeBetweenEvictionRunsMillis=-1
>>  numTestsPerEvictionRun=10
>>  minEvictableIdleTimeMillis=1000000
>>]
>>13:58:16,242 INFO  [PersistenceBrokerFactoryDefaultImpl] Create
>>PersistenceBroker instance pool, pool configuration was
>>{whenExhaustedAction=0, maxIdle=-1, maxA
>>ctive=100, maxWait=2000, removeAbandoned=false, numTestsPerEvictionRun=10,
>>testWhileIdle=false, minEvictableIdleTimeMillis=1000000,
>
> testOnReturn=false,
>
>>logAband
>>oned=false, removeAbandonedTimeout=300, timeBetweenEvictionRunsMillis=-1,
>>testOnBorrow=false}
>>
>>
>>
>>13:58:16,262 INFO  [STDOUT] GETBROKER 1
>>13:58:17,114 DEBUG [PersistenceBrokerFactoryDefaultImpl] Obtain broker
>
> from
>
>>pool, used PBKey is org.apache.ojb.broker.PBKey: jcdAlias=APPSERVER_AES,
>>user=null,password=null
>>13:58:17,235 INFO  [STDOUT] TEST1
>>13:58:17,235 INFO  [STDOUT] GETBROKER 2
>>13:58:17,235 INFO  [STDOUT] TEST2
>>13:58:17,235 INFO  [STDOUT] BROKER CLOSED 2
>>13:58:17,235 DEBUG
>>[PersistenceBrokerFactorySyncImpl$PersistenceBrokerSyncImpl] PB close was
>>called, only close the PB handle when in JTA-tx
>>13:58:17,235 INFO  [STDOUT] BROKER CLOSED 1
>>13:58:17,235 DEBUG
>>[PersistenceBrokerFactorySyncImpl$PersistenceBrokerSyncImpl] PB close was
>>called, only close the PB handle when in JTA-tx
>>13:58:17,235 DEBUG
>>[PersistenceBrokerFactorySyncImpl$PersistenceBrokerSyncImpl]
>>beforeCompletion was called, nothing to do
>>13:58:17,255 DEBUG
>>[PersistenceBrokerFactorySyncImpl$PersistenceBrokerSyncImpl]
>
> afterCompletion
>
>>was called
>>13:58:17,255 DEBUG
>>[PersistenceBrokerFactorySyncImpl$PersistenceBrokerSyncImpl] Commit PB-tx
>>13:58:17,255 DEBUG
>>[PersistenceBrokerFactorySyncImpl$PersistenceBrokerSyncImpl] Now do real
>>close of PB instance
>>13:58:17,255 INFO  [CachedConnectionManager] Closing a connection for you.
>>Please close them yourself:
>>org.jboss.resource.adapter.jdbc.WrappedConnection@66385e
>>
>>java.lang.Exception: STACKTRACE
>>        at
>>
>
>
org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnect
>
>>ion(CachedConnectionManager.java:285)
>>        at
>>
>
>
org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnecti
>
>>on(BaseConnectionManager2.java:525)
>>        at
>>
>
>
org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManage
>
>>rProxy.allocateConnection(BaseConnectionManager2.java:887)
>>        at
>>
>
>
org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataS
>
>>ource.java:102)
>>        at
>>
>
>
org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.newConnectio
>
>>nFromDataSource(ConnectionFactoryAbstractImpl.java:204)
>>        at
>>
>
>
org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.lookupConnec
>
>>tion(ConnectionFactoryAbstractImpl.java:112)
>>        at
>>
>
>
org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl.lookupConnect
>
>>ion(ConnectionFactoryManagedImpl.java:33)
>>        at
>>
>
>
org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.getConnection(Connec
>
>>tionManagerImpl.java:105)
>>        at
>>
>
>
org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.localBegin(Connectio
>
>>nManagerImpl.java:147)
>>        at
>>
>
>
org.apache.ojb.broker.core.PersistenceBrokerImpl.beginTransaction(Persistenc
>
>>eBrokerImpl.java:394)
>>        at
>>
>
>
org.apache.ojb.broker.core.DelegatingPersistenceBroker.beginTransaction(Dele
>
>>gatingPersistenceBroker.java:138)
>>        at
>>
>
>
org.apache.ojb.broker.core.PersistenceBrokerFactorySyncImpl$PersistenceBroke
>
>>rSyncImpl.internBegin(PersistenceBrokerFactorySyncImpl.java:280)
>>        at
>>
>
>
org.apache.ojb.broker.core.PersistenceBrokerFactorySyncImpl$PersistenceBroke
>
>>rSyncImpl.access$000(PersistenceBrokerFactorySyncImpl.java:225)
>>        at
>>
>
>
org.apache.ojb.broker.core.PersistenceBrokerFactorySyncImpl.wrapRequestedBro
>
>>kerInstance(PersistenceBrokerFactorySyncImpl.java:153)
>>        at
>>
>
>
org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.createPersist
>
>>enceBroker(PersistenceBrokerFactoryDefaultImpl.java:105)
>>        at
>>
>
>
org.apache.ojb.broker.core.PersistenceBrokerFactorySyncImpl.createPersistenc
>
>>eBroker(PersistenceBrokerFactorySyncImpl.java:116)
>>        at
>>
>
>
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersisten
>
>>ceBroker(PersistenceBrokerFactoryBaseImpl.java:158)
>>        at
>>
>
>
com.alabus.aes.server.ejb.application.system.AesUserBean.test1(AesUserBean.j
>
>>ava:205)
>>        at java.lang.reflect.Method.invoke(Native Method)
>>        at
>>
>
>
org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(Stateles
>
>>sSessionContainer.java:683)
>>        at
>>
>
>
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(Cach
>
>>edConnectionInterceptor.java:185)
>>        at
>>
>
>
org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSe
>
>>ssionInstanceInterceptor.java:72)
>>        at
>>
>
>
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor
>
>>.java:84)
>>        at
>>
>
>
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.
>
>>java:315)
>>        at
>>org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:148)
>>        at
>>
>
>
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:12
>
>>0)
>>        at
>>org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
>>        at
>>
>
>
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinde
>
>>rInterceptor.java:122)
>>        at
>>
>
>
org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionConta
>
>>iner.java:331)
>>        at org.jboss.ejb.Container.invoke(Container.java:723)
>>        at java.lang.reflect.Method.invoke(Native Method)
>>        at
>>
>
>
org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60
>
>>)
>>        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
>>        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
>>        at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
>>        at
>>
>
>
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:18
>
>>5)
>>        at
>>org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
>>        at
>>org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:360)
>>        at java.lang.reflect.Method.invoke(Native Method)
>>        at
>>sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:236)
>>        at sun.rmi.transport.Transport$1.run(Transport.java:147)
>>        at java.security.AccessController.doPrivileged(Native Method)
>>        at sun.rmi.transport.Transport.serviceCall(Transport.java:143)
>>        at
>>sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
>>        at
>>
>
>
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:7
>
>>01)
>>        at java.lang.Thread.run(Thread.java:479)
>>
>>
>>
>>
>>
>>OJB.properties
>>
>>#<!--
>>#/* Copyright 2002-2004 The Apache Software Foundation
>># *
>># * Licensed under the Apache License, Version 2.0 (the "License");
>># * you may not use this file except in compliance with the License.
>># * You may obtain a copy of the License at
>># *
>># *     http://www.apache.org/licenses/LICENSE-2.0
>># *
>># * Unless required by applicable law or agreed to in writing, software
>># * distributed under the License is distributed on an "AS IS" BASIS,
>># * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>
> implied.
>
>># * See the License for the specific language governing permissions and
>># * limitations under the License.
>># */
>>#-->
>># OJB.properties -- configuration of the OJB runtime environment
>># Version: 1.0
>># (c) 2001, 2002, 2003 Apache Software Foundation
>># Author: Thomas Mahler and many others
>># @version $Id: OJB.properties,v 1.75 2004/06/27 23:36:23 arminw Exp $
>>#
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># repository file settings
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># The repositoryFile entry tells OJB to use this file as as its standard
>>mapping
>># repository. The file is looked up from the classpath.
>>#
>>repositoryFile=repository/repository.xml
>>#
>># If the useSerializedRepository entry is set to true, OJB tries to load a
>># serialized version of the repository for performance reasons.
>># if set to false, OJB always loads the xml file.
>># Setting this flag to true will accelerate the startup sequence of OJB.
>># If set to true changes to the repository.xml file will only be detected
>># after maually deleting the repository.xml.serialized file.
>>useSerializedRepository=false
>>#
>># If Repository serialization is used the entry serializedRepositoryPath
>>defines the
>># directory where the Repository is written to and read from.
>># this entry is used only when the useSerializedRepository flag is set to
>>true
>>#
>>serializedRepositoryPath=.
>>#
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># PersistenceBrokerFactory / PersistenceBroker
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># The PersistenceBrokerFactoryClass entry decides which concrete
>># PersistenceBrokerFactory implemention is to be used.
>>
>
>
#PersistenceBrokerFactoryClass=org.apache.ojb.broker.core.PersistenceBrokerF
>
>>actoryDefaultImpl
>># If in managed environment *only* the PB-api was used it's recommended to
>>use this factory
>># to enable the PersistenceBroker instances to participate in the JTA
>>transaction. This makes
>># e.g. PBStateListener work properly in managed environments.
>>
>
>
PersistenceBrokerFactoryClass=org.apache.ojb.broker.core.PersistenceBrokerFa
>
>>ctorySyncImpl
>>#
>>#
>># The PersistenceBrokerClass entry decides which concrete
>
> PersistenceBroker
>
>># implementation is to be served by the PersistenceBrokerFactory.
>># This is the singlevm implementation:
>>#PersistenceBrokerClass=org.apache.ojb.broker.core.PersistenceBrokerImpl
>>#
>># This is an implementation that uses Prevayler (prevayler.sf.net) as the
>>persistent storage.
>># Using this implementation OJB works as a simple OODBMS
>>#PersistenceBrokerClass=org.apache.ojb.broker.prevayler.PBPrevaylerImpl
>>#
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># PersistenceBroker pool
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># PersistenceBroker pool configuration
>># This pool uses the jakarta-commons-pool api.
>># There you can find things described in detail.
>>#
>># maximum number of brokers that can be borrowed from the
>># pool at one time. When non-positive, there is no limit.
>>maxActive=100
>>#
>># controls the maximum number of brokers that can sit idle in the
>># pool (per key) at any time. When non-positive, there is no limit
>>maxIdle=-1
>>#
>># max time block to get broker instance from pool, after that exception is
>>thrown.
>># When non-positive, block till last judgement
>>maxWait=2000
>>#
>># indicates how long the eviction thread should sleep before "runs" of
>>examining
>># idle objects. When non-positive, no eviction thread will be launched.
>>timeBetweenEvictionRunsMillis=-1
>>#
>># specifies the minimum amount of time that an broker may sit idle
>># in the pool before it is eligable for eviction due to idle time.
>># When non-positive, no object will be dropped from the pool due
>># to idle time alone (depends on timeBetweenEvictionRunsMillis > 0)
>>minEvictableIdleTimeMillis=1000000
>>#
>># specifies the behaviour of the pool when broker capacity is
>># exhausted (see maxActive above)
>># 0 - fail
>># 1 - block
>># 2 - grow
>>whenExhaustedAction=0
>>#
>>#
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># ConnectionFactory / Default ConnectionPool
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># The ConnectionFactoryClass entry determines which kind of
>>ConnectionFactory
>># is to be used within org.apache.ojb as connection factory.
>># A ConnectionFactory is responsible for creating
>># JDBC Connections. Current version ships four implementations:
>>#
>># 1. ConnectionFactoryNotPooledImpl
>>#    No pooling, no playing around.
>>#    Every connection request returns a new connection,
>>#    every connection release close the connection.
>># 2. ConnectionFactoryPooledImpl
>>#    This implementation supports connection pooling.
>># 3. ConnectionFactoryDBCPImpl
>>#    Using the jakarta-DBCP api for connection management, support
>>#    connection- and prepared statement-pooling, abandoned connection
>>handling.
>># 4. ConnectionFactoryManagedImpl
>>#    Connection factory for use within managed environments - e.g. JBoss.
>>#    Every obtained DataSource was wrapped within OJB (and ignore
>>#    e.g. con.commit() calls within OJB).
>>#    Use this implementation e.g if you use Datasources from an
>
> application
>
>>server.
>>#
>># Use the OJB performance tests to decide, which implementation is best
>
> for
>
>>you.
>># The proper way of obtaining a connection is configured in
>># JDBCConnectionDescriptor entries in the repository.xml file.
>># If want a more fine grained control of each connection pool used by OJB,
>># take a look at the repository.dtd, there was a possibility to override
>># this default connection factory entry in each JDBCConnectionDescriptor.
>>#
>>
>
>
#ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryP
>
>>ooledImpl
>>
>
>
#ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryN
>
>>otPooledImpl
>>
>
>
ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryMa
>
>>nagedImpl
>>
>
>
#ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryD
>
>>BCPImpl
>>#
>>#
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># ConnectionManager
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># The ConnectionManagerClass entry defines the ConnectionManager
>>implemementation to be used
>>
>
>
ConnectionManagerClass=org.apache.ojb.broker.accesslayer.ConnectionManagerIm
>
>>pl
>>#
>>#
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># SqlGenerator
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># The SqlGeneratorClass entry defines the SqlGenerator implemementation to
>>be used
>>
>
>
SqlGeneratorClass=org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultI
>
>>mpl
>>#
>>#
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># IndirectionHandler
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># The IndirectionHandlerClass entry defines the class to be used by OJB's
>>proxies to
>># handle method invocations
>>#
>>
>
>
IndirectionHandlerClass=org.apache.ojb.broker.core.proxy.IndirectionHandlerD
>
>>efaultImpl
>>#
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># ListProxy
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># The ListProxyClass entry defines the proxy class to be used for
>>collections that
>># implement the java.util.List interface.
>>#
>>ListProxyClass=org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl
>>#
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># SetProxy
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># The SetProxyClass entry defines the proxy class to be used for
>
> collections
>
>>that
>># implement the java.util.Set interface.
>>#
>>SetProxyClass=org.apache.ojb.broker.core.proxy.SetProxyDefaultImpl
>>#
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># CollectionProxy
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># The CollectionProxyClass entry defines the proxy class to be used for
>>collections that
>># do not implement java.util.List or java.util.Set.
>>#
>>
>
>
CollectionProxyClass=org.apache.ojb.broker.core.proxy.CollectionProxyDefault
>
>>Impl
>>#
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># StatementManager
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># The StatementManagerClass entry defines the StatementManager
>>implemementation to be used
>>StatementManagerClass=org.apache.ojb.broker.accesslayer.StatementManager
>>#
>>#
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># StatementsForClass
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># The StatementsForClassClass entry defines the StatementsForClass
>>implemementation to be used
>># to implement cached statements.
>>
>
>
StatementsForClassClass=org.apache.ojb.broker.accesslayer.StatementsForClass
>
>>Impl
>>#
>>#
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># JdbcAccess
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># The JdbcAccessClass entry defines the JdbcAccess implemementation to be
>>used
>>JdbcAccessClass=org.apache.ojb.broker.accesslayer.JdbcAccessImpl
>>#
>>#
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># RowReader
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># Set the standard RowReader implementation. It is also possible to
>
> specify
>
>>the
>># RowReader on class-descriptor level.
>>
>
>
RowReaderDefaultClass=org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl
>
>>#
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># Object cache
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># The ObjectCacheClass entry tells OJB which concrete ObjectCache
>># implementation is to be used as standard cache.
>># Its also possible to override this entry adding object-cache elements
>># on jdbc-connection-descriptor level and
>># per class-descriptor in repository file. More info see documentation.
>>#
>>ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCacheDefaultImpl
>>#ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCacheEmptyImpl
>>#ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCachePerBrokerImpl
>>#ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCacheJCSPerClassImpl
>>#ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCachePerClassImpl
>>#
>>#
>># This property is only relevant if the per class-descriptor object-cache
>># declaration was used in conjunction with metadata runtime changes.
>># If set 'flase' the class name of the object is used
>># to find a per class ObjectCache implementation.
>># If set 'true' the ObjectCacheDescriptor instance is used as key to
>># find a per class ObjectCache, this enables to use different ObjectCache
>># instances for the same class.
>>descriptorBasedCaches=false
>>#
>>#
>># Use CacheFilters to do filter operations before caching methods were
>># called. Build your own filter class by implementing
>>org.apache.ojb.cache.CacheFilter.
>># It is possible to use a arbitrary number of CacheFilters, but this slows
>># down the performance of the cache, thus handle with care.
>>#
>># - org.apache.ojb.broker.cache.CacheFilterClassImpl
>># allows filtering of classes
>># - org.apache.ojb.broker.cache.CacheFilterPackageImpl
>># allows filtering of packages
>># More info see Javadoc of the according classes.
>># Set a comma separated list of CacheFilter.
>>
>
>
#ObjectCacheFilter=org.apache.ojb.broker.cache.CacheFilterClassImpl,org.apac
>
>>he.ojb.broker.cache.CacheFilterPackageImpl
>>#
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># Locking
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># The LockManagerClass entry tells OJB which concrete LockManager
>># implementation is to be used.
>>LockManagerClass=org.apache.ojb.odmg.locking.LockManagerDefaultImpl
>>#
>># The LockMapClass entry tells OJB which concrete LockMap
>># implementation is to be used.
>># If OJB is running on multiple concurrent clients it is recommended
>># to use the RemoteLockMapImpl. It guarantees to provide
>># Lockmanagement across multiple JVMs.
>># This Implemenation relies on a Servlet based Lockserver. To use it you
>>have to
>># deploy the ojb-lockserver.war into a Servlet engine.
>># and you have to set the Property LockServletUrl to point to this
>
> servlet.
>
>># (see LockServletUrl section below).
>># If OJB is running in a single JVM (e.g. in a desktop app, or in a
>
> servlet
>
>># engine) it is save to use the InMemoryLockMapImpl. Using it will result
>># in a large performance gain.
>>#LockMapClass=org.apache.ojb.odmg.locking.RemoteLockMapImpl
>>LockMapClass=org.apache.ojb.odmg.locking.InMemoryLockMapImpl
>>#
>># The LockTimeout entry defines the maximum time in milliseconds
>># that a lock may be hold. Defaults to 60000 = 1 minute
>>LockTimeout=60000
>>#
>># The ImplicitLocking entry defines if implicit lock acquisition is
>># to be used. If set to true OJB implicitely locks objects to ODMG
>># transactions after performing OQL queries.
>># If implicit locking is used locking objects is recursive, that is
>># associated objects are also locked.
>># If ImplicitLocking is set to false, no locks are obtained in OQL
>># queries and there is also no recursive locking.
>>ImplicitLocking=true
>>#ImplicitLocking=false
>>#
>>#
>># The LockServletUrl entry points to the Lockserver servlet.
>># This Servlet is addressed by all distributed JVMs if the
>
> RemoteLockMapImpl
>
>># is used.
>>LockServletUrl=http://127.0.0.1:8080/ojb-lockserver
>>#
>>#
>># The LockAssociations entry defines the behaviour for the OJB
>># implicit locking feature. If set to WRITE (default) acquiring a write-
>># lock on a given object x implies write locks on all objects associated
>># to x. If set to READ implicit read-locks are acquired.
>># Acquiring a read-lock on x thus allways results in implicit read-locks
>># on all associated objects.
>>#LockAssociations=READ
>>LockAssociations=WRITE
>>#
>>#
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># OQL / SQL settings
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># The OqlCollectionClass entry defines the collection type returned
>># from OQL queries. By default this value is set to DListImpl.
>># This will be good for most situations as DList allows maximum
>
> flexibility
>
>># in a ODMG environment. See also section 'ODMG settings'.
>># Using DLists for large resultsets may be bad for application
>
> performance.
>
>># For these scenarios you can use ArrayLists or Vectors.
>># Important note: the collections class to be used MUST implement the
>># interface org.apache.ojb.broker.ManageableCollection.
>>#
>>OqlCollectionClass=org.apache.ojb.odmg.collections.DListImpl_2
>>#
>>
>
>
OqlCollectionClass=org.apache.ojb.broker.util.collections.ManageableArrayLis
>
>>t
>># OqlCollectionClass=org.apache.ojb.broker.util.ManageableVector
>>#
>># The SqlInLimit entry limits the number of values in IN-sql statement,
>># -1 for no limits. This hint is used in Criteria.
>>SqlInLimit=200
>>#
>>#
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># ODMG settings
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># Specify the used base class for ODMG API
>># - ImplementationDefaultImpl is the default class
>># - ImplementationJTAImpl is for use in managed environments like J2EE
>>conform
>># Application Server
>>#
>>#ImplementationClass=org.apache.ojb.odmg.ImplementationImpl
>>ImplementationClass=org.apache.ojb.odmg.ImplementationJTAImpl
>>#
>>#
>># Specify the used tx handling.
>># - LocalTxManager use if you want the transaction to be associated by a
>>thread
>># - JTATxManager use if you want the transaction to be associated via the
>>Transaction
>># manager that is in your application server.
>>#
>>#OJBTxManagerClass=org.apache.ojb.odmg.LocalTxManager
>>OJBTxManagerClass=org.apache.ojb.odmg.JTATxManager
>>#
>>#
>># Used ODMG collection implementation classes
>># (e.g. when do a Implementation#newDlist() call)
>>#
>># org.odmg.DList implementation class
>>DListClass=org.apache.ojb.odmg.collections.DListImpl_2
>>#DListClass=org.apache.ojb.odmg.collections.DListImpl
>>#
>># org.odmg.DArray implementation class
>>DArrayClass=org.apache.ojb.odmg.collections.DListImpl_2
>>#DArrayClass=org.apache.ojb.odmg.collections.DListImpl
>>#
>># org.odmg.DMap implementation class
>>DMapClass=org.apache.ojb.odmg.collections.DMapImpl
>>#
>># org.odmg.DBag implementation class
>>DBagClass=org.apache.ojb.odmg.collections.DBagImpl
>>#
>># org.odmg.DSet implementation class
>>DSetClass=org.apache.ojb.odmg.collections.DSetImpl
>>#
>>#
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># Meta data / mapping settings
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># The PersistentFieldClass property defines the implementation class
>># for PersistentField attributes used in the OJB MetaData layer.
>># By default the best performing attribute/refection based implementation
>># is selected (PersistentFieldDirectAccessImpl).
>>#
>># - PersistentFieldDirectAccessImpl
>>#   is a high-speed version of the access strategies.
>>#   It does not cooperate with an AccessController,
>>#   but accesses the fields directly. Persistent
>>#   attributes don't need getters and setters
>>#   and don't have to be declared public or protected
>># - PersistentFieldPrivilegedImpl
>>#   Same as above, but does cooperate with AccessController and do not
>>#   suppress the java language access check (but is slow compared with
>>direct access).
>># - PersistentFieldIntrospectorImpl
>>#   uses JavaBeans compliant calls only to access persistent attributes.
>>#   No Reflection is needed. But for each attribute xxx there must be
>>#   public getXxx() and setXxx() methods.
>># - PersistentFieldDynaBeanAccessImpl
>>#   implementation used to access a property from a
>>#   org.apache.commons.beanutils.DynaBean.
>># - PersistentFieldAutoProxyImpl
>>#   for each field determines upon first access how to access this
>>particular field
>>#   (directly, as a bean, as a dyna bean) and then uses that strategy
>>#
>>
>
>
#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentF
>
>>ieldDirectAccessImpl
>>
>
>
#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentF
>
>>ieldPrivilegedImpl
>>
>
>
#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentF
>
>>ieldIntrospectorImpl
>>
>
>
#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentF
>
>>ieldDynaBeanAccessImpl
>>
>
>
#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentF
>
>>ieldAutoProxyImpl
>>#
>># Here are the new upcoming PersistentField implementations. These classes
>>will replace the
>># 'old' ones on next release. They pass the test-suite, but should be
>
> tested
>
>>by community too.
>># The new implementations are about 50 times faster in handling nested
>>fields.
>>
>
>
PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFi
>
>>eldDirectAccessImplNew
>>
>
>
#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentF
>
>>ieldPrivilegedImplNew
>>
>
>
#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentF
>
>>ieldIntrospectorImplNew
>>
>
>
#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentF
>
>>ieldAutoProxyImpl
>>
>
>
#PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentF
>
>>ieldDynaBeanImplNew
>>#(DynaBean implementation does not support nested fields)
>>#
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># Component Intercepting for Profiling and Tracing
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># By enabling an InterceptorClass all OJB components will use
>># this Interceptor. Interceptors allow advanced tracing and Profiling
>># of all component method calls.
>># This is currently an experimental feature useful only for OJB kernel
>>developers.
>>#
>>
>
>
#InterceptorClass=org.apache.ojb.broker.util.interceptor.TracingInterceptor
>
>>#
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># Transaction Management and assocation
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># (optional, only used when OJB runs within managed environments)
>># To praticipate in JTA transaction OJB needs access to the underlying
>>transaction manager.
>># The TransactionManager is acquired in different ways dependent on the
>>application server.
>># The JTATransactionManagerClass property allows you to specify the class
>>that implements
>># the proper behaviour for finding the transaction manager. Only use when
>>OJBTxManagerClass
>># is set to a factory that uses the application server transaction manager
>># (org.apache.ojb.odmg.JTATxManager)
>>#
>>
>># JBoss Transaction Manager Factory
>>
>
>
JTATransactionManagerClass=org.apache.ojb.broker.transaction.tm.JBossTransac
>
>>tionManagerFactory
>># Weblogic Transaction Manager Factory
>>
>
>
#JTATransactionManagerClass=org.apache.ojb.broker.transaction.tm.WeblogicTra
>
>>nsactionManagerFactory
>># WebSphere transaction manager factory
>>
>
>
#JTATransactionManagerClass=org.apache.ojb.broker.transaction.tm.WebSphereTr
>
>>ansactionManagerFactory
>># Orion transaction manager factory
>>
>
>
#JTATransactionManagerClass=org.apache.ojb.broker.transaction.tm.OrionTransa
>
>>ctionManagerFactory
>># SunOne transaction manager factory
>>
>
>
#JTATransactionManagerClass=org.apache.ojb.broker.transaction.tm.SunOneTrans
>
>>actionManagerFactory
>># JOnAs transaction manager factory
>>
>
>
#JTATransactionManagerClass=org.apache.ojb.broker.transaction.tm.JOnASTransa
>
>>ctionManagerFactory
>>#
>>#
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># Logging settings are now in their own file, OJB-logging.properties
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>># End of OJB.properties file
>>
>
>
#---------------------------------------------------------------------------
>
>>-------------
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Problem with PersistanceBroker

Posted by Armin Waibel <ar...@apache.org>.
Hi,

Cesar wrote:
> People
> I am having one problem of my PersistenceBroker.....
> My application(Servlet) begins to create instancias of PersistenceBroker
> (this can take days as hours after the start of application) and  mine % of
> the CPU increases, using everything that has available in the machine.
>  I verified and i´m using PB.close() in all the my calls of bank.
>  Has some bug in the version rc3?
> 

hmm, rc3 was long time ago ;-) (but I don't think that the PB.close() 
call has a bug)
Seems OJB always need to create new PB instances instead re-using an 
instance from the PB-pool.

 > created persistence broker instances: 1
...

If this increase the whole time I assume that there was a missing 
PB.close() call in your code.
OJB was shipped with an multithreaded performance test when using the 
source version. Run the target 'perf-test'. This test should pass 
against hsql (10 threads perform 2000 objects per thread).
Additionally you can implement a test which lookup a new PB instance and 
close it in a loop.

regards,
Armin



> I am using the parameters below for the PersistenceBroker.no OJB.properties
> 
> maxActive=60
> maxIdle=-1
> maxWait=5000
> timeBetweenEvictionRunsMillis=90000
> minEvictableIdleTimeMillis=60000
> whenExhaustedAction=1
> 
> 
> 
> Log Of application
> 
> [main] INFO
>  org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl - Create new
> PB instance for PBKey org.apache.ojb.broker.PBKey:
> repository=jobStoreConnection, user=managerubr, password=*****, already
> created persistence broker instances: 0
> 
> [main] INFO
>  org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl - Create new
> PB instance for PBKey org.apache.ojb.broker.PBKey:
> repository=jobStoreConnection, user=managerubr, password=*****, already
> created persistence broker instances: 1
> 
> [main] INFO
>  org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl - Create new
> PB instance for PBKey org.apache.ojb.broker.PBKey:
> repository=jobStoreConnection, user=managerubr, password=*****, already
> created persistence broker instances: 2
> 
> [main] INFO
>  org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl - Create new
> PB instance for PBKey org.apache.ojb.broker.PBKey:
> repository=jobStoreConnection, user=managerubr, password=*****, already
> created persistence broker instances: 3
> .
> .
> .
> .
> 
> ----- Original Message ----- 
> From: "André Markwalder" <an...@alabus.com>
> To: "OJB Users List" <oj...@db.apache.org>
> Sent: Friday, July 02, 2004 1:23 PM
> Subject: RE: JBoss have to close connection in managed environment and
> nested EJB calls
> 
> 
> Hi Armin
> 
> I tried the JNDI lookup with the following code and it worked perfectly.
> JBoss didn't complained about anything.
> 
> 
> regards
> André
> 
> 
> /**
> * @ejb.interface-method
> * @ejb.permission  role-name="admin,user"
> **/
> public void test1() {
> Connection conn = null;
> try {
> 
> InitialContext ctx = new InitialContext();
> DataSource ds =
> (DataSource)ctx.lookup("java:comp/env/jdbc/AESDS_MAXDB_SALUSA_AES");
> conn = ds.getConnection();
> 
> ResultSet rs =
> conn.createStatement().executeQuery("SELECT COUNT(*) FROM AES_USER");
> rs.first();
> System.out.println("TEST1: " + rs.getInt(1));
> 
> AesUserLocalHome home =
> (AesUserLocalHome)ctx.lookup(AesUserLocalHome.JNDI_NAME);
> AesUserLocal tmp = home.create();
> tmp.test2();
> 
> } catch (NamingException e) {
> e.printStackTrace();
> } catch (CreateException e) {
> e.printStackTrace();
> } catch (SQLException e) {
> e.printStackTrace();
> }
> finally {
> try {
> if (conn != null) {
> System.out.println("CLOSE CONNECTION
> 1");
> conn.close();
> }
> } catch (SQLException e1) {
> e1.printStackTrace();
> }
> }
> }
> 
> /**
> * @ejb.interface-method
> * @ejb.permission  role-name="admin,user"
> **/
> public void test2() {
> Connection conn = null;
> try {
> 
> InitialContext ctx = new InitialContext();
> DataSource ds =
> (DataSource)ctx.lookup("java:comp/env/jdbc/AESDS_MAXDB_SALUSA_AES");
> conn = ds.getConnection();
> 
> ResultSet rs =
> conn.createStatement().executeQuery("SELECT COUNT(*) FROM AES_USER");
> rs.first();
> System.out.println("TEST2: " + rs.getInt(1));
> 
> } catch (NamingException e) {
> e.printStackTrace();
> } catch (SQLException e) {
> e.printStackTrace();
> }
> finally {
> try {
> if (conn != null) {
> System.out.println("CLOSE CONNECTION
> 2");
> conn.close();
> }
> } catch (SQLException e1) {
> e1.printStackTrace();
> }
> }
> }
> 
> 
> 
> 
> -----Original Message-----
> From: Armin Waibel [mailto:arminw@apache.org]
> Sent: Freitag, 2. Juli 2004 15:03
> To: OJB Users List
> Subject: Re: JBoss have to close connection in managed environment and
> nes ted EJB calls
> 
> 
> doh! Sorry I don't read your first post till end.
> Seems we don't have a test case for your scenario. There is a session
> bean using two beans in another bean (PersonArticleManagerPBBean), but
> they never made nested PB calls.
> It is not allowed to use nested PB instances in OJB standalone mode, so
> I'm not sure about handling in managed environments. Is it possible to
> use nested connections in beans? E.g. instead create a PB instance, use
> a JNDI connection, do some work, obtain another bean, call bean method,
> close obtained JNDI connection. Is this allowed?
> 
> regards,
> Armin
> 
> André Markwalder wrote:
> 
> 
>>Hi Armin,
>>
>>Yes I did.
>>
>>regards,
>>André
>>
>>-----Original Message-----
>>From: Armin Waibel [mailto:arminw@apache.org]
>>Sent: Freitag, 2. Juli 2004 14:25
>>To: OJB Users List
>>Subject: Re: JBoss have to close connection in managed environment and
>>nested EJB calls
>>
>>
>>Hi Andre,
>>
>>do you set
>>
> 
> PersistenceBrokerFactoryClass=org.apache.ojb.broker.core.PersistenceBrokerFa
> 
>>ctorySyncImpl
>>in OJB.properties?
>>
>>regards,
>>Armin
>>
>>André Markwalder wrote:
>>
>>
>>
>>>Hi,
>>>
>>>I've got the following problem with OJB and JBoss in a managed
>>
>>environment.
>>
>>
>>>I do an EJB call to ejbA. Within that EJB I request a PersistenceBroker.
>>>After
>>>that request I call a second EJB. Let's call it ejbB. Within ejbB I
>>
>>request
>>
>>
>>>the same PersistenceBroker. After processing ejbB I release (close) the
>>>PersistenceBroker. In ejbA I release (close) also the  PersistenceBroker.
>>>
>>>The problem is that JBoss informs me, that it has to close a connection
>>
>>for
>>
>>
>>>me and I should do it myself.
>>>
>>>If I close the PersistenceBroker before I call ejbB and reobtain the
>>>PersistenceBroker afterwards everything works fine.
>>>
>>>It seems if I do a nested EJB call (nested retrieval of
>>
>>PersistenceBroker),
>>
>>
>>>OJB
>>>doesn't close all the connections.
>>>
>>>Did I something wrong or did I have misconfigured something within JBoss
>>
>>or
>>
>>
>>>OJB?
>>>
>>>I configured OJB as described in the documentation (deployment section).
>>>
>>>Below you will find the sample source code, JBoss log and OJB.properties
>>>file.
>>>
>>>I use JBoss 3.2.2 (tried also with 3.2.5 same effects) and OJB 1.0.0.
>>>
>>>
>>>
>>>Thanks in advance for any help.
>>>
>>>André
>>>
>>>
>>>
>>>
>>>Sample source code from EJB:
>>>
>>>/**
>>>* @ejb.interface-method
>>>* @ejb.permission  role-name="admin,user"
>>>**/
>>>public void test1() {
>>>
>>>System.out.println("GETBROKER 1");
>>>PersistenceBroker broker =
>>>PersistenceBrokerFactoryFactory.instance().defaultPersistenceBroker();
>>>
>>>try {
>>>System.out.println("TEST1");
>>>
>>>InitialContext ctx = new InitialContext();
>>>AesUserLocalHome home =
>>>(AesUserLocalHome)ctx.lookup(AesUserLocalHome.JNDI_NAME);
>>>AesUserLocal tmp = home.create();
>>>tmp.test2();
>>>
>>>} catch (NamingException e) {
>>>e.printStackTrace();
>>>} catch (CreateException e) {
>>>e.printStackTrace();
>>>}
>>>finally {
>>>System.out.println("BROKER CLOSED 1");
>>>if (broker != null) {
>>>broker.close();
>>>}
>>>}
>>>}
>>>
>>>/**
>>>* @ejb.interface-method
>>>* @ejb.permission  role-name="admin,user"
>>>**/
>>>public void test2() {
>>>System.out.println("GETBROKER 2");
>>>PersistenceBroker broker =
>>>PersistenceBrokerFactoryFactory.instance().defaultPersistenceBroker();
>>>
>>>try {
>>>System.out.println("TEST2");
>>>}
>>>finally {
>>>System.out.println("BROKER CLOSED 2");
>>>if (broker != null) {
>>>broker.close();
>>>}
>>>}
>>>}
>>>
>>>
>>>
>>>
>>>JBOSS log:
>>>
>>>13:58:16,232 DEBUG [PersistenceBrokerFactoryDefaultImpl] PersistenceBroker
>>>pool will be setup with the following configuration
>>>org.apache.commons.pool.impl.Gene
>>>ricKeyedObjectPool$Config@733280[
>>> maxIdle=-1
>>> maxActive=100
>>> maxTotal=-1
>>> maxWait=2000
>>> whenExhaustedAction=0
>>> testOnBorrow=false
>>> testOnReturn=false
>>> testWhileIdle=false
>>> timeBetweenEvictionRunsMillis=-1
>>> numTestsPerEvictionRun=10
>>> minEvictableIdleTimeMillis=1000000
>>>]
>>>13:58:16,242 INFO  [PersistenceBrokerFactoryDefaultImpl] Create
>>>PersistenceBroker instance pool, pool configuration was
>>>{whenExhaustedAction=0, maxIdle=-1, maxA
>>>ctive=100, maxWait=2000, removeAbandoned=false, numTestsPerEvictionRun=10,
>>>testWhileIdle=false, minEvictableIdleTimeMillis=1000000,
>>
>>testOnReturn=false,
>>
>>
>>>logAband
>>>oned=false, removeAbandonedTimeout=300, timeBetweenEvictionRunsMillis=-1,
>>>testOnBorrow=false}
>>>
>>>
>>>
>>>13:58:16,262 INFO  [STDOUT] GETBROKER 1
>>>13:58:17,114 DEBUG [PersistenceBrokerFactoryDefaultImpl] Obtain broker
>>
>>from
>>
>>
>>>pool, used PBKey is org.apache.ojb.broker.PBKey: jcdAlias=APPSERVER_AES,
>>>user=null,password=null
>>>13:58:17,235 INFO  [STDOUT] TEST1
>>>13:58:17,235 INFO  [STDOUT] GETBROKER 2
>>>13:58:17,235 INFO  [STDOUT] TEST2
>>>13:58:17,235 INFO  [STDOUT] BROKER CLOSED 2
>>>13:58:17,235 DEBUG
>>>[PersistenceBrokerFactorySyncImpl$PersistenceBrokerSyncImpl] PB close was
>>>called, only close the PB handle when in JTA-tx
>>>13:58:17,235 INFO  [STDOUT] BROKER CLOSED 1
>>>13:58:17,235 DEBUG
>>>[PersistenceBrokerFactorySyncImpl$PersistenceBrokerSyncImpl] PB close was
>>>called, only close the PB handle when in JTA-tx
>>>13:58:17,235 DEBUG
>>>[PersistenceBrokerFactorySyncImpl$PersistenceBrokerSyncImpl]
>>>beforeCompletion was called, nothing to do
>>>13:58:17,255 DEBUG
>>>[PersistenceBrokerFactorySyncImpl$PersistenceBrokerSyncImpl]
>>
>>afterCompletion
>>
>>
>>>was called
>>>13:58:17,255 DEBUG
>>>[PersistenceBrokerFactorySyncImpl$PersistenceBrokerSyncImpl] Commit PB-tx
>>>13:58:17,255 DEBUG
>>>[PersistenceBrokerFactorySyncImpl$PersistenceBrokerSyncImpl] Now do real
>>>close of PB instance
>>>13:58:17,255 INFO  [CachedConnectionManager] Closing a connection for you.
>>>Please close them yourself:
>>>org.jboss.resource.adapter.jdbc.WrappedConnection@66385e
>>>
>>>java.lang.Exception: STACKTRACE
>>>       at
>>>
>>
>>
> org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnect
> 
>>>ion(CachedConnectionManager.java:285)
>>>       at
>>>
>>
>>
> org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnecti
> 
>>>on(BaseConnectionManager2.java:525)
>>>       at
>>>
>>
>>
> org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManage
> 
>>>rProxy.allocateConnection(BaseConnectionManager2.java:887)
>>>       at
>>>
>>
>>
> org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataS
> 
>>>ource.java:102)
>>>       at
>>>
>>
>>
> org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.newConnectio
> 
>>>nFromDataSource(ConnectionFactoryAbstractImpl.java:204)
>>>       at
>>>
>>
>>
> org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.lookupConnec
> 
>>>tion(ConnectionFactoryAbstractImpl.java:112)
>>>       at
>>>
>>
>>
> org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl.lookupConnect
> 
>>>ion(ConnectionFactoryManagedImpl.java:33)
>>>       at
>>>
>>
>>
> org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.getConnection(Connec
> 
>>>tionManagerImpl.java:105)
>>>       at
>>>
>>
>>
> org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.localBegin(Connectio
> 
>>>nManagerImpl.java:147)
>>>       at
>>>
>>
>>
> org.apache.ojb.broker.core.PersistenceBrokerImpl.beginTransaction(Persistenc
> 
>>>eBrokerImpl.java:394)
>>>       at
>>>
>>
>>
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.beginTransaction(Dele
> 
>>>gatingPersistenceBroker.java:138)
>>>       at
>>>
>>
>>
> org.apache.ojb.broker.core.PersistenceBrokerFactorySyncImpl$PersistenceBroke
> 
>>>rSyncImpl.internBegin(PersistenceBrokerFactorySyncImpl.java:280)
>>>       at
>>>
>>
>>
> org.apache.ojb.broker.core.PersistenceBrokerFactorySyncImpl$PersistenceBroke
> 
>>>rSyncImpl.access$000(PersistenceBrokerFactorySyncImpl.java:225)
>>>       at
>>>
>>
>>
> org.apache.ojb.broker.core.PersistenceBrokerFactorySyncImpl.wrapRequestedBro
> 
>>>kerInstance(PersistenceBrokerFactorySyncImpl.java:153)
>>>       at
>>>
>>
>>
> org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.createPersist
> 
>>>enceBroker(PersistenceBrokerFactoryDefaultImpl.java:105)
>>>       at
>>>
>>
>>
> org.apache.ojb.broker.core.PersistenceBrokerFactorySyncImpl.createPersistenc
> 
>>>eBroker(PersistenceBrokerFactorySyncImpl.java:116)
>>>       at
>>>
>>
>>
> org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersisten
> 
>>>ceBroker(PersistenceBrokerFactoryBaseImpl.java:158)
>>>       at
>>>
>>
>>
> com.alabus.aes.server.ejb.application.system.AesUserBean.test1(AesUserBean.j
> 
>>>ava:205)
>>>       at java.lang.reflect.Method.invoke(Native Method)
>>>       at
>>>
>>
>>
> org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(Stateles
> 
>>>sSessionContainer.java:683)
>>>       at
>>>
>>
>>
> org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(Cach
> 
>>>edConnectionInterceptor.java:185)
>>>       at
>>>
>>
>>
> org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSe
> 
>>>ssionInstanceInterceptor.java:72)
>>>       at
>>>
>>
>>
> org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor
> 
>>>.java:84)
>>>       at
>>>
>>
>>
> org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.
> 
>>>java:315)
>>>       at
>>>org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:148)
>>>       at
>>>
>>
>>
> org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:12
> 
>>>0)
>>>       at
>>>org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
>>>       at
>>>
>>
>>
> org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinde
> 
>>>rInterceptor.java:122)
>>>       at
>>>
>>
>>
> org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionConta
> 
>>>iner.java:331)
>>>       at org.jboss.ejb.Container.invoke(Container.java:723)
>>>       at java.lang.reflect.Method.invoke(Native Method)
>>>       at
>>>
>>
>>
> org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60
> 
>>>)
>>>       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
>>>       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
>>>       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
>>>       at
>>>
>>
>>
> org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:18
> 
>>>5)
>>>       at
>>>org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
>>>       at
>>>org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:360)
>>>       at java.lang.reflect.Method.invoke(Native Method)
>>>       at
>>>sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:236)
>>>       at sun.rmi.transport.Transport$1.run(Transport.java:147)
>>>       at java.security.AccessController.doPrivileged(Native Method)
>>>       at sun.rmi.transport.Transport.serviceCall(Transport.java:143)
>>>       at
>>>sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
>>>       at
>>>
>>
>>
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:7
> 
>>>01)
>>>       at java.lang.Thread.run(Thread.java:479)
>>>
>>>
>>>
>>>
>>>
>>>OJB.properties
>>>
>>>#<!--
>>>#/* Copyright 2002-2004 The Apache Software Foundation
>>># *
>>># * Licensed under the Apache License, Version 2.0 (the "License");
>>># * you may not use this file except in compliance with the License.
>>># * You may obtain a copy of the License at
>>># *
>>># *     http://www.apache.org/licenses/LICENSE-2.0
>>># *
>>># * Unless required by applicable law or agreed to in writing, software
>>># * distributed under the License is distributed on an "AS IS" BASIS,
>>># * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>>
>>implied.
>>
>>
>>># * See the License for the specific language governing permissions and
>>># * limitations under the License.
>>># */
>>>#-->
>>># OJB.properties -- configuration of the OJB runtime environment
>>># Version: 1.0
>>># (c) 2001, 2002, 2003 Apache Software Foundation
>>># Author: Thomas Mahler and many others
>>># @version $Id: OJB.properties,v 1.75 2004/06/27 23:36:23 arminw Exp $
>>>#
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># repository file settings
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># The repositoryFile entry tells OJB to use this file as as its standard
>>>mapping
>>># repository. The file is looked up from the classpath.
>>>#
>>>repositoryFile=repository/repository.xml
>>>#
>>># If the useSerializedRepository entry is set to true, OJB tries to load a
>>># serialized version of the repository for performance reasons.
>>># if set to false, OJB always loads the xml file.
>>># Setting this flag to true will accelerate the startup sequence of OJB.
>>># If set to true changes to the repository.xml file will only be detected
>>># after maually deleting the repository.xml.serialized file.
>>>useSerializedRepository=false
>>>#
>>># If Repository serialization is used the entry serializedRepositoryPath
>>>defines the
>>># directory where the Repository is written to and read from.
>>># this entry is used only when the useSerializedRepository flag is set to
>>>true
>>>#
>>>serializedRepositoryPath=.
>>>#
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># PersistenceBrokerFactory / PersistenceBroker
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># The PersistenceBrokerFactoryClass entry decides which concrete
>>># PersistenceBrokerFactory implemention is to be used.
>>>
>>
>>
> #PersistenceBrokerFactoryClass=org.apache.ojb.broker.core.PersistenceBrokerF
> 
>>>actoryDefaultImpl
>>># If in managed environment *only* the PB-api was used it's recommended to
>>>use this factory
>>># to enable the PersistenceBroker instances to participate in the JTA
>>>transaction. This makes
>>># e.g. PBStateListener work properly in managed environments.
>>>
>>
>>
> PersistenceBrokerFactoryClass=org.apache.ojb.broker.core.PersistenceBrokerFa
> 
>>>ctorySyncImpl
>>>#
>>>#
>>># The PersistenceBrokerClass entry decides which concrete
>>
>>PersistenceBroker
>>
>>
>>># implementation is to be served by the PersistenceBrokerFactory.
>>># This is the singlevm implementation:
>>>#PersistenceBrokerClass=org.apache.ojb.broker.core.PersistenceBrokerImpl
>>>#
>>># This is an implementation that uses Prevayler (prevayler.sf.net) as the
>>>persistent storage.
>>># Using this implementation OJB works as a simple OODBMS
>>>#PersistenceBrokerClass=org.apache.ojb.broker.prevayler.PBPrevaylerImpl
>>>#
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># PersistenceBroker pool
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># PersistenceBroker pool configuration
>>># This pool uses the jakarta-commons-pool api.
>>># There you can find things described in detail.
>>>#
>>># maximum number of brokers that can be borrowed from the
>>># pool at one time. When non-positive, there is no limit.
>>>maxActive=100
>>>#
>>># controls the maximum number of brokers that can sit idle in the
>>># pool (per key) at any time. When non-positive, there is no limit
>>>maxIdle=-1
>>>#
>>># max time block to get broker instance from pool, after that exception is
>>>thrown.
>>># When non-positive, block till last judgement
>>>maxWait=2000
>>>#
>>># indicates how long the eviction thread should sleep before "runs" of
>>>examining
>>># idle objects. When non-positive, no eviction thread will be launched.
>>>timeBetweenEvictionRunsMillis=-1
>>>#
>>># specifies the minimum amount of time that an broker may sit idle
>>># in the pool before it is eligable for eviction due to idle time.
>>># When non-positive, no object will be dropped from the pool due
>>># to idle time alone (depends on timeBetweenEvictionRunsMillis > 0)
>>>minEvictableIdleTimeMillis=1000000
>>>#
>>># specifies the behaviour of the pool when broker capacity is
>>># exhausted (see maxActive above)
>>># 0 - fail
>>># 1 - block
>>># 2 - grow
>>>whenExhaustedAction=0
>>>#
>>>#
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># ConnectionFactory / Default ConnectionPool
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># The ConnectionFactoryClass entry determines which kind of
>>>ConnectionFactory
>>># is to be used within org.apache.ojb as connection factory.
>>># A ConnectionFactory is responsible for creating
>>># JDBC Connections. Current version ships four implementations:
>>>#
>>># 1. ConnectionFactoryNotPooledImpl
>>>#    No pooling, no playing around.
>>>#    Every connection request returns a new connection,
>>>#    every connection release close the connection.
>>># 2. ConnectionFactoryPooledImpl
>>>#    This implementation supports connection pooling.
>>># 3. ConnectionFactoryDBCPImpl
>>>#    Using the jakarta-DBCP api for connection management, support
>>>#    connection- and prepared statement-pooling, abandoned connection
>>>handling.
>>># 4. ConnectionFactoryManagedImpl
>>>#    Connection factory for use within managed environments - e.g. JBoss.
>>>#    Every obtained DataSource was wrapped within OJB (and ignore
>>>#    e.g. con.commit() calls within OJB).
>>>#    Use this implementation e.g if you use Datasources from an
>>
>>application
>>
>>
>>>server.
>>>#
>>># Use the OJB performance tests to decide, which implementation is best
>>
>>for
>>
>>
>>>you.
>>># The proper way of obtaining a connection is configured in
>>># JDBCConnectionDescriptor entries in the repository.xml file.
>>># If want a more fine grained control of each connection pool used by OJB,
>>># take a look at the repository.dtd, there was a possibility to override
>>># this default connection factory entry in each JDBCConnectionDescriptor.
>>>#
>>>
>>
>>
> #ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryP
> 
>>>ooledImpl
>>>
>>
>>
> #ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryN
> 
>>>otPooledImpl
>>>
>>
>>
> ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryMa
> 
>>>nagedImpl
>>>
>>
>>
> #ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryD
> 
>>>BCPImpl
>>>#
>>>#
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># ConnectionManager
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># The ConnectionManagerClass entry defines the ConnectionManager
>>>implemementation to be used
>>>
>>
>>
> ConnectionManagerClass=org.apache.ojb.broker.accesslayer.ConnectionManagerIm
> 
>>>pl
>>>#
>>>#
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># SqlGenerator
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># The SqlGeneratorClass entry defines the SqlGenerator implemementation to
>>>be used
>>>
>>
>>
> SqlGeneratorClass=org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultI
> 
>>>mpl
>>>#
>>>#
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># IndirectionHandler
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># The IndirectionHandlerClass entry defines the class to be used by OJB's
>>>proxies to
>>># handle method invocations
>>>#
>>>
>>
>>
> IndirectionHandlerClass=org.apache.ojb.broker.core.proxy.IndirectionHandlerD
> 
>>>efaultImpl
>>>#
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># ListProxy
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># The ListProxyClass entry defines the proxy class to be used for
>>>collections that
>>># implement the java.util.List interface.
>>>#
>>>ListProxyClass=org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl
>>>#
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># SetProxy
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># The SetProxyClass entry defines the proxy class to be used for
>>
>>collections
>>
>>
>>>that
>>># implement the java.util.Set interface.
>>>#
>>>SetProxyClass=org.apache.ojb.broker.core.proxy.SetProxyDefaultImpl
>>>#
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># CollectionProxy
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># The CollectionProxyClass entry defines the proxy class to be used for
>>>collections that
>>># do not implement java.util.List or java.util.Set.
>>>#
>>>
>>
>>
> CollectionProxyClass=org.apache.ojb.broker.core.proxy.CollectionProxyDefault
> 
>>>Impl
>>>#
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># StatementManager
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># The StatementManagerClass entry defines the StatementManager
>>>implemementation to be used
>>>StatementManagerClass=org.apache.ojb.broker.accesslayer.StatementManager
>>>#
>>>#
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># StatementsForClass
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># The StatementsForClassClass entry defines the StatementsForClass
>>>implemementation to be used
>>># to implement cached statements.
>>>
>>
>>
> StatementsForClassClass=org.apache.ojb.broker.accesslayer.StatementsForClass
> 
>>>Impl
>>>#
>>>#
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># JdbcAccess
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># The JdbcAccessClass entry defines the JdbcAccess implemementation to be
>>>used
>>>JdbcAccessClass=org.apache.ojb.broker.accesslayer.JdbcAccessImpl
>>>#
>>>#
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># RowReader
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># Set the standard RowReader implementation. It is also possible to
>>
>>specify
>>
>>
>>>the
>>># RowReader on class-descriptor level.
>>>
>>
>>
> RowReaderDefaultClass=org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl
> 
>>>#
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># Object cache
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># The ObjectCacheClass entry tells OJB which concrete ObjectCache
>>># implementation is to be used as standard cache.
>>># Its also possible to override this entry adding object-cache elements
>>># on jdbc-connection-descriptor level and
>>># per class-descriptor in repository file. More info see documentation.
>>>#
>>>ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCacheDefaultImpl
>>>#ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCacheEmptyImpl
>>>#ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCachePerBrokerImpl
>>>#ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCacheJCSPerClassImpl
>>>#ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCachePerClassImpl
>>>#
>>>#
>>># This property is only relevant if the per class-descriptor object-cache
>>># declaration was used in conjunction with metadata runtime changes.
>>># If set 'flase' the class name of the object is used
>>># to find a per class ObjectCache implementation.
>>># If set 'true' the ObjectCacheDescriptor instance is used as key to
>>># find a per class ObjectCache, this enables to use different ObjectCache
>>># instances for the same class.
>>>descriptorBasedCaches=false
>>>#
>>>#
>>># Use CacheFilters to do filter operations before caching methods were
>>># called. Build your own filter class by implementing
>>>org.apache.ojb.cache.CacheFilter.
>>># It is possible to use a arbitrary number of CacheFilters, but this slows
>>># down the performance of the cache, thus handle with care.
>>>#
>>># - org.apache.ojb.broker.cache.CacheFilterClassImpl
>>># allows filtering of classes
>>># - org.apache.ojb.broker.cache.CacheFilterPackageImpl
>>># allows filtering of packages
>>># More info see Javadoc of the according classes.
>>># Set a comma separated list of CacheFilter.
>>>
>>
>>
> #ObjectCacheFilter=org.apache.ojb.broker.cache.CacheFilterClassImpl,org.apac
> 
>>>he.ojb.broker.cache.CacheFilterPackageImpl
>>>#
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># Locking
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># The LockManagerClass entry tells OJB which concrete LockManager
>>># implementation is to be used.
>>>LockManagerClass=org.apache.ojb.odmg.locking.LockManagerDefaultImpl
>>>#
>>># The LockMapClass entry tells OJB which concrete LockMap
>>># implementation is to be used.
>>># If OJB is running on multiple concurrent clients it is recommended
>>># to use the RemoteLockMapImpl. It guarantees to provide
>>># Lockmanagement across multiple JVMs.
>>># This Implemenation relies on a Servlet based Lockserver. To use it you
>>>have to
>>># deploy the ojb-lockserver.war into a Servlet engine.
>>># and you have to set the Property LockServletUrl to point to this
>>
>>servlet.
>>
>>
>>># (see LockServletUrl section below).
>>># If OJB is running in a single JVM (e.g. in a desktop app, or in a
>>
>>servlet
>>
>>
>>># engine) it is save to use the InMemoryLockMapImpl. Using it will result
>>># in a large performance gain.
>>>#LockMapClass=org.apache.ojb.odmg.locking.RemoteLockMapImpl
>>>LockMapClass=org.apache.ojb.odmg.locking.InMemoryLockMapImpl
>>>#
>>># The LockTimeout entry defines the maximum time in milliseconds
>>># that a lock may be hold. Defaults to 60000 = 1 minute
>>>LockTimeout=60000
>>>#
>>># The ImplicitLocking entry defines if implicit lock acquisition is
>>># to be used. If set to true OJB implicitely locks objects to ODMG
>>># transactions after performing OQL queries.
>>># If implicit locking is used locking objects is recursive, that is
>>># associated objects are also locked.
>>># If ImplicitLocking is set to false, no locks are obtained in OQL
>>># queries and there is also no recursive locking.
>>>ImplicitLocking=true
>>>#ImplicitLocking=false
>>>#
>>>#
>>># The LockServletUrl entry points to the Lockserver servlet.
>>># This Servlet is addressed by all distributed JVMs if the
>>
>>RemoteLockMapImpl
>>
>>
>>># is used.
>>>LockServletUrl=http://127.0.0.1:8080/ojb-lockserver
>>>#
>>>#
>>># The LockAssociations entry defines the behaviour for the OJB
>>># implicit locking feature. If set to WRITE (default) acquiring a write-
>>># lock on a given object x implies write locks on all objects associated
>>># to x. If set to READ implicit read-locks are acquired.
>>># Acquiring a read-lock on x thus allways results in implicit read-locks
>>># on all associated objects.
>>>#LockAssociations=READ
>>>LockAssociations=WRITE
>>>#
>>>#
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># OQL / SQL settings
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># The OqlCollectionClass entry defines the collection type returned
>>># from OQL queries. By default this value is set to DListImpl.
>>># This will be good for most situations as DList allows maximum
>>
>>flexibility
>>
>>
>>># in a ODMG environment. See also section 'ODMG settings'.
>>># Using DLists for large resultsets may be bad for application
>>
>>performance.
>>
>>
>>># For these scenarios you can use ArrayLists or Vectors.
>>># Important note: the collections class to be used MUST implement the
>>># interface org.apache.ojb.broker.ManageableCollection.
>>>#
>>>OqlCollectionClass=org.apache.ojb.odmg.collections.DListImpl_2
>>>#
>>>
>>
>>
> OqlCollectionClass=org.apache.ojb.broker.util.collections.ManageableArrayLis
> 
>>>t
>>># OqlCollectionClass=org.apache.ojb.broker.util.ManageableVector
>>>#
>>># The SqlInLimit entry limits the number of values in IN-sql statement,
>>># -1 for no limits. This hint is used in Criteria.
>>>SqlInLimit=200
>>>#
>>>#
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># ODMG settings
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># Specify the used base class for ODMG API
>>># - ImplementationDefaultImpl is the default class
>>># - ImplementationJTAImpl is for use in managed environments like J2EE
>>>conform
>>># Application Server
>>>#
>>>#ImplementationClass=org.apache.ojb.odmg.ImplementationImpl
>>>ImplementationClass=org.apache.ojb.odmg.ImplementationJTAImpl
>>>#
>>>#
>>># Specify the used tx handling.
>>># - LocalTxManager use if you want the transaction to be associated by a
>>>thread
>>># - JTATxManager use if you want the transaction to be associated via the
>>>Transaction
>>># manager that is in your application server.
>>>#
>>>#OJBTxManagerClass=org.apache.ojb.odmg.LocalTxManager
>>>OJBTxManagerClass=org.apache.ojb.odmg.JTATxManager
>>>#
>>>#
>>># Used ODMG collection implementation classes
>>># (e.g. when do a Implementation#newDlist() call)
>>>#
>>># org.odmg.DList implementation class
>>>DListClass=org.apache.ojb.odmg.collections.DListImpl_2
>>>#DListClass=org.apache.ojb.odmg.collections.DListImpl
>>>#
>>># org.odmg.DArray implementation class
>>>DArrayClass=org.apache.ojb.odmg.collections.DListImpl_2
>>>#DArrayClass=org.apache.ojb.odmg.collections.DListImpl
>>>#
>>># org.odmg.DMap implementation class
>>>DMapClass=org.apache.ojb.odmg.collections.DMapImpl
>>>#
>>># org.odmg.DBag implementation class
>>>DBagClass=org.apache.ojb.odmg.collections.DBagImpl
>>>#
>>># org.odmg.DSet implementation class
>>>DSetClass=org.apache.ojb.odmg.collections.DSetImpl
>>>#
>>>#
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># Meta data / mapping settings
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># The PersistentFieldClass property defines the implementation class
>>># for PersistentField attributes used in the OJB MetaData layer.
>>># By default the best performing attribute/refection based implementation
>>># is selected (PersistentFieldDirectAccessImpl).
>>>#
>>># - PersistentFieldDirectAccessImpl
>>>#   is a high-speed version of the access strategies.
>>>#   It does not cooperate with an AccessController,
>>>#   but accesses the fields directly. Persistent
>>>#   attributes don't need getters and setters
>>>#   and don't have to be declared public or protected
>>># - PersistentFieldPrivilegedImpl
>>>#   Same as above, but does cooperate with AccessController and do not
>>>#   suppress the java language access check (but is slow compared with
>>>direct access).
>>># - PersistentFieldIntrospectorImpl
>>>#   uses JavaBeans compliant calls only to access persistent attributes.
>>>#   No Reflection is needed. But for each attribute xxx there must be
>>>#   public getXxx() and setXxx() methods.
>>># - PersistentFieldDynaBeanAccessImpl
>>>#   implementation used to access a property from a
>>>#   org.apache.commons.beanutils.DynaBean.
>>># - PersistentFieldAutoProxyImpl
>>>#   for each field determines upon first access how to access this
>>>particular field
>>>#   (directly, as a bean, as a dyna bean) and then uses that strategy
>>>#
>>>
>>
>>
> #PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentF
> 
>>>ieldDirectAccessImpl
>>>
>>
>>
> #PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentF
> 
>>>ieldPrivilegedImpl
>>>
>>
>>
> #PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentF
> 
>>>ieldIntrospectorImpl
>>>
>>
>>
> #PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentF
> 
>>>ieldDynaBeanAccessImpl
>>>
>>
>>
> #PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentF
> 
>>>ieldAutoProxyImpl
>>>#
>>># Here are the new upcoming PersistentField implementations. These classes
>>>will replace the
>>># 'old' ones on next release. They pass the test-suite, but should be
>>
>>tested
>>
>>
>>>by community too.
>>># The new implementations are about 50 times faster in handling nested
>>>fields.
>>>
>>
>>
> PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFi
> 
>>>eldDirectAccessImplNew
>>>
>>
>>
> #PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentF
> 
>>>ieldPrivilegedImplNew
>>>
>>
>>
> #PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentF
> 
>>>ieldIntrospectorImplNew
>>>
>>
>>
> #PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentF
> 
>>>ieldAutoProxyImpl
>>>
>>
>>
> #PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentF
> 
>>>ieldDynaBeanImplNew
>>>#(DynaBean implementation does not support nested fields)
>>>#
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># Component Intercepting for Profiling and Tracing
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># By enabling an InterceptorClass all OJB components will use
>>># this Interceptor. Interceptors allow advanced tracing and Profiling
>>># of all component method calls.
>>># This is currently an experimental feature useful only for OJB kernel
>>>developers.
>>>#
>>>
>>
>>
> #InterceptorClass=org.apache.ojb.broker.util.interceptor.TracingInterceptor
> 
>>>#
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># Transaction Management and assocation
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># (optional, only used when OJB runs within managed environments)
>>># To praticipate in JTA transaction OJB needs access to the underlying
>>>transaction manager.
>>># The TransactionManager is acquired in different ways dependent on the
>>>application server.
>>># The JTATransactionManagerClass property allows you to specify the class
>>>that implements
>>># the proper behaviour for finding the transaction manager. Only use when
>>>OJBTxManagerClass
>>># is set to a factory that uses the application server transaction manager
>>># (org.apache.ojb.odmg.JTATxManager)
>>>#
>>>
>>># JBoss Transaction Manager Factory
>>>
>>
>>
> JTATransactionManagerClass=org.apache.ojb.broker.transaction.tm.JBossTransac
> 
>>>tionManagerFactory
>>># Weblogic Transaction Manager Factory
>>>
>>
>>
> #JTATransactionManagerClass=org.apache.ojb.broker.transaction.tm.WeblogicTra
> 
>>>nsactionManagerFactory
>>># WebSphere transaction manager factory
>>>
>>
>>
> #JTATransactionManagerClass=org.apache.ojb.broker.transaction.tm.WebSphereTr
> 
>>>ansactionManagerFactory
>>># Orion transaction manager factory
>>>
>>
>>
> #JTATransactionManagerClass=org.apache.ojb.broker.transaction.tm.OrionTransa
> 
>>>ctionManagerFactory
>>># SunOne transaction manager factory
>>>
>>
>>
> #JTATransactionManagerClass=org.apache.ojb.broker.transaction.tm.SunOneTrans
> 
>>>actionManagerFactory
>>># JOnAs transaction manager factory
>>>
>>
>>
> #JTATransactionManagerClass=org.apache.ojb.broker.transaction.tm.JOnASTransa
> 
>>>ctionManagerFactory
>>>#
>>>#
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># Logging settings are now in their own file, OJB-logging.properties
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>># End of OJB.properties file
>>>
>>
>>
> #---------------------------------------------------------------------------
> 
>>>-------------
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>For additional commands, e-mail: ojb-user-help@db.apache.org
>>>
>>>
>>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org