<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Loading Feature Layer in a map in Java Maps SDK Questions</title>
    <link>https://community.esri.com/t5/java-maps-sdk-questions/loading-feature-layer-in-a-map/m-p/1206684#M2622</link>
    <description>&lt;P&gt;For the serviceFeatureTable to load something needs to trigger it.&amp;nbsp; If you are using it to create a FeatureLayer and then add it to the operational layers list of your map this will happen automatically.&lt;/P&gt;&lt;P&gt;However if you are not adding it to an ArcGISMap instance then you will need to trigger the load event yourself using this line of code:&lt;/P&gt;&lt;LI-CODE lang="java"&gt;serviceFeatureTable.loadAsync();&lt;/LI-CODE&gt;&lt;P&gt;Does this make the event fire?&lt;/P&gt;</description>
    <pubDate>Fri, 26 Aug 2022 10:58:51 GMT</pubDate>
    <dc:creator>MarkBaird</dc:creator>
    <dc:date>2022-08-26T10:58:51Z</dc:date>
    <item>
      <title>Loading Feature Layer in a map</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/loading-feature-layer-in-a-map/m-p/1206673#M2619</link>
      <description>&lt;P&gt;I have two feature layers, one which I got from an authorized publisher (in the form of a shapefile), and the other which I created from scratch (using ArcMap).&lt;/P&gt;&lt;P&gt;I'm able to load the former using the following snippet,&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;ServiceFeatureTable serviceFeatureTable = new ServiceFeatureTable(&amp;lt;service_url&amp;gt;);&lt;/P&gt;&lt;P&gt;serviceFeatureTable.addDoneLoadingListener(() -&amp;gt; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; if (serviceFeatureTable.getLoadStatus() == LoadStatus.LOADED) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.err.println("loaded layer");&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; featureLayer = new FeatureLayer(serviceFeatureTable);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; map.getOperationalLayers().add(featureLayer);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; } else {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.err.println("cannot load");&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw serviceFeatureTable.getLoadError();&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;while, in the second one, addDoneLoadingListener isn't being called at all.&lt;/P&gt;&lt;P&gt;In the second feature layer, I'm using REST addFeatures to populate/update entries.&lt;/P&gt;&lt;P&gt;What could cause the second layer to not load? What all things should I check for in the portal/server?&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 09:52:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/loading-feature-layer-in-a-map/m-p/1206673#M2619</guid>
      <dc:creator>VineetMenon</dc:creator>
      <dc:date>2022-08-26T09:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: Loading Feature Layer in a map</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/loading-feature-layer-in-a-map/m-p/1206679#M2620</link>
      <description>&lt;P&gt;Whenever I see a DoneLoadingListener not firing, I would confirm that you are not being hit by the JVM garbage collection cleaning up your service feature table class before you had chance to use it.&lt;/P&gt;&lt;P&gt;In the code snippet above your ServiceFeatureTable class instance is a local variable, but the event fires on a separate thread when possibly the variable has gone out of scope and is vulnerable to garbage collection.&lt;/P&gt;&lt;P&gt;Can you try making the variable for the ServiceFeatureTable a class member and see if it improves things?&lt;/P&gt;&lt;P&gt;If this fixes the issue, there is a blog post I wrote which explain this in more detail &lt;A href="https://www.esri.com/arcgis-blog/products/developers/field-mobility/a-pitfall-of-asynchronous-java-code/" target="_self"&gt;here&lt;/A&gt;.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if that helps - can look at other things if this isn't the problem.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 10:22:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/loading-feature-layer-in-a-map/m-p/1206679#M2620</guid>
      <dc:creator>MarkBaird</dc:creator>
      <dc:date>2022-08-26T10:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: Loading Feature Layer in a map</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/loading-feature-layer-in-a-map/m-p/1206680#M2621</link>
      <description>&lt;P&gt;Hi Mark,&lt;/P&gt;&lt;P&gt;Thanks for the quick reply.&lt;/P&gt;&lt;P&gt;Unfortunately, making the serviceFeatureTable a member variable doesn't help.&lt;/P&gt;&lt;P&gt;I'm thinking the issue is related to my layer, because as I said, another feature layer published from a shapefile can be loaded onto the map.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 10:27:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/loading-feature-layer-in-a-map/m-p/1206680#M2621</guid>
      <dc:creator>VineetMenon</dc:creator>
      <dc:date>2022-08-26T10:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: Loading Feature Layer in a map</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/loading-feature-layer-in-a-map/m-p/1206684#M2622</link>
      <description>&lt;P&gt;For the serviceFeatureTable to load something needs to trigger it.&amp;nbsp; If you are using it to create a FeatureLayer and then add it to the operational layers list of your map this will happen automatically.&lt;/P&gt;&lt;P&gt;However if you are not adding it to an ArcGISMap instance then you will need to trigger the load event yourself using this line of code:&lt;/P&gt;&lt;LI-CODE lang="java"&gt;serviceFeatureTable.loadAsync();&lt;/LI-CODE&gt;&lt;P&gt;Does this make the event fire?&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 10:58:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/loading-feature-layer-in-a-map/m-p/1206684#M2622</guid>
      <dc:creator>MarkBaird</dc:creator>
      <dc:date>2022-08-26T10:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: Loading Feature Layer in a map</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/loading-feature-layer-in-a-map/m-p/1206686#M2623</link>
      <description>&lt;P&gt;If that doesn't work then take a look at your service endpoint in a browser.&amp;nbsp; It should look something like this one which I know works fine:&lt;/P&gt;&lt;P&gt;&lt;A href="https://sampleserver6.arcgisonline.com/arcgis/rest/services/Energy/Geology/FeatureServer/9" target="_blank"&gt;https://sampleserver6.arcgisonline.com/arcgis/rest/services/Energy/Geology/FeatureServer/9&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 11:02:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/loading-feature-layer-in-a-map/m-p/1206686#M2623</guid>
      <dc:creator>MarkBaird</dc:creator>
      <dc:date>2022-08-26T11:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: Loading Feature Layer in a map</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/loading-feature-layer-in-a-map/m-p/1206687#M2624</link>
      <description>&lt;P&gt;Hi Mark,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes. The layer loading wasn't getting triggered.&lt;/P&gt;&lt;P&gt;Thanks a lot for your help.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 11:08:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/loading-feature-layer-in-a-map/m-p/1206687#M2624</guid>
      <dc:creator>VineetMenon</dc:creator>
      <dc:date>2022-08-26T11:08:07Z</dc:date>
    </item>
  </channel>
</rss>

