@Override
  public synchronized void close() throws IOException {
    if (streamsHolder != null) {
      streamsHolder.close();

      renameFile(streamsHolder.getPath());

      StoreEventPublisher storeEventPublisher = getStoreEventPublisher();
      if (storeEventPublisher != null) {
        storeEventPublisher.publishEvent(new FileWrittenEvent(this, streamsHolder.getPath()));
      }

      streamsHolder = null;
    }
  }
  @Override
  public synchronized void write(byte[] entity) throws IOException {
    if (streamsHolder == null) {
      streamsHolder = getOutput();
    }
    OutputStream out = streamsHolder.getStream();
    out.write(entity);

    setWritePosition(getPosition(streamsHolder));

    OutputContext context = getOutputContext();
    if (context.getRolloverState()) {
      log.info("after write, rollever state is true");
      close();
      context.rollStrategies();
    }
  }
 public synchronized void hflush() throws IOException {
   if (streamsHolder != null) {
     ((Syncable) streamsHolder.getStream()).hflush();
   }
 }
 @Override
 public void flush() throws IOException {
   if (streamsHolder != null) {
     streamsHolder.getStream().flush();
   }
 }