From 3b460c49a7cbca72f367bc44ca111b2a508d0cac Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 28 Feb 2017 14:29:05 +0300 Subject: readonly mode --- juick-server/src/main/java/com/juick/service/MessagesService.java | 2 ++ .../src/main/java/com/juick/service/MessagesServiceImpl.java | 6 ++++++ 2 files changed, 8 insertions(+) (limited to 'juick-server/src/main/java/com/juick') diff --git a/juick-server/src/main/java/com/juick/service/MessagesService.java b/juick-server/src/main/java/com/juick/service/MessagesService.java index 284b2018..cad0f860 100644 --- a/juick-server/src/main/java/com/juick/service/MessagesService.java +++ b/juick-server/src/main/java/com/juick/service/MessagesService.java @@ -81,4 +81,6 @@ public interface MessagesService { List getLastMessages(int hours); List getLastReplies(int hours); + + boolean isReadonly(); } diff --git a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java index 5c2701eb..a19878d9 100644 --- a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -767,4 +767,10 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ return reply; }, -hours); } + + @Transactional(readOnly = true) + @Override + public boolean isReadonly() { + return getJdbcTemplate().queryForObject("SELECT @@global.read_only", Integer.class) > 0; + } } -- cgit v1.2.3