phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samarthjain <...@git.apache.org>
Subject [GitHub] phoenix pull request: PHOENIX-2822 - Tests that extend BaseHBaseMa...
Date Thu, 07 Apr 2016 16:30:58 GMT
Github user samarthjain commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/158#discussion_r58902469
  
    --- Diff: phoenix-core/src/test/java/org/apache/phoenix/memory/MemoryManagerTest.java
---
    @@ -69,35 +76,38 @@ private static void sleepFor(long time) {
         }
     
         @Test
    -    public void testWaitForMemoryAvailable() {
    -        final GlobalMemoryManager gmm = new GlobalMemoryManager(100,8000);
    +    public void testWaitForMemoryAvailable() throws Exception {
    +        final GlobalMemoryManager gmm = spy(new GlobalMemoryManager(100, 80));
             final ChildMemoryManager rmm1 = new ChildMemoryManager(gmm,100);
             final ChildMemoryManager rmm2 = new ChildMemoryManager(gmm,100);
    +        final CountDownLatch latch = new CountDownLatch(2);
             Thread t1 = new Thread() {
                 @Override
                 public void run() {
                     MemoryChunk c1 = rmm1.allocate(50);
                     MemoryChunk c2 = rmm1.allocate(50);
    -                sleepFor(4000);
    +                sleepFor(40);
                     c1.close();
    -                sleepFor(2000);
    +                sleepFor(20);
                     c2.close();
    +                latch.countDown();
                 }
             };
             Thread t2 = new Thread() {
                 @Override
                 public void run() {
    -                sleepFor(2000);
    +                sleepFor(20);
                     // Will require waiting for a bit of time before t1 frees the requested
memory
    -                long startTime = System.currentTimeMillis();
    +                Stopwatch watch = new Stopwatch().start();
    --- End diff --
    
    Actually, I don't see this watch being used anywhere. Make sure you have the phoenix eclipse
preferences imported. This should have been flagged as an unused variable warning.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message