private void processPayload(byte[] compressedPayload) {
   byte[] payload = PayloadUtil.ungzip(compressedPayload);
   String rmiUrls = new String(payload);
   if (self(rmiUrls)) {
     return;
   }
   rmiUrls = rmiUrls.trim();
   if (LOG.isLoggable(Level.FINE)) {
     LOG.fine("rmiUrls received " + rmiUrls);
   }
   processRmiUrls(rmiUrls);
 }
Example #2
0
 /**
  * 169 µs per one.
  *
  * @throws IOException
  * @throws InterruptedException
  */
 @Test
 public void testUngzipPerformance() throws IOException, InterruptedException {
   String payload = createReferenceString();
   int length = payload.toCharArray().length;
   byte[] original = payload.getBytes();
   int byteLength = original.length;
   assertEquals(length, byteLength);
   byte[] compressed = PayloadUtil.gzip(original);
   // warmup vm
   for (int i = 0; i < 10; i++) {
     byte[] uncompressed = PayloadUtil.ungzip(compressed);
     uncompressed.hashCode();
     assertEquals(original.length, uncompressed.length);
     Thread.sleep(20);
   }
   StopWatch stopWatch = new StopWatch();
   for (int i = 0; i < 10000; i++) {
     PayloadUtil.ungzip(compressed);
   }
   long elapsed = stopWatch.getElapsedTime();
   LOG.info("Ungzip took " + elapsed / 10000F + " µs");
 }