Cool, finally tracked down all the little things that was killing this
and managed to get my tests working!
I may be pinging the list with other questions as I run into issues.
Hopefully there won't be too many, but as I beef up my framework I may
be asking more as I run into other config options that I want to
support (keeping it simple right now).
-warner
On Nov 20, 2007 9:31 AM, Warner Onstine <[EMAIL PROTECTED]> wrote:
> Ok, so I narrowed it down further and found the method that was
> locking in Throttle
>
> public void increment() {
> synchronized (LOCK) {
> long totalWaitTime = 0;
> while (count >= limit) {
> if (maxWait > 0) {
> long waitTime = System.currentTimeMillis();
> try {
> LOCK.wait(maxWait - totalWaitTime);
> } catch (InterruptedException e) {
> //ignore
> }
> totalWaitTime += System.currentTimeMillis() - waitTime;
> if (totalWaitTime > maxWait) {
> throw new RuntimeException("Throttle waited too long (" +
> totalWaitTime + " milliseconds) for lock.");
> }
> } else {
> try {
> LOCK.wait();
> } catch (InterruptedException e) {
> //ignore
> }
> }
> }
> count++;
> }
> }
>
> What was happening in my config instance is limit was set to 0, but
> when I run the normal config it is set to 32 so it will increment the
> count and come back. Still trying to figure out how the Throttle limit
> is set during config setup.
>
> -warner
>
>
> On Nov 19, 2007 12:47 PM, Warner Onstine <[EMAIL PROTECTED]> wrote:
> > Ok, so admittedly I'm pushing things a bit here, but I'm hoping
> > someone can help me see what I'm doing wrong (or point me in the right
> > direction. I am attempting to write a small groovy framework that gets
> > rid of the xml config and mapping files.
> >
> > Where I'm running into trouble right now is in running my test. I have
> > a basic config setup and one MappedStatement. I know that my statement
> > is setup as when I query the delegate it comes back with my current
> > statement. But when I run the test it just "hangs" in some kind of
> > infinite loop.
> >
> > I've tracked this down to this piece of code, but can't figure out why
> > it's dying:
> >
> > SqlMapExecutorDelegate
> > public void startTransaction(SessionScope session) throws SQLException {
> > try {
> > txManager.begin(session);
> > } catch (TransactionException e) {
> > throw new NestedSQLException("Could not start transaction.
> > Cause: " + e, e);
> > }
> > }
> >
> > I'm sure it's because I missed some configuration property when I was
> > setting up the delegate but I'm not sure what it might be. Here's my
> > groovy version of setting up the delegate:
> >
> > def public SqlMapClient buildSqlMapClient(DBConfiguration config) {
> > def connection = config.getTestConnection()
> > def delegate = new SqlMapExecutorDelegate()
> > def client = new SqlMapClientImpl(delegate)
> > def dsConfig = ["JDBC.Driver": connection.driver,
> > "JDBC.ConnectionURL": connection.url +
> > connection.dbName,
> > "JDBC.Username": connection.username,
> > "JDBC.Password": connection.password,
> > "JDBC.DefaultAutoCommit": "false"]
> > def ds = new SimpleDataSource(dsConfig)
> > def txMgrConfig = new JdbcTransactionConfig()
> > txMgrConfig.setDataSource(ds)
> > def txManager = new TransactionManager(txMgrConfig)
> > delegate.setTxManager(txManager)
> > addStatements(delegate)
> > return client
> > }
> >
> > Thanks in advance for all the help!
> >
> > -warner
> >
> > --
> > Warner Onstine - Programmer/Author
> > New book on Tapestry 4!
> > Tapestry 101 available at
> > http://sourcebeat.com/books/tapestrylive.html
> > [EMAIL PROTECTED]
> > http://warneronstine.com/blog
> >
>
>
>
> --
> Warner Onstine - Programmer/Author
> New book on Tapestry 4!
> Tapestry 101 available at
> http://sourcebeat.com/books/tapestrylive.html
> [EMAIL PROTECTED]
> http://warneronstine.com/blog
>
--
Warner Onstine - Programmer/Author
New book on Tapestry 4!
Tapestry 101 available at
http://sourcebeat.com/books/tapestrylive.html
[EMAIL PROTECTED]
http://warneronstine.com/blog