use of org.apache.catalina.tribes.io.ReplicationStream in project tomcat by apache.
the class DeltaManager method deserializeDeltaRequest.
/**
* Load Deltarequest from external node
* Load the Class at container classloader
* @see DeltaRequest#readExternal(java.io.ObjectInput)
* @param session Corresponding session
* @param data message data
* @return The request
* @throws ClassNotFoundException Serialization error
* @throws IOException IO error with serialization
*/
protected DeltaRequest deserializeDeltaRequest(DeltaSession session, byte[] data) throws ClassNotFoundException, IOException {
session.lock();
try {
ReplicationStream ois = getReplicationStream(data);
session.getDeltaRequest().readExternal(ois);
ois.close();
return session.getDeltaRequest();
} finally {
session.unlock();
}
}
use of org.apache.catalina.tribes.io.ReplicationStream in project tomcat by apache.
the class DeltaManager method deserializeSessionId.
/**
* Load sessionID
* @param data serialized session id
* @return session id
* @throws IOException if an input/output error occurs
*/
protected String deserializeSessionId(byte[] data) throws IOException {
ReplicationStream ois = getReplicationStream(data);
String sessionId = ois.readUTF();
ois.close();
return sessionId;
}
use of org.apache.catalina.tribes.io.ReplicationStream in project tomcat by apache.
the class DeltaSession method deserializeAndExecuteDeltaRequest.
protected void deserializeAndExecuteDeltaRequest(byte[] delta) throws IOException, ClassNotFoundException {
if (manager instanceof ClusterManagerBase) {
SynchronizedStack<DeltaRequest> deltaRequestPool = ((ClusterManagerBase) manager).getDeltaRequestPool();
DeltaRequest newDeltaRequest = deltaRequestPool.pop();
if (newDeltaRequest == null) {
newDeltaRequest = createRequest(null, ((ClusterManagerBase) manager).isRecordAllActions());
}
ReplicationStream ois = ((ClusterManagerBase) manager).getReplicationStream(delta);
newDeltaRequest.readExternal(ois);
ois.close();
DeltaRequest oldDeltaRequest = null;
lockInternal();
try {
oldDeltaRequest = replaceDeltaRequest(newDeltaRequest);
newDeltaRequest.execute(this, ((ClusterManagerBase) manager).isNotifyListenersOnReplication());
setPrimarySession(false);
} finally {
unlockInternal();
if (oldDeltaRequest != null) {
oldDeltaRequest.reset();
deltaRequestPool.push(oldDeltaRequest);
}
}
}
}
use of org.apache.catalina.tribes.io.ReplicationStream in project tomcat70 by apache.
the class DeltaManager method deserializeSessionId.
/**
* Load sessionID
* @throws IOException if an input/output error occurs
*/
protected String deserializeSessionId(byte[] data) throws IOException {
ReplicationStream ois = getReplicationStream(data);
String sessionId = ois.readUTF();
ois.close();
return sessionId;
}
use of org.apache.catalina.tribes.io.ReplicationStream in project tomcat70 by apache.
the class DeltaManager method deserializeDeltaRequest.
/**
* Load Deltarequest from external node
* Load the Class at container classloader
* @see DeltaRequest#readExternal(java.io.ObjectInput)
* @param session
* @param data message data
* @return The request
* @throws ClassNotFoundException
* @throws IOException
*/
protected DeltaRequest deserializeDeltaRequest(DeltaSession session, byte[] data) throws ClassNotFoundException, IOException {
try {
session.lock();
ReplicationStream ois = getReplicationStream(data);
session.getDeltaRequest().readExternal(ois);
ois.close();
return session.getDeltaRequest();
} finally {
session.unlock();
}
}
Aggregations