Solution (source code)

= Solution

Continuity and adaptedness make the first boundary hit a <stopping time>. A continuous path starting in the open domain cannot leave it before meeting its boundary. Thus $X_{t\wedge T}\in\mathcal D\cup\partial\mathcal D$, with the usual interpretation when $T=\infty$. If $|u|\le K$ on this set, then
$$
|M_{t\wedge T}|=e^{-\lambda(t\wedge T)}|u(X_{t\wedge T})|\le K.
$$
The stopped process is a bounded <local martingale>; the <bounded local martingale criterion> makes it a martingale and, in fact, a <uniformly integrable martingale>. The <Martingale convergence theorem> gives \b[almost sure and $L^1$ convergence] as $t\to\infty$.

Its limit can also be identified pathwise. On $\{T<\infty\}$ the stopped process is eventually constant at $e^{-\lambda T}u(X_T)$. On $\{T=\infty\}$ its absolute value is at most $Ke^{-\lambda t}$ and hence tends to zero. Thus the limit is $e^{-\lambda T}u(X_T)\mathbf1_{\{T<\infty\}}$.