()
| 121 | } |
| 122 | |
| 123 | @Override |
| 124 | public Set<K> keySet() { |
| 125 | byte[] rep; |
| 126 | try { |
| 127 | MapMessage<K,V> request = new MapMessage<>(); |
| 128 | request.setType(MapRequestType.KEYSET); |
| 129 | |
| 130 | //invokes BFT-SMaRt |
| 131 | rep = serviceProxy.invokeUnordered(MapMessage.toBytes(request)); |
| 132 | } catch (IOException e) { |
| 133 | System.out.println("Failed to send KEYSET request: " + e.getMessage()); |
| 134 | return Collections.emptySet(); |
| 135 | } |
| 136 | |
| 137 | if (rep.length == 0) { |
| 138 | return Collections.emptySet(); |
| 139 | } |
| 140 | try { |
| 141 | MapMessage<K,V> response = MapMessage.fromBytes(rep); |
| 142 | return response.getKeySet(); |
| 143 | } catch (ClassNotFoundException | IOException ex) { |
| 144 | System.out.println("Failed to deserialized response of KEYSET request: " + ex.getMessage()); |
| 145 | return Collections.emptySet(); |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | public void close() { |
| 150 | serviceProxy.close(); |
no test coverage detected