org.jboss.messaging.core.impl
Class JDBCPersistenceManager

java.lang.Object
  extended by org.jboss.messaging.core.impl.JDBCSupport
      extended by org.jboss.messaging.core.impl.JDBCPersistenceManager
All Implemented Interfaces:
MessagingComponent, PersistenceManager

public class JDBCPersistenceManager
extends JDBCSupport
implements PersistenceManager

JDBC implementation of PersistenceManager

Version:
1.1 JDBCPersistenceManager.java,v 1.1 2006/02/22 17:33:41 timfox Exp
Author:
Ovidiu Feodorov, Tim Fox, Adrian Brock, Juha Lindfors

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jboss.messaging.core.impl.JDBCSupport
JDBCSupport.JDBCTxRunner<T>, JDBCSupport.JDBCTxRunner2<T>, JDBCSupport.TransactionWrapper
 
Nested classes/interfaces inherited from interface org.jboss.messaging.core.contract.PersistenceManager
PersistenceManager.InitialLoadInfo, PersistenceManager.MessageChannelPair, PersistenceManager.ReferenceInfo
 
Field Summary
 
Fields inherited from class org.jboss.messaging.core.impl.JDBCSupport
ds, sqlProperties
 
Constructor Summary
JDBCPersistenceManager(javax.sql.DataSource ds, TransactionManager tm, java.util.Properties sqlProperties, boolean createTablesOnStartup, boolean usingBatchUpdates, boolean usingBinaryStream, boolean usingTrailingByte, int maxParams, boolean supportsBlobSelect)
           
 
Method Summary
protected  void addReference(long channelID, MessageReference ref, java.sql.PreparedStatement ps, boolean paged)
           
 void addReference(long channelID, MessageReference ref, Transaction tx)
           
protected  void addTXRecord(java.sql.Connection conn, Transaction tx)
           
protected  java.util.HashMap bytesToMap(byte[] bytes)
           
protected  byte[] getBytes(java.sql.ResultSet rs, int columnIndex)
           
protected  org.jboss.messaging.core.impl.JDBCPersistenceManager.TransactionCallback getCallback(Transaction tx)
           
protected  java.util.Map getDefaultDDLStatements()
           
protected  java.util.Map getDefaultDMLStatements()
           
 java.util.List getMessageChannelPairAcksForTx(long transactionId)
           
 java.util.List getMessageChannelPairRefsForTx(long transactionId)
           
 java.util.List getMessages(java.util.List messageIds)
           
 java.util.List getPagedReferenceInfos(long channelID, long orderStart, int number)
           
protected  byte[] getVarBinaryColumn(java.sql.ResultSet rs, int columnIndex)
           
protected  void handleBeforeCommit1PC(java.util.List refsToAdd, java.util.List refsToRemove, Transaction tx)
           
protected  void handleBeforeCommit2PC(java.util.List refsToRemove, Transaction tx)
           
protected  void handleBeforePrepare(java.util.List refsToAdd, java.util.List refsToRemove, Transaction tx)
           
protected  void handleBeforeRollback(java.util.List refsToAdd, Transaction tx)
           
 void injectNodeID(int nodeID)
           
 PersistenceManager.InitialLoadInfo loadFromStart(long channelID, int number)
           
protected  void logBatchUpdate(java.lang.String name, int[] rows, java.lang.String action)
           
protected  byte[] mapToBytes(java.util.Map map)
           
 PersistenceManager.InitialLoadInfo mergeAndLoad(long fromChannelID, long toChannelID, int numberToLoad, long firstPagingOrder, long nextPagingOrder)
           
 void mergeTransactions(long fromChannelID, long toChannelID)
           
 void pageReferences(long channelID, java.util.List references, boolean page)
           
protected  void prepareToAddReference(long channelID, MessageReference ref, Transaction tx, java.sql.PreparedStatement ps)
           
protected  void prepareToRemoveReference(long channelID, MessageReference ref, Transaction tx, java.sql.PreparedStatement ps)
           
 boolean referenceExists(long messageID)
           
 void removeDepagedReferences(long channelID, java.util.List references)
           
protected  void removeReference(long channelID, MessageReference ref, java.sql.PreparedStatement ps)
           
 void removeReference(long channelID, MessageReference ref, Transaction tx)
           
protected  void removeTXRecord(java.sql.Connection conn, Transaction tx)
           
 long reserveIDBlock(java.lang.String counterName, int size)
           
 java.util.List retrievePreparedTransactions()
           
protected  void setBytes(java.sql.PreparedStatement ps, int columnIndex, byte[] bytes)
           
protected  void setVarBinaryColumn(int column, java.sql.PreparedStatement ps, byte[] bytes)
           
 void start()
           
protected  void storeMessage(Message m, java.sql.PreparedStatement ps, boolean bindBlobs)
          Stores the message in the MESSAGE table.
protected  int storeMessage(Message message, java.sql.PreparedStatement psInsertMessage, java.sql.PreparedStatement psUpdateMessage)
          Stores the message using the Conditional update
 void testSpeed()
           
 java.lang.String toString()
           
 void updateDeliveryCount(long channelID, MessageReference ref)
           
 void updatePageOrder(long channelID, java.util.List references)
           
 void updateReferencesNotPagedInRange(long channelID, long orderStart, long orderEnd, long num)
           
 
Methods inherited from class org.jboss.messaging.core.impl.JDBCSupport
closeConnection, closeResultSet, closeStatement, getSQLStatement, ignoreVerificationOnStartup, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.messaging.core.contract.MessagingComponent
stop
 

Constructor Detail

JDBCPersistenceManager

public JDBCPersistenceManager(javax.sql.DataSource ds,
                              TransactionManager tm,
                              java.util.Properties sqlProperties,
                              boolean createTablesOnStartup,
                              boolean usingBatchUpdates,
                              boolean usingBinaryStream,
                              boolean usingTrailingByte,
                              int maxParams,
                              boolean supportsBlobSelect)
Method Detail

start

public void start()
           throws java.lang.Exception
Specified by:
start in interface MessagingComponent
Overrides:
start in class JDBCSupport
Throws:
java.lang.Exception

injectNodeID

public void injectNodeID(int nodeID)

getMessageChannelPairRefsForTx

public java.util.List getMessageChannelPairRefsForTx(long transactionId)
                                              throws java.lang.Exception
Specified by:
getMessageChannelPairRefsForTx in interface PersistenceManager
Throws:
java.lang.Exception

getMessageChannelPairAcksForTx

public java.util.List getMessageChannelPairAcksForTx(long transactionId)
                                              throws java.lang.Exception
Specified by:
getMessageChannelPairAcksForTx in interface PersistenceManager
Throws:
java.lang.Exception

retrievePreparedTransactions

public java.util.List retrievePreparedTransactions()
                                            throws java.lang.Exception
Specified by:
retrievePreparedTransactions in interface PersistenceManager
Throws:
java.lang.Exception

reserveIDBlock

public long reserveIDBlock(java.lang.String counterName,
                           int size)
                    throws java.lang.Exception
Specified by:
reserveIDBlock in interface PersistenceManager
Throws:
java.lang.Exception

getMessages

public java.util.List getMessages(java.util.List messageIds)
                           throws java.lang.Exception
Specified by:
getMessages in interface PersistenceManager
Throws:
java.lang.Exception

pageReferences

public void pageReferences(long channelID,
                           java.util.List references,
                           boolean page)
                    throws java.lang.Exception
Specified by:
pageReferences in interface PersistenceManager
Throws:
java.lang.Exception

removeDepagedReferences

public void removeDepagedReferences(long channelID,
                                    java.util.List references)
                             throws java.lang.Exception
Specified by:
removeDepagedReferences in interface PersistenceManager
Throws:
java.lang.Exception

updateReferencesNotPagedInRange

public void updateReferencesNotPagedInRange(long channelID,
                                            long orderStart,
                                            long orderEnd,
                                            long num)
                                     throws java.lang.Exception
Specified by:
updateReferencesNotPagedInRange in interface PersistenceManager
Throws:
java.lang.Exception

updatePageOrder

public void updatePageOrder(long channelID,
                            java.util.List references)
                     throws java.lang.Exception
Specified by:
updatePageOrder in interface PersistenceManager
Throws:
java.lang.Exception

getPagedReferenceInfos

public java.util.List getPagedReferenceInfos(long channelID,
                                             long orderStart,
                                             int number)
                                      throws java.lang.Exception
Specified by:
getPagedReferenceInfos in interface PersistenceManager
Throws:
java.lang.Exception

loadFromStart

public PersistenceManager.InitialLoadInfo loadFromStart(long channelID,
                                                        int number)
                                                 throws java.lang.Exception
Specified by:
loadFromStart in interface PersistenceManager
Throws:
java.lang.Exception

mergeTransactions

public void mergeTransactions(long fromChannelID,
                              long toChannelID)
                       throws java.lang.Exception
Specified by:
mergeTransactions in interface PersistenceManager
Throws:
java.lang.Exception

mergeAndLoad

public PersistenceManager.InitialLoadInfo mergeAndLoad(long fromChannelID,
                                                       long toChannelID,
                                                       int numberToLoad,
                                                       long firstPagingOrder,
                                                       long nextPagingOrder)
                                                throws java.lang.Exception
Specified by:
mergeAndLoad in interface PersistenceManager
Throws:
java.lang.Exception

testSpeed

public void testSpeed()
               throws java.lang.Exception
Throws:
java.lang.Exception

addReference

public void addReference(long channelID,
                         MessageReference ref,
                         Transaction tx)
                  throws java.lang.Exception
Specified by:
addReference in interface PersistenceManager
Throws:
java.lang.Exception

updateDeliveryCount

public void updateDeliveryCount(long channelID,
                                MessageReference ref)
                         throws java.lang.Exception
Specified by:
updateDeliveryCount in interface PersistenceManager
Throws:
java.lang.Exception

removeReference

public void removeReference(long channelID,
                            MessageReference ref,
                            Transaction tx)
                     throws java.lang.Exception
Specified by:
removeReference in interface PersistenceManager
Throws:
java.lang.Exception

referenceExists

public boolean referenceExists(long messageID)
                        throws java.lang.Exception
Specified by:
referenceExists in interface PersistenceManager
Throws:
java.lang.Exception

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getCallback

protected org.jboss.messaging.core.impl.JDBCPersistenceManager.TransactionCallback getCallback(Transaction tx)

handleBeforeCommit1PC

protected void handleBeforeCommit1PC(java.util.List refsToAdd,
                                     java.util.List refsToRemove,
                                     Transaction tx)
                              throws java.lang.Exception
Throws:
java.lang.Exception

handleBeforeCommit2PC

protected void handleBeforeCommit2PC(java.util.List refsToRemove,
                                     Transaction tx)
                              throws java.lang.Exception
Throws:
java.lang.Exception

handleBeforePrepare

protected void handleBeforePrepare(java.util.List refsToAdd,
                                   java.util.List refsToRemove,
                                   Transaction tx)
                            throws java.lang.Exception
Throws:
java.lang.Exception

handleBeforeRollback

protected void handleBeforeRollback(java.util.List refsToAdd,
                                    Transaction tx)
                             throws java.lang.Exception
Throws:
java.lang.Exception

addTXRecord

protected void addTXRecord(java.sql.Connection conn,
                           Transaction tx)
                    throws java.lang.Exception
Throws:
java.lang.Exception

removeTXRecord

protected void removeTXRecord(java.sql.Connection conn,
                              Transaction tx)
                       throws java.lang.Exception
Throws:
java.lang.Exception

addReference

protected void addReference(long channelID,
                            MessageReference ref,
                            java.sql.PreparedStatement ps,
                            boolean paged)
                     throws java.lang.Exception
Throws:
java.lang.Exception

removeReference

protected void removeReference(long channelID,
                               MessageReference ref,
                               java.sql.PreparedStatement ps)
                        throws java.lang.Exception
Throws:
java.lang.Exception

prepareToAddReference

protected void prepareToAddReference(long channelID,
                                     MessageReference ref,
                                     Transaction tx,
                                     java.sql.PreparedStatement ps)
                              throws java.lang.Exception
Throws:
java.lang.Exception

prepareToRemoveReference

protected void prepareToRemoveReference(long channelID,
                                        MessageReference ref,
                                        Transaction tx,
                                        java.sql.PreparedStatement ps)
                                 throws java.lang.Exception
Throws:
java.lang.Exception

mapToBytes

protected byte[] mapToBytes(java.util.Map map)
                     throws java.lang.Exception
Throws:
java.lang.Exception

bytesToMap

protected java.util.HashMap bytesToMap(byte[] bytes)
                                throws java.lang.Exception
Throws:
java.lang.Exception

storeMessage

protected void storeMessage(Message m,
                            java.sql.PreparedStatement ps,
                            boolean bindBlobs)
                     throws java.lang.Exception
Stores the message in the MESSAGE table.

Throws:
java.lang.Exception

storeMessage

protected int storeMessage(Message message,
                           java.sql.PreparedStatement psInsertMessage,
                           java.sql.PreparedStatement psUpdateMessage)
                    throws java.lang.Exception
Stores the message using the Conditional update

Throws:
java.lang.Exception

setVarBinaryColumn

protected void setVarBinaryColumn(int column,
                                  java.sql.PreparedStatement ps,
                                  byte[] bytes)
                           throws java.lang.Exception
Throws:
java.lang.Exception

getVarBinaryColumn

protected byte[] getVarBinaryColumn(java.sql.ResultSet rs,
                                    int columnIndex)
                             throws java.lang.Exception
Throws:
java.lang.Exception

setBytes

protected void setBytes(java.sql.PreparedStatement ps,
                        int columnIndex,
                        byte[] bytes)
                 throws java.lang.Exception
Throws:
java.lang.Exception

getBytes

protected byte[] getBytes(java.sql.ResultSet rs,
                          int columnIndex)
                   throws java.lang.Exception
Throws:
java.lang.Exception

logBatchUpdate

protected void logBatchUpdate(java.lang.String name,
                              int[] rows,
                              java.lang.String action)

getDefaultDDLStatements

protected java.util.Map getDefaultDDLStatements()
Overrides:
getDefaultDDLStatements in class JDBCSupport

getDefaultDMLStatements

protected java.util.Map getDefaultDMLStatements()
Overrides:
getDefaultDMLStatements in class JDBCSupport


Copyright © 2006 JBoss Inc. All Rights Reserved.