Package org.apache.qpid.server.store

Examples of org.apache.qpid.server.store.StoreException


        verify(_store).removeNodeFromGroup(TEST_NODE_NAME);
    }

    public void testRemoveNodeFromReplicationGroupWithError() throws Exception
    {
        doThrow(new StoreException("mocked exception")).when(_store).removeNodeFromGroup(TEST_NODE_NAME);

        try
        {
            _mBean.removeNodeFromGroup(TEST_NODE_NAME);
            fail("Exception not thrown");
View Full Code Here


        verify(_store).setDesignatedPrimary(true);
    }

    public void testSetAsDesignatedPrimaryWithError() throws Exception
    {
        doThrow(new StoreException("mocked exception")).when(_store).setDesignatedPrimary(true);

        try
        {
            _mBean.setDesignatedPrimary(true);
            fail("Exception not thrown");
View Full Code Here

            // Open them all for reading.
            fileInputStreams = new FileInputStream[fileSet.length];

            if (fileSet.length == 0)
            {
                throw new StoreException("There are no BDB log files to backup in the " + fromdir + " directory.");
            }

            for (int i = 0; i < fileSet.length; i++)
            {
                try
                {
                    fileInputStreams[i] = new FileInputStream(fileSet[i]);
                }
                catch (FileNotFoundException e)
                {
                    // Close any files opened for reading so far.
                    for (int j = 0; j < i; j++)
                    {
                        if (fileInputStreams[j] != null)
                        {
                            try
                            {
                                fileInputStreams[j].close();
                            }
                            catch (IOException ioEx)
                            {
                                // Rethrow this as a runtime exception, as something strange has happened.
                                throw new StoreException(ioEx);
                            }
                        }
                    }

                    // Could not open a consistent file set so try again.
                    break;
                }

                // A consistent set has been opened if all files were sucesfully opened for reading.
                if (i == (fileSet.length - 1))
                {
                    consistentSet = true;
                }
            }

            // Check that the script has not timed out, and raise an error if it has.
            long now = System.currentTimeMillis();
            if ((now - start) > TIMEOUT)
            {
                throw new StoreException("Hot backup script failed to complete in " + (TIMEOUT / 1000) + " seconds.");
            }
        }

        // Copy the consistent set of open files.
        List<String> backedUpFileNames = new LinkedList<String>();

        for (int j = 0; j < fileSet.length; j++)
        {
            File destFile = new File(todir + File.separator + fileSet[j].getName());
            try
            {
                FileUtils.copy(fileSet[j], destFile);
            }
            catch (RuntimeException re)
            {
                Throwable cause = re.getCause();
                if ((cause != null) && (cause instanceof IOException))
                {
                    throw new StoreException(re.getMessage() + " fromDir:" + fromdir + " toDir:" + toDirFile, cause);
                }
                else
                {
                    throw re;
                }
            }

            backedUpFileNames.add(destFile.getName());

            // Close all of the files.
            try
            {
                fileInputStreams[j].close();
            }
            catch (IOException e)
            {
                // Rethrow this as a runtime exception, as something strange has happened.
                throw new StoreException(e);
            }
        }

        return backedUpFileNames.toArray(new String[backedUpFileNames.size()]);
    }
View Full Code Here

                {
                    wait(250);
                }
                catch (InterruptedException e)
                {
                    throw new StoreException(e);
                }
            }

            if(LOGGER.isDebugEnabled())
            {
View Full Code Here

            {
                byte[] dataAsBytes = contentTupleBinding.entryToObject(value);
                int size = dataAsBytes.length;
                if (offset > size)
                {
                    throw new StoreException("Offset " + offset + " is greater than message size " + size
                            + " for message id " + messageId + "!");

                }

                written = size - offset;
                if(written > dst.remaining())
                {
                    written = dst.remaining();
                }

                dst.put(dataAsBytes, offset, written);
            }
            return written;
        }
        catch (DatabaseException e)
        {
            throw new StoreException("Error getting AMQMessage with id " + messageId + " to database: " + e.getMessage(), e);
        }
    }
View Full Code Here

            try
            {
                OperationStatus status = _configuredObjectsDb.put(null, key, value);
                if (status != OperationStatus.SUCCESS)
                {
                    throw new StoreException("Error writing configured object " + configuredObject + " to database: "
                            + status);
                }
            }
            catch (DatabaseException e)
            {
                throw new StoreException("Error writing configured object " + configuredObject
                        + " to database: " + e.getMessage(), e);
            }
        }
    }
View Full Code Here

        {
            return _configuredObjectsDb.delete(tx, key);
        }
        catch (DatabaseException e)
        {
            throw new StoreException("Error deleting of configured object with id " + id + " from database", e);
        }
    }
View Full Code Here

                //expected and represents a clean shutdown of this database only, do nothing.
            }
            else
            {
                getLogger().error("Exception whilst shutting down the store: " + e);
                throw new StoreException("Error closing message store", e);
            }
        }
    }
View Full Code Here

                    }
                }
                catch (SQLException e)
                {
                    closeConnection(conn);
                    throw new StoreException("Exception while processing store size change", e);
                }
            }
        }
    }
View Full Code Here

            }
        }
        catch (SQLException e)
        {
            closeConnection(conn);
            throw new StoreException("Error reducing on disk size", e);
        }
        finally
        {
            closePreparedStatement(stmt);
            closePreparedStatement(cs);
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.store.StoreException

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.