@Test public void updateSingleTest() throws Exception { for (int i = 0; i < _test_ids.size(); i++) { Counter c = _counter_factory.getCounter(_test_ids.get(i)); Client client = new Client(c, _test_numOfIncrements.get(i)); client.start(); client.join(); assertEquals((int) _test_numOfIncrements.get(i), client .getCollectedValues().size()); assertEquals((int) _test_numOfIncrements.get(i), c.current()); } }
public synchronized Counter getCounter(final String id) { Counter counter = _id2counter.get(id); if (counter == null) { counter = new Counter(id); _id2counter.put(id, counter); } return counter; }
CounterFactory implements Initialisable { public synchronized Counter getCounter(final String id) { Counter counter = _id2counter.get(id); if (counter == null) { counter = new Counter(id); _id2counter.put(id, counter); } return counter; } }
CounterFactory implements Initialisable { public synchronized Counter getCounter(final String id) { Counter counter = _id2counter.get(id); if (counter == null) { counter = new Counter(id); _id2counter.put(id, counter); } return counter; } private  CounterFactory(); }
CounterFactory implements Initialisable { public synchronized Counter getCounter(final String id) { Counter counter = _id2counter.get(id); if (counter == null) { counter = new Counter(id); _id2counter.put(id, counter); } return counter; } private  CounterFactory(); static CounterFactory getInstance(); synchronized void close(); synchronized void destroy(); synchronized Counter getCounter(final String id); synchronized void removeCounter(final String id); @Override void initialise(final DataAccessLayerFactory factory); }
CounterFactory implements Initialisable { public synchronized Counter getCounter(final String id) { Counter counter = _id2counter.get(id); if (counter == null) { counter = new Counter(id); _id2counter.put(id, counter); } return counter; } private  CounterFactory(); static CounterFactory getInstance(); synchronized void close(); synchronized void destroy(); synchronized Counter getCounter(final String id); synchronized void removeCounter(final String id); @Override void initialise(final DataAccessLayerFactory factory);  }