summaryrefslogtreecommitdiffstats
path: root/logserver/src/main/java/com/yahoo/logserver/handlers/archive/LogWriter.java
diff options
context:
space:
mode:
Diffstat (limited to 'logserver/src/main/java/com/yahoo/logserver/handlers/archive/LogWriter.java')
-rw-r--r--logserver/src/main/java/com/yahoo/logserver/handlers/archive/LogWriter.java25
1 files changed, 9 insertions, 16 deletions
diff --git a/logserver/src/main/java/com/yahoo/logserver/handlers/archive/LogWriter.java b/logserver/src/main/java/com/yahoo/logserver/handlers/archive/LogWriter.java
index 8d0eeb004fb..47a9b04291d 100644
--- a/logserver/src/main/java/com/yahoo/logserver/handlers/archive/LogWriter.java
+++ b/logserver/src/main/java/com/yahoo/logserver/handlers/archive/LogWriter.java
@@ -14,22 +14,26 @@ import com.yahoo.log.LogLevel;
*
* @author Bjorn Borud
*/
-public class LogWriter extends Writer {
+public class LogWriter {
private static final Logger log = Logger.getLogger(LogWriter.class.getName());
private long bytesWritten = 0;
- private int generation = 0;
+ private int generation;
private int maxSize = 20 * (1024 * 1024);
private final int resumeLimit = 95;
private final int resumeLimitSize = (maxSize * resumeLimit / 100);
private File currentFile;
private Writer writer;
private final String prefix;
+ private final FilesArchived archive;
- public LogWriter(String prefix, int maxSize) throws IOException {
+ public LogWriter(String prefix, int maxSize, FilesArchived archive) throws IOException {
this.prefix = prefix;
this.maxSize = maxSize;
+ this.archive = archive;
+ this.generation = archive.highestGen(prefix);
writer = nextWriter();
+ archive.maintenance();
}
/**
@@ -96,22 +100,10 @@ public class LogWriter extends Writer {
throw new RuntimeException("Unable to create next log file");
}
- /**
- * Note that this method should not be used directly since
- * that would circumvent rotation when it grows past its
- * maximum size. use the one that takes String instead.
- * <p>
- * <em>
- * (This is a class which is only used internally anyway)
- * </em>
- */
- public void write(char[] cbuff, int offset, int len) throws IOException {
- throw new RuntimeException("This method should not be used");
- }
-
public void write(String str) throws IOException {
if (writer == null) {
writer = nextWriter();
+ archive.maintenance();
}
bytesWritten += str.length();
@@ -122,6 +114,7 @@ public class LogWriter extends Writer {
+ currentFile.getAbsolutePath()
+ "' full, rotating");
writer = nextWriter();
+ archive.maintenance();
}
}