<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><br>
</p>
<br>
<div class="moz-cite-prefix">On 10/27/2016 08:42 AM, Gunnar Morling
wrote:<br>
</div>
<blockquote
cite="mid:CADGJaX8HtPHAQT3K=sZfR9ZpWwH558du5TwByQJ1ZwQWCxSUiw@mail.gmail.com"
type="cite">
<div dir="ltr">Hi,
<div><br>
</div>
<div>---</div>
<div>TL,DR: Hibernate components would like to receive the
Jandex index during deployment. A new method IndexView#close()
may help to address concerns about long-living index view
references</div>
<div>---<br>
</div>
<div><br>
</div>
<div>Different projects from the Hibernate umbrella (e.g. ORM,
Validator and Search) rely heavily on meta-data given via
annotations. In order to speed up annotation retrieval, we are
looking into using the Jandex index created for deployments by
the container.</div>
<div><br>
</div>
<div>This would require subsystems like JipiJapa or the one for
Bean Validation to pass the IndexView for the deployment to
the bootstrapped component. The change itself should be easy,
I hope. But Scott expressed concerns about components keeping
references to the index after the deployment phase has
succeeded. As indexes can be large, this may potentially
block a big chunk of memory for as long as the deployment is
running.</div>
<div><br>
</div>
<div>Of course we can promise that Hibernate components wouldn't
keep such references ;) But if that's not enough, could this
concern be mitigated by adding a new method IndexView#close()?</div>
<div><br>
</div>
<div>This method would free all resources of the index and would
be called by the container after the deployment has finished.
Any operation on a closed index view would throw an exception
indicating that the view has been closed. Then, even if a
component accidentally kept a reference to an IndexView, it
wouldn't retain much memory (of course the index view wouldn't
be of much use to the component in that state).</div>
<div><br>
</div>
<div>Would that be an acceptable way forward? If so, I could
send a pull request towards Jandex. In a next step WF would
have to make use of that new version and invoke close() on a
deployment's index at a suitable time during the deployment
lifecycle and eventually pass the index to ORM et al.<br>
</div>
<div><br>
</div>
<div>In a subsequent step we may consider to address use cases
such as dynamic reconfiguration which would require to access
the index *after* deployment time. One way for addressing this
may be to allow for passing in some kind of executor which
would expect e.g. a Lambda doing work on an IndexView passed
in by the executor. That way components could access the index
at runtime, while not keeping a reference to it themselves and
thus allowing the container to manage the index and e.g. close
or re-open it upon execution. But I think this could be done
as a follow-up.</div>
</div>
</blockquote>
<br>
A related question might be if creating a Jandex Index after
application deployment completes, could be backed by the application
classloader defined classes and whether that would be memory space
efficient enough for runtime use.<br>
<br>
<blockquote
cite="mid:CADGJaX8HtPHAQT3K=sZfR9ZpWwH558du5TwByQJ1ZwQWCxSUiw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div><br>
</div>
<div>Any thoughts?</div>
<div><br>
</div>
<div>Thanks,</div>
<div><br>
</div>
<div>--Gunnar</div>
<div><br>
</div>
<div>PS: As a side note, Hibernate Validator currently reads
annotations lazily at runtime (when first validating a
specific bean type). When using Jandex, we'd have to change
this to eagerly build up all the meta-data for the types
listed in the index passed during bootstrap. A bit of work,
but as said we hope to gain a nice performance improvement
from it.</div>
<div><br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
wildfly-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:wildfly-dev@lists.jboss.org">wildfly-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/wildfly-dev">https://lists.jboss.org/mailman/listinfo/wildfly-dev</a></pre>
</blockquote>
<br>
</body>
</html>