/** Message contains a Command. Execute it against *this* object and return result. */
 @Override
 public void handle(Message req, org.jgroups.blocks.Response response) throws Exception {
   if (isValid(req)) {
     ReplicableCommand cmd = null;
     try {
       cmd =
           (ReplicableCommand)
               req_marshaller.objectFromBuffer(
                   req.getRawBuffer(), req.getOffset(), req.getLength());
       if (cmd == null)
         throw new NullPointerException("Unable to execute a null command!  Message was " + req);
       if (req.getSrc() instanceof SiteAddress) {
         executeCommandFromRemoteSite(cmd, req, response);
       } else {
         executeCommandFromLocalCluster(cmd, req, response);
       }
     } catch (InterruptedException e) {
       log.shutdownHandlingCommand(cmd);
       reply(response, new ExceptionResponse(new CacheException("Cache is shutting down")));
     } catch (Throwable x) {
       if (cmd == null) log.errorUnMarshallingCommand(x);
       else log.exceptionHandlingCommand(cmd, x);
       reply(response, new ExceptionResponse(new CacheException("Problems invoking command.", x)));
     }
   } else {
     reply(response, null);
   }
 }
 @Override
 public Object perform(InvocationContext ctx) throws Throwable {
   final boolean trace = log.isTraceEnabled();
   LogFactory.pushNDC(cacheName, trace);
   stateTransferManager.waitForJoinToStart();
   try {
     switch (type) {
       case APPLY_STATE:
         stateTransferManager.applyState(state, sender, viewId);
         return null;
       case APPLY_LOCKS:
         stateTransferManager.applyLocks(locks, sender, viewId);
         return null;
       default:
         throw new CacheException("Unknown rehash control command type " + type);
     }
   } catch (Throwable t) {
     log.exceptionHandlingCommand(this, t);
     return null;
   } finally {
     LogFactory.popNDC(trace);
   }
 }