Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I improve this implementation to be more efficient
    primarykey
    data
    text
    <p>I have a service method that needs to process an incoming object: (by the way, this is pseudo code)</p> <pre><code>public class IncomingParentObject { public Collection&lt;IncomingChildOject&gt; childObjects; } public Class IncmoingChildObject { public String name; } </code></pre> <p>I have a "registry" of "clients" that care about a subset of the incoming child objects. At the point of registration we only know about the "name". The client object encapsulates details for the transport layer to forward information to.</p> <pre><code>public class Registry { // String represents the name in the child object public Map&lt;String, Set&lt;Client&gt;&gt; clients; } </code></pre> <p>Right now the service class is something along the lines of this:</p> <pre><code>public void processIncmoingParentObject(IncomingParentObject parentObject) { for (IncmoingChildObject childObject : parentObject.childObjects) { Set&lt;Client&gt; clients = registry.clients.get(childObject.name); for (Client client : clients) { this.transportLayer.transportChildObject(childObject, client); } } } </code></pre> <p>This results in several calls to the transportLayer (which may be expensive or timely). I want to reduce this to basically one transport per client of a subset of ChildObjects. </p> <pre><code>transportLayer.transport(Client client, Set&lt;IncmoingChildObject&gt; childObjects); </code></pre> <p>What would an effiecent manor be to scan through the parents children to determine a subset of children to send to a client. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload