class SegmentTransfer {

    public void transfer() {
        Segment realtSeg = null;
        Segment histSeg = null;
        try {
            SEG_SVC.save(histSegKey);

            realtSeg = newSegment(realtSegKey);
            histSeg = newSegment(histSegKey);
            SegmentBuilder segBuilder = new SegmentBuilder(histSeg, realtSeg.getMetaData().getFieldNames(), Collections.singletonList(realtSeg), Collections.singletonList(realtSeg.getAllShowIndex()));
            segBuilder.build();

            onSucceed();
        } catch (Exception e) {
            remove(histSegKey);
            SwiftLoggers.getLogger().error("seg transfer from {} to {} failed", realtSegKey, histSegKey, e);
        } finally {
            SegmentUtils.releaseHisSeg(Arrays.asList(realtSeg, histSeg));
        }
    }

    public  SegmentTransfer(SegmentKey realtSegKey);

}