-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d96a7e9
Showing
8 changed files
with
173 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
BSD 3-Clause License | ||
|
||
Copyright (c) 2022, Automatic Controls Equipment Systems, Inc. | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# GarbageCollector | ||
|
||
WebCTRL is a trademark of Automated Logic Corporation. Any other trademarks mentioned herein are the property of their respective owners. | ||
|
||
## About | ||
|
||
This WebCTRL add-on invokes `System.gc()` every 5 minutes. Essentially, this hints that the JVM should run its garbage collector, freeing any excess memory. In some cases, this should improve performance of a WebCTRL server. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
JDK Version: | ||
openjdk 18.0.2.1 2022-08-18 | ||
OpenJDK Runtime Environment (build 18.0.2.1+1-1) | ||
OpenJDK 64-Bit Server VM (build 18.0.2.1+1-1, mixed mode, sharing) | ||
|
||
Compilation Flags: | ||
--release 8 | ||
|
||
Runtime Dependencies: | ||
addonsupport-api-addon-1.7.0 | ||
alarmmanager-api-addon-1.7.0 | ||
bacnet-api-addon-1.8.007-20220318.0837r | ||
directaccess-api-addon-1.7.0 | ||
tomcat-embed-core-9.0.37 | ||
webaccess-api-addon-1.7.0 | ||
xdatabase-api-addon-1.7.0 | ||
|
||
Packaged Dependencies: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--release 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
@echo off | ||
if "%WebCTRL%" EQU "" goto :bad | ||
if "%addonFile%" EQU "" goto :bad | ||
if "%certFile%" EQU "" goto :bad | ||
if /i "%*" EQU "--help" ( | ||
echo DEPLOY Copies the .addon archive and certificate file to the bound WebCTRL installation. | ||
exit /b 0 | ||
) | ||
if "%*" NEQ "" ( | ||
echo Unexpected parameter. | ||
exit /b 1 | ||
) | ||
if not exist "%addonFile%" ( | ||
echo Cannot deploy because !name!.addon does not exist. | ||
exit /b 1 | ||
) | ||
echo Deploying... | ||
if "!name!" EQU "AddonDevRefresher" ( | ||
echo Cannot be used to self-deploy. | ||
echo Deployment unsuccessful. | ||
exit /b 1 | ||
) | ||
if not exist "%WebCTRL%\addons" mkdir "%WebCTRL%\addons" >nul 2>nul | ||
copy /y "%certFile%" "%WebCTRL%\addons\%certFileName%" >nul | ||
copy /y "%addonFile%" "%WebCTRL%\addons\!name!.update" >nul | ||
if %ErrorLevel% NEQ 0 ( | ||
echo Deployment unsuccessful. | ||
exit /b 1 | ||
) | ||
set /a count=0 | ||
:waitUpdate | ||
timeout 1 /nobreak >nul | ||
set /a count+=1 | ||
if exist "%WebCTRL%\addons\!name!.update" ( | ||
if "%count%" EQU "60" ( | ||
echo Timeout occurred. | ||
echo Deployment unsuccessful. | ||
exit /b 1 | ||
) else ( | ||
goto :waitUpdate | ||
) | ||
) | ||
if exist "%WebCTRL%\addons\!name!.addon" ( | ||
echo Deployment successful. | ||
exit /b 0 | ||
) else ( | ||
echo Deployment unsuccessful. | ||
exit /b 1 | ||
) | ||
|
||
:bad | ||
echo This script should not be invoked as a stand-alone application. | ||
echo You must use this file as an extension to addon-dev-script. | ||
echo https://github.com/automatic-controls/addon-dev-script | ||
echo Press any key to exit. | ||
pause >nul | ||
exit /b 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<extension version="1"> | ||
<name>GarbageCollector</name> | ||
<description>A simple WebCTRL add-on which invoked System.gc() every 5 minutes.</description> | ||
<version>1.0.0</version> | ||
<vendor>Automatic Controls Equipment Systems, Inc.</vendor> | ||
</extension> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<web-app> | ||
|
||
<listener> | ||
<listener-class>aces.webctrl.garbage.Initializer</listener-class> | ||
</listener> | ||
|
||
<security-constraint> | ||
<web-resource-collection> | ||
<web-resource-name>WEB</web-resource-name> | ||
<url-pattern>/*</url-pattern> | ||
</web-resource-collection> | ||
</security-constraint> | ||
|
||
<filter> | ||
<filter-name>RoleFilterAJAX</filter-name> | ||
<filter-class>com.controlj.green.addonsupport.web.RoleFilter</filter-class> | ||
<init-param> | ||
<param-name>roles</param-name> | ||
<param-value>view_administrator_only</param-value> | ||
</init-param> | ||
</filter> | ||
<filter-mapping> | ||
<filter-name>RoleFilterAJAX</filter-name> | ||
<url-pattern>/*</url-pattern> | ||
</filter-mapping> | ||
|
||
</web-app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package aces.webctrl.garbage; | ||
import javax.servlet.*; | ||
public class Initializer implements ServletContextListener { | ||
private volatile Thread thread; | ||
private volatile boolean go = true; | ||
@Override public void contextInitialized(ServletContextEvent sce){ | ||
thread = new Thread(){ | ||
@Override public void run(){ | ||
while (go){ | ||
try{ | ||
System.gc(); | ||
Thread.sleep(300000); | ||
}catch(InterruptedException e){} | ||
} | ||
} | ||
}; | ||
thread.start(); | ||
} | ||
@Override public void contextDestroyed(ServletContextEvent sce){ | ||
try{ | ||
go = false; | ||
thread.interrupt(); | ||
thread.join(); | ||
}catch(InterruptedException e){} | ||
} | ||
} |