use of org.apache.geode.modules.session.catalina.internal.DeltaSessionAttributeEventBatch in project geode by apache.
the class DeltaSession8 method queueAttributeEvent.
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()) {
// 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);
}
use of org.apache.geode.modules.session.catalina.internal.DeltaSessionAttributeEventBatch in project geode by apache.
the class DeltaSession7 method fromDelta.
public void fromDelta(DataInput in) throws IOException, InvalidDeltaException {
// Read whether to apply the changes to another DS if necessary
this.applyRemotely = in.readBoolean();
// Read the events
List<DeltaSessionAttributeEvent> events = null;
try {
events = DataSerializer.readArrayList(in);
} catch (ClassNotFoundException e) {
throw new InvalidDeltaException(e);
}
// This allows for backwards compatibility with 2.1 clients
if (((InputStream) in).available() > 0) {
this.lastAccessedTime = in.readLong();
this.maxInactiveInterval = in.readInt();
}
// Iterate and apply the events
for (DeltaSessionAttributeEvent event : events) {
event.apply(this);
}
// Add the events to the gateway delta region if necessary
if (this.enableGatewayDeltaReplication && this.applyRemotely) {
setCurrentGatewayDeltaEvent(new DeltaSessionAttributeEventBatch(this.sessionRegionName, this.id, events));
}
// Access it to set the last accessed time. End access it to set not new.
access();
endAccess();
}
use of org.apache.geode.modules.session.catalina.internal.DeltaSessionAttributeEventBatch in project geode by apache.
the class DeltaSession7 method commit.
public void commit() {
if (!isValidInternal())
throw new IllegalStateException("commit: Session " + getId() + " already invalidated");
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();
}
}
use of org.apache.geode.modules.session.catalina.internal.DeltaSessionAttributeEventBatch in project geode by apache.
the class DeltaSession method queueAttributeEvent.
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()) {
// 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);
}
use of org.apache.geode.modules.session.catalina.internal.DeltaSessionAttributeEventBatch in project geode by apache.
the class DeltaSession method fromDelta.
public void fromDelta(DataInput in) throws IOException, InvalidDeltaException {
// Read whether to apply the changes to another DS if necessary
this.applyRemotely = in.readBoolean();
// Read the events
List<DeltaSessionAttributeEvent> events = null;
try {
events = DataSerializer.readArrayList(in);
} catch (ClassNotFoundException e) {
throw new InvalidDeltaException(e);
}
// This allows for backwards compatibility with 2.1 clients
if (((InputStream) in).available() > 0) {
this.lastAccessedTime = in.readLong();
this.maxInactiveInterval = in.readInt();
}
// Iterate and apply the events
for (DeltaSessionAttributeEvent event : events) {
event.apply(this);
}
// Add the events to the gateway delta region if necessary
if (this.enableGatewayDeltaReplication && this.applyRemotely) {
setCurrentGatewayDeltaEvent(new DeltaSessionAttributeEventBatch(this.sessionRegionName, this.id, events));
}
// Access it to set the last accessed time. End access it to set not new.
access();
endAccess();
}
Aggregations