Package com.salesforce.phoenix.memory.MemoryManager

Examples of com.salesforce.phoenix.memory.MemoryManager.MemoryChunk.resize()


                maxSize = Math.max(length, maxSize);
            }
            spoolTo.close();
            if (spoolTo.isInMemory()) {
                byte[] data = spoolTo.getData();
                chunk.resize(data.length);
                spoolFrom = new InMemoryResultIterator(data, chunk);
            } else {
                spoolFrom = new OnDiskResultIterator(maxSize, spoolTo.getFile());
                usedOnDiskIterator = true;
            }
View Full Code Here


            // Once we return from the first call to next, we've run through and cached
            // the topN rows, so we no longer need to start/stop a region operation.
            firstTuple = iterator.next();
            // Now that the topN are cached, we can resize based on the real size
            long actualSize = iterator.getByteSize();
            chunk.resize(actualSize);
        } catch (Throwable t) {
            ServerUtil.throwIOException(region.getRegionNameAsString(), t);
            return null;
        } finally {
            region.closeRegionOperation();
View Full Code Here

            public void run() {
                sleepFor(2000);
                MemoryChunk c3 = rmm2.allocate(10);
                // Will require waiting for a bit of time before t1 frees the requested memory
                long startTime = System.currentTimeMillis();
                c3.resize(50);
                assertTrue(System.currentTimeMillis() - startTime >= 2000);
                c3.close();
            }
        };
        t1.start();
View Full Code Here

            public void run() {
                sleepFor(2000);
                ChildMemoryManager rmm2 = new ChildMemoryManager(gmm,100);
                MemoryChunk c3 = rmm2.allocate(10);
                long startTime = System.currentTimeMillis();
                c3.resize(60); // Test that resize waits if memory not available
                assertTrue(c1.getSize() == 20); // c1 was resized not closed
                assertTrue(System.currentTimeMillis() - startTime >= 2000); // we waited some time before the allocate happened
                c3.close();
                assertTrue(rmm2.getAvailableMemory() == rmm2.getMaxMemory());
            }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.