Package com.dbay.apns4j

Examples of com.dbay.apns4j.IApnsConnection


  @Override
  public void sendNotification(final String token, final Payload payload) {
    service.execute(new Runnable() {
      @Override
      public void run() {
        IApnsConnection conn = null;
        try {
          conn = getConnection();
          conn.sendNotification(token, payload);
        } catch (Exception e) {
          logger.error(e.getMessage(), e);
        } finally {
          if (conn != null) {
            connPool.returnConn(conn);
View Full Code Here


  @Override
  public void sendNotification(final PushNotification notification) {
    service.execute(new Runnable() {
      @Override
      public void run() {
        IApnsConnection conn = null;
        try {
          conn = getConnection();
          conn.sendNotification(notification);
        } catch (Exception e) {
          logger.error(e.getMessage(), e);
        } finally {
          if (conn != null) {
            connPool.returnConn(conn);
View Full Code Here

        }
      }
    });
  }
  private IApnsConnection getConnection() {
    IApnsConnection conn = connPool.borrowConn();
    if (conn == null) {
      throw new RuntimeException("Can't get apns connection");
    }
    return conn;
  }
View Full Code Here

    int poolSize = config.getPoolSize();
    connQueue = new LinkedBlockingQueue<IApnsConnection>(poolSize);
   
    for (int i = 0; i < poolSize; i++) {
      String connName = (config.isDevEnv() ? "dev-" : "pro-") + CONN_ID_SEQ++;
      IApnsConnection conn = new ApnsConnectionImpl(this.factory, host, port, config.getRetries(),
          config.getCacheLength(), config.getName(), connName, config.getIntervalTime(), config.getTimeout());
      connQueue.add(conn);
    }
  }
View Full Code Here

TOP

Related Classes of com.dbay.apns4j.IApnsConnection

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.