AMQ-4399: Allow to configure checkpoint interval on jdbc persistence adapter.

This commit is contained in:
Claus Ibsen 2014-03-30 09:23:14 +02:00
parent 4927c54a0a
commit d77014aa5d
2 changed files with 20 additions and 2 deletions

View File

@ -98,7 +98,7 @@ public class JournalPersistenceAdapter implements PersistenceAdapter, JournalEve
private final ConcurrentHashMap<ActiveMQTopic, JournalTopicMessageStore> topics = new ConcurrentHashMap<ActiveMQTopic, JournalTopicMessageStore>();
private SystemUsage usageManager;
private final long checkpointInterval = 1000 * 60 * 5;
private long checkpointInterval = 1000 * 60 * 5;
private long lastCheckpointRequest = System.currentTimeMillis();
private long lastCleanup = System.currentTimeMillis();
private int maxCheckpointWorkers = 10;
@ -708,6 +708,14 @@ public class JournalPersistenceAdapter implements PersistenceAdapter, JournalEve
this.maxCheckpointWorkers = maxCheckpointWorkers;
}
public long getCheckpointInterval() {
return checkpointInterval;
}
public void setCheckpointInterval(long checkpointInterval) {
this.checkpointInterval = checkpointInterval;
}
public boolean isUseExternalMessageReferences() {
return false;
}
@ -733,7 +741,7 @@ public class JournalPersistenceAdapter implements PersistenceAdapter, JournalEve
@Override
public String toString() {
return "JournalPersistenceAdapator(" + longTermPersistence + ")";
return "JournalPersistenceAdapter(" + longTermPersistence + ")";
}
public void setDirectory(File dir) {

View File

@ -46,6 +46,7 @@ public class JournalPersistenceAdapterFactory extends DataSourceServiceSupport i
private static final Logger LOG = LoggerFactory.getLogger(JournalPersistenceAdapterFactory.class);
private long checkpointInterval = 1000 * 60 * 5;
private int journalLogFileSize = 1024 * 1024 * 20;
private int journalLogFiles = 2;
private TaskRunnerFactory taskRunnerFactory;
@ -66,6 +67,7 @@ public class JournalPersistenceAdapterFactory extends DataSourceServiceSupport i
}
JournalPersistenceAdapter result = new JournalPersistenceAdapter(getJournal(), jdbcPersistenceAdapter, getTaskRunnerFactory());
result.setDirectory(getDataDirectoryFile());
result.setCheckpointInterval(getCheckpointInterval());
return result;
}
@ -106,6 +108,14 @@ public class JournalPersistenceAdapterFactory extends DataSourceServiceSupport i
return useJournal;
}
public long getCheckpointInterval() {
return checkpointInterval;
}
public void setCheckpointInterval(long checkpointInterval) {
this.checkpointInterval = checkpointInterval;
}
/**
* Enables or disables the use of the journal. The default is to use the
* journal