From dee797859f32c150ee240e77ca32176f661cfec0 Mon Sep 17 00:00:00 2001 From: Nicolai Date: Wed, 20 Mar 2024 15:29:47 +0100 Subject: [PATCH 1/2] Fixed calculation of Millis, updated dependencies & cleaned up code --- pom.xml | 26 +++---- .../codecrafter47/bungeemail/BungeeMail.java | 25 +++---- .../bungeemail/FlatFileBackend.java | 67 ++++++++---------- .../codecrafter47/bungeemail/MailCommand.java | 70 +++++++++++-------- .../bungeemail/MySQLBackend.java | 5 +- .../bungeemail/PlayerListener.java | 37 ++++------ .../bungeemail/TabCompleteCache.java | 26 +++---- 7 files changed, 118 insertions(+), 138 deletions(-) diff --git a/pom.xml b/pom.xml index 63f38c5..94b4719 100644 --- a/pom.xml +++ b/pom.xml @@ -14,12 +14,12 @@ codecrafter47-repo - http://nexus.codecrafter47.dyndns.eu/content/repositories/public/ + https://nexus.codecrafter47.dyndns.eu/content/repositories/public/ dakani Dakani Nexus Repo - http://repo.dakanilabs.com/content/repositories/public + https://repo.dakanilabs.com/content/repositories/public CodeMC @@ -31,26 +31,26 @@ net.md-5 bungeecord-api - 1.8-SNAPSHOT + 1.20-R0.1 jar provided org.projectlombok lombok - 1.18.6 + 1.18.32 provided junit junit - 4.13.1 + 4.13.2 test org.apache.commons commons-dbcp2 - 2.2.0 + 2.11.0 compile @@ -62,7 +62,7 @@ org.bstats bstats-bungeecord - 1.4 + 3.0.2 compile @@ -83,16 +83,16 @@ org.apache.maven.plugins maven-compiler-plugin - 3.1 + 3.12.0 - 1.7 - 1.7 + 8 + 8 org.apache.maven.plugins maven-shade-plugin - 2.3 + 3.5.1 package @@ -130,12 +130,12 @@ deployment Internal Releases - http://nexus.codecrafter47.dyndns.eu/content/repositories/releases/ + https://nexus.codecrafter47.dyndns.eu/content/repositories/releases/ deployment Internal Releases - http://nexus.codecrafter47.dyndns.eu/content/repositories/snapshots/ + https://nexus.codecrafter47.dyndns.eu/content/repositories/snapshots/ \ No newline at end of file diff --git a/src/main/java/codecrafter47/bungeemail/BungeeMail.java b/src/main/java/codecrafter47/bungeemail/BungeeMail.java index fb2dd12..7d3b726 100644 --- a/src/main/java/codecrafter47/bungeemail/BungeeMail.java +++ b/src/main/java/codecrafter47/bungeemail/BungeeMail.java @@ -68,12 +68,7 @@ public void onEnable() { return; } // schedule saving - getProxy().getScheduler().schedule(this, new Runnable() { - @Override - public void run() { - fileBackend.saveData(); - } - }, 2, 2, TimeUnit.MINUTES); + getProxy().getScheduler().schedule(this, fileBackend::saveData, 2, 2, TimeUnit.MINUTES); storage = fileBackend; } else { storage = new MySQLBackend(this); @@ -83,7 +78,7 @@ public void run() { instance = this; // Start metrics - Metrics metrics = new Metrics(this); + new Metrics(this, 4570); TabCompleteCache tabCompleteCache = null; if (config.getBoolean("enable_tab_complete")) { @@ -94,14 +89,11 @@ public void run() { getProxy().getPluginManager().registerListener(this, new PlayerListener(this, tabCompleteCache)); if (config.getBoolean("cleanup_enabled", false)) { - getProxy().getScheduler().schedule(this, new Runnable() { - @Override - public void run() { - try { - storage.deleteOlder(System.currentTimeMillis() - (60L * 60L * 24L * config.getLong("cleanup_threshold", 7L)), false); - } catch (StorageException e) { - getLogger().log(Level.WARNING, "Automatic database cleanup failed", e); - } + getProxy().getScheduler().schedule(this, () -> { + try { + storage.deleteOlder(System.currentTimeMillis() - config.getLong("cleanup_threshold", 7L) * 86400000L, false); + } catch (StorageException e) { + getLogger().log(Level.WARNING, "Automatic database cleanup failed", e); } }, 1, 120, TimeUnit.MINUTES); } @@ -147,8 +139,7 @@ public void listMessages(CommandSender sender, int start, boolean listIfNotAvail int i = 1; int end = start + 9; if (end >= messages.size()) end = messages.size(); - List output = new ArrayList<>(); - output.addAll(Arrays.asList(ChatUtil.parseBBCode(headerTemplate. + List output = new ArrayList<>(Arrays.asList(ChatUtil.parseBBCode(headerTemplate. replace("%start%", "" + start).replace("%end%", "" + end). replace("%max%", "" + messages.size()).replace("%list%", listReadMessages ? "listall" : "list"). replace("%next%", "" + (end + 1)).replace("%visible%", messages.size() > 10 ? "" + 10 : ("" + messages.size()))))); diff --git a/src/main/java/codecrafter47/bungeemail/FlatFileBackend.java b/src/main/java/codecrafter47/bungeemail/FlatFileBackend.java index d058429..c505bb2 100644 --- a/src/main/java/codecrafter47/bungeemail/FlatFileBackend.java +++ b/src/main/java/codecrafter47/bungeemail/FlatFileBackend.java @@ -2,12 +2,12 @@ import com.google.common.base.Charsets; import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import java.io.*; +import java.nio.file.Files; import java.util.*; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.locks.ReadWriteLock; @@ -16,14 +16,14 @@ import java.util.logging.Logger; public class FlatFileBackend implements IStorageBackend { - private Logger logger; - private Gson gson = new GsonBuilder().setPrettyPrinting().create(); - private File saveFile; - private File tmpSaveFile; + private final Logger logger; + private final Gson gson = new GsonBuilder().setPrettyPrinting().create(); + private final File saveFile; + private final File tmpSaveFile; private Data data; - private ReadWriteLock mailLock = new ReentrantReadWriteLock(); - private ReadWriteLock uuidLock = new ReentrantReadWriteLock(); - private ReadWriteLock fileLock = new ReentrantReadWriteLock(); + private final ReadWriteLock mailLock = new ReentrantReadWriteLock(); + private final ReadWriteLock uuidLock = new ReentrantReadWriteLock(); + private final ReadWriteLock fileLock = new ReentrantReadWriteLock(); private boolean saveRequested = false; public FlatFileBackend(BungeeMail plugin) { @@ -67,10 +67,8 @@ public boolean readData() { /** * Attempts to save the mail data to a file - * - * @return true on success, false otherwise */ - public boolean saveData() { + public void saveData() { if (saveRequested) { saveRequested = false; mailLock.readLock().lock(); @@ -78,26 +76,24 @@ public boolean saveData() { fileLock.writeLock().lock(); try { if (tmpSaveFile.exists()) { - if (!tmpSaveFile.delete()) return false; + if (!tmpSaveFile.delete()) return; } - if (!tmpSaveFile.createNewFile()) return false; - Writer writer = new OutputStreamWriter(new FileOutputStream(tmpSaveFile), Charsets.UTF_8); + if (!tmpSaveFile.createNewFile()) return; + Writer writer = new OutputStreamWriter(Files.newOutputStream(tmpSaveFile.toPath()), Charsets.UTF_8); gson.toJson(data, writer); writer.close(); if (saveFile.exists()) { - if (!saveFile.delete()) return false; + if (!saveFile.delete()) return; } - return tmpSaveFile.renameTo(saveFile); + tmpSaveFile.renameTo(saveFile); } catch (IOException ex) { logger.log(Level.WARNING, "Failed to save file to disk", ex); - return false; } finally { fileLock.writeLock().unlock(); uuidLock.readLock().unlock(); mailLock.readLock().unlock(); } } - return true; } /** @@ -108,7 +104,7 @@ private void requestSave() { } @Override - public List getMessagesFor(UUID uuid, boolean onlyNew) throws StorageException { + public List getMessagesFor(UUID uuid, boolean onlyNew) { mailLock.readLock().lock(); try { ArrayList messages = new ArrayList<>(); @@ -122,7 +118,7 @@ public List getMessagesFor(UUID uuid, boolean onlyNew) throws StorageEx } @Override - public Message saveMessage(String senderName, UUID senderUUID, UUID recipient, String message, boolean read, long time) throws StorageException { + public Message saveMessage(String senderName, UUID senderUUID, UUID recipient, String message, boolean read, long time) { mailLock.writeLock().lock(); try { FlatFileMessage mail = new FlatFileMessage(time, read, message, recipient, senderUUID, senderName); @@ -135,7 +131,7 @@ public Message saveMessage(String senderName, UUID senderUUID, UUID recipient, S } @Override - public int saveMessageToAll(String senderName, UUID senderUUID, String message, boolean read, long time) throws StorageException { + public int saveMessageToAll(String senderName, UUID senderUUID, String message, boolean read, long time) { Collection targets = getAllKnownUUIDs(); mailLock.writeLock().lock(); try { @@ -151,7 +147,7 @@ public int saveMessageToAll(String senderName, UUID senderUUID, String message, } @Override - public void markRead(Message message) throws StorageException { + public void markRead(Message message) { Preconditions.checkArgument(message instanceof FlatFileMessage); mailLock.writeLock().lock(); try { @@ -163,7 +159,7 @@ public void markRead(Message message) throws StorageException { } @Override - public void delete(Message message) throws StorageException { + public void delete(Message message) { Preconditions.checkArgument(message instanceof FlatFileMessage); mailLock.writeLock().lock(); try { @@ -175,7 +171,7 @@ public void delete(Message message) throws StorageException { } @Override - public boolean delete(long id, UUID recipient) throws StorageException { + public boolean delete(long id, UUID recipient) { boolean deleted = false; mailLock.writeLock().lock(); try { @@ -195,15 +191,10 @@ public boolean delete(long id, UUID recipient) throws StorageException { } @Override - public void deleteOlder(long time, boolean deleteUnread) throws StorageException { + public void deleteOlder(long time, boolean deleteUnread) { mailLock.writeLock().lock(); try { - for (Iterator iterator = data.data.iterator(); iterator.hasNext(); ) { - Message message = iterator.next(); - if (message.getTime() < time && (deleteUnread || message.isRead())) { - iterator.remove(); - } - } + data.data.removeIf(message -> message.getTime() < time && (deleteUnread || message.isRead())); requestSave(); } finally { mailLock.writeLock().unlock(); @@ -211,7 +202,7 @@ public void deleteOlder(long time, boolean deleteUnread) throws StorageException } @Override - public UUID getUUIDForName(String name) throws StorageException { + public UUID getUUIDForName(String name) { if ("Console".equals(name)) { return BungeeMail.CONSOLE_UUID; } @@ -233,7 +224,7 @@ public UUID getUUIDForName(String name) throws StorageException { } @Override - public Collection getAllKnownUUIDs() throws StorageException { + public Collection getAllKnownUUIDs() { uuidLock.readLock().lock(); try { return ImmutableSet.copyOf(data.uuidMap.values()); @@ -243,7 +234,7 @@ public Collection getAllKnownUUIDs() throws StorageException { } @Override - public Collection getKnownUsernames() throws StorageException { + public Collection getKnownUsernames() { uuidLock.readLock().lock(); try { return ImmutableSet.copyOf(data.uuidMap.keySet()); @@ -253,7 +244,7 @@ public Collection getKnownUsernames() throws StorageException { } @Override - public void updateUserEntry(UUID uuid, String username) throws StorageException { + public void updateUserEntry(UUID uuid, String username) { uuidLock.writeLock().lock(); try { data.uuidMap.put(username, uuid); @@ -272,7 +263,7 @@ private static class FlatFileMessage implements Message { private long time; private transient final long id; - private static AtomicLong idSupplier = new AtomicLong(1); + private static final AtomicLong idSupplier = new AtomicLong(1); public FlatFileMessage(long time, boolean read, String message, UUID recipient, UUID senderUUID, String senderName) { this(); @@ -339,7 +330,7 @@ public boolean equals(Object other) { } private static class Data { - private List data = new ArrayList<>(); - private Map uuidMap = new HashMap<>(); + private final List data = new ArrayList<>(); + private final Map uuidMap = new HashMap<>(); } } diff --git a/src/main/java/codecrafter47/bungeemail/MailCommand.java b/src/main/java/codecrafter47/bungeemail/MailCommand.java index 8176968..e38f40b 100644 --- a/src/main/java/codecrafter47/bungeemail/MailCommand.java +++ b/src/main/java/codecrafter47/bungeemail/MailCommand.java @@ -14,7 +14,7 @@ public class MailCommand extends Command { - private BungeeMail plugin; + private final BungeeMail plugin; public MailCommand(String name, String permission, BungeeMail plugin) { super(name, permission); @@ -30,11 +30,11 @@ public void execute(CommandSender commandSender, String[] args) { switch (args[0].toLowerCase()) { case "view": case "list": - case "read": + case "read": { int start = 1; if (args.length >= 2) { try { - start = Integer.valueOf(args[1]); + start = Integer.parseInt(args[1]); } catch (NumberFormatException e) { commandSender.sendMessage(ChatUtil.parseBBCode(plugin.messages.wrongSyntaxList)); return; @@ -46,12 +46,13 @@ public void execute(CommandSender commandSender, String[] args) { plugin.getLogger().log(Level.SEVERE, "Failed to show mails to player", e); commandSender.sendMessage(ChatUtil.parseBBCode(plugin.messages.commandError.replace("%error%", e.getMessage()))); } - return; - case "listall": - start = 1; + break; + } + case "listall": { + int start = 1; if (args.length >= 2) { try { - start = Integer.valueOf(args[1]); + start = Integer.parseInt(args[1]); } catch (NumberFormatException e) { commandSender.sendMessage(ChatUtil.parseBBCode(plugin.messages.wrongSyntaxListall)); return; @@ -63,19 +64,21 @@ public void execute(CommandSender commandSender, String[] args) { plugin.getLogger().log(Level.SEVERE, "Failed to show mails to player", e); commandSender.sendMessage(ChatUtil.parseBBCode(plugin.messages.commandError.replace("%error%", e.getMessage()))); } - return; - case "sendall": + break; + } + case "sendall": { if (!commandSender.hasPermission(Permissions.COMMAND_SENDALL)) { commandSender.sendMessage(ChatUtil.parseBBCode(plugin.messages.noPermission)); return; } - String text = ""; + StringBuilder text = new StringBuilder(); for (int i = 1; i < args.length; i++) { - text += args[i] + " "; + text.append(args[i]).append(" "); } - plugin.sendMailToAll(commandSender, text); - return; - case "reload": + plugin.sendMailToAll(commandSender, text.toString()); + break; + } + case "reload": { if (!commandSender.hasPermission(Permissions.COMMAND_ADMIN)) { commandSender.sendMessage(ChatUtil.parseBBCode(plugin.messages.noPermission)); return; @@ -88,12 +91,13 @@ public void execute(CommandSender commandSender, String[] args) { } } if (config_options_reload.isEmpty()) { - commandSender.sendMessage(ChatUtil.parseBBCode("&aBungeeMail: &fReload Successfull")); + commandSender.sendMessage(ChatUtil.parseBBCode("&aBungeeMail: &fReload Successful")); } else { commandSender.sendMessage(ChatUtil.parseBBCode("&aBungeeMail: &fA restart is required for your changes to the following options to take effect: " + Joiner.on(", ").join(config_options_reload))); } - return; - case "send": + break; + } + case "send": { if (!commandSender.hasPermission(Permissions.COMMAND_SEND)) { commandSender.sendMessage(ChatUtil.parseBBCode(plugin.messages.noPermission)); return; @@ -103,16 +107,18 @@ public void execute(CommandSender commandSender, String[] args) { return; } String target = args[1]; - text = ""; + StringBuilder text = new StringBuilder(); for (int i = 2; i < args.length; i++) { - text += args[i] + " "; + text.append(args[i]).append(" "); } - plugin.sendMail(commandSender, target, text); - return; - case "help": + plugin.sendMail(commandSender, target, text.toString()); + break; + } + case "help": { commandSender.sendMessage(ChatUtil.parseBBCode(plugin.messages.help)); - return; - case "del": + break; + } + case "del": { if (args.length < 2) { commandSender.sendMessage(ChatUtil.parseBBCode(plugin.messages.wrongSyntaxDelete)); return; @@ -138,7 +144,7 @@ public void execute(CommandSender commandSender, String[] args) { } } else { try { - long id = Long.valueOf(args[1]); + long id = Long.parseLong(args[1]); plugin.getStorage().delete(id, senderUUID); commandSender.sendMessage(ChatUtil.parseBBCode(plugin.messages.deletedSingle)); } catch (NumberFormatException e) { @@ -148,19 +154,21 @@ public void execute(CommandSender commandSender, String[] args) { commandSender.sendMessage(ChatUtil.parseBBCode(plugin.messages.commandError.replace("%error%", e.getMessage()))); } } - return; - default: + break; + } + default: { if (!commandSender.hasPermission(Permissions.COMMAND_SEND)) { commandSender.sendMessage(ChatUtil.parseBBCode(plugin.messages.help)); return; } // send mail - target = args[0]; - text = ""; + String target = args[0]; + StringBuilder text = new StringBuilder(); for (int i = 1; i < args.length; i++) { - text += args[i] + " "; + text.append(args[i]).append(" "); } - plugin.sendMail(commandSender, target, text); + plugin.sendMail(commandSender, target, text.toString()); + } } } diff --git a/src/main/java/codecrafter47/bungeemail/MySQLBackend.java b/src/main/java/codecrafter47/bungeemail/MySQLBackend.java index 7246826..1be8665 100644 --- a/src/main/java/codecrafter47/bungeemail/MySQLBackend.java +++ b/src/main/java/codecrafter47/bungeemail/MySQLBackend.java @@ -2,12 +2,10 @@ import com.google.common.base.Preconditions; import org.apache.commons.dbcp2.*; -import org.apache.commons.pool2.ObjectPool; import org.apache.commons.pool2.impl.GenericObjectPool; import javax.sql.DataSource; import java.sql.*; -import java.sql.Statement; import java.util.*; public class MySQLBackend implements IStorageBackend { @@ -109,8 +107,7 @@ public int saveMessageToAll(String senderName, UUID senderUUID, String message, ps.setString(3, message); ps.setBoolean(4, read); ps.setLong(5, time); - int affectedRows = ps.executeUpdate(); - return affectedRows; + return ps.executeUpdate(); } } catch (SQLException e) { throw new StorageException(e); diff --git a/src/main/java/codecrafter47/bungeemail/PlayerListener.java b/src/main/java/codecrafter47/bungeemail/PlayerListener.java index 7d1ecc6..986353f 100644 --- a/src/main/java/codecrafter47/bungeemail/PlayerListener.java +++ b/src/main/java/codecrafter47/bungeemail/PlayerListener.java @@ -11,14 +11,13 @@ import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.event.EventPriority; -import java.util.Collections; import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.logging.Level; public class PlayerListener implements Listener { - private BungeeMail plugin; + private final BungeeMail plugin; private final TabCompleteCache tabCompleteCache; public PlayerListener(BungeeMail plugin, TabCompleteCache tabCompleteCache) { @@ -31,14 +30,11 @@ public void onPlayerJoin(LoginEvent event) { if (!event.isCancelled()) { final UUID uniqueId = event.getConnection().getUniqueId(); final String name = event.getConnection().getName(); - ProxyServer.getInstance().getScheduler().runAsync(plugin, new Runnable() { - @Override - public void run() { - try { - plugin.getStorage().updateUserEntry(uniqueId, name); - } catch (StorageException e) { - plugin.getLogger().log(Level.SEVERE, "Unable to update a players uuid in the cache", e); - } + ProxyServer.getInstance().getScheduler().runAsync(plugin, () -> { + try { + plugin.getStorage().updateUserEntry(uniqueId, name); + } catch (StorageException e) { + plugin.getLogger().log(Level.SEVERE, "Unable to update a players uuid in the cache", e); } }); } @@ -61,18 +57,15 @@ public void onPlayerServerSwitch(ServerSwitchEvent event) { } private void showNewMailInfo(final ProxiedPlayer player) { - plugin.getProxy().getScheduler().schedule(plugin, new Runnable() { - @Override - public void run() { - if (plugin.config.getBoolean("showMailsOnLogin")) { - try { - plugin.listMessages(player, 1, false, false); - } catch (StorageException e) { - plugin.getLogger().log(Level.SEVERE, "Failed to show mails to player", e); - } - } else { - plugin.showLoginInfo(player); + plugin.getProxy().getScheduler().schedule(plugin, () -> { + if (plugin.config.getBoolean("showMailsOnLogin")) { + try { + plugin.listMessages(player, 1, false, false); + } catch (StorageException e) { + plugin.getLogger().log(Level.SEVERE, "Failed to show mails to player", e); } + } else { + plugin.showLoginInfo(player); } }, 1, TimeUnit.SECONDS); } @@ -130,7 +123,7 @@ public void onTabComplete(TabCompleteEvent event) { || (args.length == 2 && event.getSuggestions().isEmpty())) { if (player.hasPermission(Permissions.COMMAND_SEND) && tabCompleteCache != null) { event.getSuggestions().addAll(tabCompleteCache.getSuggestions(prefix)); - Collections.sort(event.getSuggestions(), CaseInsensitiveComparator.INSTANCE); + event.getSuggestions().sort(CaseInsensitiveComparator.INSTANCE); } } } diff --git a/src/main/java/codecrafter47/bungeemail/TabCompleteCache.java b/src/main/java/codecrafter47/bungeemail/TabCompleteCache.java index af7c303..d49d64c 100644 --- a/src/main/java/codecrafter47/bungeemail/TabCompleteCache.java +++ b/src/main/java/codecrafter47/bungeemail/TabCompleteCache.java @@ -3,7 +3,10 @@ import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.plugin.Plugin; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.logging.Level; @@ -21,19 +24,16 @@ public TabCompleteCache(Plugin plugin, final IStorageBackend backend) { } private void updateCache(final int wait) { - plugin.getProxy().getScheduler().schedule(plugin, new Runnable() { - @Override - public void run() { - ArrayList usernames = null; - try { - usernames = new ArrayList<>(backend.getKnownUsernames()); - } catch (StorageException e) { - plugin.getLogger().log(Level.WARNING, "Failed to get tab completion data", e); - return; - } - Collections.sort(usernames, CaseInsensitiveComparator.INSTANCE); - sortedNames = usernames; + plugin.getProxy().getScheduler().schedule(plugin, () -> { + ArrayList usernames; + try { + usernames = new ArrayList<>(backend.getKnownUsernames()); + } catch (StorageException e) { + plugin.getLogger().log(Level.WARNING, "Failed to get tab completion data", e); + return; } + usernames.sort(CaseInsensitiveComparator.INSTANCE); + sortedNames = usernames; }, wait, TimeUnit.MINUTES); } From 6f33c7ce2acab7a78e404b910de3ad21f3e555fb Mon Sep 17 00:00:00 2001 From: Nicolai Date: Wed, 10 Apr 2024 00:31:55 +0200 Subject: [PATCH 2/2] made calculation of millis more readable --- src/main/java/codecrafter47/bungeemail/BungeeMail.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/codecrafter47/bungeemail/BungeeMail.java b/src/main/java/codecrafter47/bungeemail/BungeeMail.java index 7d3b726..983abec 100644 --- a/src/main/java/codecrafter47/bungeemail/BungeeMail.java +++ b/src/main/java/codecrafter47/bungeemail/BungeeMail.java @@ -91,7 +91,7 @@ public void onEnable() { if (config.getBoolean("cleanup_enabled", false)) { getProxy().getScheduler().schedule(this, () -> { try { - storage.deleteOlder(System.currentTimeMillis() - config.getLong("cleanup_threshold", 7L) * 86400000L, false); + storage.deleteOlder(System.currentTimeMillis() - (1000L * 60L * 60L * 24L * config.getLong("cleanup_threshold", 7L)), false); } catch (StorageException e) { getLogger().log(Level.WARNING, "Automatic database cleanup failed", e); }