@Override public boolean containsValue(Object value) { if (value == null) { throw new NullPointerException(); } Iterator<Map.Entry<K,MapEntry<K,V>>> i = innerMap.entrySet().iterator(); while (i.hasNext()) { Map.Entry<K,MapEntry<K,V>> e = i.next(); MapEntry<K,V> entry = innerMap.get(e.getKey()); if (entry!=null && entry.isActive() && value.equals(entry.getValue())) return true; } return false; }
public String toString() { StringBuffer buf = new StringBuffer("MapEntry[key:"); buf.append(getKey()).append("; "); buf.append("value:").append(getValue()).append("; "); buf.append("primary:").append(isPrimary()).append("; "); buf.append("backup:").append(isBackup()).append("; "); buf.append("proxy:").append(isProxy()).append(";]"); return buf.toString(); }
@Override public String toString() { StringBuilder buf = new StringBuilder("MapEntry[key:"); buf.append(getKey()).append("; "); buf.append("value:").append(getValue()).append("; "); buf.append("primary:").append(isPrimary()).append("; "); buf.append("backup:").append(isBackup()).append("; "); buf.append("proxy:").append(isProxy()).append(";]"); return buf.toString(); }
@Override public int size() { //todo, implement a counter variable instead //only count active members in this node int counter = 0; Iterator<Map.Entry<K,MapEntry<K,V>>> it = innerMap.entrySet().iterator(); while (it!=null && it.hasNext() ) { Map.Entry<?,?> e = it.next(); if ( e != null ) { MapEntry<K,V> entry = innerMap.get(e.getKey()); if (entry!=null && entry.isActive() && entry.getValue() != null) counter++; } } return counter; }
@Override public Set<MapEntry> entrySet() { LinkedHashSet<MapEntry> set = new LinkedHashSet<MapEntry>(super.size()); Iterator<Map.Entry<?,?>> i = super.entrySet().iterator(); while ( i.hasNext() ) { Map.Entry<?,?> e = i.next(); Object key = e.getKey(); MapEntry entry = (MapEntry)super.get(key); if ( entry != null && entry.isActive() ) { set.add(new MapEntry(key, entry.getValue())); } } return Collections.unmodifiableSet(set); }
@Override public int size() { //todo, implement a counter variable instead //only count active members in this node int counter = 0; Iterator<Map.Entry<K,MapEntry<K,V>>> it = innerMap.entrySet().iterator(); while (it!=null && it.hasNext() ) { Map.Entry<?,?> e = it.next(); if ( e != null ) { MapEntry<K,V> entry = innerMap.get(e.getKey()); if (entry!=null && entry.isActive() && entry.getValue() != null) counter++; } } return counter; }
public int size() { //todo, implement a counter variable instead //only count active members in this node int counter = 0; Iterator it = super.entrySet().iterator(); while (it!=null && it.hasNext() ) { Map.Entry e = (Map.Entry) it.next(); if ( e != null ) { MapEntry entry = (MapEntry) super.get(e.getKey()); if (entry!=null && entry.isPrimary() && entry.getValue() != null) counter++; } } return counter; }
public boolean containsValue(Object value) { if ( value == null ) { return super.containsValue(value); } else { Iterator i = super.entrySet().iterator(); while (i.hasNext()) { Map.Entry e = (Map.Entry) i.next(); MapEntry entry = (MapEntry) super.get(e.getKey()); if (entry!=null && entry.isPrimary() && value.equals(entry.getValue())) return true; }//while return false; }//end if }
@Override public String toString() { StringBuilder buf = new StringBuilder("MapEntry[key:"); buf.append(getKey()).append("; "); buf.append("value:").append(getValue()).append("; "); buf.append("primary:").append(isPrimary()).append("; "); buf.append("backup:").append(isBackup()).append("; "); buf.append("proxy:").append(isProxy()).append(";]"); return buf.toString(); }
@Override public Collection<V> values() { List<V> values = new ArrayList<>(); for (Entry<K, MapEntry<K, V>> e : innerMap.entrySet()) { MapEntry<K,V> entry = innerMap.get(e.getKey()); if (entry!=null && entry.isActive() && entry.getValue()!=null) values.add(entry.getValue()); } return Collections.unmodifiableCollection(values); }
@Override public boolean containsValue(Object value) { Objects.requireNonNull(value); for (Entry<K, MapEntry<K, V>> e : innerMap.entrySet()) { MapEntry<K,V> entry = innerMap.get(e.getKey()); if (entry!=null && entry.isActive() && value.equals(entry.getValue())) return true; } return false; }
public Set entrySet() { LinkedHashSet set = new LinkedHashSet(super.size()); Iterator i = super.entrySet().iterator(); while ( i.hasNext() ) { Map.Entry e = (Map.Entry)i.next(); Object key = e.getKey(); MapEntry entry = (MapEntry)super.get(key); if ( entry != null && entry.isPrimary() ) { set.add(new MapEntry(key, entry.getValue())); } } return Collections.unmodifiableSet(set); }
public V remove(Object key, boolean notify) { MapEntry<K,V> entry = innerMap.remove(key); try { if (getMapMembers().length > 0 && notify) { MapMessage msg = new MapMessage(getMapContextName(), MapMessage.MSG_REMOVE, false, (Serializable) key, null, null, null,null); getChannel().send(getMapMembers(), msg, getChannelSendOptions()); } } catch ( ChannelException x ) { log.error("Unable to replicate out data for a LazyReplicatedMap.remove operation",x); } return entry!=null?entry.getValue():null; }
@Override public String toString() { StringBuilder buf = new StringBuilder("MapEntry[key:"); buf.append(getKey()).append("; "); buf.append("value:").append(getValue()).append("; "); buf.append("primary:").append(isPrimary()).append("; "); buf.append("backup:").append(isBackup()).append("; "); buf.append("proxy:").append(isProxy()).append(";]"); return buf.toString(); }
@Override public Collection<Object> values() { ArrayList<Object> values = new ArrayList<Object>(); Iterator<Map.Entry<?,?>> i = super.entrySet().iterator(); while ( i.hasNext() ) { Map.Entry<?,?> e = i.next(); MapEntry entry = (MapEntry)super.get(e.getKey()); if (entry!=null && entry.isActive() && entry.getValue()!=null) values.add(entry.getValue()); } return Collections.unmodifiableCollection(values); }
public V remove(Object key, boolean notify) { MapEntry<K,V> entry = innerMap.remove(key); try { if (getMapMembers().length > 0 && notify) { MapMessage msg = new MapMessage(getMapContextName(), MapMessage.MSG_REMOVE, false, (Serializable) key, null, null, null,null); getChannel().send(getMapMembers(), msg, getChannelSendOptions()); } } catch ( ChannelException x ) { log.error(sm.getString("abstractReplicatedMap.unable.remove"),x); } return entry!=null?entry.getValue():null; }
@Override public Collection<V> values() { ArrayList<V> values = new ArrayList<>(); Iterator<Map.Entry<K,MapEntry<K,V>>> i = innerMap.entrySet().iterator(); while ( i.hasNext() ) { Map.Entry<K,MapEntry<K,V>> e = i.next(); MapEntry<K,V> entry = innerMap.get(e.getKey()); if (entry!=null && entry.isActive() && entry.getValue()!=null) values.add(entry.getValue()); } return Collections.unmodifiableCollection(values); }
public Collection values() { ArrayList values = new ArrayList(); Iterator i = super.entrySet().iterator(); while ( i.hasNext() ) { Map.Entry e = (Map.Entry)i.next(); MapEntry entry = (MapEntry)super.get(e.getKey()); if (entry!=null && entry.isPrimary() && entry.getValue()!=null) values.add(entry.getValue()); } return Collections.unmodifiableCollection(values); }
public Object remove(Object key, boolean notify) { MapEntry entry = (MapEntry)super.remove(key); try { if (getMapMembers().length > 0 && notify) { MapMessage msg = new MapMessage(getMapContextName(), MapMessage.MSG_REMOVE, false, (Serializable) key, null, null, null,null); getChannel().send(getMapMembers(), msg, getChannelSendOptions()); } } catch ( ChannelException x ) { log.error("Unable to replicate out data for a LazyReplicatedMap.remove operation",x); } return entry!=null?entry.getValue():null; }
public Object remove(Object key, boolean notify) { MapEntry entry = (MapEntry)super.remove(key); try { if (getMapMembers().length > 0 && notify) { MapMessage msg = new MapMessage(getMapContextName(), MapMessage.MSG_REMOVE, false, (Serializable) key, null, null, null,null); getChannel().send(getMapMembers(), msg, getChannelSendOptions()); } } catch ( ChannelException x ) { log.error("Unable to replicate out data for a LazyReplicatedMap.remove operation",x); } return entry!=null?entry.getValue():null; }