mirror of
https://github.com/yacy/yacy_search_server.git
synced 2026-10-25 05:54:15 +00:00
new release file names with date and git hash
...without reference to 9000ish SVN
This commit is contained in:
1 parent
ede9efe50c
commit
60c9986a0e
12 files changed
+292
-265
No files matched your search
@@ -4,7 +4,6 @@ javacTarget=1.8
|
||||
|
||||
# Release Configuration
|
||||
releaseVersion=1.925
|
||||
releaseNr=9749
|
||||
releaseFileParentDir=yacy
|
||||
privateKeyFile=private.key
|
||||
|
||||
|
||||
@@ -90,28 +90,27 @@
|
||||
<property name="target-resolve-already-run" value="true" />
|
||||
</target>
|
||||
|
||||
<!-- find git version and write it to git.revision -->
|
||||
<available file=".git" type="dir" property="git.present"/>
|
||||
<target name="git.revision" description="Store git revision in ${repository.version}" if="git.present">
|
||||
<exec executable="git" outputproperty="git.revision" failifexecutionfails="false" errorproperty="">
|
||||
<arg value="describe"/>
|
||||
<arg value="--tags"/>
|
||||
<arg value="--always"/>
|
||||
<arg value="--abbrev=7"/>
|
||||
<arg value="HEAD"/>
|
||||
</exec>
|
||||
<condition property="repository.version" value="${git.revision}" else="unknown">
|
||||
<and>
|
||||
<isset property="git.revision"/>
|
||||
<length string="${git.revision}" trim="yes" length="0" when="greater"/>
|
||||
</and>
|
||||
</condition>
|
||||
</target>
|
||||
|
||||
<!-- initializing all needed variables -->
|
||||
<target name="init" depends="git.revision">
|
||||
<!-- initializing all needed variables -->
|
||||
<target name="init">
|
||||
<loadproperties srcFile="build.properties" />
|
||||
<property name="stdReleaseFile" value="yacy_v${releaseVersion}_${releaseNr}.tar.gz"/>
|
||||
|
||||
<exec executable="git" outputproperty="repository.revision.date">
|
||||
<arg value="log"/>
|
||||
<arg value="-1"/>
|
||||
<arg value="--pretty=format:%ad" />
|
||||
<arg value="--date=format:%Y%m%d" />
|
||||
</exec>
|
||||
<exec executable="git" outputproperty="repository.revision.time">
|
||||
<arg value="log"/>
|
||||
<arg value="-1"/>
|
||||
<arg value="--pretty=format:%ad" />
|
||||
<arg value="--date=format:%H%m" />
|
||||
</exec>
|
||||
<exec executable="git" outputproperty="repository.revision.hash">
|
||||
<arg value="log"/>
|
||||
<arg value="-1"/>
|
||||
<arg value="--pretty=format:%h" />
|
||||
</exec>
|
||||
|
||||
<mkdir dir="${data}"/>
|
||||
<mkdir dir="${release}"/>
|
||||
@@ -120,13 +119,23 @@
|
||||
<echo message="YaCy Version number: ${releaseVersion}" />
|
||||
<filter token="REPL_VERSION" value="${releaseVersion}" />
|
||||
|
||||
<!-- YaCy Release revision number -->
|
||||
<echo message="YaCy Release number: ${releaseNr}" />
|
||||
<filter token="REPL_REVISION_NR" value="${releaseNr}"/>
|
||||
|
||||
<!-- GIT Release revision number -->
|
||||
<echo message="GIT Release Tag: ${repository.version}" />
|
||||
<filter token="REPL_REPVER" value="${repository.version}"/>
|
||||
<echo message="GIT Release Date: ${repository.revision.date}" />
|
||||
<echo message="GIT Release Time: ${repository.revision.time}" />
|
||||
<echo message="GIT Release Hash: ${repository.revision.hash}" />
|
||||
<filter token="REPL_REPVERDATE" value="${repository.revision.date}"/>
|
||||
<filter token="REPL_REPVERTIME" value="${repository.revision.time}"/>
|
||||
<filter token="REPL_REPVERHASH" value="${repository.revision.hash}"/>
|
||||
|
||||
<!-- set time stamp: DSTAMP should have the format yyyyMMdd, TSTAMP hhmm -->
|
||||
<tstamp/>
|
||||
<filter token="REPL_DSTAMP" value="${DSTAMP}"/>
|
||||
<filter token="REPL_TSTAMP" value="${TSTAMP}"/>
|
||||
|
||||
<!-- release file names -->
|
||||
<property name="stdReleaseStub" value="yacy_v${releaseVersion}_${repository.revision.date}${repository.revision.time}_${repository.revision.hash}"/>
|
||||
<property name="stdReleaseFile" value="${stdReleaseStub}.tar.gz"/>
|
||||
<filter token="REPL_RELEASESTUB" value="${stdReleaseStub}"/>
|
||||
|
||||
<!-- apply replacments -->
|
||||
<copy file="${defaults}/yacyBuild.properties.template" tofile="${defaults}/yacyBuild.properties" overwrite="true" filtering="true" />
|
||||
@@ -518,8 +527,8 @@
|
||||
<arg value="-NOCD" />
|
||||
<arg value="${release_windows}/build.nsi" />
|
||||
</exec>
|
||||
<move file="${release_windows}/yacy_v${releaseVersion}_${releaseNr}.exe"
|
||||
tofile="${release}/yacy_v${releaseVersion}_${releaseNr}.exe" />
|
||||
<move file="${release_windows}/${stdReleaseStub}.exe"
|
||||
tofile="${release}/${stdReleaseStub}.exe" />
|
||||
|
||||
<delete dir="${release_main}"/>
|
||||
<delete dir="${release_windows}" failonerror="false" />
|
||||
@@ -535,7 +544,7 @@
|
||||
<chmod file="${release_mac}/YaCy.app/Contents/MacOS/startYACYMacOS.sh" perm="755"/>
|
||||
<chmod file="${release_mac}/YaCy.app/Contents/MacOS/startYACY.sh" perm="755"/>
|
||||
<exec executable="hdiutil">
|
||||
<arg line="create -srcfolder ${release_mac}/YaCy.app ${release}/yacy_v${releaseVersion}_${releaseNr}.dmg"/>
|
||||
<arg line="create -srcfolder ${release_mac}/YaCy.app ${release}/${stdReleaseStub}.dmg"/>
|
||||
</exec>
|
||||
<delete dir="${release_mac}" failonerror="false" verbose="false" />
|
||||
</target>
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
SVNRevision = @REPL_REVISION_NR@
|
||||
Version = @REPL_VERSION@
|
||||
RepositoryVersion = @REPL_REPVER@
|
||||
RepositoryVersionDate = @REPL_REPVERDATE@
|
||||
RepositoryVersionTime = @REPL_REPVERTIME@
|
||||
RepositoryVersionHash = @REPL_REPVERHASH@
|
||||
ReleaseStub = @REPL_RELEASESTUB@
|
||||
dstamp = @REPL_DSTAMP@
|
||||
tstamp = @REPL_TSTAMP@
|
||||
@@ -1,6 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<version>
|
||||
<number>#[versionstring]#</number>
|
||||
<svnRevision>#[svnRev]#</svnRevision>
|
||||
<buildDate>19700101</buildDate>
|
||||
<file>#[versionstring]#</file>
|
||||
<buildDate>#[buildDate]#</buildDate>
|
||||
<buildTime>#[buildTime]#</buildTime>
|
||||
<buildDateTime>#[buildDateTime]#</buildDateTime>
|
||||
<buildHash>#[buildDateTime]#</buildHash>
|
||||
<buildVersion>#[buildVersion]#</buildVersion>
|
||||
</version>
|
||||
@@ -78,26 +78,26 @@ public class ConfigUpdate_p {
|
||||
final String release = post.get("releasedownload", "");
|
||||
if (!release.isEmpty()) {
|
||||
try {
|
||||
yacyRelease versionToDownload = new yacyRelease(new DigestURL(release));
|
||||
yacyRelease versionToDownload = new yacyRelease(new DigestURL(release));
|
||||
|
||||
// replace this version with version which contains public key
|
||||
final yacyRelease.DevAndMainVersions allReleases = yacyRelease.allReleases(false, false);
|
||||
final Set<yacyRelease> mostReleases = versionToDownload.isMainRelease() ? allReleases.main : allReleases.dev;
|
||||
for (final yacyRelease rel : mostReleases) {
|
||||
if (rel.equals(versionToDownload)) {
|
||||
versionToDownload = rel;
|
||||
break;
|
||||
}
|
||||
}
|
||||
final File downloadedRelease = versionToDownload.downloadRelease();
|
||||
if(downloadedRelease == null) {
|
||||
prop.put("candeploy_downloadError", "1");
|
||||
prop.putHTML("candeploy_downloadError_releasedownload", release);
|
||||
}
|
||||
// replace this version with version which contains public key
|
||||
final yacyRelease.DevAndMainVersions allReleases = yacyRelease.allReleases(false, false);
|
||||
final Set<yacyRelease> mostReleases = versionToDownload.isMainRelease() ? allReleases.main : allReleases.dev;
|
||||
for (final yacyRelease rel : mostReleases) {
|
||||
if (rel.equals(versionToDownload)) {
|
||||
versionToDownload = rel;
|
||||
break;
|
||||
}
|
||||
}
|
||||
final File downloadedRelease = versionToDownload.downloadRelease();
|
||||
if(downloadedRelease == null) {
|
||||
prop.put("candeploy_downloadError", "1");
|
||||
prop.putHTML("candeploy_downloadError_releasedownload", release);
|
||||
}
|
||||
} catch (final IOException e) {
|
||||
ConcurrentLog.logException(e);
|
||||
prop.put("candeploy_downloadError", "1");
|
||||
prop.putHTML("candeploy_downloadError_releasedownload", release);
|
||||
ConcurrentLog.logException(e);
|
||||
prop.put("candeploy_downloadError", "1");
|
||||
prop.putHTML("candeploy_downloadError_releasedownload", release);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,8 +112,8 @@ public class ConfigUpdate_p {
|
||||
try {
|
||||
// only delete files from RELEASE directory
|
||||
if (FileUtils.isInDirectory(new File(sb.releasePath, release), sb.releasePath)) {
|
||||
FileUtils.deletedelete(new File(sb.releasePath, release));
|
||||
FileUtils.deletedelete(new File(sb.releasePath, release + ".sig"));
|
||||
FileUtils.deletedelete(new File(sb.releasePath, release));
|
||||
FileUtils.deletedelete(new File(sb.releasePath, release + ".sig"));
|
||||
} else {
|
||||
sb.getLog().severe("AUTO-UPDATE: could not delete " + release + ": file not in release directory.");
|
||||
}
|
||||
@@ -141,9 +141,9 @@ public class ConfigUpdate_p {
|
||||
prop.put("candeploy_autoUpdate", "4");
|
||||
} else {
|
||||
if(yacyRelease.deployRelease(downloaded)) {
|
||||
sb.terminate(10, "manual release update to " + downloaded.getName());
|
||||
sb.getLog().info("AUTO-UPDATE: deploy and restart initiated");
|
||||
prop.put("candeploy_autoUpdate", "1");
|
||||
sb.terminate(10, "manual release update to " + downloaded.getName());
|
||||
sb.getLog().info("AUTO-UPDATE: deploy and restart initiated");
|
||||
prop.put("candeploy_autoUpdate", "1");
|
||||
} else {
|
||||
sb.getLog().info("AUTO-UPDATE: omitting update because an error occurred while trying to deploy the release..");
|
||||
prop.put("candeploy_autoUpdate", "5");
|
||||
@@ -163,7 +163,7 @@ public class ConfigUpdate_p {
|
||||
}
|
||||
|
||||
// version information
|
||||
final String versionstring = yacyBuildProperties.getVersion() + "/" + yacyBuildProperties.getSVNRevision();
|
||||
final String versionstring = yacyBuildProperties.getReleaseStub();
|
||||
prop.putHTML("candeploy_versionpp", versionstring);
|
||||
final boolean devenvironment = new File(sb.getAppPath(), ".git").exists();
|
||||
float thisVersion = Float.parseFloat(yacyBuildProperties.getVersion());
|
||||
@@ -180,14 +180,14 @@ public class ConfigUpdate_p {
|
||||
|
||||
prop.put("candeploy_deployenabled", (downloadedFilesNum == 0) ? "0" : ((devenvironment) ? "1" : "2")); // prevent that a developer-version is over-deployed
|
||||
|
||||
final NavigableSet<yacyRelease> downloadedReleases = new TreeSet<yacyRelease>();
|
||||
final NavigableSet<yacyRelease> downloadedReleases = new TreeSet<>();
|
||||
for (final File downloaded : downloadedFiles) {
|
||||
try {
|
||||
final yacyRelease release = new yacyRelease(downloaded);
|
||||
downloadedReleases.add(release);
|
||||
} catch (final RuntimeException e) {
|
||||
// not a valid release
|
||||
// can be also a restart- or deploy-file
|
||||
// can be also a restart- or deploy-file
|
||||
final File invalid = downloaded;
|
||||
if (!(invalid.getName().endsWith(".bat") || invalid.getName().endsWith(".sh") || invalid.getName().endsWith(".sig"))) { // Windows & Linux don't like deleted scripts while execution!
|
||||
invalid.deleteOnExit();
|
||||
@@ -216,7 +216,7 @@ public class ConfigUpdate_p {
|
||||
final yacyRelease.DevAndMainVersions releasess = yacyRelease.allReleases(false, false);
|
||||
relcount = 0;
|
||||
|
||||
final ArrayList<yacyRelease> rlist = new ArrayList<yacyRelease>();
|
||||
final ArrayList<yacyRelease> rlist = new ArrayList<>();
|
||||
final Set<yacyRelease> remoteDevReleases = releasess.dev;
|
||||
remoteDevReleases.removeAll(downloadedReleases);
|
||||
for (final yacyRelease release : remoteDevReleases) {
|
||||
|
||||
@@ -58,9 +58,9 @@ public class Status
|
||||
private static final String PEERSTATUS = "peerStatus";
|
||||
|
||||
public static serverObjects respond(
|
||||
final RequestHeader header,
|
||||
final serverObjects post,
|
||||
final serverSwitch env) {
|
||||
final RequestHeader header,
|
||||
final serverObjects post,
|
||||
final serverSwitch env) {
|
||||
// return variable that accumulates replacements
|
||||
final serverObjects prop = new serverObjects();
|
||||
final Switchboard sb = (Switchboard) env;
|
||||
@@ -77,7 +77,7 @@ public class Status
|
||||
|
||||
if ( post != null && !post.isEmpty() ) {
|
||||
if ( sb.adminAuthenticated(header) < 2 ) {
|
||||
prop.authenticationRequired();
|
||||
prop.authenticationRequired();
|
||||
return prop;
|
||||
}
|
||||
boolean redirect = false;
|
||||
@@ -133,7 +133,7 @@ public class Status
|
||||
|
||||
// password protection
|
||||
if ( (sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, "").isEmpty())
|
||||
&& (!sb.getConfigBool(SwitchboardConstants.ADMIN_ACCOUNT_FOR_LOCALHOST, false)) ) {
|
||||
&& (!sb.getConfigBool(SwitchboardConstants.ADMIN_ACCOUNT_FOR_LOCALHOST, false)) ) {
|
||||
prop.put("protection", "0"); // not protected
|
||||
prop.put("urgentSetPassword", "1");
|
||||
} else {
|
||||
@@ -143,8 +143,8 @@ public class Status
|
||||
if ( sb.getConfigBool(SwitchboardConstants.ADMIN_ACCOUNT_FOR_LOCALHOST, false) ) {
|
||||
prop.put("unrestrictedLocalAccess", 1);
|
||||
if(sb.getConfig(SwitchboardConstants.SERVER_SERVLETS_CALLED, "").indexOf("ConfigAccounts_p.html", 0) < 0) {
|
||||
/* Encourage checking accounts config page to be sure that unrestricted local access is desired */
|
||||
prop.put("warningUnrestrictedLocalAccess", true);
|
||||
/* Encourage checking accounts config page to be sure that unrestricted local access is desired */
|
||||
prop.put("warningUnrestrictedLocalAccess", true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ public class Status
|
||||
}
|
||||
if ( !sb.observer.getMemoryAvailable() ) {
|
||||
final String minFree =
|
||||
Formatter.bytesToString(sb.observer.getMinFreeMemory() * 1024L * 1024L);
|
||||
Formatter.bytesToString(sb.observer.getMinFreeMemory() * 1024L * 1024L);
|
||||
prop.put("warningMemoryLow", "1");
|
||||
prop.put("warningMemoryLow_minSpace", minFree);
|
||||
}
|
||||
@@ -166,7 +166,7 @@ public class Status
|
||||
|
||||
// version information
|
||||
//final String versionstring = yacyVersion.combined2prettyVersion(sb.getConfig("version","0.1"));
|
||||
final String versionstring = yacyBuildProperties.getVersion() + "/" + yacyBuildProperties.getSVNRevision();
|
||||
final String versionstring = yacyBuildProperties.getReleaseStub();
|
||||
prop.put("versionpp", versionstring);
|
||||
prop.put("java.version", System.getProperty("java.version"));
|
||||
|
||||
@@ -239,18 +239,18 @@ public class Status
|
||||
}
|
||||
}
|
||||
final String peerStatus =
|
||||
((sb.peers.mySeed() == null) ? Seed.PEERTYPE_VIRGIN : sb.peers.mySeed().get(
|
||||
Seed.PEERTYPE,
|
||||
Seed.PEERTYPE_VIRGIN));
|
||||
((sb.peers.mySeed() == null) ? Seed.PEERTYPE_VIRGIN : sb.peers.mySeed().get(
|
||||
Seed.PEERTYPE,
|
||||
Seed.PEERTYPE_VIRGIN));
|
||||
|
||||
if ( Seed.PEERTYPE_VIRGIN.equals(peerStatus)
|
||||
&& "freeworld".equals(sb.getConfig(SwitchboardConstants.NETWORK_NAME, ""))
|
||||
&& !SwitchboardConstants.CLUSTER_MODE_PRIVATE_PEER.equals(sb.getConfig(SwitchboardConstants.CLUSTER_MODE, ""))) {
|
||||
&& "freeworld".equals(sb.getConfig(SwitchboardConstants.NETWORK_NAME, ""))
|
||||
&& !SwitchboardConstants.CLUSTER_MODE_PRIVATE_PEER.equals(sb.getConfig(SwitchboardConstants.CLUSTER_MODE, ""))) {
|
||||
prop.put(PEERSTATUS, "0");
|
||||
prop.put("urgentStatusVirgin", "1");
|
||||
} else if ( Seed.PEERTYPE_JUNIOR.equals(peerStatus)
|
||||
&& "freeworld".equals(sb.getConfig(SwitchboardConstants.NETWORK_NAME, ""))
|
||||
&& !SwitchboardConstants.CLUSTER_MODE_PRIVATE_PEER.equals(sb.getConfig(SwitchboardConstants.CLUSTER_MODE, ""))) {
|
||||
&& "freeworld".equals(sb.getConfig(SwitchboardConstants.NETWORK_NAME, ""))
|
||||
&& !SwitchboardConstants.CLUSTER_MODE_PRIVATE_PEER.equals(sb.getConfig(SwitchboardConstants.CLUSTER_MODE, ""))) {
|
||||
prop.put(PEERSTATUS, "1");
|
||||
prop.put("warningStatusJunior", "1");
|
||||
} else if ( Seed.PEERTYPE_SENIOR.equals(peerStatus) ) {
|
||||
@@ -266,9 +266,9 @@ public class Status
|
||||
|
||||
final String seedUploadMethod = sb.getConfig("seedUploadMethod", "");
|
||||
if ( !"none".equalsIgnoreCase(seedUploadMethod)
|
||||
|| ("".equals(seedUploadMethod) && (sb.getConfig("seedFTPPassword", "").length() > 0 || sb
|
||||
.getConfig("seedFilePath", "")
|
||||
.length() > 0)) ) {
|
||||
|| ("".equals(seedUploadMethod) && (sb.getConfig("seedFTPPassword", "").length() > 0 || sb
|
||||
.getConfig("seedFilePath", "")
|
||||
.length() > 0)) ) {
|
||||
if ( "".equals(seedUploadMethod) ) {
|
||||
if ( sb.getConfig("seedFTPPassword", "").length() > 0 ) {
|
||||
sb.setConfig("seedUploadMethod", "Ftp");
|
||||
@@ -289,8 +289,8 @@ public class Status
|
||||
prop.putHTML("seedServer_seedFile", sb.getConfig("seedFilePath", ""));
|
||||
}
|
||||
prop.put(
|
||||
"seedServer_lastUpload",
|
||||
PeerActions.formatInterval(System.currentTimeMillis() - sb.peers.lastSeedUpload_timeStamp));
|
||||
"seedServer_lastUpload",
|
||||
PeerActions.formatInterval(System.currentTimeMillis() - sb.peers.lastSeedUpload_timeStamp));
|
||||
} else {
|
||||
prop.put(SEEDSERVER, "0"); // disabled
|
||||
}
|
||||
@@ -347,18 +347,18 @@ public class Status
|
||||
prop.put("loaderQueuePercent", (loaderPercent > 100) ? 100 : loaderPercent);
|
||||
|
||||
prop.putNum("localCrawlQueueSize", sb
|
||||
.getThread(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL)
|
||||
.getJobCount());
|
||||
.getThread(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL)
|
||||
.getJobCount());
|
||||
prop.put("localCrawlPaused", sb.crawlJobIsPaused(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL)
|
||||
? "1"
|
||||
: "0");
|
||||
? "1"
|
||||
: "0");
|
||||
|
||||
prop.putNum(
|
||||
"remoteTriggeredCrawlQueueSize",
|
||||
sb.getThread(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL) != null ? sb.getThread(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL).getJobCount() : 0);
|
||||
"remoteTriggeredCrawlQueueSize",
|
||||
sb.getThread(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL) != null ? sb.getThread(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL).getJobCount() : 0);
|
||||
prop.put(
|
||||
"remoteTriggeredCrawlPaused",
|
||||
sb.crawlJobIsPaused(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL) ? "1" : "0");
|
||||
"remoteTriggeredCrawlPaused",
|
||||
sb.crawlJobIsPaused(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL) ? "1" : "0");
|
||||
|
||||
prop.putNum("stackCrawlQueueSize", sb.crawlStacker.size());
|
||||
|
||||
|
||||
@@ -12,9 +12,12 @@ public class version {
|
||||
public static serverObjects respond(@SuppressWarnings("unused") final RequestHeader header, @SuppressWarnings("unused") final serverObjects post, @SuppressWarnings("unused") final serverSwitch env) {
|
||||
// return variable that accumulates replacements
|
||||
final serverObjects prop = new serverObjects();
|
||||
|
||||
prop.put("versionstring", yacyBuildProperties.getLongVersion());
|
||||
prop.put("svnRev", yacyBuildProperties.getSVNRevision());
|
||||
prop.put("versionstring", yacyBuildProperties.getReleaseStub());
|
||||
prop.put("buildDate", yacyBuildProperties.getRepositoryVersionDate());
|
||||
prop.put("buildTime", yacyBuildProperties.getRepositoryVersionTime());
|
||||
prop.put("buildDateTime", yacyBuildProperties.getRepositoryVersionDate() + yacyBuildProperties.getRepositoryVersionTime());
|
||||
prop.put("buildHash", yacyBuildProperties.getRepositoryVersionHash());
|
||||
prop.put("buildVersion", yacyBuildProperties.getVersion());
|
||||
|
||||
// return rewrite properties
|
||||
return prop;
|
||||
|
||||
@@ -57,8 +57,8 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
|
||||
private static final Pattern multiDumpFilterPattern = Pattern.compile(multiDumpFilter);
|
||||
|
||||
public static class StackTrace {
|
||||
private String text;
|
||||
private Thread.State state;
|
||||
private final String text;
|
||||
private final Thread.State state;
|
||||
public StackTrace(final String text, final Thread.State state) {
|
||||
this.state = state;
|
||||
this.text = text;
|
||||
@@ -81,7 +81,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
|
||||
}
|
||||
|
||||
public static class Lock {
|
||||
private String id;
|
||||
private final String id;
|
||||
public Lock(final String name) {
|
||||
this.id = name;
|
||||
}
|
||||
@@ -122,7 +122,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
|
||||
|
||||
/**
|
||||
* Try to get the thread dump from a yacy.log file which is available when YaCy is started with
|
||||
* startYACY.sh -l
|
||||
* startYACY.sh -l
|
||||
* @param logFile the log file to read
|
||||
* @throws IOException when a read/write error occurred
|
||||
*/
|
||||
@@ -145,10 +145,10 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
|
||||
if (sizeAfter <= sizeBefore) return;
|
||||
|
||||
try(final RandomAccessFile raf = new RandomAccessFile(logFile, "r");) {
|
||||
raf.seek(sizeBefore);
|
||||
final byte[] b = new byte[(int) (sizeAfter - sizeBefore)];
|
||||
raf.readFully(b);
|
||||
|
||||
raf.seek(sizeBefore);
|
||||
final byte[] b = new byte[(int) (sizeAfter - sizeBefore)];
|
||||
raf.readFully(b);
|
||||
|
||||
// import the thread dump;
|
||||
importText(new ByteArrayInputStream(b));
|
||||
}
|
||||
@@ -179,7 +179,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
|
||||
String line;
|
||||
String thread = null;
|
||||
int p;
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<String> list = new ArrayList<>();
|
||||
Thread.State state = null;
|
||||
Thread.State state0;
|
||||
while ((line = br.readLine()) != null) {
|
||||
@@ -189,7 +189,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
|
||||
if (thread != null) {
|
||||
put(new ThreadDump.StackTrace(thread, state), list);
|
||||
}
|
||||
list = new ArrayList<String>();
|
||||
list = new ArrayList<>();
|
||||
thread = null;
|
||||
state = null;
|
||||
continue;
|
||||
@@ -262,7 +262,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
|
||||
final String threaddump = sb.toString();
|
||||
@SuppressWarnings("unlikely-arg-type")
|
||||
List<String> threads = get(threaddump);
|
||||
if (threads == null) threads = new ArrayList<String>();
|
||||
if (threads == null) threads = new ArrayList<>();
|
||||
Thread.State state = null;
|
||||
for (final String t: threads) {
|
||||
final int p = t.indexOf(statestatement);
|
||||
@@ -303,8 +303,8 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
|
||||
for (int i = size() + 10; i > 0; i--) {
|
||||
for (final Map.Entry<StackTrace, Integer> entry: locks.entrySet()) {
|
||||
if (entry.getValue().intValue() == i) {
|
||||
bufferappend(buffer, plain, "holds lock for " + i + " threads:");
|
||||
final List<String> list = get(entry.getKey());
|
||||
bufferappend(buffer, plain, "holds lock for " + i + " threads:");
|
||||
final List<String> list = get(entry.getKey());
|
||||
if (list == null) continue;
|
||||
bufferappend(buffer, plain, "Thread= " + entry.getKey());
|
||||
for (final String s: list) bufferappend(buffer, plain, " " + (plain ? s : s.replaceAll("<", "<").replaceAll(">", ">")));
|
||||
@@ -323,7 +323,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
|
||||
final boolean plain) {
|
||||
|
||||
// collect single dumps
|
||||
final Map<String, Integer> dumps = new HashMap<String, Integer>();
|
||||
final Map<String, Integer> dumps = new HashMap<>();
|
||||
ThreadDump x;
|
||||
for (final Map<Thread, StackTraceElement[]> trace: stackTraces) {
|
||||
x = new ThreadDump(rootPath, trace, plain, Thread.State.RUNNABLE);
|
||||
@@ -384,7 +384,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
|
||||
|
||||
|
||||
public List<Map.Entry<StackTrace, List<String>>> freerun() {
|
||||
final List<Map.Entry<StackTrace, List<String>>> runner = new ArrayList<Map.Entry<StackTrace, List<String>>>();
|
||||
final List<Map.Entry<StackTrace, List<String>>> runner = new ArrayList<>();
|
||||
runf: for (final Map.Entry<StackTrace, List<String>> entry: entrySet()) {
|
||||
// check if the thread is locked or holds a lock
|
||||
if (entry.getKey().state != Thread.State.RUNNABLE) continue runf;
|
||||
@@ -402,7 +402,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
|
||||
*/
|
||||
public Map<Lock, StackTrace> locks() {
|
||||
int p;
|
||||
final Map<Lock, StackTrace> locks = new HashMap<Lock, StackTrace>();
|
||||
final Map<Lock, StackTrace> locks = new HashMap<>();
|
||||
for (final Map.Entry<StackTrace, List<String>> entry: entrySet()) {
|
||||
for (final String s: entry.getValue()) {
|
||||
if ((p = s.indexOf("locked <",0)) > 0) {
|
||||
@@ -433,7 +433,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
|
||||
|
||||
public Map<StackTrace, Integer> countLocks() {
|
||||
final Map<Lock, StackTrace> locks = locks();
|
||||
final Map<StackTrace, Integer> count = new HashMap<StackTrace, Integer>();
|
||||
final Map<StackTrace, Integer> count = new HashMap<>();
|
||||
for (final Map.Entry<Lock, StackTrace> entry: locks.entrySet()) {
|
||||
// look where the lock has an effect
|
||||
int c = 0;
|
||||
@@ -461,8 +461,8 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
|
||||
if (sleep > 0) try {Thread.sleep(sleep);} catch (final InterruptedException e) {}
|
||||
// Thread dump
|
||||
final Date dt = new Date();
|
||||
final String versionstring = yacyBuildProperties.getVersion() + "/" + yacyBuildProperties.getSVNRevision();
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
final String versionstring = yacyBuildProperties.getReleaseStub();
|
||||
final Runtime runtime = Runtime.getRuntime();
|
||||
|
||||
ThreadDump.bufferappend(buffer, plain, "************* Start Thread Dump " + dt + " *******************");
|
||||
ThreadDump.bufferappend(buffer, plain, " ");
|
||||
@@ -473,9 +473,9 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
|
||||
ThreadDump.bufferappend(buffer, plain, " ");
|
||||
ThreadDump.bufferappend(buffer, plain, " ");
|
||||
|
||||
File appPath = sb.getAppPath();
|
||||
final File appPath = sb.getAppPath();
|
||||
if (multiple) {
|
||||
final ArrayList<Map<Thread,StackTraceElement[]>> traces = new ArrayList<Map<Thread,StackTraceElement[]>>();
|
||||
final ArrayList<Map<Thread,StackTraceElement[]>> traces = new ArrayList<>();
|
||||
for (int i = 0; i < multipleCount; i++) {
|
||||
try {
|
||||
traces.add(ThreadDump.getAllStackTraces());
|
||||
@@ -486,7 +486,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
|
||||
ThreadDump.appendStackTraceStats(appPath, buffer, traces, plain);
|
||||
} else {
|
||||
// write a thread dump to standard error output
|
||||
File logFile = new File("yacy.log");
|
||||
final File logFile = new File("yacy.log");
|
||||
if (ThreadDump.canProduceLockedBy(logFile)) {
|
||||
try {
|
||||
new ThreadDump(logFile).appendBlockTraces(buffer, plain);
|
||||
@@ -511,10 +511,10 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
|
||||
ThreadDump.bufferappend(buffer, plain, "************* End Thread Dump " + dt + " *******************");
|
||||
|
||||
ThreadDump.bufferappend(buffer, plain, "");
|
||||
ThreadMXBean threadbean = ManagementFactory.getThreadMXBean();
|
||||
final ThreadMXBean threadbean = ManagementFactory.getThreadMXBean();
|
||||
ThreadDump.bufferappend(buffer, plain, "Thread list from ThreadMXBean, " + threadbean.getThreadCount() + " threads:");
|
||||
ThreadInfo[] threadinfo = threadbean.dumpAllThreads(true, true);
|
||||
for (ThreadInfo ti: threadinfo) {
|
||||
final ThreadInfo[] threadinfo = threadbean.dumpAllThreads(true, true);
|
||||
for (final ThreadInfo ti: threadinfo) {
|
||||
ThreadDump.bufferappend(buffer, plain, ti.getThreadName());
|
||||
}
|
||||
|
||||
|
||||
@@ -2,39 +2,51 @@ package net.yacy.peers.operation;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
public final class yacyBuildProperties {
|
||||
|
||||
|
||||
private static Properties props = new Properties();
|
||||
|
||||
|
||||
static {
|
||||
try {
|
||||
props.load(new FileInputStream("defaults/yacyBuild.properties"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
props = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getSVNRevision() {
|
||||
if (props == null) return "0";
|
||||
final String revision = props.getProperty("SVNRevision");
|
||||
return revision.contains("@") || revision.contains("$") ? "0" : revision;
|
||||
}
|
||||
|
||||
public static String getVersion() {
|
||||
if (props == null) return "0.1";
|
||||
final String version = props.getProperty("Version");
|
||||
return version.contains("@") ? "0.1" : version;
|
||||
return props.getProperty("Version", "0.1");
|
||||
}
|
||||
|
||||
public static final Pattern versionMatcher = Pattern.compile("\\A(\\d+\\.\\d{1,3})(\\d{0,5})\\z");
|
||||
|
||||
public static String getLongVersion() {
|
||||
return String.format(Locale.US, "%.3f%05d", Float.valueOf(getVersion()), Integer.valueOf(getSVNRevision()));
|
||||
public static String getRepositoryVersionDate() {
|
||||
return props.getProperty("RepositoryVersionDate", "20220101");
|
||||
}
|
||||
|
||||
public static String getRepositoryVersionTime() {
|
||||
return props.getProperty("RepositoryVersionTime", "0000");
|
||||
}
|
||||
|
||||
public static String getRepositoryVersionHash() {
|
||||
return props.getProperty("RepositoryVersionHash", "0");
|
||||
}
|
||||
|
||||
public static String getReleaseStub() {
|
||||
return props.getProperty("ReleaseStub", "yacy_v0.1_202201010000_000000000");
|
||||
}
|
||||
|
||||
public static String getDstamp() {
|
||||
return props.getProperty("dstamp", "20220101");
|
||||
}
|
||||
|
||||
public static String getTstamp() {
|
||||
return props.getProperty("tstamp", "0000");
|
||||
}
|
||||
|
||||
public static final Pattern versionMatcher = Pattern.compile("\\A(\\d+\\.\\d{1,3})(\\d{0,5})\\z");
|
||||
|
||||
}
|
||||
@@ -79,10 +79,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
|
||||
if (thisVersion == null) {
|
||||
final Switchboard sb = Switchboard.getSwitchboard();
|
||||
if (sb == null) return null;
|
||||
thisVersion = new yacyVersion(
|
||||
"yacy" +
|
||||
"_v" + yacyBuildProperties.getVersion() + "_" +
|
||||
yacyBuildProperties.getSVNRevision() + ".tar.gz", null);
|
||||
thisVersion = new yacyVersion(yacyBuildProperties.getReleaseStub() + ".tar.gz", null);
|
||||
}
|
||||
return thisVersion;
|
||||
}
|
||||
@@ -134,17 +131,17 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
|
||||
* "dev/00000" - If the input does not matcht the regular expression above
|
||||
*/
|
||||
public static String[] combined2prettyVersion(final String ver) {
|
||||
return combined2prettyVersion(ver, "");
|
||||
}
|
||||
return combined2prettyVersion(ver, "");
|
||||
}
|
||||
|
||||
public static String[] combined2prettyVersion(final String ver, final String computerName) {
|
||||
final Matcher matcher = yacyBuildProperties.versionMatcher.matcher(ver);
|
||||
if (!matcher.find()) {
|
||||
ConcurrentLog.warn("STARTUP", "Peer '"+computerName+"': wrong format of version-string: '" + ver + "'. Using default string 'dev/00000' instead");
|
||||
return new String[]{"dev", "0000"};
|
||||
}
|
||||
if (!matcher.find()) {
|
||||
ConcurrentLog.warn("STARTUP", "Peer '"+computerName+"': wrong format of version-string: '" + ver + "'. Using default string 'dev/00000' instead");
|
||||
return new String[]{"dev", "0000"};
|
||||
}
|
||||
|
||||
final String mainversion = (Double.parseDouble(matcher.group(1)) < 0.11 ? "dev" : matcher.group(1));
|
||||
final String mainversion = (Double.parseDouble(matcher.group(1)) < 0.11 ? "dev" : matcher.group(1));
|
||||
String revision = matcher.group(2);
|
||||
for(int i=revision.length();i<4;++i) revision += "0";
|
||||
return new String[]{mainversion, revision};
|
||||
@@ -166,7 +163,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
|
||||
*/
|
||||
public static double versvn2combinedVersion(final double version, final int svn) {
|
||||
return (Math.rint((version*100000000.0) + (svn))/100000000);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamp of this version
|
||||
|
||||
@@ -4497,7 +4497,7 @@ public final class Switchboard extends serverSwitch {
|
||||
mySeed.put(Seed.ICOUNT, Long.toString(this.index.RWICount())); // the minimum number of words that the peer has indexed (as it says)
|
||||
mySeed.put(Seed.SCOUNT, Integer.toString(this.peers.sizeConnected())); // the number of seeds that the peer has stored
|
||||
mySeed.put(Seed.CCOUNT, Float.toString(((int) ((this.peers.sizeConnected() + this.peers.sizeDisconnected() + this.peers.sizePotential()) * 60.0f / (uptime + 1.01f)) * 100.0f) / 100.0f)); // the number of clients that the peer connects (as connects/hour)
|
||||
mySeed.put(Seed.VERSION, yacyBuildProperties.getLongVersion());
|
||||
mySeed.put(Seed.VERSION, yacyBuildProperties.getReleaseStub());
|
||||
mySeed.setFlagDirectConnect(true);
|
||||
mySeed.setLastSeenUTC();
|
||||
mySeed.put(Seed.UTC, GenericFormatter.UTCDiffString());
|
||||
|
||||
+114
-114
@@ -84,40 +84,40 @@ import net.yacy.utils.translation.TranslatorXliff;
|
||||
|
||||
|
||||
/**
|
||||
* This is the main class of YaCy. Several threads are started from here:
|
||||
* <ul>
|
||||
* <li>one single instance of the plasmaSwitchboard is generated, which itself
|
||||
* starts a thread with a plasmaHTMLCache object. This object simply counts
|
||||
* files sizes in the cache and terminates them. It also generates a
|
||||
* plasmaCrawlerLoader object, which may itself start some more httpc-calling
|
||||
* threads to load web pages. They terminate automatically when a page has
|
||||
* loaded.
|
||||
* <li>one serverCore - thread is started, which implements a multi-threaded
|
||||
* server. The process may start itself many more processes that handle
|
||||
* connections.lo
|
||||
* <li>finally, all idle-dependent processes are written in a queue in
|
||||
* plasmaSwitchboard which are worked off inside an idle-sensitive loop of the
|
||||
* main process. (here)
|
||||
* </ul>
|
||||
*
|
||||
* On termination, the following must be done:
|
||||
* <ul>
|
||||
* <li>stop feeding of the crawling process because it otherwise fills the
|
||||
* indexing queue.
|
||||
* <li>say goodbye to connected peers and disable new connections. Don't wait for
|
||||
* success.
|
||||
* <li>first terminate the serverCore thread. This prevents that new cache
|
||||
* objects are queued.
|
||||
* <li>wait that the plasmaHTMLCache terminates (it should be normal that this
|
||||
* process already has terminated).
|
||||
* <li>then wait for termination of all loader process of the
|
||||
* plasmaCrawlerLoader.
|
||||
* <li>work off the indexing and cache storage queue. These values are inside a
|
||||
* RAM cache and would be lost otherwise.
|
||||
* <li>write all settings.
|
||||
* <li>terminate.
|
||||
* </ul>
|
||||
*/
|
||||
* This is the main class of YaCy. Several threads are started from here:
|
||||
* <ul>
|
||||
* <li>one single instance of the plasmaSwitchboard is generated, which itself
|
||||
* starts a thread with a plasmaHTMLCache object. This object simply counts
|
||||
* files sizes in the cache and terminates them. It also generates a
|
||||
* plasmaCrawlerLoader object, which may itself start some more httpc-calling
|
||||
* threads to load web pages. They terminate automatically when a page has
|
||||
* loaded.
|
||||
* <li>one serverCore - thread is started, which implements a multi-threaded
|
||||
* server. The process may start itself many more processes that handle
|
||||
* connections.lo
|
||||
* <li>finally, all idle-dependent processes are written in a queue in
|
||||
* plasmaSwitchboard which are worked off inside an idle-sensitive loop of the
|
||||
* main process. (here)
|
||||
* </ul>
|
||||
*
|
||||
* On termination, the following must be done:
|
||||
* <ul>
|
||||
* <li>stop feeding of the crawling process because it otherwise fills the
|
||||
* indexing queue.
|
||||
* <li>say goodbye to connected peers and disable new connections. Don't wait for
|
||||
* success.
|
||||
* <li>first terminate the serverCore thread. This prevents that new cache
|
||||
* objects are queued.
|
||||
* <li>wait that the plasmaHTMLCache terminates (it should be normal that this
|
||||
* process already has terminated).
|
||||
* <li>then wait for termination of all loader process of the
|
||||
* plasmaCrawlerLoader.
|
||||
* <li>work off the indexing and cache storage queue. These values are inside a
|
||||
* RAM cache and would be lost otherwise.
|
||||
* <li>write all settings.
|
||||
* <li>terminate.
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
public final class yacy {
|
||||
|
||||
@@ -139,12 +139,12 @@ public final class yacy {
|
||||
private static Switchboard sb = null;
|
||||
|
||||
/**
|
||||
* Starts up the whole application. Sets up all datastructures and starts
|
||||
* the main threads.
|
||||
*
|
||||
* @param homePath Root-path where all information is to be found.
|
||||
* @param startupFree free memory at startup time, to be used later for statistics
|
||||
*/
|
||||
* Starts up the whole application. Sets up all datastructures and starts
|
||||
* the main threads.
|
||||
*
|
||||
* @param homePath Root-path where all information is to be found.
|
||||
* @param startupFree free memory at startup time, to be used later for statistics
|
||||
*/
|
||||
private static void startup(final File dataHome, final File appHome, final long startupMemFree, final long startupMemTotal, final boolean gui) {
|
||||
String tmpdir=null;
|
||||
try {
|
||||
@@ -185,7 +185,7 @@ public final class yacy {
|
||||
System.out.println("could not find logging properties in homePath=" + dataHome);
|
||||
ConcurrentLog.logException(e);
|
||||
}
|
||||
ConcurrentLog.config("STARTUP", "YaCy version: " + yacyBuildProperties.getVersion() + "/" + yacyBuildProperties.getSVNRevision());
|
||||
ConcurrentLog.config("STARTUP", "YaCy version: " + yacyBuildProperties.getReleaseStub());
|
||||
ConcurrentLog.config("STARTUP", "Java version: " + System.getProperty("java.version", "no-java-version"));
|
||||
ConcurrentLog.config("STARTUP", "Operation system: " + System.getProperty("os.name","unknown"));
|
||||
ConcurrentLog.config("STARTUP", "Application root-path: " + appHome);
|
||||
@@ -235,7 +235,7 @@ public final class yacy {
|
||||
if (oldRev > 1) {
|
||||
oldVer = Double.parseDouble(tmpversion) + oldRev / 100000000.0;
|
||||
} else {
|
||||
oldVer = Double.parseDouble(yacyBuildProperties.getLongVersion()); // failsafe (assume current version = no migration)
|
||||
oldVer = Double.parseDouble(yacyBuildProperties.getVersion()); // failsafe (assume current version = no migration)
|
||||
}
|
||||
} else {
|
||||
oldVer = Double.parseDouble(tmpversion);
|
||||
@@ -243,8 +243,8 @@ public final class yacy {
|
||||
} catch (final NumberFormatException e) {
|
||||
oldVer = 0.0d;
|
||||
}
|
||||
final double newRev = Double.parseDouble(yacyBuildProperties.getLongVersion());
|
||||
sb.setConfig(Seed.VERSION, yacyBuildProperties.getLongVersion());
|
||||
final double newRev = Double.parseDouble(yacyBuildProperties.getVersion());
|
||||
sb.setConfig(Seed.VERSION, yacyBuildProperties.getVersion());
|
||||
sb.setConfig("applicationRoot", appHome.toString());
|
||||
sb.setConfig("dataRoot", dataHome.toString());
|
||||
|
||||
@@ -262,16 +262,16 @@ public final class yacy {
|
||||
final File htdocsReadme = new File(htDocsPath, "readme.txt");
|
||||
if (!(htdocsReadme.exists())) try {FileUtils.copy((
|
||||
"This is your root directory for individual Web Content\r\n" +
|
||||
"\r\n" +
|
||||
"Please place your html files into the www subdirectory.\r\n" +
|
||||
"The URL of that path is either\r\n" +
|
||||
"http://www.<your-peer-name>.yacy or\r\n" +
|
||||
"http://<your-ip>:<your-port>/www\r\n" +
|
||||
"\r\n" +
|
||||
"Other subdirectories may be created; they map to corresponding sub-domains.\r\n" +
|
||||
"This directory shares it's content with the applications htroot path, so you\r\n" +
|
||||
"may access your yacy search page with\r\n" +
|
||||
"http://<your-peer-name>.yacy/\r\n" +
|
||||
"\r\n" +
|
||||
"Please place your html files into the www subdirectory.\r\n" +
|
||||
"The URL of that path is either\r\n" +
|
||||
"http://www.<your-peer-name>.yacy or\r\n" +
|
||||
"http://<your-ip>:<your-port>/www\r\n" +
|
||||
"\r\n" +
|
||||
"Other subdirectories may be created; they map to corresponding sub-domains.\r\n" +
|
||||
"This directory shares it's content with the applications htroot path, so you\r\n" +
|
||||
"may access your yacy search page with\r\n" +
|
||||
"http://<your-peer-name>.yacy/\r\n" +
|
||||
"\r\n").getBytes(), htdocsReadme);} catch (final IOException e) {
|
||||
System.out.println("Error creating htdocs readme: " + e.getMessage());
|
||||
}
|
||||
@@ -314,7 +314,7 @@ public final class yacy {
|
||||
Browser.openBrowser(("http://localhost:"+port) + "/" + browserPopUpPage);
|
||||
}
|
||||
}.start();
|
||||
// Browser.openBrowser((server.withSSL()?"https":"http") + "://localhost:" + serverCore.getPortNr(port) + "/" + browserPopUpPage);
|
||||
// Browser.openBrowser((server.withSSL()?"https":"http") + "://localhost:" + serverCore.getPortNr(port) + "/" + browserPopUpPage);
|
||||
} catch (final Throwable e) {
|
||||
// cannot open browser. This may be normal in headless environments
|
||||
//Log.logException(e);
|
||||
@@ -377,11 +377,11 @@ public final class yacy {
|
||||
|
||||
// save information about available memory after all initializations
|
||||
//try {
|
||||
sb.setConfig("memoryFreeAfterInitBGC", MemoryControl.free());
|
||||
sb.setConfig("memoryTotalAfterInitBGC", MemoryControl.total());
|
||||
System.gc();
|
||||
sb.setConfig("memoryFreeAfterInitAGC", MemoryControl.free());
|
||||
sb.setConfig("memoryTotalAfterInitAGC", MemoryControl.total());
|
||||
sb.setConfig("memoryFreeAfterInitBGC", MemoryControl.free());
|
||||
sb.setConfig("memoryTotalAfterInitBGC", MemoryControl.total());
|
||||
System.gc();
|
||||
sb.setConfig("memoryFreeAfterInitAGC", MemoryControl.free());
|
||||
sb.setConfig("memoryTotalAfterInitAGC", MemoryControl.total());
|
||||
//} catch (final ConcurrentModificationException e) {}
|
||||
|
||||
// wait for server shutdown
|
||||
@@ -446,15 +446,15 @@ public final class yacy {
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the configuration from the data-folder.
|
||||
* FIXME: Why is this called over and over again from every method, instead
|
||||
* of setting the configurationdata once for this class in main?
|
||||
*
|
||||
* @param mes Where are we called from, so that the errormessages can be
|
||||
* more descriptive.
|
||||
* @param homePath Root-path where all the information is to be found.
|
||||
* @return Properties read from the configurationfile.
|
||||
*/
|
||||
* Loads the configuration from the data-folder.
|
||||
* FIXME: Why is this called over and over again from every method, instead
|
||||
* of setting the configurationdata once for this class in main?
|
||||
*
|
||||
* @param mes Where are we called from, so that the errormessages can be
|
||||
* more descriptive.
|
||||
* @param homePath Root-path where all the information is to be found.
|
||||
* @return Properties read from the configurationfile.
|
||||
*/
|
||||
private static Properties configuration(final String mes, final File homePath) {
|
||||
ConcurrentLog.config(mes, "Application Root Path: " + homePath.toString());
|
||||
|
||||
@@ -490,11 +490,11 @@ public final class yacy {
|
||||
}
|
||||
|
||||
/**
|
||||
* Call the shutdown-page of YaCy to tell it to shut down. This method is
|
||||
* called if you start yacy with the argument -shutdown.
|
||||
*
|
||||
* @param homePath Root-path where all the information is to be found.
|
||||
*/
|
||||
* Call the shutdown-page of YaCy to tell it to shut down. This method is
|
||||
* called if you start yacy with the argument -shutdown.
|
||||
*
|
||||
* @param homePath Root-path where all the information is to be found.
|
||||
*/
|
||||
public static void shutdown(final File homePath) {
|
||||
// start up
|
||||
System.out.println(copyright);
|
||||
@@ -773,51 +773,51 @@ public final class yacy {
|
||||
// show yacy version
|
||||
System.out.println(copyright);
|
||||
} else if ((args.length > 1) && (args[0].toLowerCase(Locale.ROOT).equals("-config"))) {
|
||||
// set config parameter. Special handling of adminAccount=user:pwd (generates md5 encoded password)
|
||||
// on Windows parameter should be enclosed in doublequotes to accept = sign (e.g. -config "port=8090" "port.ssl=8043")
|
||||
final File f = new File (dataRoot,"DATA/SETTINGS/");
|
||||
if (!f.exists()) {
|
||||
mkdirsIfNeseccary(f);
|
||||
} else {
|
||||
if (new File(dataRoot, "DATA/yacy.running").exists()) {
|
||||
System.out.println("please restart YaCy");
|
||||
}
|
||||
// set config parameter. Special handling of adminAccount=user:pwd (generates md5 encoded password)
|
||||
// on Windows parameter should be enclosed in doublequotes to accept = sign (e.g. -config "port=8090" "port.ssl=8043")
|
||||
final File f = new File (dataRoot,"DATA/SETTINGS/");
|
||||
if (!f.exists()) {
|
||||
mkdirsIfNeseccary(f);
|
||||
} else {
|
||||
if (new File(dataRoot, "DATA/yacy.running").exists()) {
|
||||
System.out.println("please restart YaCy");
|
||||
}
|
||||
// use serverSwitch to read config properties (including init values from yacy.init
|
||||
final serverSwitch ss = new serverSwitch(dataRoot,applicationRoot,"defaults/yacy.init","DATA/SETTINGS/yacy.conf");
|
||||
}
|
||||
// use serverSwitch to read config properties (including init values from yacy.init
|
||||
final serverSwitch ss = new serverSwitch(dataRoot,applicationRoot,"defaults/yacy.init","DATA/SETTINGS/yacy.conf");
|
||||
|
||||
for (int icnt=1; icnt < args.length ; icnt++) {
|
||||
final String cfg = args[icnt];
|
||||
final int pos = cfg.indexOf('=');
|
||||
if (pos > 0) {
|
||||
final String cmd = cfg.substring(0, pos);
|
||||
final String val = cfg.substring(pos + 1);
|
||||
for (int icnt=1; icnt < args.length ; icnt++) {
|
||||
final String cfg = args[icnt];
|
||||
final int pos = cfg.indexOf('=');
|
||||
if (pos > 0) {
|
||||
final String cmd = cfg.substring(0, pos);
|
||||
final String val = cfg.substring(pos + 1);
|
||||
|
||||
if (!val.isEmpty()) {
|
||||
if (cmd.equalsIgnoreCase(SwitchboardConstants.ADMIN_ACCOUNT)) { // special command to set adminusername and md5-pwd
|
||||
final int cpos = val.indexOf(':'); //format adminAccount=adminname:adminpwd
|
||||
if (cpos >= 0) {
|
||||
String username = val.substring(0, cpos);
|
||||
final String pwdtxt = val.substring(cpos + 1);
|
||||
if (!username.isEmpty()) {
|
||||
ss.setConfig(SwitchboardConstants.ADMIN_ACCOUNT_USER_NAME, username);
|
||||
System.out.println("Set property " + SwitchboardConstants.ADMIN_ACCOUNT_USER_NAME + " = " + username);
|
||||
} else {
|
||||
username = ss.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_USER_NAME, "admin");
|
||||
}
|
||||
ss.setConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, sb.encodeDigestAuth(username, pwdtxt));
|
||||
System.out.println("Set property " + SwitchboardConstants.ADMIN_ACCOUNT_B64MD5 + " = " + ss.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, ""));
|
||||
if (!val.isEmpty()) {
|
||||
if (cmd.equalsIgnoreCase(SwitchboardConstants.ADMIN_ACCOUNT)) { // special command to set adminusername and md5-pwd
|
||||
final int cpos = val.indexOf(':'); //format adminAccount=adminname:adminpwd
|
||||
if (cpos >= 0) {
|
||||
String username = val.substring(0, cpos);
|
||||
final String pwdtxt = val.substring(cpos + 1);
|
||||
if (!username.isEmpty()) {
|
||||
ss.setConfig(SwitchboardConstants.ADMIN_ACCOUNT_USER_NAME, username);
|
||||
System.out.println("Set property " + SwitchboardConstants.ADMIN_ACCOUNT_USER_NAME + " = " + username);
|
||||
} else {
|
||||
username = ss.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_USER_NAME, "admin");
|
||||
}
|
||||
} else {
|
||||
ss.setConfig(cmd, val);
|
||||
System.out.println("Set property " + cmd + " = " + val);
|
||||
ss.setConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, sb.encodeDigestAuth(username, pwdtxt));
|
||||
System.out.println("Set property " + SwitchboardConstants.ADMIN_ACCOUNT_B64MD5 + " = " + ss.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, ""));
|
||||
}
|
||||
} else {
|
||||
ss.setConfig(cmd, val);
|
||||
System.out.println("Set property " + cmd + " = " + val);
|
||||
}
|
||||
} else {
|
||||
System.out.println("skip parameter " + cfg + " (equal sign missing, put parameter in doublequotes)");
|
||||
}
|
||||
System.out.println();
|
||||
} else {
|
||||
System.out.println("skip parameter " + cfg + " (equal sign missing, put parameter in doublequotes)");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
} else {
|
||||
if (args.length == 1) {
|
||||
applicationRoot= new File(args[0]);
|
||||
@@ -832,9 +832,9 @@ public final class yacy {
|
||||
}
|
||||
|
||||
/**
|
||||
* This class is a helper class whose instance is started, when the java virtual
|
||||
* machine shuts down. Signals the plasmaSwitchboard to shut down.
|
||||
*/
|
||||
* This class is a helper class whose instance is started, when the java virtual
|
||||
* machine shuts down. Signals the plasmaSwitchboard to shut down.
|
||||
*/
|
||||
class shutdownHookThread extends Thread {
|
||||
private final Switchboard sb;
|
||||
private final Semaphore shutdownSemaphore;
|
||||
|
||||
Reference in new issue
Block a user