7475767778798081828384
msg.getLast().print("Worker: "); msg.getLast().reset("OK"); msg.send(worker); } ctx.destroy(); } } // The main task begins by setting-up its frontend and backend sockets // and then starting its client and worker tasks:
2728293031323334
break; String data = subscriber.recvStr(); assert(topic.equals(subscription)); System.out.println(data); } context.destroy(); } }
4647484950515253545556
address.destroy(); msg.addFirst(new ZFrame("C")); msg.send(frontend); } } ctx.destroy(); } } static class Worker implements Runnable {
6566676869707172737475
while (!Thread.currentThread().isInterrupted()) { ZMsg msg = ZMsg.recvMsg(worker); msg.send(worker); } ctx.destroy(); } }
120121122123124125126127128129130
} System.out.printf(" %d calls/second\n", (1000 * SAMPLE_SIZE) / (System.currentTimeMillis() - start)); ctx.destroy(); } } public static void main(String[] args) {
686970717273747576
// Send request again, on new socket client.send(request); } } } ctx.destroy(); } }
237238239240241242243244
while (workers.size() > 0) { ZFrame frame = workers.remove(0); frame.destroy(); } ctx.destroy(); } }
4445464748495051525354
try { Thread.sleep(1000); } catch (InterruptedException e) { } } ctx.destroy(); } } // The worker task plugs into the LRU routing dialog using a REQ // socket:
717273747576777879
if (reply != null) { System.out.printf ("Service is running OK\n"); reply.destroy(); } request.destroy();; ctx.destroy(); } }
2829303132333435363738
clonecli1.kvMap.put(kvMsg.getKey(), kvMsg); System.out.println("receiving " + kvMsg); sequence.incrementAndGet(); } ctx.destroy(); } public static void main(String[] args) { new clonecli1().run(); }