private void addPropertyDifference(String key, Object value, boolean isRemoved) { // Narrowed the synchronization so that we only wait // if a property difference is added. synchronized(this) { // Lazizly create propertyDifferences map if (propertyDifferences == null) { propertyDifferences = new HashMap<String, Object>(DEFAULT_MAP_SIZE); } propertyDifferences.put(key, new PropertyDifference(key, value, isRemoved)); } }
public void addContextProperty(PropertyDifference diff) { properties.put(diff.getKey(), diff); }
String key = (String) o; PropertyDifference diff = (PropertyDifference) diffs.get(key); Object value = diff.getValue(); if (isSerializable(value)) { log.debug("sending property =" + key + "-" + value); PropertyDifference diff = new PropertyDifference(key, value, false); updateCmd.addProperty(diff);
public void updateProperties(AbstractContext abstractContext) { if (log.isDebugEnabled()) { log.debug("Updating props in " + abstractContext); } if (abstractContext != null) { for (Iterator iter = properties.keySet().iterator(); iter.hasNext();) { String key = (String) iter.next(); PropertyDifference propDiff = (PropertyDifference) properties.get(key); if (propDiff.isRemoved()) { abstractContext.removePropertyNonReplicable(key); } else { // it is updated/added abstractContext.setNonReplicableProperty(key, propDiff.getValue()); if (log.isDebugEnabled()) { log.debug("Added prop=" + key + ", value=" + propDiff.getValue() + " to context " + abstractContext); } } } } }
private static void fillProperties(UpdateStateCommand updateCmd, AbstractContext context, String[] propertyNames) throws ClusteringFault { Map diffs = context.getPropertyDifferences(); for (String key : propertyNames) { Object prop = context.getPropertyNonReplicable(key); // First check whether it is serializable if (isSerializable(prop)) { if (log.isDebugEnabled()) { log.debug("sending property =" + key + "-" + prop); } PropertyDifference diff = (PropertyDifference) diffs.get(key); if (diff != null) { diff.setValue(prop); updateCmd.addProperty(diff); // Remove the diff? diffs.remove(key); } } else { String msg = "Trying to replicate non-serializable property " + key + " in context " + context; throw new ClusteringFault(msg); } } }
String key = (String) o; PropertyDifference diff = (PropertyDifference) diffs.get(key); Object value = diff.getValue(); if (isSerializable(value)) { log.debug("sending property =" + key + "-" + value); PropertyDifference diff = new PropertyDifference(key, value, false); updateCmd.addProperty(diff);
public void updateProperties(AbstractContext abstractContext) { if (log.isDebugEnabled()) { log.debug("Updating props in " + abstractContext); } if (abstractContext != null) { for (Iterator iter = properties.keySet().iterator(); iter.hasNext();) { String key = (String) iter.next(); PropertyDifference propDiff = (PropertyDifference) properties.get(key); if (propDiff.isRemoved()) { abstractContext.removePropertyNonReplicable(key); } else { // it is updated/added abstractContext.setNonReplicableProperty(key, propDiff.getValue()); if (log.isDebugEnabled()) { log.debug("Added prop=" + key + ", value=" + propDiff.getValue() + " to context " + abstractContext); } } } } }
private static void fillProperties(UpdateStateCommand updateCmd, AbstractContext context, String[] propertyNames) throws ClusteringFault { Map diffs = context.getPropertyDifferences(); for (String key : propertyNames) { Object prop = context.getPropertyNonReplicable(key); // First check whether it is serializable if (isSerializable(prop)) { if (log.isDebugEnabled()) { log.debug("sending property =" + key + "-" + prop); } PropertyDifference diff = (PropertyDifference) diffs.get(key); if (diff != null) { diff.setValue(prop); updateCmd.addProperty(diff); // Remove the diff? diffs.remove(key); } } else { String msg = "Trying to replicate non-serializable property " + key + " in context " + context; throw new ClusteringFault(msg); } } }
private void addPropertyDifference(String key, Object value, boolean isRemoved) { // Narrowed the synchronization so that we only wait // if a property difference is added. synchronized(this) { // Lazizly create propertyDifferences map if (propertyDifferences == null) { propertyDifferences = new HashMap<String, Object>(DEFAULT_MAP_SIZE); } propertyDifferences.put(key, new PropertyDifference(key, value, isRemoved)); } }
public void addContextProperty(PropertyDifference diff) { properties.put(diff.getKey(), diff); }