Search in sources :

Example 1 with ApnsConnectionImpl

use of com.notnoop.apns.internal.ApnsConnectionImpl in project java-apns by notnoop.

the class ApnsServiceBuilder method build.

/**
     * Returns a fully initialized instance of {@link ApnsService},
     * according to the requested settings.
     *
     * @return  a new instance of ApnsService
     */
public ApnsService build() {
    checkInitialization();
    ApnsService service;
    SSLSocketFactory sslFactory = sslContext.getSocketFactory();
    ApnsFeedbackConnection feedback = new ApnsFeedbackConnection(sslFactory, feedbackHost, feedbackPort, proxy, readTimeout, connectTimeout, proxyUsername, proxyPassword);
    ApnsConnection conn = new ApnsConnectionImpl(sslFactory, gatewayHost, gatewayPort, proxy, proxyUsername, proxyPassword, reconnectPolicy, delegate, errorDetection, errorDetectionThreadFactory, cacheLength, autoAdjustCacheLength, readTimeout, connectTimeout);
    if (pooledMax != 1) {
        conn = new ApnsPooledConnection(conn, pooledMax, executor);
    }
    service = new ApnsServiceImpl(conn, feedback);
    if (isQueued) {
        service = new QueuedApnsService(service, queueThreadFactory);
    }
    if (isBatched) {
        service = new BatchApnsService(conn, feedback, batchWaitTimeInSec, batchMaxWaitTimeInSec, batchThreadPoolExecutor);
    }
    service.start();
    return service;
}
Also used : ApnsPooledConnection(com.notnoop.apns.internal.ApnsPooledConnection) ApnsConnectionImpl(com.notnoop.apns.internal.ApnsConnectionImpl) QueuedApnsService(com.notnoop.apns.internal.QueuedApnsService) BatchApnsService(com.notnoop.apns.internal.BatchApnsService) ApnsConnection(com.notnoop.apns.internal.ApnsConnection) SSLSocketFactory(javax.net.ssl.SSLSocketFactory) ApnsFeedbackConnection(com.notnoop.apns.internal.ApnsFeedbackConnection) ApnsServiceImpl(com.notnoop.apns.internal.ApnsServiceImpl) QueuedApnsService(com.notnoop.apns.internal.QueuedApnsService) BatchApnsService(com.notnoop.apns.internal.BatchApnsService)

Aggregations

ApnsConnection (com.notnoop.apns.internal.ApnsConnection)1 ApnsConnectionImpl (com.notnoop.apns.internal.ApnsConnectionImpl)1 ApnsFeedbackConnection (com.notnoop.apns.internal.ApnsFeedbackConnection)1 ApnsPooledConnection (com.notnoop.apns.internal.ApnsPooledConnection)1 ApnsServiceImpl (com.notnoop.apns.internal.ApnsServiceImpl)1 BatchApnsService (com.notnoop.apns.internal.BatchApnsService)1 QueuedApnsService (com.notnoop.apns.internal.QueuedApnsService)1 SSLSocketFactory (javax.net.ssl.SSLSocketFactory)1