java.lang.Object
java.lang.Thread
net.i2p.util.I2PThread
net.i2p.util.I2PAppThread
net.i2p.router.update.UpdateRunner
net.i2p.router.update.DevSU3UpdateRunner
- All Implemented Interfaces:
Runnable, UpdateTask, EepGet.StatusListener
Eepget the .su3 file to the temp dir, then notify. ConsoleUpdateManager will do the rest.
Nested Class Summary
Nested classes/interfaces inherited from class I2PThread
I2PThread.OOMEventListenerModifier and TypeClassDescriptionstatic interfaceListener for out-of-memory events.Nested classes/interfaces inherited from class Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandlerField Summary
Fields inherited from class UpdateRunner
_baos, _context, _currentURI, _get, _isPartial, _isRunning, _log, _method, _mgr, _newVersion, _type, _updateFile, _urls, CONNECT_TIMEOUT, done, INACTIVITY_TIMEOUT, NOPROXY_INACTIVITY_TIMEOUTModifier and TypeFieldDescriptionprotected final ByteArrayOutputStream56 byte header, only used for suds.protected final RouterContextRouter context.protected URICurrent URI being fetched.protected EepGetThe current EepGet instance.protected booleanTells the listeners what mode we are in - set to true in extending classes for checks.protected booleanWhether the runner is currently running.protected final LogClass logger.protected final UpdateMethodUpdate method.protected final ConsoleUpdateManagerUpdate manager.protected StringSet by the listeners on completion.protected final UpdateTypeUpdate type.protected final StringTemporary file for the update download.List of update URIs.protected static final longConnect timeout in ms.protected booleanWhether the update completed.protected static final longInactivity timeout with proxy in ms.protected static final longInactivity timeout without proxy in ms.Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITYConstructor Summary
ConstructorsConstructorDescriptionDevSU3UpdateRunner(RouterContext ctx, ConsoleUpdateManager mgr, List<URI> uris) DevSU3UpdateRunner.Method Summary
Public MethodsModifier and TypeMethodDescriptionvoidtransferComplete(long alreadyTransferred, long bytesTransferred, long bytesRemaining, String url, String outputFile, boolean notModified) Eepget listener callback Overrides.protected voidupdate()Get the file.Methods inherited from class UpdateRunner
_t, _t, attemptFailed, attempting, bytesTransferred, getID, getMethod, getType, getURI, headerReceived, isRunning, linkify, run, shutdown, toString, transferFailed, updateStatusModifier and TypeMethodDescriptionprotected StringTranslate a string.protected StringTranslate a string with a parameter.voidattemptFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt, int numRetries, Exception cause) An attempt failed.voidattempting(String url) A retry is starting.voidbytesTransferred(long alreadyTransferred, int currentWrite, long bytesTransferred, long bytesRemaining, String url) Subclasses should override.getID()I d.Returns how the update is fetched, such as HTTP or torrent.getType()Returns what kind of update this runner handles.getURI()U r i.voidheaderReceived(String url, int attemptNum, String key, String val) HTTP response headers are not used to determine the update version.booleanWhether running.protected static StringWrap a URL in an anchor tag for display.voidrun()Runs the update, reporting any failure to the update manager.voidshutdown()Clears the running flag and interrupts any update in progress.toString()Handler summary for log messages.voidtransferFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt) Subclasses should override.protected voidReport progress to the user.Methods inherited from class I2PAppThread
addOOMEventThreadListener, fireOOM, removeOOMEventThreadListenerModifier and TypeMethodDescriptionvoidRegister a new component that wants notification of OOM events.protected voidfireOOM(OutOfMemoryError oom) Notify listeners that an OutOfMemoryError occurred.voidUnregister a component that wants notification of OOM events.Methods inherited from class I2PThread
addOOMEventListener, removeOOMEventListener, startModifier and TypeMethodDescriptionstatic voidRegister a new component that wants notification of OOM events.static voidUnregister a component that wants notification of OOM events.voidstart()Overridden to provide useful info to users on OOM, and to prevent shutting down the whole JVM for what is most likely not a heap issue.Methods inherited from class Thread
activeCount, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, startVirtualThread, threadId, yieldMethods inherited from interface UpdateTask
start
Constructor Details
DevSU3UpdateRunner
DevSU3UpdateRunner.- Parameters:
ctx- router context supplying the clock, config and loggingmgr- console update manager notified of progress and completionuris- candidate .su3 URLs, the first of which is fetched
Method Details
update
transferComplete
public void transferComplete(long alreadyTransferred, long bytesTransferred, long bytesRemaining, String url, String outputFile, boolean notModified) Eepget listener callback Overrides.- Specified by:
transferCompletein interfaceEepGet.StatusListener- Overrides:
transferCompletein classUpdateRunner- Parameters:
alreadyTransferred- total bytes transferredbytesTransferred- total incl headersbytesRemaining- bytes still owed by the server, or -1 if chunked encoding or no Content-Length was returnedurl- the address the transfer was readingoutputFile- null if unknown (output stream constructor)notModified- whether 304- See Also: