@Test public void multipleClientsShouldNotRetrieveTheSameNode() throws InterruptedException { int N = 5; IdlePool pool = IdlePoolFactory.getCleanInstance(CloudConfiguration.getCloudConfigurationInstance(), N, POOL_THRESHOLD); pool.fillPool(); Thread.sleep(100); List<PoolClient> clients = new ArrayList<PoolClient>(); for (int i = 0; i < 3; i++) { PoolClient client = new PoolClient(pool); clients.add(client); Thread thrd = new Thread(client); thrd.start(); } Thread.sleep(200); Iterator<PoolClient> it = clients.iterator(); CloudNode previousNode = it.next().retrievedNode; assertNotNull(previousNode); while (it.hasNext()) { CloudNode node = it.next().retrievedNode; assertNotNull(node); assertNotSame(previousNode, node); previousNode = node; } }
public void fillPool() { PoolFiller filler = new PoolFiller(); this.fillerExecutor.execute(filler); }
IdlePool { public void fillPool() { PoolFiller filler = new PoolFiller(); this.fillerExecutor.execute(filler); } }
IdlePool { public void fillPool() { PoolFiller filler = new PoolFiller(); this.fillerExecutor.execute(filler); } IdlePool(CloudConfiguration cloudConfiguration, int poolSize, int threshold); }
IdlePool { public void fillPool() { PoolFiller filler = new PoolFiller(); this.fillerExecutor.execute(filler); } IdlePool(CloudConfiguration cloudConfiguration, int poolSize, int threshold); int getSize(); int getThreshold(); CloudNode retriveNode(); void createExtraVMs(int howManyVMs); boolean isFull(); void fillPool(); void emptyPool(); }
IdlePool { public void fillPool() { PoolFiller filler = new PoolFiller(); this.fillerExecutor.execute(filler); } IdlePool(CloudConfiguration cloudConfiguration, int poolSize, int threshold); int getSize(); int getThreshold(); CloudNode retriveNode(); void createExtraVMs(int howManyVMs); boolean isFull(); void fillPool(); void emptyPool();  }