public void setState(InputStream istream) throws Exception { HashMap<K,V> new_copy=null; try(ObjectInputStream ois=new ObjectInputStream(istream)) { new_copy=(HashMap<K,V>)ois.readObject(); } if(new_copy != null) _putAll(new_copy); log.debug("state received successfully"); }
public void setState(InputStream istream) throws Exception { HashMap<K,V> new_copy=null; try(ObjectInputStream ois=new ObjectInputStream(istream)) { new_copy=(HashMap<K,V>)ois.readObject(); } if(new_copy != null) _putAll(new_copy); log.debug("state received successfully"); }
public void setState(byte[] new_state) { HashMap<K,V> new_copy; try { new_copy=(HashMap<K,V>)Util.objectFromByteBuffer(new_state); if(new_copy == null) return; } catch(Throwable ex) { if(log.isErrorEnabled()) log.error("exception unmarshalling state: " + ex); return; } _putAll(new_copy); state_promise.setResult(Boolean.TRUE); }
public void setState(InputStream istream) { HashMap<K,V> new_copy=null; ObjectInputStream ois=null; try { ois=new ObjectInputStream(istream); new_copy=(HashMap<K,V>)ois.readObject(); ois.close(); } catch(Throwable e) { e.printStackTrace(); if(log.isErrorEnabled()) log.error("exception marshalling state: " + e); } finally { Util.close(ois); } if(new_copy != null) _putAll(new_copy); state_promise.setResult(Boolean.TRUE); }
/** * Copies all of the mappings from the specified Map to this hashmap. * These mappings will replace any mappings that this hashmap had for any of the keys currently in the specified Map. * @param m - Mappings to be stored in this map */ public void putAll(Map<? extends K, ? extends V> m) { if(send_message == true) { try { MethodCall call=new MethodCall((short)2, new Object[]{m}); disp.callRemoteMethods(null, call, update_mode, timeout); } catch(Throwable t) { throw new RuntimeException("putAll() failed", t); } } else { _putAll(m); } }