Subclasses of {@link RemoteMuzeiArtSource} should implement {@link #onTryUpdate(int)}
instead of this method.
197548
@RequiresPermission(allOf =
            {Manifest.permission.ACCESS_NETWORK_STATE, Manifest.permission.WAKE_LOCK})
    @CallSuper
    @Override
    protected void onUpdate(@UpdateReason int reason) {
        PowerManager pwm = (PowerManager) getSystemService(POWER_SERVICE);
        PowerManager.WakeLock lock = pwm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, mName);
        lock.acquire(FETCH_WAKELOCK_TIMEOUT_MILLIS);

        SharedPreferences sp = getSharedPreferences();

        try {
            NetworkInfo ni = ((ConnectivityManager) getSystemService(
                    Context.CONNECTIVITY_SERVICE)).getActiveNetworkInfo();
            if (ni == null || !ni.isConnected()) {
                Log.d(TAG, "No network connection; not attempting to fetch update, id=" + mName);
                throw new RetryException();
            }

            // Attempt an update
            onTryUpdate(reason);

            // No RetryException, so declare success and reset update attempt
            sp.edit().remove(PREF_RETRY_ATTEMPT).apply();
            setWantsNetworkAvailable(false);

        } catch (RetryException e) {
            Log.w(TAG, "Error fetching, scheduling retry, id=" + mName);

            // Schedule retry with exponential backoff, starting with INITIAL_RETRY... seconds later
            int retryAttempt = Math.min(sp.getInt(PREF_RETRY_ATTEMPT, 0), MAX_RETRY_ATTEMPTS);
            scheduleUpdate(
                    System.currentTimeMillis() + (INITIAL_RETRY_DELAY_MILLIS << retryAttempt));
            if (retryAttempt < MAX_RETRY_ATTEMPTS) {
                sp.edit().putInt(PREF_RETRY_ATTEMPT, retryAttempt + 1).apply();
            }
            setWantsNetworkAvailable(true);

        } finally {
            if (lock.isHeld()) {
                lock.release();
            }
        }
    }
453456
public HTTPRequest retry(final int maxRetries, final Retryable retryable, final WaitStrategy waitStrategy) {
        if (maxRetries <= 0) {
            throw new IllegalArgumentException("maxRetries must be > 0");
        }
        if (retryable == null) {
            throw new IllegalArgumentException("retryable must not be null");
        }
        if (waitStrategy == null) {
            throw new IllegalArgumentException("waitStrategy must not be null");
        }
        this.maxRetries = maxRetries;
        this.retryable = retryable;
        this.waitStrategy = waitStrategy;
        return this;
    }
427293
@Override
    public void applyUpdate(StepFunction function, INDArray params, INDArray updates, boolean isFinalStep) {
        if (updatesApplied.get() == null)
            updatesApplied.set(new AtomicLong(0));
        try {
            // nullify given updates first
            Nd4j.getMemoryManager().memset(updates);
            //updates.assign(0.0);

            int cnt = 0;
            while (!messages.get(index.get()).isEmpty()) {
                INDArray compressed = messages.get(index.get()).poll();

                int encoding = compressed.data().getInt(3);
                if (encoding == ThresholdCompression.FLEXIBLE_ENCODING)
                    Nd4j.getExecutioner().thresholdDecode(compressed, updates);
                else if (encoding == ThresholdCompression.BITMAP_ENCODING)
                    Nd4j.getExecutioner().bitmapDecode(compressed, updates);
                else
                    throw new DL4JInvalidConfigException("Unknown compression header received: " + encoding);

                cnt++;
            }

            if (cnt > 0 && isDebug)
                log.info("Local updates to be applied: {}", cnt);

            if (externalSource != null) {
                int ent = 0;
                if (externalSource.hasAnything()) {
                    externalSource.drainTo(updates);

                    cnt++;
                    ent++;
                }

                if (isDebug)
                    log.info("thread {} finished at Externals", Thread.currentThread().getId());

                if (ent > 0 && isDebug)
                    log.info("External updates to be applied: {}", ent);
            }

            if (isFinalStep)
                synchronize(currentConsumers.get(), isFinalStep);

            // TODO: average updates probably?

            if (cnt > 0) {
                function.step(params, updates);
                updatesApplied.get().addAndGet(cnt);
                if (isDebug)
                    log.info("Total updates applied so far for thread [{}]: [{}]", Thread.currentThread().getName(), updatesApplied.get());
            }
        } catch (Exception e) {
            throwable.setIfFirst(e);
            throw new RuntimeException(e);
        }
    }
886664
public RetryInterceptorBuilder<T> retryOperations(RetryOperations retryOperations) {
		Assert.isTrue(!this.templateAltered,
				"Cannot set retryOperations when the default has been modified");
		this.retryOperations = retryOperations;
		return this;
	}
808455
public static base_responses update(nitro_service client, snmptrap resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			snmptrap updateresources[] = new snmptrap[resources.length];
			for (int i=0;i<resources.length;i++){
				updateresources[i] = new snmptrap();
				updateresources[i].trapclass = resources[i].trapclass;
				updateresources[i].trapdestination = resources[i].trapdestination;
				updateresources[i].destport = resources[i].destport;
				updateresources[i].version = resources[i].version;
				updateresources[i].communityname = resources[i].communityname;
				updateresources[i].srcip = resources[i].srcip;
				updateresources[i].severity = resources[i].severity;
			}
			result = update_bulk_request(client, updateresources);
		}
		return result;
	}
484655
public BaseMessage receiveRemoteMessage() throws RemoteException
    {
        BaseTransport transport = this.createProxyTransport(RECEIVE_REMOTE_MESSAGE);
        Object strReturn = transport.sendMessageAndGetReply();
        Object objReturn = transport.convertReturnObject(strReturn);
        return (BaseMessage)objReturn;
    }
2554
public Object sendMessageAndGetReply() throws RemoteException
    {
        URL url = null;
        try {
            url = this.getProxyURL();
        } catch (MalformedURLException ex) {
            ex.printStackTrace();
            return null;
        }
        ServletMessage servlet = new ServletMessage(url);
        while (true)
        {   // to allow for retry on timeout
            long time = 0;
            try {
                time = System.currentTimeMillis();
                InputStream in = servlet.sendMessage(m_properties);
                InputStreamReader reader = new InputStreamReader(in);
                BufferedReader buffReader = new BufferedReader(reader);
                String string = Constants.BLANK;
                while (true)
                {
                    String str = buffReader.readLine();
                    if ((str == null) || (str.length() == 0))
                        break;
                    if (string.length() > 0)
                        string += "\n";
                    string += str;
                }
                return string;
            } catch (IOException ex)  {
                if (System.currentTimeMillis() > time + MAX_WAIT_TIME)
                    continue;   // Server timeout, try again
                throw new RemoteException(ex.getMessage() + ' ' + url, ex.getCause());
            }
        }
    }
1168510
@Override
	public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {

		if (cause instanceof TransportException) {
			notifyAllChannelsOfErrorAndClose(cause);
		}
		else {
			final SocketAddress remoteAddr = ctx.channel().remoteAddress();

			final TransportException tex;

			// Improve on the connection reset by peer error message
			if (cause instanceof IOException
					&& cause.getMessage().equals("Connection reset by peer")) {

				tex = new RemoteTransportException(
						"Lost connection to task manager '" + remoteAddr + "'. This indicates "
								+ "that the remote task manager was lost.", remoteAddr, cause);
			}
			else {
				SocketAddress localAddr = ctx.channel().localAddress();
				tex = new LocalTransportException(
					String.format("%s (connection to '%s')", cause.getMessage(), remoteAddr),
					localAddr,
					cause);
			}

			notifyAllChannelsOfErrorAndClose(tex);
		}
	}
1288233
@Override
    public boolean statusUpdate(final String appName, final String id,
                                final InstanceStatus newStatus, String lastDirtyTimestamp,
                                final boolean isReplication) {
        if (super.statusUpdate(appName, id, newStatus, lastDirtyTimestamp, isReplication)) {
            replicateToPeers(Action.StatusUpdate, appName, id, null, newStatus, isReplication);
            return true;
        }
        return false;
    }
371383
@Override
  public void connect(
      ChannelHandlerContext ctx,
      SocketAddress remoteAddress,
      SocketAddress localAddress,
      ChannelPromise promise) throws Exception {
    final class ConnectListener implements ChannelFutureListener {
      @Override
      public void operationComplete(ChannelFuture future) {
        if (!future.isSuccess()) {
          failWrites(future.cause());
        }
      }
    }

    super.connect(ctx, remoteAddress, localAddress, promise);
    promise.addListener(new ConnectListener());
  }
1248243
@SuppressWarnings("unchecked")
	@Override
	public T retry(final int count, final int waitTime) {
		context().setMaxRetryCount(count).setRetryWaitTime(waitTime);
		return (T) this;
	}
1310845
@Override
  @SuppressWarnings("checkstyle:diamondoperatorforvariabledefinition")
  public synchronized void onNext(final RemoteEvent<byte[]> value) {

    LOG.log(Level.FINER, "RemoteManager: {0} value: {1}", new Object[] {this.name, value});

    final T decodedEvent = this.codec.decode(value.getEvent());
    final Class<? extends T> clazz = (Class<? extends T>) decodedEvent.getClass();

    LOG.log(Level.FINEST, "RemoteManager: {0} decoded event {1} :: {2}",
        new Object[] {this.name, clazz.getCanonicalName(), decodedEvent});

    // check remote identifier and message type
    final SocketRemoteIdentifier id = new SocketRemoteIdentifier((InetSocketAddress)value.remoteAddress());

    final Tuple2<RemoteIdentifier, Class<? extends T>> tuple =
        new Tuple2<RemoteIdentifier, Class<? extends T>>(id, clazz);

    final EventHandler<? super T> tupleHandler = this.tupleToHandlerMap.get(tuple);

    if (tupleHandler != null) {

      LOG.log(Level.FINER, "Tuple handler: {0},{1}",
          new Object[] {tuple.getT1(), tuple.getT2().getCanonicalName()});

      tupleHandler.onNext(decodedEvent);

    } else {

      final EventHandler<RemoteMessage<? extends T>> messageHandler = this.msgTypeToHandlerMap.get(clazz);

      if (messageHandler == null) {
        final RuntimeException ex = new RemoteRuntimeException(
            "Unknown message type in dispatch: " + clazz.getCanonicalName() + " from " + id);
        LOG.log(Level.WARNING, "Unknown message type in dispatch.", ex);
        throw ex;
      }

      LOG.log(Level.FINER, "Message handler: {0}", clazz.getCanonicalName());

      messageHandler.onNext(new DefaultRemoteMessage<>(id, decodedEvent));
    }
  }
500224
@Override
    public java.util.concurrent.Future<UpdateApplicationResult> updateApplicationAsync(
            com.amazonaws.handlers.AsyncHandler<UpdateApplicationRequest, UpdateApplicationResult> asyncHandler) {

        return updateApplicationAsync(new UpdateApplicationRequest(), asyncHandler);
    }
1355612
@Override
    protected void applyValueUpdate(final T value) throws NotAvailableException {

        if(value == null) {
            throw new NotAvailableException("Value");
        }

        synchronized (VALUE_LOCK) {
            this.value = value;
            this.valueFuture.complete(value);
            VALUE_LOCK.notifyAll();
        }
    }
1201451
@FFDCIgnore({ ConfigStartException.class })
    private void update() throws Exception {
        // OK to ignore calls to update() if already busy updating
        if (busy.compareAndSet(false, true)) {
            try {
                Map<String, String> updated = new HashMap<>();
                //a last minute check to see if the system is shutting down
                if (!com.ibm.wsspi.kernel.service.utils.FrameworkState.isStopping()) {
                    Map<String, String> props = source.getProperties();
                    if (props != null) {
                        updated.putAll(props);
                    }
                    if (!updated.equals(current)) {
                        current = updated;

                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "update: Contents of ConfigSource {0} has changed.", this);
                        }

                        notifyConfigUpdated();
                    } else {
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "update: Contents of ConfigSource {0} has NOT changed.", this);
                        }
                    }
                } else {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "update: Parent Config has been garbage collectded.", this);
                    }
                }
            } catch (ConfigStartException cse) {
                //Just Re-throw the ConfigStartException, don't FFDC
                //At the moment this exception means that we could not properly query the config source
                //It was introduced as a quick fix for issue #3997 but we might reconsider the design at some point
                throw cse;
            } catch (Exception e) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "update: Exception updating dynamic source: {0}. Exception: {1}", this, e);
                }

                throw e;
            } finally {
                busy.set(false);
            }
        }

    }
1302737
public void put(String remoteFileName,
                    DataSource source,
                    MarkerListener mListener)
        throws IOException, ServerException, ClientException {
        put(remoteFileName, source, mListener, false);
    }
1196782
@Override
    public final Object preInvoke(EJSDeployedSupport s,
                                  ContainerTx tx) // d139352-2
                    throws RemoteException {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "preInvoke");

        setState(POOLED, IN_METHOD);

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "preInvoke");
        return ivEjbInstance;
    }