ARTEMIS-1447 Reuse thread pools on JDBC Locks
(cherry picked from commit 1af6d986a5
)
This commit is contained in:
parent
565b817592
commit
1a7cd8aabe
|
@ -188,6 +188,13 @@ public abstract class ActiveMQScheduledComponent implements ActiveMQComponent, R
|
|||
return this;
|
||||
}
|
||||
|
||||
public synchronized ActiveMQScheduledComponent setPeriod(long period, TimeUnit unit) {
|
||||
this.period = period;
|
||||
this.timeUnit = unit;
|
||||
restartIfNeeded();
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getInitialDelay() {
|
||||
return initialDelay;
|
||||
}
|
||||
|
|
|
@ -494,6 +494,8 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
|
||||
configuration.parseSystemProperties();
|
||||
|
||||
initializeExecutorServices();
|
||||
|
||||
startDate = new Date();
|
||||
|
||||
state = SERVER_STATE.STARTING;
|
||||
|
@ -1982,9 +1984,6 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
if (state == SERVER_STATE.STOPPED)
|
||||
return false;
|
||||
|
||||
// Create the pools - we have two pools - one for non scheduled - and another for scheduled
|
||||
initializeExecutorServices();
|
||||
|
||||
if (configuration.getJournalType() == JournalType.ASYNCIO) {
|
||||
if (!AIOSequentialFileFactory.isSupported()) {
|
||||
ActiveMQServerLogger.LOGGER.switchingNIO();
|
||||
|
|
|
@ -17,16 +17,16 @@
|
|||
|
||||
package org.apache.activemq.artemis.core.server.impl.jdbc;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.activemq.artemis.core.io.IOCriticalErrorListener;
|
||||
import org.apache.activemq.artemis.core.server.ActiveMQScheduledComponent;
|
||||
import org.apache.activemq.artemis.utils.actors.ArtemisExecutor;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* Default implementation of a {@link ScheduledLeaseLock}: see {@link ScheduledLeaseLock#of(ScheduledExecutorService, ArtemisExecutor, String, LeaseLock, long, IOCriticalErrorListener)}.
|
||||
* Default implementation of a {@link ScheduledLeaseLock}: see {@link ScheduledLeaseLock#of(ScheduledExecutorService, Executor, String, LeaseLock, long, IOCriticalErrorListener)}.
|
||||
*/
|
||||
final class ActiveMQScheduledLeaseLock extends ActiveMQScheduledComponent implements ScheduledLeaseLock {
|
||||
|
||||
|
@ -39,7 +39,7 @@ final class ActiveMQScheduledLeaseLock extends ActiveMQScheduledComponent implem
|
|||
private final IOCriticalErrorListener ioCriticalErrorListener;
|
||||
|
||||
ActiveMQScheduledLeaseLock(ScheduledExecutorService scheduledExecutorService,
|
||||
ArtemisExecutor executor,
|
||||
Executor executor,
|
||||
String lockName,
|
||||
LeaseLock lock,
|
||||
long renewPeriodMillis,
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
|
||||
package org.apache.activemq.artemis.core.server.impl.jdbc;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import org.apache.activemq.artemis.core.io.IOCriticalErrorListener;
|
||||
import org.apache.activemq.artemis.core.server.ActiveMQComponent;
|
||||
import org.apache.activemq.artemis.utils.actors.ArtemisExecutor;
|
||||
|
||||
/**
|
||||
* {@link LeaseLock} holder that allows to schedule a {@link LeaseLock#renew} task with a fixed {@link #renewPeriodMillis()} delay.
|
||||
|
@ -33,7 +33,7 @@ interface ScheduledLeaseLock extends ActiveMQComponent {
|
|||
long renewPeriodMillis();
|
||||
|
||||
static ScheduledLeaseLock of(ScheduledExecutorService scheduledExecutorService,
|
||||
ArtemisExecutor executor,
|
||||
Executor executor,
|
||||
String lockName,
|
||||
LeaseLock lock,
|
||||
long renewPeriodMillis,
|
||||
|
|
Loading…
Reference in New Issue