"bindings",
1);
if (replicator != null)
{
bindingsJournal = new ReplicatedJournal((byte)0, localBindings, replicator);
}
else
{
bindingsJournal = localBindings;
}
if (journalDir == null)
{
throw new NullPointerException("journal-dir is null");
}
createJournalDir = config.isCreateJournalDir();
syncNonTransactional = config.isJournalSyncNonTransactional();
syncTransactional = config.isJournalSyncTransactional();
SequentialFileFactory journalFF = null;
JournalType journalTypeToUse = config.getJournalType();
if (config.getJournalType() == JournalType.ASYNCIO && !AIOSequentialFileFactory.isSupported())
{
JournalStorageManager.log.warn("AIO wasn't located on this platform, it will fall back to using pure Java NIO. If your platform is Linux, install LibAIO to enable the AIO journal");
journalTypeToUse = JournalType.NIO;
}
if (journalTypeToUse == JournalType.ASYNCIO)
{
JournalStorageManager.log.info("Using AIO Journal");
journalFF = new AIOSequentialFileFactory(journalDir,
config.getJournalBufferSize_AIO(),
config.getJournalBufferTimeout_AIO(),
config.isLogJournalWriteRate());
}
else if (journalTypeToUse == JournalType.NIO)
{
JournalStorageManager.log.info("Using NIO Journal");
journalFF = new NIOSequentialFileFactory(journalDir,
true,
config.getJournalBufferSize_NIO(),
config.getJournalBufferTimeout_NIO(),
config.isLogJournalWriteRate());
}
else
{
throw new IllegalArgumentException("Unsupported journal type " + config.getJournalType());
}
if (config.isBackup())
{
idGenerator = null;
}
else
{
idGenerator = new BatchingIDGenerator(0, JournalStorageManager.CHECKPOINT_BATCH_SIZE, bindingsJournal);
}
Journal localMessage = new JournalImpl(config.getJournalFileSize(),
config.getJournalMinFiles(),
config.getJournalCompactMinFiles(),
config.getJournalCompactPercentage(),
journalFF,
"hornetq-data",
"hq",
config.getJournalType() == JournalType.ASYNCIO ? config.getJournalMaxIO_AIO()
: config.getJournalMaxIO_NIO());
if (replicator != null)
{
messageJournal = new ReplicatedJournal((byte)1, localMessage, replicator);
}
else
{
messageJournal = localMessage;
}