@Override public Object getAttribute(String name) { checkBackingCacheAvailable(); Object value = super.getAttribute(name); // If the attribute is a byte[] (meaning it came from the server), // deserialize it and add it to attributes map before returning it. if (value instanceof byte[]) { try { value = BlobHelper.deserializeBlob((byte[]) value); } catch (Exception e) { StringBuilder builder = new StringBuilder(); builder.append(this).append(": Attribute named ").append(name).append( " contains a byte[] that cannot be deserialized due to the following exception"); ((DeltaSessionManager) getManager()).getLogger().warn(builder.toString(), e); } if (this.preferDeserializedForm) { localUpdateAttribute(name, value); } } // Touch the session region if necessary. This is an asynchronous operation // that prevents the session region from prematurely expiring a session that // is only getting attributes. ((DeltaSessionManager) getManager()).addSessionToTouch(getId()); return value; }
@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); } } }
public Object getAttribute(String name) { checkBackingCacheAvailable(); Object value = super.getAttribute(name); // If the attribute is a byte[] (meaning it came from the server), // deserialize it and add it to attributes map before returning it. if (value instanceof byte[]) { try { value = BlobHelper.deserializeBlob((byte[]) value); } catch (Exception e) { StringBuilder builder = new StringBuilder(); builder.append(this).append(": Attribute named ").append(name).append( " contains a byte[] that cannot be deserialized due to the following exception"); ((DeltaSessionManager) getManager()).getLogger().warn(builder.toString(), e); } if (this.preferDeserializedForm) { localUpdateAttribute(name, value); } } // Touch the session region if necessary. This is an asynchronous operation // that prevents the session region from prematurely expiring a session that // is only getting attributes. ((DeltaSessionManager) getManager()).addSessionToTouch(getId()); return value; }
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); } } }