Package org.fusesource.hawtdb.util.buffer

Examples of org.fusesource.hawtdb.util.buffer.Buffer


        String exchangeId = getMockEndpoint("mock:result").getReceivedExchanges().get(0).getExchangeId();

        // the exchange should NOT be in the completed repo as it was confirmed
        final HawtDBFile hawtDBFile = repo.getHawtDBFile();
        final HawtDBCamelMarshaller marshaller = new HawtDBCamelMarshaller();
        final Buffer confirmKeyBuffer = marshaller.marshallKey(exchangeId);
        Buffer bf = hawtDBFile.execute(new Work<Buffer>() {
            public Buffer execute(Transaction tx) {
                Index<Buffer, Buffer> index = hawtDBFile.getRepositoryIndex(tx, "repo1-completed", false);
                return index.get(confirmKeyBuffer);
            }
        });
View Full Code Here


            // If we could guarantee that the key and exchange are immutable,
            // then we could have stuck them directly into the index,
            // HawtDB could then eliminate the need to marshal and un-marshal 
            // in some cases.  But since we can.. we are going to force
            // early marshaling.
            final Buffer keyBuffer = marshaller.marshallKey(key);
            final Buffer exchangeBuffer = marshaller.marshallExchange(camelContext, exchange);
            Buffer rc = hawtDBFile.execute(new Work<Buffer>() {
                public Buffer execute(Transaction tx) {
                    Index<Buffer, Buffer> index = hawtDBFile.getRepositoryIndex(tx, repositoryName, true);
                    return index.put(keyBuffer, exchangeBuffer);
                }
View Full Code Here

    }

    public Exchange get(final CamelContext camelContext, final String key) {
        Exchange answer = null;
        try {
            final Buffer keyBuffer = marshaller.marshallKey(key);
            Buffer rc = hawtDBFile.execute(new Work<Buffer>() {
                public Buffer execute(Transaction tx) {
                    Index<Buffer, Buffer> index = hawtDBFile.getRepositoryIndex(tx, repositoryName, false);
                    if (index == null) {
                        return null;
                    }
View Full Code Here

    public void remove(final CamelContext camelContext, final String key, final Exchange exchange) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Removing key [" + key + "]");
        }
        try {
            final Buffer keyBuffer = marshaller.marshallKey(key);
            final Buffer confirmKeyBuffer = marshaller.marshallKey(exchange.getExchangeId());
            final Buffer exchangeBuffer = marshaller.marshallExchange(camelContext, exchange);
            hawtDBFile.execute(new Work<Buffer>() {
                public Buffer execute(Transaction tx) {
                    Index<Buffer, Buffer> index = hawtDBFile.getRepositoryIndex(tx, repositoryName, true);
                    // remove from the in progress index
                    index.remove(keyBuffer);
View Full Code Here

    public void confirm(final CamelContext camelContext, final String exchangeId) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Confirming exchangeId [" + exchangeId + "]");
        }
        try {
            final Buffer confirmKeyBuffer = marshaller.marshallKey(exchangeId);
            hawtDBFile.execute(new Work<Buffer>() {
                public Buffer execute(Transaction tx) {
                    Index<Buffer, Buffer> indexCompleted = hawtDBFile.getRepositoryIndex(tx, getRepositoryNameCompleted(), true);
                    return indexCompleted.remove(confirmKeyBuffer);
                }
View Full Code Here

                Iterator<Map.Entry<Buffer, Buffer>> it = index.iterator();
                // scan could potentially be running while we are shutting down so check for that
                while (it.hasNext() && isRunAllowed()) {
                    Map.Entry<Buffer, Buffer> entry = it.next();
                    Buffer keyBuffer = entry.getKey();

                    String key;
                    try {
                        key  = marshaller.unmarshallKey(keyBuffer);
                    } catch (IOException e) {
View Full Code Here

                Iterator<Map.Entry<Buffer, Buffer>> it = indexCompleted.iterator();
                // scan could potentially be running while we are shutting down so check for that
                while (it.hasNext() && isRunAllowed()) {
                    Map.Entry<Buffer, Buffer> entry = it.next();
                    Buffer keyBuffer = entry.getKey();

                    String exchangeId;
                    try {
                        exchangeId = marshaller.unmarshallKey(keyBuffer);
                    } catch (IOException e) {
View Full Code Here

        String exchangeId = getMockEndpoint("mock:aggregated").getReceivedExchanges().get(0).getExchangeId();

        // the exchange should be in the completed repo where we should be able to find it
        final HawtDBFile hawtDBFile = repo.getHawtDBFile();
        final HawtDBCamelMarshaller marshaller = new HawtDBCamelMarshaller();
        final Buffer confirmKeyBuffer = marshaller.marshallKey(exchangeId);
        Buffer bf = hawtDBFile.execute(new Work<Buffer>() {
            public Buffer execute(Transaction tx) {
                Index<Buffer, Buffer> index = hawtDBFile.getRepositoryIndex(tx, "repo1-completed", false);
                return index.get(confirmKeyBuffer);
            }
        });
View Full Code Here

    }

    public Exchange recover(CamelContext camelContext, final String exchangeId) {
        Exchange answer = null;
        try {
            final Buffer confirmKeyBuffer = marshaller.marshallKey(exchangeId);
            Buffer rc = hawtDBFile.execute(new Work<Buffer>() {
                public Buffer execute(Transaction tx) {
                    Index<Buffer, Buffer> indexCompleted = hawtDBFile.getRepositoryIndex(tx, getRepositoryNameCompleted(), false);
                    if (indexCompleted == null) {
                        return null;
                    }
View Full Code Here

TOP

Related Classes of org.fusesource.hawtdb.util.buffer.Buffer

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.