Commit f64567e
committed
Assert lease wraps the same pooled QueryImpl
borrowQuery() returns a thin Query lease that is freshly allocated on
every borrow, while the heavy state it delegates to -- the per-worker
QueryImpl -- is pre-allocated once and reused across borrows. Nothing
pinned that the fresh wrapper actually points back at the one pooled
QueryImpl, so a regression that allocated a new QueryImpl per borrow (or
dropped the worker's reuse) would have gone unnoticed here.
Add testLeaseWrapsSamePooledQueryImpl: two lease() calls on the same
worker must return distinct wrappers (assertNotSame) that delegate to the
same pooled QueryImpl (assertSame on the reflected impl field). lease()
never dereferences the client or pool, so the worker is built with nulls,
mirroring the null-worker shortcut the reset test already uses.1 parent e30a59c commit f64567e
1 file changed
Lines changed: 35 additions & 0 deletions
Lines changed: 35 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
100 | 135 | | |
101 | 136 | | |
102 | 137 | | |
| |||
0 commit comments