int lastRead = 0;
while (lastRead > -1)
{
try
{
ByteChunk chunk = action.getNextBytes();
Object[] args = new Object[]{ id, action.getRepositoryContentModification().getItem(), chunk};
List<?> rsps = this.partition.callMethodOnCluster(getServiceHAName(), "pushBytes", args, PUSH_BYTES_TYPES, true);
for (Object rsp : rsps)
{
if (rsp instanceof NotSynchronizedException)
{
continue;
}
else if (rsp instanceof Throwable)
{
rethrowAsException((Throwable) rsp);
}
}
lastRead = chunk.getByteCount();
}
catch (Exception e)
{
action.cancel();
throw e;