public Stats getStats() {
   Stats stats = new Stats();
   stats.uptime = (int) ((Clock.currentTimeMillis() - startTime) / 1000);
   stats.threads = parallelExecutor.getActiveCount();
   stats.waiting_requests = parallelExecutor.getPoolSize();
   stats.cmd_get = gets.get();
   stats.cmd_set = sets.get();
   stats.cmd_delete = deletes.get();
   stats.get_hits = getHits.get();
   stats.get_misses = gets.get() - getHits.get();
   stats.curr_connections = node.connectionManager.getCurrentClientConnections();
   stats.total_connections = node.connectionManager.getAllTextConnections();
   return stats;
 }
 public void restart() {
   synchronized (lifecycleLock) {
     ThreadContext.get().setCurrentFactory(factory);
     fireLifecycleEvent(RESTARTING);
     paused.set(true);
     final Node node = factory.node;
     final ILogger logger = getLogger();
     List<Record> lsOwnedRecords = new ArrayList<Record>();
     for (CMap cmap : node.concurrentMapManager.getCMaps().values()) {
       if (cmap.isUserMap()) {
         lsOwnedRecords.addAll(cmap.getMapIndexService().getOwnedRecords());
       }
     }
     node.onRestart();
     node.clientHandlerService.restart();
     node.connectionManager.onRestart();
     node.clusterManager.onRestart();
     node.concurrentMapManager.onRestart();
     node.rejoin();
     final CountDownLatch latch = new CountDownLatch(lsOwnedRecords.size());
     final ParallelExecutor executor = node.executorManager.newParallelExecutor(16);
     for (final Record ownedRecord : lsOwnedRecords) {
       executor.execute(
           new Runnable() {
             public void run() {
               try {
                 ConcurrentMapManager.MPut mput = node.concurrentMapManager.new MPut();
                 mput.merge(ownedRecord);
                 // invalidate record now (skipped invalidation on restart)
                 ownedRecord.invalidate();
                 latch.countDown();
               } catch (Exception e) {
                 logger.log(Level.WARNING, e.getMessage(), e);
               }
             }
           });
     }
     try {
       latch.await(60, TimeUnit.SECONDS);
     } catch (InterruptedException ignored) {
     }
     paused.set(false);
     fireLifecycleEvent(RESTARTED);
   }
 }
 public void processRequest(TextCommand command) {
   if (responseThreadRunnable == null) {
     synchronized (this) {
       if (responseThreadRunnable == null) {
         responseThreadRunnable = new ResponseThreadRunnable();
         Thread thread =
             new Thread(
                 node.threadGroup, responseThreadRunnable, "hz.ascii.service.response.thread");
         thread.start();
       }
     }
   }
   parallelExecutor.execute(new CommandExecutor(command));
 }