summaryrefslogtreecommitdiffstats
path: root/api/src
diff options
context:
space:
mode:
authorSimon Rettberg2019-11-13 17:09:02 +0100
committerSimon Rettberg2019-11-13 17:09:02 +0100
commit642b82d0eabd6356713af172aea7ca51e7f3fb57 (patch)
treec5fac8d0d97362e48a5dc5770c759fa4c3d0f03f /api/src
parentAdd isFinished() to Task (diff)
downloadtaskman-lite-642b82d0eabd6356713af172aea7ca51e7f3fb57.tar.gz
taskman-lite-642b82d0eabd6356713af172aea7ca51e7f3fb57.tar.xz
taskman-lite-642b82d0eabd6356713af172aea7ca51e7f3fb57.zip
BoundedLog type + serializer
Diffstat (limited to 'api/src')
-rw-r--r--api/src/main/java/org/openslx/taskmanager/api/BoundedLog.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/api/src/main/java/org/openslx/taskmanager/api/BoundedLog.java b/api/src/main/java/org/openslx/taskmanager/api/BoundedLog.java
new file mode 100644
index 0000000..86b8343
--- /dev/null
+++ b/api/src/main/java/org/openslx/taskmanager/api/BoundedLog.java
@@ -0,0 +1,25 @@
+package org.openslx.taskmanager.api;
+
+import java.util.concurrent.LinkedBlockingQueue;
+
+public class BoundedLog extends LinkedBlockingQueue<String>
+{
+ private static final long serialVersionUID = -5425030291381563963L;
+
+ public final boolean implicitNewlines;
+
+ public BoundedLog( int capacity, boolean implicitNewlines )
+ {
+ super( capacity );
+ this.implicitNewlines = implicitNewlines;
+ }
+
+ public void addLog( String data )
+ {
+ while ( !this.offer( data ) ) {
+ // Throw away oldest entry and try again
+ this.poll();
+ }
+ }
+
+}