Remove option to disable file locking
This commit is contained in:
@@ -157,7 +157,7 @@ public class Application
|
|||||||
*/
|
*/
|
||||||
public Application (File appdir, String appid)
|
public Application (File appdir, String appid)
|
||||||
{
|
{
|
||||||
this(appdir, appid, null, false);
|
this(appdir, appid, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -169,15 +169,13 @@ public class Application
|
|||||||
* <code>appid.apparg</code> to configure itself but all other parameters will be the same as
|
* <code>appid.apparg</code> to configure itself but all other parameters will be the same as
|
||||||
* the primary application.
|
* the primary application.
|
||||||
* @param signers an array of possible signers of this application. Used to verify the digest.
|
* @param signers an array of possible signers of this application. Used to verify the digest.
|
||||||
* @param useLock - if true, attempt to acquire a lockfile while active updating is occuring.
|
|
||||||
*/
|
*/
|
||||||
public Application (File appdir, String appid, Object[] signers, boolean useLock)
|
public Application (File appdir, String appid, Object[] signers)
|
||||||
{
|
{
|
||||||
_appdir = appdir;
|
_appdir = appdir;
|
||||||
_appid = appid;
|
_appid = appid;
|
||||||
_signers = signers;
|
_signers = signers;
|
||||||
_config = getLocalPath(CONFIG_FILE);
|
_config = getLocalPath(CONFIG_FILE);
|
||||||
_locking = useLock;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1043,7 +1041,7 @@ public class Application
|
|||||||
*/
|
*/
|
||||||
public synchronized boolean lockForUpdates ()
|
public synchronized boolean lockForUpdates ()
|
||||||
{
|
{
|
||||||
if (!_locking || (_lock != null && _lock.isValid())) {
|
if (_lock != null && _lock.isValid()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@@ -1330,7 +1328,4 @@ public class Application
|
|||||||
|
|
||||||
/** Channel to the file underying _lock. Kept around solely so the lock doesn't close. */
|
/** Channel to the file underying _lock. Kept around solely so the lock doesn't close. */
|
||||||
protected FileChannel _lockChannel;
|
protected FileChannel _lockChannel;
|
||||||
|
|
||||||
/** True if we're using the locks, false means we're allowing multiple getdowns to run. */
|
|
||||||
protected boolean _locking;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public abstract class Getdown extends Thread
|
|||||||
"\nis invalid. The directory must not contain the '!' character. Please reinstall.";
|
"\nis invalid. The directory must not contain the '!' character. Please reinstall.";
|
||||||
fail(errmsg);
|
fail(errmsg);
|
||||||
}
|
}
|
||||||
_app = new Application(appDir, appId, signers, useLocks());
|
_app = new Application(appDir, appId, signers);
|
||||||
_startup = System.currentTimeMillis();
|
_startup = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -928,16 +928,6 @@ public abstract class Getdown extends Thread
|
|||||||
return Boolean.getBoolean("direct");
|
return Boolean.getBoolean("direct");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* If this method returns true we will acquire a lock when starting to update files to prevent
|
|
||||||
* other instances of getdown from running.
|
|
||||||
*/
|
|
||||||
protected boolean useLocks ()
|
|
||||||
{
|
|
||||||
// allow passing -Dlock=true to turn on lock usage
|
|
||||||
return Boolean.getBoolean("lock");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to the applet that we'll pass on to our application when we're in "invoke
|
* Provides access to the applet that we'll pass on to our application when we're in "invoke
|
||||||
* direct" mode.
|
* direct" mode.
|
||||||
|
|||||||
@@ -112,9 +112,6 @@ public class GetdownApplet extends JApplet
|
|||||||
protected boolean invokeDirect () {
|
protected boolean invokeDirect () {
|
||||||
return "true".equalsIgnoreCase(getParameter("direct"));
|
return "true".equalsIgnoreCase(getParameter("direct"));
|
||||||
}
|
}
|
||||||
protected boolean useLocks () {
|
|
||||||
return "true".equalsIgnoreCase(getParameter("lock"));
|
|
||||||
}
|
|
||||||
protected JApplet getApplet () {
|
protected JApplet getApplet () {
|
||||||
return GetdownApplet.this;
|
return GetdownApplet.this;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user