@Test public void testStopShouldNotBeCalledIfStopped() throws Exception { final TestAccountConnection connection = new TestAccountConnection(); connection.stop(); assertEquals(0, connection.stopCounter.get()); }
@Override public final void stop() { if (stopped.compareAndSet(false, true) || stopping.get()) { Log.d(TAG, "Trying to stop connection"); stopping.set(false); stop0(); } else { Log.d(TAG, "Connection is already stopped"); } }
BaseAccountConnection implements AccountConnection { @Override public final void stop() { if (stopped.compareAndSet(false, true) || stopping.get()) { Log.d(TAG, "Trying to stop connection"); stopping.set(false); stop0(); } else { Log.d(TAG, "Connection is already stopped"); } } }
BaseAccountConnection implements AccountConnection { @Override public final void stop() { if (stopped.compareAndSet(false, true) || stopping.get()) { Log.d(TAG, "Trying to stop connection"); stopping.set(false); stop0(); } else { Log.d(TAG, "Connection is already stopped"); } } protected  BaseAccountConnection(@Nonnull A account, @Nonnull Context context); protected  BaseAccountConnection(@Nonnull A account, @Nonnull Context context, int retryCount); }
BaseAccountConnection implements AccountConnection { @Override public final void stop() { if (stopped.compareAndSet(false, true) || stopping.get()) { Log.d(TAG, "Trying to stop connection"); stopping.set(false); stop0(); } else { Log.d(TAG, "Connection is already stopped"); } } protected  BaseAccountConnection(@Nonnull A account, @Nonnull Context context); protected  BaseAccountConnection(@Nonnull A account, @Nonnull Context context, int retryCount); @Nonnull final A getAccount(); void setAccount(@Nonnull A account); boolean isStopped(); @Override final void start(); @Override final void stop(); @Override final void stopDelayed(); @Override boolean isInternetConnectionRequired(); @Override int getRetryCount(); }
BaseAccountConnection implements AccountConnection { @Override public final void stop() { if (stopped.compareAndSet(false, true) || stopping.get()) { Log.d(TAG, "Trying to stop connection"); stopping.set(false); stop0(); } else { Log.d(TAG, "Connection is already stopped"); } } protected  BaseAccountConnection(@Nonnull A account, @Nonnull Context context); protected  BaseAccountConnection(@Nonnull A account, @Nonnull Context context, int retryCount); @Nonnull final A getAccount(); void setAccount(@Nonnull A account); boolean isStopped(); @Override final void start(); @Override final void stop(); @Override final void stopDelayed(); @Override boolean isInternetConnectionRequired(); @Override int getRetryCount();  }