diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2014-09-10 00:12:30 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2014-09-12 09:08:00 +0200 |
commit | d6989f1e54104d09b8af6d22cf46ea4f6fc5f4dc (patch) | |
tree | 2e9cd83b8a9425ea184b72c12721d7e08ea87d52 /src/main/java/io/trygvis/jz14/demo/NotifierMain.java | |
download | javazone-2014-d6989f1e54104d09b8af6d22cf46ea4f6fc5f4dc.tar.gz javazone-2014-d6989f1e54104d09b8af6d22cf46ea4f6fc5f4dc.tar.bz2 javazone-2014-d6989f1e54104d09b8af6d22cf46ea4f6fc5f4dc.tar.xz javazone-2014-d6989f1e54104d09b8af6d22cf46ea4f6fc5f4dc.zip |
Diffstat (limited to 'src/main/java/io/trygvis/jz14/demo/NotifierMain.java')
-rw-r--r-- | src/main/java/io/trygvis/jz14/demo/NotifierMain.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/main/java/io/trygvis/jz14/demo/NotifierMain.java b/src/main/java/io/trygvis/jz14/demo/NotifierMain.java new file mode 100644 index 0000000..12dad41 --- /dev/null +++ b/src/main/java/io/trygvis/jz14/demo/NotifierMain.java @@ -0,0 +1,34 @@ +package io.trygvis.jz14.demo; + +import org.slf4j.Logger; + +import java.sql.Connection; +import java.util.Random; + +import static org.slf4j.LoggerFactory.getLogger; + +public class NotifierMain { + Logger log = getLogger(getClass()); + Db db = new Db("notifier"); + Random r = new Random(); + + public static void main(String[] args) throws Exception { + new NotifierMain().main(); + } + + public void main() throws Exception { + Connection c = db.getConnection(); +// c.setAutoCommit(false); + + int count = 1 + r.nextInt(9); + + for (int i = 0; i < count; i++) { + c.createStatement().execute("NOTIFY mail_raw, '" + i + "';"); + } +// c.commit(); + + log.info("NOTIFY performed, count={}", count); + + c.close(); + } +} |