ARTEMIS-2056 Set write position on JDBCFile copy
This commit is contained in:
parent
490ef71e1d
commit
b36a1058d4
|
@ -330,6 +330,7 @@ public class JDBCSequentialFile implements SequentialFile {
|
|||
public SequentialFile cloneFile() {
|
||||
try {
|
||||
JDBCSequentialFile clone = new JDBCSequentialFile(fileFactory, filename, executor, dbDriver, writeLock);
|
||||
clone.setWritePosition(this.writePosition);
|
||||
return clone;
|
||||
} catch (Exception e) {
|
||||
fileFactory.onIOError(e, "Error cloning JDBC file.", this);
|
||||
|
@ -342,8 +343,13 @@ public class JDBCSequentialFile implements SequentialFile {
|
|||
JDBCSequentialFile clone = (JDBCSequentialFile) cloneFile;
|
||||
try {
|
||||
synchronized (writeLock) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("JDBC Copying File. From: " + this + " To: " + cloneFile);
|
||||
}
|
||||
|
||||
clone.open();
|
||||
dbDriver.copyFileData(this, clone);
|
||||
clone.setWritePosition(writePosition);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
fileFactory.onIOError(e, "Error copying JDBC file.", this);
|
||||
|
|
|
@ -221,6 +221,9 @@ public class JDBCSequentialFileFactoryTest {
|
|||
|
||||
checkData(file, src);
|
||||
checkData(copy, src);
|
||||
|
||||
assertEquals(bufferSize, copy.size());
|
||||
assertEquals(bufferSize, file.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue