Search in sources :

Example 6 with ReplicationStream

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();
    }
}
Also used : ReplicationStream(org.apache.catalina.tribes.io.ReplicationStream) ClusterManager(org.apache.catalina.ha.ClusterManager)

Aggregations

ReplicationStream (org.apache.catalina.tribes.io.ReplicationStream)6 ClusterManager (org.apache.catalina.ha.ClusterManager)1