Well, to be clear, you can have linked nodes. But if N had both `next` and
`previous` members is where you'd run into trouble.

On Sun, Sep 24, 2023 at 12:22 PM Matt Benson <[email protected]> wrote:

> If you're doing a search down the tree you'd need some way to keep JXPath
> from traversing these relationships, yes.
>
> On Sun, Sep 24, 2023 at 11:59 AM Debraj Manna <[email protected]>
> wrote:
>
>> Are you saying that in JxPath we cannot use something like below?
>>
>> class A {
>>     int n;
>>     A next;
>> }
>>
>> On Sun, Sep 24, 2023 at 8:43 PM Matt Benson <[email protected]> wrote:
>>
>> > Is it possible the proto message (I'm not familiar with this API) is
>> built
>> > with internal recursive references, i.e. some child has a property that
>> > points, possibly indirectly, to its parent? That would be the most
>> probable
>> > explanation, particularly as you say feeding jxpath the known absolute
>> path
>> > works.
>> >
>> > Matt
>> >
>> > On Sun, Sep 24, 2023, 9:44 AM Debraj Manna <[email protected]>
>> > wrote:
>> >
>> > > It looks like it is getting stuck in some infinite loop. The thread
>> stack
>> > > looks like below after ~ 8 hours from the start.
>> > >
>> > > main  Runnable CPU usage on sample: 979ms
>> > >   jdk.internal.reflect.GeneratedMethodAccessor640.invoke()
>> > >
>> > >
>> > >
>> >
>> jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> > >   java.lang.reflect.Method.invoke(Method.java:568)
>> > >
>>  org.apache.commons.jxpath.util.ValueUtils.getValue(ValueUtils.java:367)
>> > >
>> > >
>> > >
>> >
>> org.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer.getBaseValue(BeanPropertyPointer.java:120)
>> > >
>> > >
>> > >
>> >
>> org.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer.getImmediateNode(BeanPropertyPointer.java:149)
>> > >
>> > >
>> > >
>> >
>> org.apache.commons.jxpath.ri.model.beans.PropertyPointer.getImmediateValuePointer(PropertyPointer.java:161)
>> > >
>> > >
>> > >
>> >
>> org.apache.commons.jxpath.ri.model.NodePointer.getValuePointer(NodePointer.java:297)
>> > >
>> > >
>> > >
>> >
>> org.apache.commons.jxpath.ri.model.beans.PropertyIterator.getNodePointer(PropertyIterator.java:121)
>> > >
>> > >
>> > >
>> >
>> org.apache.commons.jxpath.ri.axes.DescendantContext.nextNode(DescendantContext.java:115)
>> > >
>>  org.apache.commons.jxpath.ri.EvalContext.nextSet(EvalContext.java:349)
>> > >
>> > >
>> > >
>> >
>> org.apache.commons.jxpath.ri.axes.ChildContext.getSingleNodePointer(ChildContext.java:70)
>> > >
>>  org.apache.commons.jxpath.ri.compiler.Path.searchForPath(Path.java:201)
>> > >
>> > >
>> > >
>> >
>> org.apache.commons.jxpath.ri.compiler.Path.getSingleNodePointerForSteps(Path.java:176)
>> > >
>> > >
>> > >
>> >
>> org.apache.commons.jxpath.ri.compiler.LocationPath.computeValue(LocationPath.java:87)
>> > >
>> > >
>> > >
>> >
>> org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathContextReferenceImpl.java:353)
>> > >
>> > >
>> > >
>> >
>> org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathContextReferenceImpl.java:313)
>> > >
>> > >
>> > >
>> >
>> com.spotnana.webhooks.isos.PNRListBuilderTest.testJxPathCtx(PNRListBuilderTest.java:366)
>> > >
>> > > On Sun, Sep 24, 2023 at 1:24 AM Debraj Manna <
>> [email protected]>
>> > > wrote:
>> > >
>> > > > I am trying to search using JxPath on a proto message, My proto
>> message
>> > > is
>> > > > placed here
>> > > > <
>> https://gist.github.com/debraj-manna/4a8ded5d79dc9aee8d4c03d460327284
>> > >.
>> > > >
>> > > > val protoStr =
>> > > > getStringFromFile("classpath:BookingEnginePnrUpdateEventProto.txt");
>> > > > val msgBld = BookingEnginePNRUpdateEvent.newBuilder();
>> > > > TextFormat.getParser().merge(protoStr, msgBld);
>> > > > val msgCtx = JXPathContext.newContext(msgBld.build());
>> > > > System.out.println(msgCtx.getValue("//employeeId"));
>> > > >
>> > > > I am observing that  msgCtx.getValue("//employeeId") is taking a
>> lot of
>> > > > time. Thread dumps at various points are placed in the below gist.
>> > > >
>> > > >
>> https://gist.github.com/debraj-manna/47852fa190075abdacd527969f355cde
>> > > >
>> > > > If I specify the entire path like
>> > > >
>> > >
>> >
>> msgCtx.getValue("/metadata/bookerInfo/traveler/userBusinessInfo/employeeId").
>> > > > It is working fine.
>> > > >
>> > > > Can someone let me know what is going wrong? Is this expected?
>> > > >
>> > > >
>> > > >
>> > > >
>> > > >
>> > >
>> >
>>
>

Reply via email to