private void queueAttributeEvent(DeltaSessionAttributeEvent event, boolean checkAddToCurrentGatewayDelta) { // Add to current gateway delta if necessary if (checkAddToCurrentGatewayDelta) { // If the manager has enabled gateway delta replication and is a P2P // manager, the GatewayDeltaForwardCacheListener will be invoked in this // VM. Add the event to the currentDelta. DeltaSessionManager mgr = (DeltaSessionManager) this.manager; if (this.enableGatewayDeltaReplication && mgr.isPeerToPeer()) { // If commit is not enabled, add the event to the current batch; else, // the current batch will be initialized to the events in the queue will // be added at commit time. if (!isCommitEnabled()) { List<DeltaSessionAttributeEvent> events = new ArrayList<DeltaSessionAttributeEvent>(); events.add(event); this.currentGatewayDeltaEvent = new DeltaSessionAttributeEventBatch(this.sessionRegionName, this.id, events); } } } this.eventQueue.add(event); }
@Override public void removeAttribute(String name, boolean notify) { checkBackingCacheAvailable(); if (expired) { return; } synchronized (this.changeLock) { // Remove the attribute locally super.removeAttribute(name, true); // Create the destroy attribute message DeltaSessionAttributeEvent event = new DeltaSessionDestroyAttributeEvent(name); queueAttributeEvent(event, true); // Distribute the update if (!isCommitEnabled()) { putInRegion(getOperatingRegion(), true, null); } } }
@Override public void setAttribute(String name, Object value, boolean notify) { checkBackingCacheAvailable(); synchronized (this.changeLock) { // Serialize the value byte[] serializedValue = serialize(value); // Store the attribute locally if (this.preferDeserializedForm) { super.setAttribute(name, value, true); } else { super.setAttribute(name, serializedValue, true); } if (serializedValue == null) { return; } // Create the update attribute message DeltaSessionAttributeEvent event = new DeltaSessionUpdateAttributeEvent(name, serializedValue); queueAttributeEvent(event, true); // Distribute the update if (!isCommitEnabled()) { putInRegion(getOperatingRegion(), true, null); } } }
private void queueAttributeEvent(DeltaSessionAttributeEvent event, boolean checkAddToCurrentGatewayDelta) { // Add to current gateway delta if necessary if (checkAddToCurrentGatewayDelta) { // If the manager has enabled gateway delta replication and is a P2P // manager, the GatewayDeltaForwardCacheListener will be invoked in this // VM. Add the event to the currentDelta. DeltaSessionManager mgr = (DeltaSessionManager) this.manager; if (this.enableGatewayDeltaReplication && mgr.isPeerToPeer()) { // If commit is not enabled, add the event to the current batch; else, // the current batch will be initialized to the events in the queue will // be added at commit time. if (!isCommitEnabled()) { List<DeltaSessionAttributeEvent> events = new ArrayList<DeltaSessionAttributeEvent>(); events.add(event); this.currentGatewayDeltaEvent = new DeltaSessionAttributeEventBatch(this.sessionRegionName, this.id, events); } } } this.eventQueue.add(event); }
public void removeAttribute(String name, boolean notify) { checkBackingCacheAvailable(); if (expired) { return; } synchronized (this.changeLock) { // Remove the attribute locally super.removeAttribute(name, true); // Create the destroy attribute message DeltaSessionAttributeEvent event = new DeltaSessionDestroyAttributeEvent(name); queueAttributeEvent(event, true); // Distribute the update if (!isCommitEnabled()) { putInRegion(getOperatingRegion(), true, null); } } }
public void setAttribute(String name, Object value, boolean notify) { checkBackingCacheAvailable(); synchronized (this.changeLock) { // Serialize the value byte[] serializedValue = serialize(value); // Store the attribute locally if (this.preferDeserializedForm) { super.setAttribute(name, value, true); } else { super.setAttribute(name, serializedValue, true); } if (serializedValue == null) { return; } // Create the update attribute message DeltaSessionAttributeEvent event = new DeltaSessionUpdateAttributeEvent(name, serializedValue); queueAttributeEvent(event, true); // Distribute the update if (!isCommitEnabled()) { putInRegion(getOperatingRegion(), true, null); } } }