Package gov.nasa.arc.mct.buffer.config

Examples of gov.nasa.arc.mct.buffer.config.DataBufferEnv


        } else {
            partitionBuffer = partitionBufferFactory.newPartitionBuffer(env);
        }
        this.currentParition = partitionBuffer;
       
        DataBufferEnv currentEnv = currentParition.getBufferEnv();
        for (int i=0; i<partitionDataBuffers.length; i++) {
            this.partitionDataBuffers[i] = new AtomicReference<PartitionDataBuffer>();
        }
        this.partitionDataBuffers[currentEnv.getCurrentBufferPartition()].set(currentParition);
    }
View Full Code Here


        }
        this.partitionDataBuffers[currentEnv.getCurrentBufferPartition()].set(currentParition);
    }
   
    private void startEvictor() {
        DataBufferEnv currentEnv = currentParition.getBufferEnv();
       
        if (currentEnv.getNumOfBufferPartitions() > 1 && currentEnv.getBufferTime() != -1) {
            this.evictor = new DataBufferEvictor(this, currentEnv.getBufferTime()
                            - currentEnv.getBufferPartitionOverlap(), currentEnv.getBufferPartitionOverlap());
            evictor.schedule();
        }
    }
View Full Code Here

       
        try {
            if (evictor != null) {
                evictor.cancel();
            }
            DataBufferEnv env = currentParition.getBufferEnv();
            for (int j = 0; j < this.partitionDataBuffers.length; j++) {
                if (partitionDataBuffers[j].get() != null) {
                    partitionDataBuffers[j].get().removeBuffer();
                    partitionDataBuffers[j].set(null);
                }
            }
           
            if (this.metaDataBuffer != null) {
                this.metaDataBuffer.restart();
            }
           
            DataBufferEnv currentEnv = (DataBufferEnv)env.clone();
           
            assert currentEnv != null : "Current DataBufferEnv should not be null.";
            assert dataBufferHelper != null : "DataBufferHelper should not be null.";
           
            PartitionDataBuffer partitionBuffer = dataBufferHelper.newPartitionBuffer(currentEnv);
            this.currentParition = partitionBuffer;
            this.partitionDataBuffers[currentEnv.getCurrentBufferPartition()].set(currentParition);

            startEvictor();
        } finally {
            synchronized(movePartitionLock) {
                reset = false;
View Full Code Here

                    rowOverData = toBeClosedBuffer.getLastData(rowOverFeedIDs, TimeUnit.NANOSECONDS, 0, Long.MAX_VALUE);
                }
                closeBuffer(toBeClosedBuffer);
            }

            DataBufferEnv newBufferEnv = this.currentParition.getBufferEnv().advanceBufferPartition();
            PartitionDataBuffer newPartitionBuffer = dataBufferHelper.newPartitionBuffer(newBufferEnv);
            if (rowOverData != null) {
                Map<String, Map<Long, Map<String, String>>> data = new HashMap<String, Map<Long,Map<String,String>>>();
                for (Entry<String, SortedMap<Long, Map<String, String>>> entry: rowOverData.entrySet()) {
                    Map<Long, Map<String, String>> feedData = new HashMap<Long, Map<String,String>>(entry.getValue());
                    data.put(entry.getKey(), feedData);
                }
                try {
                    Map<String, PartitionTimestamps> timeStamps = putData(newPartitionBuffer, data, TimeUnit.NANOSECONDS);
                    if (timeStamps != null) {
                        metaDataBuffer.updatePartitionMetaData(newBufferPartition, timeStamps);
                    }
                } catch (BufferFullException e) {
                    LOGGER.error("Buffer full during prepareForNextPartition", e);
                }
            }
            this.partitionDataBuffers[newBufferEnv.getCurrentBufferPartition()].set(newPartitionBuffer);
        } finally {
            synchronized(resetLock) {
                prepareNewPartitionInProgress = false;
                resetLock.notifyAll();
            }
View Full Code Here

    public void testExceptions() {
        Properties prop = new Properties();
        prop.put("memory.buffer.partition", "2");
        prop.put("memory.buffer.time.millis", "100");
        final CountDownLatch latch = new CountDownLatch(2);
        DataBufferEnv env = new MemoryBufferEnv(prop);
        DataBufferHelper partitionBufferFactory = new MemoryDataBufferHelper();
        DataBuffer mockBuffer = new DataBuffer(env, partitionBufferFactory) {
            int prepareCount;
            int moveCount;
View Full Code Here

TOP

Related Classes of gov.nasa.arc.mct.buffer.config.DataBufferEnv

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.