Hi Mark / Christopher,

Firstly, thanks for confirming my analysis on what is happening.

>> Would you be interested in looking at the existing algorithm to see if
>> it would be updated in this way?

> WebappLoader.backgroundProcess() would be a good place to start.

I am sort of interested in looking at this. I have only been playing
with Java for about 6 months, having been a Pascal developer most of
my life (40 odd years). Therefore, I think that I could at least ‘give
it a look’, if I can get Tomcat installed locally.

However, I appreciate that I could be well out of my depth and there
are too many unknowns / barriers in order to be of any use.

It is the installation process that I am having issues with. I think
it is down to lack of experience / knowledge / familiarity with
commercial strength application.

I use Netbeans 12.6 (Apache loyalty!) on Windows 10 for all my Java
development using JDK 17.

Unfortunately, I am only ‘sort-of’ familiar with Maven and have never
touched Ant so I am flying a bit blind here, but that shouldn’t matter
if it all works as I don't need to touch the build process.

I downloaded the ‘main’ branch from GitHub
(https://github.com/apache/tomcat) and unzipped it into its own
folder, again with Ant (apache-ant-1.9.16).

I have managed to get Ant to build it using instructions in
BUILDING.txt. While it says that Tomcat built successfully, scrolling
up, I got lots of warnings saying ‘can’t find a module etc so not sure
if doing something wrong. I can send the results as an attachment if
that would be useful.

I can also get it to build in Netbeans (I first had to set  Project >
Properties > Java Sources to Source Level 17 which may be a bit of a
guess as Netbeans complained about default value of 1.7). The java
files in Netbeans don’t highlight any exceptions, just warnings.

I appear to have issues with the other two folders
‘C:\Community\Tomcat\tomcat-main\webapps\docs\appdev\sample\src\mypackage’
and ‘C:\Community\Tomcat\tomcat-main\test’ as they don’t seem to be
able to locate the dependencies (HelloWorld is -e.g. import
jakarta.servlet.http.HttpServlet & tests is -e.g. import
org.junit.Assert). In Maven, I would add a dependency to the pom.xml
file, but not sure what to do in Ant as I would expect the
configuration to already be set up.

I also ran the ‘ant test’, took about 90 minutes and failed a number
of tests (which I thought was surprising as I would expect sources in
the repository to pass all the tests. I can provide examples if useful
as it may indicate that I have done something wrong.

I read through the ‘RUNNING.txt’ file, but that assumes a binary to
start, rather than following on from BUILDING Tomcat and so I couldn’t
relate that to what I was trying to achieve.

However, if I launch Tomcat from within Netbeans (F6), I get a dialog
which I don’t understand - probably due to my lack of familiarity with
Ant. Again, I can include a screenshot if that would help.

[Run – Tomcat 8.0]
No build target is associated with Run action.
The free-form project requires a target
Representing the Run action to invoke in
Your Ant script. Select the target to invoke.
[Dropdown with lots of tasks v]

Is there an alternative document I should be reviewing to get me to
actually run Tomcat from within Netbeans?

I need to be able to run the locally built version of Tomcat so that,
as a starting point, I can add some System.out.print() messages around
the relevant routines (which I have located – thanks Mark). Of course
I am assuming that it is possible to develop Tomcat from within
Netbeans.

While I would enjoy the challenge of reviewing the existing sources
and attempting to incorporate a delay, I may waste more peoples time
trying to get off the starting blocks. If that is the case, then I can
raise a bug for future inclusion although it will be a
pain-in-the-neck having to keep shutting down Tomcat after each
compile!

John



From: Mark Thomas
Sent: 17 February 2022 21:47
To: users@tomcat.apache.org
Subject: Re: <Context … reloadable = "true"> is too quick to respond



On 17/02/2022 19:50, Christopher Schultz wrote:



<snip/>



> This kind of thing could happen due to a number of different reasons,

> such as a slow disk or network share, etc. and ought to be

> protected-against.

>

> I haven't looked at the code, but I would imagine it periodically reads

> all relevant files looking for anything that's been updated, but

> immediately acts the first time is finds someting worth triggering a

> reload.



It does. The periodic check is triggered by the background process.



> It might make more sense to modify that logic so that *all* files are

> checked, but we cancel the reload if there are any files that are "too

> new". This would allow us to avoid a reload if some kind of copy is in

> progress. So we are looking for "anything newer than

> last_reload_timestamp but not if we find anything older than NOW - 10

> seconds".



Yes. We do something similar when checking for an update WAR file. Ten

seconds might be a little on the high side.



> Would you be interested in looking at the existing algorithm to see if

> it would be updated in this way?



WebappLoader.backgroundProcess() would be a good place to start.



Mark



---------------------------------------------------------------------

To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org

For additional commands, e-mail: users-h...@tomcat.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to