Skip to content

Commit

Permalink
ISPN-6702 ClientEventsOOMTest hangs the TRACE build
Browse files Browse the repository at this point in the history
Also fixed some generics warnings in the test.
  • Loading branch information
danberindei authored and anistor committed May 25, 2016
1 parent 6022ed9 commit e48a64f
Showing 1 changed file with 11 additions and 11 deletions.
Expand Up @@ -43,7 +43,7 @@ public class ClientEventsOOMTest extends MultiHotRodServersTest {


private static BufferPoolMXBean DIRECT_POOL = getDirectMemoryPool(); private static BufferPoolMXBean DIRECT_POOL = getDirectMemoryPool();


private RemoteCache remoteCache; private RemoteCache<Integer, byte[]> remoteCache;


// There is only one Godzilla in heap, but we can use Netty's off-heap pools to multiply them and destroy the world // There is only one Godzilla in heap, but we can use Netty's off-heap pools to multiply them and destroy the world
private static final byte[] GODZILLA = makeGodzilla(); private static final byte[] GODZILLA = makeGodzilla();
Expand Down Expand Up @@ -90,7 +90,7 @@ public void testOOM() throws Throwable {
log.debugf("ADDED LISTENER"); log.debugf("ADDED LISTENER");
logDirectMemory(log); logDirectMemory(log);


latch.await(); latch.await(1, TimeUnit.MINUTES);


remoteCache.removeClientListener(listener); remoteCache.removeClientListener(listener);
assertEquals(NUM_ENTRIES, listener.eventCount); assertEquals(NUM_ENTRIES, listener.eventCount);
Expand Down Expand Up @@ -128,7 +128,7 @@ private static long maxDirectMemory0() {
} }
} }


public static String humanReadableByteCount(long bytes, boolean si) { private static String humanReadableByteCount(long bytes, boolean si) {
int unit = si ? 1000 : 1024; int unit = si ? 1000 : 1024;
if (bytes < unit) return bytes + " B"; if (bytes < unit) return bytes + " B";
int exp = (int) (Math.log(bytes) / Math.log(unit)); int exp = (int) (Math.log(bytes) / Math.log(unit));
Expand All @@ -137,12 +137,12 @@ public static String humanReadableByteCount(long bytes, boolean si) {
} }


@ClientListener(converterFactoryName = "godzilla-growing-converter-factory", useRawData = true, includeCurrentState = true) @ClientListener(converterFactoryName = "godzilla-growing-converter-factory", useRawData = true, includeCurrentState = true)
static class ClientEntryListener { private static class ClientEntryListener {
private static final Log log = LogFactory.getLog(ClientEntryListener.class); private static final Log log = LogFactory.getLog(ClientEntryListener.class);
private final CountDownLatch latch; private final CountDownLatch latch;
int eventCount = 0; int eventCount = 0;


public ClientEntryListener(CountDownLatch latch) { ClientEntryListener(CountDownLatch latch) {
this.latch = latch; this.latch = latch;
} }


Expand All @@ -163,17 +163,17 @@ public void handleClientCacheEntryCreatedEvent(ClientCacheEntryCustomEvent event
} }


@NamedFactory(name = "godzilla-growing-converter-factory") @NamedFactory(name = "godzilla-growing-converter-factory")
static class CustomConverterFactory implements CacheEventConverterFactory { private static class CustomConverterFactory implements CacheEventConverterFactory {
@Override @Override
public CacheEventConverter<Object, Object, Object> getConverter(Object[] params) { public <K, V, C> CacheEventConverter<K, V, C> getConverter(Object[] params) {
return new CustomConverter(); return new CustomConverter<K, V, C>();
} }


static class CustomConverter implements CacheEventConverter<Object, Object, Object>, Serializable { static class CustomConverter<K, V, C> implements CacheEventConverter<K, V, C>, Serializable {
@Override @Override
public Object convert(Object key, Object previousValue, Metadata previousMetadata, Object value, Metadata metadata, EventType eventType) { public C convert(Object key, Object previousValue, Metadata previousMetadata, Object value, Metadata metadata, EventType eventType) {
// all baby godzillas get converted to full grown godzillas // all baby godzillas get converted to full grown godzillas
return GODZILLA; return (C) GODZILLA;
} }
} }
} }
Expand Down

0 comments on commit e48a64f

Please sign in to comment.