mirror of https://github.com/apache/activemq.git
log which Persistence Adaptor we are using
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@480924 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a9d1f21c05
commit
415d46cf46
|
@ -385,7 +385,7 @@ public class BrokerService implements Service, Serializable {
|
|||
startDestinations();
|
||||
|
||||
addShutdownHook();
|
||||
log.info("Using Persistence Adaptor " + getPersistenceAdapter());
|
||||
log.info("Using Persistence Adaptor: " + getPersistenceAdapter());
|
||||
if (deleteAllMessagesOnStartup) {
|
||||
deleteAllMessages();
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public class StoreQueueCursor extends AbstractPendingMessageCursor{
|
|||
}
|
||||
nonPersistent.start();
|
||||
persistent.start();
|
||||
pendingCount=persistent.size();
|
||||
pendingCount=persistent.size() + nonPersistent.size();
|
||||
}
|
||||
|
||||
public synchronized void stop() throws Exception{
|
||||
|
@ -88,11 +88,27 @@ public class StoreQueueCursor extends AbstractPendingMessageCursor{
|
|||
}
|
||||
}
|
||||
|
||||
public void addMessageFirst(MessageReference node) throws Exception{
|
||||
if(node!=null){
|
||||
Message msg=node.getMessage();
|
||||
if(started){
|
||||
pendingCount++;
|
||||
if(!msg.isPersistent()){
|
||||
nonPersistent.addMessageFirst(node);
|
||||
}
|
||||
}
|
||||
if(msg.isPersistent()){
|
||||
persistent.addMessageFirst(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void clear(){
|
||||
pendingCount=0;
|
||||
}
|
||||
|
||||
public synchronized boolean hasNext(){
|
||||
|
||||
boolean result=pendingCount>0;
|
||||
if(result){
|
||||
try{
|
||||
|
@ -107,7 +123,8 @@ public class StoreQueueCursor extends AbstractPendingMessageCursor{
|
|||
}
|
||||
|
||||
public synchronized MessageReference next(){
|
||||
return currentCursor!=null?currentCursor.next():null;
|
||||
MessageReference result = currentCursor!=null?currentCursor.next():null;
|
||||
return result;
|
||||
}
|
||||
|
||||
public synchronized void remove(){
|
||||
|
@ -118,6 +135,11 @@ public class StoreQueueCursor extends AbstractPendingMessageCursor{
|
|||
}
|
||||
|
||||
public void remove(MessageReference node){
|
||||
if (!node.isPersistent()) {
|
||||
nonPersistent.remove(node);
|
||||
}else {
|
||||
persistent.remove(node);
|
||||
}
|
||||
pendingCount--;
|
||||
}
|
||||
|
||||
|
|
|
@ -89,4 +89,8 @@ public class DataSourceSupport {
|
|||
return ds;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return ""+dataSource;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -482,4 +482,8 @@ public class JDBCPersistenceAdapter extends DataSourceSupport implements Persist
|
|||
protected DatabaseLocker createDatabaseLocker() throws IOException {
|
||||
return new DefaultDatabaseLocker(getDataSource(), getStatements());
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return "JDBCPersistenceAdaptor("+super.toString()+")";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -670,4 +670,8 @@ public class JournalPersistenceAdapter implements PersistenceAdapter, JournalEve
|
|||
return new ByteSequence(sequence.getData(), sequence.getOffset(), sequence.getLength());
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return "JournalPersistenceAdapator(" + longTermPersistence + ")";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -270,4 +270,8 @@ public class KahaPersistenceAdapter implements PersistenceAdapter{
|
|||
String name=dir.getAbsolutePath()+File.separator+"kahadb";
|
||||
return name;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return "KahaPersistenceAdapter(" + getStoreName() +")";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,13 +50,17 @@ public class MemoryMessageStore implements MessageStore{
|
|||
}
|
||||
|
||||
public synchronized void addMessage(ConnectionContext context,Message message) throws IOException{
|
||||
synchronized(messageTable){
|
||||
messageTable.put(message.getMessageId(),message);
|
||||
}
|
||||
}
|
||||
|
||||
public void addMessageReference(ConnectionContext context,MessageId messageId,long expirationTime,String messageRef)
|
||||
throws IOException{
|
||||
synchronized(messageTable){
|
||||
messageTable.put(messageId,messageRef);
|
||||
}
|
||||
}
|
||||
|
||||
public Message getMessage(MessageId identity) throws IOException{
|
||||
return (Message)messageTable.get(identity);
|
||||
|
@ -67,11 +71,16 @@ public class MemoryMessageStore implements MessageStore{
|
|||
}
|
||||
|
||||
public void removeMessage(ConnectionContext context,MessageAck ack) throws IOException{
|
||||
messageTable.remove(ack.getLastMessageId());
|
||||
removeMessage(ack.getLastMessageId());
|
||||
}
|
||||
|
||||
public void removeMessage(MessageId msgId) throws IOException{
|
||||
synchronized(messageTable){
|
||||
messageTable.remove(msgId);
|
||||
if(lastBatchId!=null&lastBatchId.equals(msgId)){
|
||||
lastBatchId=null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void recover(MessageRecoveryListener listener) throws Exception{
|
||||
|
@ -96,16 +105,20 @@ public class MemoryMessageStore implements MessageStore{
|
|||
}
|
||||
|
||||
public void removeAllMessages(ConnectionContext context) throws IOException{
|
||||
synchronized(messageTable){
|
||||
messageTable.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public ActiveMQDestination getDestination(){
|
||||
return destination;
|
||||
}
|
||||
|
||||
public void delete(){
|
||||
synchronized(messageTable){
|
||||
messageTable.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param usageManager The UsageManager that is controlling the destination's memory usage.
|
||||
|
@ -117,10 +130,8 @@ public class MemoryMessageStore implements MessageStore{
|
|||
return messageTable.size();
|
||||
}
|
||||
|
||||
|
||||
public void recoverNextMessages(int maxReturned,MessageRecoveryListener listener) throws Exception{
|
||||
synchronized(messageTable){
|
||||
|
||||
boolean pastLackBatch=lastBatchId==null;
|
||||
int count=0;
|
||||
for(Iterator iter=messageTable.entrySet().iterator();iter.hasNext();){
|
||||
|
|
|
@ -154,4 +154,8 @@ public class MemoryPersistenceAdapter implements PersistenceAdapter {
|
|||
*/
|
||||
public void setUsageManager(UsageManager usageManager) {
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return "MemoryPersistenceAdapter";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue