mirror of
https://github.com/apache/activemq.git
synced 2025-02-18 07:56:20 +00:00
[AMQ-6625] remove kahadbioexceptionhandler by pushing allowIOResumption into persistence adapter. This allows the lease locker to still be used with kahadb for stopStartConnectors support
This commit is contained in:
parent
bfbdd3c5ad
commit
b07821ab64
@ -206,4 +206,6 @@ public interface PersistenceAdapter extends Service {
|
|||||||
* @return the last stored sequence id or -1 if no suppression needed
|
* @return the last stored sequence id or -1 if no suppression needed
|
||||||
*/
|
*/
|
||||||
long getLastProducerSequenceId(ProducerId id) throws IOException;
|
long getLastProducerSequenceId(ProducerId id) throws IOException;
|
||||||
|
|
||||||
|
void allowIOResumption();
|
||||||
}
|
}
|
||||||
|
@ -237,6 +237,9 @@ public class MemoryPersistenceAdapter implements PersistenceAdapter, NoLocalSubs
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void allowIOResumption() {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JobSchedulerStore createJobSchedulerStore() throws IOException, UnsupportedOperationException {
|
public JobSchedulerStore createJobSchedulerStore() throws IOException, UnsupportedOperationException {
|
||||||
// We could eventuall implement an in memory scheduler.
|
// We could eventuall implement an in memory scheduler.
|
||||||
|
@ -166,6 +166,11 @@ import org.slf4j.LoggerFactory;
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void allowIOResumption() {
|
protected void allowIOResumption() {
|
||||||
|
try {
|
||||||
|
broker.getPersistenceAdapter().allowIOResumption();
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOG.warn("Failed to allow IO resumption", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void stopBroker(Exception exception) {
|
private void stopBroker(Exception exception) {
|
||||||
|
@ -291,6 +291,9 @@ public class JDBCPersistenceAdapter extends DataSourceServiceSupport implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void allowIOResumption() {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
getAdapter().setUseExternalMessageReferences(isUseExternalMessageReferences());
|
getAdapter().setUseExternalMessageReferences(isUseExternalMessageReferences());
|
||||||
|
@ -799,6 +799,11 @@ public class JournalPersistenceAdapter implements PersistenceAdapter, JournalEve
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void allowIOResumption() {
|
||||||
|
longTermPersistence.allowIOResumption();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JobSchedulerStore createJobSchedulerStore() throws IOException, UnsupportedOperationException {
|
public JobSchedulerStore createJobSchedulerStore() throws IOException, UnsupportedOperationException {
|
||||||
return longTermPersistence.createJobSchedulerStore();
|
return longTermPersistence.createJobSchedulerStore();
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
* <p>
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* <p>
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.apache.activemq.store.kahadb;
|
|
||||||
|
|
||||||
import org.apache.activemq.util.DefaultIOExceptionHandler;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @org.apache.xbean.XBean
|
|
||||||
*/
|
|
||||||
public class KahaDBIOExceptionHandler extends DefaultIOExceptionHandler {
|
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory
|
|
||||||
.getLogger(KahaDBIOExceptionHandler.class);
|
|
||||||
|
|
||||||
protected void allowIOResumption() {
|
|
||||||
try {
|
|
||||||
if (broker.getPersistenceAdapter() instanceof KahaDBPersistenceAdapter) {
|
|
||||||
KahaDBPersistenceAdapter kahaDBPersistenceAdapter = (KahaDBPersistenceAdapter) broker.getPersistenceAdapter();
|
|
||||||
kahaDBPersistenceAdapter.getStore().allowIOResumption();
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
LOG.warn("Failed to allow IO resumption", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -163,6 +163,11 @@ public class KahaDBPersistenceAdapter extends LockableServiceSupport implements
|
|||||||
return this.letter.getLastProducerSequenceId(id);
|
return this.letter.getLastProducerSequenceId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void allowIOResumption() {
|
||||||
|
this.letter.allowIOResumption();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param destination
|
* @param destination
|
||||||
* @see org.apache.activemq.store.PersistenceAdapter#removeQueueMessageStore(org.apache.activemq.command.ActiveMQQueue)
|
* @see org.apache.activemq.store.PersistenceAdapter#removeQueueMessageStore(org.apache.activemq.command.ActiveMQQueue)
|
||||||
|
@ -288,6 +288,13 @@ public class MultiKahaDBPersistenceAdapter extends LockableServiceSupport implem
|
|||||||
return maxId;
|
return maxId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void allowIOResumption() {
|
||||||
|
for (PersistenceAdapter persistenceAdapter : adapters) {
|
||||||
|
persistenceAdapter.allowIOResumption();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeQueueMessageStore(ActiveMQQueue destination) {
|
public void removeQueueMessageStore(ActiveMQQueue destination) {
|
||||||
PersistenceAdapter adapter = null;
|
PersistenceAdapter adapter = null;
|
||||||
|
@ -647,6 +647,13 @@ public class TempKahaDBStore extends TempMessageDatabase implements PersistenceA
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void allowIOResumption() {
|
||||||
|
if (pageFile != null) {
|
||||||
|
pageFile.allowIOResumption();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBrokerService(BrokerService brokerService) {
|
public void setBrokerService(BrokerService brokerService) {
|
||||||
this.brokerService = brokerService;
|
this.brokerService = brokerService;
|
||||||
|
@ -1147,4 +1147,6 @@ class LevelDBStore extends LockableServiceSupport with BrokerServiceAware with P
|
|||||||
def rollbackTransaction(context: ConnectionContext): Unit = {}
|
def rollbackTransaction(context: ConnectionContext): Unit = {}
|
||||||
|
|
||||||
def createClient = new LevelDBClient(this);
|
def createClient = new LevelDBClient(this);
|
||||||
|
|
||||||
|
def allowIOResumption() = {}
|
||||||
}
|
}
|
||||||
|
@ -132,4 +132,6 @@ abstract class ProxyLevelDBStore extends LockableServiceSupport with BrokerServi
|
|||||||
def removePList(name: String): Boolean = {
|
def removePList(name: String): Boolean = {
|
||||||
return proxy_target.removePList(name)
|
return proxy_target.removePList(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def allowIOResumption() = {}
|
||||||
}
|
}
|
@ -416,7 +416,12 @@ public class RedeliveryRestartWithExceptionTest extends TestSupport {
|
|||||||
public long getLastProducerSequenceId(ProducerId id) throws IOException {
|
public long getLastProducerSequenceId(ProducerId id) throws IOException {
|
||||||
return kahaDB.getLastProducerSequenceId(id);
|
return kahaDB.getLastProducerSequenceId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void allowIOResumption() {
|
||||||
|
kahaDB.allowIOResumption();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ProxyMessageStoreWithUpdateException extends ProxyMessageStore {
|
private class ProxyMessageStoreWithUpdateException extends ProxyMessageStore {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user