@Override public String toString() { return new StringBuilder().append("DeltaSession[").append("id=").append(getId()) .append("; context=").append(this.contextName).append("; sessionRegionName=") .append(this.sessionRegionName).append("; operatingRegionName=") .append(getOperatingRegion() == null ? "unset" : getOperatingRegion().getFullPath()) .append("]").toString(); } }
@Override public void expire(boolean notify) { if (notify) { getOperatingRegion().destroy(this.getId(), this); } else { super.expire(false); } }
@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 commit() { if (!isValidInternal()) throw new IllegalStateException("commit: Session " + getId() + " already invalidated"); // (STRING_MANAGER.getString("deltaSession.commit.ise", getId())); synchronized (this.changeLock) { // Jens - there used to be a check to only perform this if the queue is // empty, but we want this to always run so that the lastAccessedTime // will be updated even when no attributes have been changed. DeltaSessionManager mgr = (DeltaSessionManager) this.manager; if (this.enableGatewayDeltaReplication && mgr.isPeerToPeer()) { setCurrentGatewayDeltaEvent( new DeltaSessionAttributeEventBatch(this.sessionRegionName, this.id, this.eventQueue)); } this.hasDelta = true; this.applyRemotely = true; putInRegion(getOperatingRegion(), true, null); this.eventQueue.clear(); } }
@Override public String toString() { return new StringBuilder().append("DeltaSession[").append("id=").append(getId()) .append("; context=").append(this.contextName).append("; sessionRegionName=") .append(this.sessionRegionName).append("; operatingRegionName=") .append(getOperatingRegion() == null ? "unset" : getOperatingRegion().getFullPath()) .append("]").toString(); } }
@Override public void expire(boolean notify) { if (notify) { getOperatingRegion().destroy(this.getId(), this); } else { super.expire(false); } }
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 commit() { if (!isValidInternal()) throw new IllegalStateException("commit: Session " + getId() + " already invalidated"); // (STRING_MANAGER.getString("deltaSession.commit.ise", getId())); synchronized (this.changeLock) { // Jens - there used to be a check to only perform this if the queue is // empty, but we want this to always run so that the lastAccessedTime // will be updated even when no attributes have been changed. DeltaSessionManager mgr = (DeltaSessionManager) this.manager; if (this.enableGatewayDeltaReplication && mgr.isPeerToPeer()) { setCurrentGatewayDeltaEvent( new DeltaSessionAttributeEventBatch(this.sessionRegionName, this.id, this.eventQueue)); } this.hasDelta = true; this.applyRemotely = true; putInRegion(getOperatingRegion(), true, null); this.eventQueue.clear(); } }