Two Java RPC Calls or One
I have a requirement to return two different pieces of string data through RPC calls.
Would it be better to m开发者_运维技巧ake one RPC call and return a hashmap with both data points in the hashmap or make two separate RPC calls and return a different string each time or does it matter? Is there a best practice that I should employ here?
If they're closely related, then it's best practice to return them together... either in a map like you said, or preferably in a UIVO/DTO.
If they're completely unrelated, then you should separate out your RPC methods and make two different calls.
Reducing the network IO is always good. for your simple case return a Map.
精彩评论