Package org.apache.qpid.server.store.berkeleydb.tuples

Examples of org.apache.qpid.server.store.berkeleydb.tuples.MessageContentKeyTB_5


            //now remove the content data from the store if there is any.

            DatabaseEntry contentKeyEntry = new DatabaseEntry();
            MessageContentKey_5 mck = new MessageContentKey_5(messageId,0);

            TupleBinding<MessageContentKey> contentKeyTupleBinding = new MessageContentKeyTB_5();
            contentKeyTupleBinding.objectToEntry(mck, contentKeyEntry);

            //Use a partial record for the value to prevent retrieving the
            //data itself as we only need the key to identify what to remove.
            DatabaseEntry value = new DatabaseEntry();
            value.setPartial(0, 0, true);

            cursor = _messageContentDb.openCursor(tx, null);

            status = cursor.getSearchKeyRange(contentKeyEntry, value, LockMode.RMW);
            while (status == OperationStatus.SUCCESS)
            {
                mck = (MessageContentKey_5) contentKeyTupleBinding.entryToObject(contentKeyEntry);
               
                if(mck.getMessageId() != messageId)
                {
                    //we have exhausted all chunks for this message id, break
                    break;
View Full Code Here


     */
    protected void addContent(final com.sleepycat.je.Transaction tx, Long messageId, int offset,
                                      ByteBuffer contentBody) throws AMQStoreException
    {
        DatabaseEntry key = new DatabaseEntry();
        TupleBinding<MessageContentKey> keyBinding = new MessageContentKeyTB_5();
        keyBinding.objectToEntry(new MessageContentKey_5(messageId, offset), key);
        DatabaseEntry value = new DatabaseEntry();
        TupleBinding<ByteBuffer> messageBinding = new ContentTB();
        messageBinding.objectToEntry(contentBody, value);
        try
        {
View Full Code Here

    {   
        DatabaseEntry contentKeyEntry = new DatabaseEntry();
       
        //Start from 0 offset and search for the starting chunk.
        MessageContentKey_5 mck = new MessageContentKey_5(messageId, 0);
        TupleBinding<MessageContentKey> contentKeyTupleBinding = new MessageContentKeyTB_5();
        contentKeyTupleBinding.objectToEntry(mck, contentKeyEntry);
        DatabaseEntry value = new DatabaseEntry();
        TupleBinding<ByteBuffer> contentTupleBinding = new ContentTB();
       
        if (_log.isDebugEnabled())
        {
            _log.debug("Message Id: " + messageId + " Getting content body from offset: " + offset);
        }

        int written = 0;
        int seenSoFar = 0;
       
        Cursor cursor = null;
        try
        {
            cursor = _messageContentDb.openCursor(null, null);
           
            OperationStatus status = cursor.getSearchKeyRange(contentKeyEntry, value, LockMode.READ_UNCOMMITTED);

            while (status == OperationStatus.SUCCESS)
            {
                mck = (MessageContentKey_5) contentKeyTupleBinding.entryToObject(contentKeyEntry);
                long id = mck.getMessageId();
               
                if(id != messageId)
                {
                    //we have exhausted all chunks for this message id, break
View Full Code Here

        //Migrate _messageContentDb;
        _logger.info("Message Contents");
        final Database newContentDB = _newMessageStore.getContentDb();
       
        final TupleBinding<MessageContentKey> oldContentKeyTupleBinding = new MessageContentKeyTB_4();
        final TupleBinding<MessageContentKey> newContentKeyTupleBinding = new MessageContentKeyTB_5();
        final TupleBinding contentTB = new ContentTB();
       
        DatabaseVisitor contentVisitor = new DatabaseVisitor()
        {
            long _prevMsgId = -1; //Initialise to invalid value
            int _bytesSeenSoFar = 0;
           
            public void visit(DatabaseEntry key, DatabaseEntry value) throws DatabaseException
            {
                _count++;

                //determine the msgId of the current entry
                MessageContentKey_4 contentKey = (MessageContentKey_4) oldContentKeyTupleBinding.entryToObject(key);
                long msgId = contentKey.getMessageId();

                // ONLY copy data if message is delivered to existing queue
                if (!queueMessages.contains(msgId))
                {
                    return;
                }
                //if this is a new message, restart the byte offset count.
                if(_prevMsgId != msgId)
                {
                    _bytesSeenSoFar = 0;
                }

                //determine the content size
                ByteBuffer content = (ByteBuffer) contentTB.entryToObject(value);
                int contentSize = content.limit();

                //create the new key: id + previously seen data count
                MessageContentKey_5 newKey = new MessageContentKey_5(msgId, _bytesSeenSoFar);
                DatabaseEntry newKeyEntry = new DatabaseEntry();
                newContentKeyTupleBinding.objectToEntry(newKey, newKeyEntry);

                DatabaseEntry newValueEntry = new DatabaseEntry();
                contentTB.objectToEntry(content, newValueEntry);

                newContentDB.put(null, newKeyEntry, newValueEntry);
View Full Code Here

        //Migrate _messageContentDb
        _logger.info("Message Contents");
        final Database newContentDB = _newMessageStore.getContentDb();
       
        final TupleBinding<MessageContentKey> oldContentKeyTupleBinding = new MessageContentKeyTB_4();
        final TupleBinding<MessageContentKey> newContentKeyTupleBinding = new MessageContentKeyTB_5();
        final TupleBinding contentTB = new ContentTB();
       
        DatabaseVisitor contentVisitor = new ContentVisitor(oldContentKeyTupleBinding, queueMessages,
                                                            contentTB, newContentKeyTupleBinding, newContentDB);
        _oldMessageStore.visitContentDb(contentVisitor);
View Full Code Here

                    int offset = 0;
                    do
                    {
                        DatabaseEntry contentKeyEntry = new DatabaseEntry();
                        MessageContentKey_5 mck = new MessageContentKey_5(messageId,offset);
                        TupleBinding<MessageContentKey> contentKeyTupleBinding = new MessageContentKeyTB_5();
                        contentKeyTupleBinding.objectToEntry(mck, contentKeyEntry);
                        //Use a partial record for the value to prevent retrieving the
                        //data itself as we only need the key to identify what to remove.
                        DatabaseEntry value = new DatabaseEntry();
                        value.setPartial(0, 4, true);
View Full Code Here

     */
    protected void addContent(final com.sleepycat.je.Transaction tx, long messageId, int offset,
                                      ByteBuffer contentBody) throws AMQStoreException
    {
        DatabaseEntry key = new DatabaseEntry();
        TupleBinding<MessageContentKey> keyBinding = new MessageContentKeyTB_5();
        keyBinding.objectToEntry(new MessageContentKey_5(messageId, offset), key);
        DatabaseEntry value = new DatabaseEntry();
        TupleBinding<ByteBuffer> messageBinding = new ContentTB();
        messageBinding.objectToEntry(contentBody, value);
        try
        {
View Full Code Here

    {
        DatabaseEntry contentKeyEntry = new DatabaseEntry();

        //Start from 0 offset and search for the starting chunk.
        MessageContentKey_5 mck = new MessageContentKey_5(messageId, 0);
        TupleBinding<MessageContentKey> contentKeyTupleBinding = new MessageContentKeyTB_5();
        contentKeyTupleBinding.objectToEntry(mck, contentKeyEntry);
        DatabaseEntry value = new DatabaseEntry();
        TupleBinding<ByteBuffer> contentTupleBinding = new ContentTB();

        if (_log.isDebugEnabled())
        {
            _log.debug("Message Id: " + messageId + " Getting content body from offset: " + offset);
        }

        int written = 0;
        int seenSoFar = 0;

        Cursor cursor = null;
        try
        {
            cursor = _messageContentDb.openCursor(null, null);

            OperationStatus status = cursor.getSearchKeyRange(contentKeyEntry, value, LockMode.READ_UNCOMMITTED);

            while (status == OperationStatus.SUCCESS)
            {
                mck = (MessageContentKey_5) contentKeyTupleBinding.entryToObject(contentKeyEntry);
                long id = mck.getMessageId();

                if(id != messageId)
                {
                    //we have exhausted all chunks for this message id, break
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.store.berkeleydb.tuples.MessageContentKeyTB_5

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.