use of org.apache.catalina.tribes.io.ReplicationStream in project tomcat70 by apache.
the class DeltaSession method applyDiff.
/**
* Applies a diff to an existing object.
* @param diff byte[]
* @param offset int
* @param length int
* @throws IOException
*/
@Override
public void applyDiff(byte[] diff, int offset, int length) throws IOException, ClassNotFoundException {
try {
lock();
ReplicationStream stream = ((ClusterManager) getManager()).getReplicationStream(diff, offset, length);
ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
try {
ClassLoader[] loaders = getClassLoaders();
if (loaders != null && loaders.length > 0)
Thread.currentThread().setContextClassLoader(loaders[0]);
getDeltaRequest().readExternal(stream);
getDeltaRequest().execute(this, ((ClusterManager) getManager()).isNotifyListenersOnReplication());
stream.close();
} finally {
Thread.currentThread().setContextClassLoader(contextLoader);
}
} finally {
unlock();
}
}
Aggregations