Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.phonedeck.gcm4j;
 
 
 
public class DefaultGcm extends AbstractDefaultGcm {
    private final ListeningExecutorService executor;
    public DefaultGcm(GcmConfig gcmConfig) {
        super(gcmConfig);
        this. = gcmConfig.getExecutor() != null ? gcmConfig.getExecutor() : MoreExecutors.listeningDecorator(Executors.newCachedThreadPool());
    }
    @Override
    protected ListenableFuture<GcmResponseexecuteRequestFuture(final GcmRequest request) {
        final SettableFuture<GcmResponseresult = SettableFuture.create();
        .submit(new Runnable() {
            @Override
            public void run() {
                try {
                    result.set(executeRequest(request));
                } catch (GcmException ex) {
                    result.setException(ex);
                }
                  catch (Exception ex) {
                    result.setException(new GcmException("An error occurred when submitting the messsage"ex));
                }
            }
        });
        return result;
    }
New to GrepCode? Check out our FAQ X