@Override public FenceResponse fence(JournalInfo journalInfo, long epoch, String fencerInfo) throws IOException { LOG.info("Fenced by " + fencerInfo + " with epoch " + epoch); throw new UnsupportedOperationException( "BackupNode does not support fence"); }
@Override public FenceResponse fence(JournalInfo journalInfo, long epoch, String fencerInfo) throws IOException { FenceRequestProto req = FenceRequestProto.newBuilder().setEpoch(epoch) .setJournalInfo(PBHelper.convert(journalInfo)).build(); try { FenceResponseProto resp = rpcProxy.fence(NULL_CONTROLLER, req); return new FenceResponse(resp.getPreviousEpoch(), resp.getLastTransactionId(), resp.getInSync()); } catch (ServiceException e) { throw ProtobufHelper.getRemoteException(e); } }
@Override public FenceResponseProto fence(RpcController controller, FenceRequestProto req) throws ServiceException { try { FenceResponse resp = impl.fence(PBHelper.convert(req.getJournalInfo()), req.getEpoch(), req.getFencerInfo()); return FenceResponseProto.newBuilder().setInSync(resp.isInSync()) .setLastTransactionId(resp.getLastTransactionId()) .setPreviousEpoch(resp.getPreviousEpoch()).build(); } catch (IOException e) { throw new ServiceException(e); } }