use of org.apache.activemq.artemis.core.io.SequentialFile in project activemq-artemis by apache.
the class LargeServerMessageImpl method copy.
@Override
public Message copy() {
SequentialFile newfile = storageManager.createFileForLargeMessage(messageID, durable);
Message newMessage = new LargeServerMessageImpl(this, properties, newfile, messageID);
return newMessage;
}
use of org.apache.activemq.artemis.core.io.SequentialFile in project activemq-artemis by apache.
the class LargeServerMessageImpl method getBodySize.
private long getBodySize() throws ActiveMQException {
try {
if (bodySize < 0) {
if (file != null) {
bodySize = file.size();
} else {
SequentialFile tmpFile = createFile();
bodySize = tmpFile.size();
tmpFile.close();
}
}
return bodySize;
} catch (Exception e) {
ActiveMQIOErrorException errorException = new ActiveMQIOErrorException();
errorException.initCause(e);
throw errorException;
}
}
use of org.apache.activemq.artemis.core.io.SequentialFile in project activemq-artemis by apache.
the class PagingStoreFactoryDatabase method newFileFactory.
@Override
public synchronized SequentialFileFactory newFileFactory(final SimpleString address) throws Exception {
String tableName = "" + storageManager.generateID();
SequentialFileFactory factory = newFileFactory(tableName, true);
factory.start();
SequentialFile file = factory.createSequentialFile(PagingStoreFactoryDatabase.ADDRESS_FILE);
file.open();
ActiveMQBuffer buffer = ActiveMQBuffers.fixedBuffer(SimpleString.sizeofNullableString(address));
buffer.writeSimpleString(address);
file.write(buffer, true);
file.close();
return factory;
}
use of org.apache.activemq.artemis.core.io.SequentialFile in project activemq-artemis by apache.
the class PagingStoreImpl method createPage.
@Override
public Page createPage(final int pageNumber) throws Exception {
String fileName = createFileName(pageNumber);
checkFileFactory();
SequentialFile file = fileFactory.createSequentialFile(fileName);
Page page = new Page(storeName, storageManager, fileFactory, file, pageNumber);
// To create the file
file.open();
file.position(0);
file.close();
return page;
}
use of org.apache.activemq.artemis.core.io.SequentialFile in project activemq-artemis by apache.
the class PagingStoreImpl method sendPages.
@Override
public void sendPages(ReplicationManager replicator, Collection<Integer> pageIds) throws Exception {
for (Integer id : pageIds) {
SequentialFile sFile = fileFactory.createSequentialFile(createFileName(id));
if (!sFile.exists()) {
continue;
}
ActiveMQServerLogger.LOGGER.replicaSyncFile(sFile, sFile.size());
replicator.syncPages(sFile, id, getAddress());
}
}
Aggregations