public void close() throws DataAccessException { isClosed = true; queue.remove(this); if (subscription != null) { if (subscription.isAlive()) { subscription.doClose(); } subscription = null; } try { client.close(); } catch (IOException ex) { throw convertSrpAccessException(ex); } }
public void subscribe(MessageListener listener, byte[]... channels) { checkSubscription(); try { if (isPipelined()) { throw new UnsupportedOperationException(); } subscription = new SrpSubscription(listener, client); subscription.subscribe(channels); } catch (Exception ex) { throw convertSrpAccessException(ex); } }
public boolean isSubscribed() { return (subscription != null && subscription.isAlive()); }