Package com.impossibl.postgres.api.jdbc

Examples of com.impossibl.postgres.api.jdbc.PGNotificationListener


  public void testSimpleNotification() throws Exception {

    try (PGConnection conn = (PGConnection) TestUtil.openDB()) {

      final AtomicBoolean flag = new AtomicBoolean(false);
      PGNotificationListener notificationListener = new PGNotificationListener() {

        @Override
        public void notification(int processId, String channelName, String payload) {
          flag.set(true);
View Full Code Here


  public void testFilteredNotification() throws Exception {

    try (PGConnection conn = (PGConnection) TestUtil.openDB()) {

      final AtomicBoolean validFlag = new AtomicBoolean(false);
      PGNotificationListener validNotificationListener = new PGNotificationListener() {

        @Override
        public void notification(int processId, String channelName, String payload) {
          validFlag.set(true);
        }

      };
      conn.addNotificationListener("1.*", validNotificationListener);

      final AtomicBoolean invalidFlag = new AtomicBoolean(false);
      PGNotificationListener invalidNotificationListener = new PGNotificationListener() {

        @Override
        public void notification(int processId, String channelName, String payload) {
          invalidFlag.set(true);
        }

      };
      conn.addNotificationListener("2.*", invalidNotificationListener);

      final AtomicBoolean allFlag = new AtomicBoolean(false);
      PGNotificationListener allNotificationListener = new PGNotificationListener() {

        @Override
        public void notification(int processId, String channelName, String payload) {
          allFlag.set(true);
        }
View Full Code Here

TOP

Related Classes of com.impossibl.postgres.api.jdbc.PGNotificationListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.