Skip to content

Commit

Permalink
Remove useless synchronized
Browse files Browse the repository at this point in the history
Internal init, destroy, start and stop are always called by the final
init, destroy, start and stop method of the lifecycle. These methods are
synchronized. As a result, synchronized on these methods is useless.
  • Loading branch information
rmaucher committed Jan 18, 2024
1 parent 160cc59 commit 54012bd
Show file tree
Hide file tree
Showing 27 changed files with 46 additions and 46 deletions.
4 changes: 2 additions & 2 deletions java/org/apache/catalina/authenticator/AuthenticatorBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ public void logout(Request request) {


@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {
ServletContext servletContext = context.getServletContext();
jaspicAppContextID = servletContext.getVirtualServerName() + " " + servletContext.getContextPath();

Expand Down Expand Up @@ -1237,7 +1237,7 @@ protected synchronized void startInternal() throws LifecycleException {


@Override
protected synchronized void stopInternal() throws LifecycleException {
protected void stopInternal() throws LifecycleException {
super.stopInternal();
sso = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ protected boolean isPreemptiveAuthPossible(Request request) {
// ------------------------------------------------------- Lifecycle Methods

@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {
super.startInternal();

// Generate a random secret key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ protected X509Certificate[] getRequestCertificates(final Request request) throws


@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {

super.startInternal();

Expand Down
4 changes: 2 additions & 2 deletions java/org/apache/catalina/authenticator/SingleSignOn.java
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ protected SessionListener getSessionListener(String ssoId) {


@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {
Container c = getContainer();
while (c != null && !(c instanceof Engine)) {
c = c.getParent();
Expand All @@ -583,7 +583,7 @@ protected synchronized void startInternal() throws LifecycleException {


@Override
protected synchronized void stopInternal() throws LifecycleException {
protected void stopInternal() throws LifecycleException {
super.stopInternal();
engine = null;
}
Expand Down
4 changes: 2 additions & 2 deletions java/org/apache/catalina/core/ContainerBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ private void reconfigureStartStopExecutor(int threads) {
* used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {

reconfigureStartStopExecutor(getStartStopThreads());

Expand Down Expand Up @@ -875,7 +875,7 @@ protected synchronized void startInternal() throws LifecycleException {
* used
*/
@Override
protected synchronized void stopInternal() throws LifecycleException {
protected void stopInternal() throws LifecycleException {

// Stop our thread
if (monitorFuture != null) {
Expand Down
4 changes: 2 additions & 2 deletions java/org/apache/catalina/core/StandardContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -4613,7 +4613,7 @@ public boolean loadOnStartup(Container children[]) {
* used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {

if (log.isDebugEnabled()) {
log.debug("Starting " + getBaseName());
Expand Down Expand Up @@ -5024,7 +5024,7 @@ private void mergeParameters() {
* used
*/
@Override
protected synchronized void stopInternal() throws LifecycleException {
protected void stopInternal() throws LifecycleException {

// Send j2ee.state.stopping notification
if (this.getObjectName() != null) {
Expand Down
2 changes: 1 addition & 1 deletion java/org/apache/catalina/core/StandardEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ protected void initInternal() throws LifecycleException {
* used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {

// Log our server identification information
if (log.isInfoEnabled()) {
Expand Down
2 changes: 1 addition & 1 deletion java/org/apache/catalina/core/StandardHost.java
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ public void removeAlias(String alias) {
* used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {

// Set error report valve
String errorValve = getErrorReportValveClass();
Expand Down
4 changes: 2 additions & 2 deletions java/org/apache/catalina/core/StandardPipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ protected void initInternal() {
* used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {

// Start the Valves in our pipeline (including the basic), if any
Valve current = first;
Expand All @@ -184,7 +184,7 @@ protected synchronized void startInternal() throws LifecycleException {
* used
*/
@Override
protected synchronized void stopInternal() throws LifecycleException {
protected void stopInternal() throws LifecycleException {

setState(LifecycleState.STOPPING);

Expand Down
4 changes: 2 additions & 2 deletions java/org/apache/catalina/core/StandardWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ protected Method[] getAllDeclaredMethods(Class<?> c) {
* used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {

// Send j2ee.state.starting notification
if (this.getObjectName() != null) {
Expand Down Expand Up @@ -1310,7 +1310,7 @@ protected synchronized void startInternal() throws LifecycleException {
* used
*/
@Override
protected synchronized void stopInternal() throws LifecycleException {
protected void stopInternal() throws LifecycleException {

setAvailable(Long.MAX_VALUE);

Expand Down
4 changes: 2 additions & 2 deletions java/org/apache/catalina/ha/context/ReplicatedContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class ReplicatedContext extends StandardContext implements MapOwner {
* used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {
super.startInternal();
try {
CatalinaCluster catclust = (CatalinaCluster) this.getCluster();
Expand All @@ -76,7 +76,7 @@ protected synchronized void startInternal() throws LifecycleException {
* used
*/
@Override
protected synchronized void stopInternal() throws LifecycleException {
protected void stopInternal() throws LifecycleException {

Map<String,Object> map = ((ReplApplContext) this.context).getAttributeMap();

Expand Down
4 changes: 2 additions & 2 deletions java/org/apache/catalina/ha/session/BackupManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public String getName() {
* used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {

super.startInternal();

Expand Down Expand Up @@ -170,7 +170,7 @@ public String getMapName() {
* used
*/
@Override
protected synchronized void stopInternal() throws LifecycleException {
protected void stopInternal() throws LifecycleException {

if (log.isDebugEnabled()) {
log.debug(sm.getString("backupManager.stopped", getName()));
Expand Down
4 changes: 2 additions & 2 deletions java/org/apache/catalina/ha/session/DeltaManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ protected byte[] serializeSessions(Session[] currentSessions) throws IOException
* used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {

super.startInternal();

Expand Down Expand Up @@ -808,7 +808,7 @@ protected void waitForSendAllSessions(long beforeSendTime) {
* used
*/
@Override
protected synchronized void stopInternal() throws LifecycleException {
protected void stopInternal() throws LifecycleException {

if (log.isDebugEnabled()) {
log.debug(sm.getString("deltaManager.stopped", getName()));
Expand Down
4 changes: 2 additions & 2 deletions java/org/apache/catalina/ha/session/JvmRouteBinderValve.java
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ protected void changeSessionAuthenticationNote(String sessionId, String newSessi
* used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {

if (cluster == null) {
Cluster containerCluster = getContainer().getCluster();
Expand Down Expand Up @@ -383,7 +383,7 @@ protected synchronized void startInternal() throws LifecycleException {
* used
*/
@Override
protected synchronized void stopInternal() throws LifecycleException {
protected void stopInternal() throws LifecycleException {

super.stopInternal();

Expand Down
2 changes: 1 addition & 1 deletion java/org/apache/catalina/ha/tcp/ReplicationValve.java
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ public void resetStatistics() {
* used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {
if (cluster == null) {
Cluster containerCluster = getContainer().getCluster();
if (containerCluster instanceof CatalinaCluster) {
Expand Down
2 changes: 1 addition & 1 deletion java/org/apache/catalina/realm/LockOutRealm.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public class LockOutRealm extends CombinedRealm {


@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {
/*
* Configure the list of failed users to delete the oldest entry once it exceeds the specified size. This is an
* LRU cache so if the cache size is exceeded the users who most recently failed authentication will be
Expand Down
4 changes: 2 additions & 2 deletions java/org/apache/catalina/session/PersistentManagerBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ protected void writeSession(Session session) throws IOException {
* used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {

super.startInternal();

Expand All @@ -712,7 +712,7 @@ protected synchronized void startInternal() throws LifecycleException {
* used
*/
@Override
protected synchronized void stopInternal() throws LifecycleException {
protected void stopInternal() throws LifecycleException {

if (log.isDebugEnabled()) {
log.debug("Stopping");
Expand Down
4 changes: 2 additions & 2 deletions java/org/apache/catalina/session/StandardManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public void unload() throws IOException {
* used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {

super.startInternal();

Expand All @@ -273,7 +273,7 @@ protected synchronized void startInternal() throws LifecycleException {
* used
*/
@Override
protected synchronized void stopInternal() throws LifecycleException {
protected void stopInternal() throws LifecycleException {

if (log.isDebugEnabled()) {
log.debug("Stopping");
Expand Down
4 changes: 2 additions & 2 deletions java/org/apache/catalina/session/StoreBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ protected void initInternal() {
* used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {

setState(LifecycleState.STARTING);
}
Expand All @@ -254,7 +254,7 @@ protected synchronized void startInternal() throws LifecycleException {
* used
*/
@Override
protected synchronized void stopInternal() throws LifecycleException {
protected void stopInternal() throws LifecycleException {

setState(LifecycleState.STOPPING);
}
Expand Down
4 changes: 2 additions & 2 deletions java/org/apache/catalina/valves/AccessLogValve.java
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ protected synchronized void open() {
* used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {

// Initialize the Date formatters
String format = getFileDateFormat();
Expand All @@ -674,7 +674,7 @@ protected synchronized void startInternal() throws LifecycleException {
* used
*/
@Override
protected synchronized void stopInternal() throws LifecycleException {
protected void stopInternal() throws LifecycleException {

super.stopInternal();
close(false);
Expand Down
4 changes: 2 additions & 2 deletions java/org/apache/catalina/valves/FilterValve.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public Enumeration<String> getInitParameterNames() {
}

@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {
super.startInternal();

if (null == getFilterClassName()) {
Expand Down Expand Up @@ -220,7 +220,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
}

@Override
protected synchronized void stopInternal() throws LifecycleException {
protected void stopInternal() throws LifecycleException {
super.stopInternal();

if (null != filter) {
Expand Down
2 changes: 1 addition & 1 deletion java/org/apache/catalina/valves/HealthCheckValve.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void setCheckContainersAvailable(boolean checkContainersAvailable) {
}

@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {
super.startInternal();
context = (getContainer() instanceof Context);
}
Expand Down
4 changes: 2 additions & 2 deletions java/org/apache/catalina/valves/JDBCAccessLogValve.java
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ protected void close() {
* used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {
try {
open();
} catch (SQLException e) {
Expand All @@ -640,7 +640,7 @@ protected synchronized void startInternal() throws LifecycleException {
* used
*/
@Override
protected synchronized void stopInternal() throws LifecycleException {
protected void stopInternal() throws LifecycleException {
super.stopInternal();
close();
}
Expand Down
2 changes: 1 addition & 1 deletion java/org/apache/catalina/valves/RequestFilterValve.java
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ protected void initInternal() throws LifecycleException {


@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {
if (!allowValid || !denyValid) {
throw new LifecycleException(sm.getString("requestFilterValve.configInvalid"));
}
Expand Down
4 changes: 2 additions & 2 deletions java/org/apache/catalina/valves/SemaphoreValve.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public void setInterruptible(boolean interruptible) {
* used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {
semaphore = new Semaphore(concurrency, fairness);
super.startInternal();
}
Expand All @@ -135,7 +135,7 @@ protected synchronized void startInternal() throws LifecycleException {
* used
*/
@Override
protected synchronized void stopInternal() throws LifecycleException {
protected void stopInternal() throws LifecycleException {
super.stopInternal();
semaphore = null;
}
Expand Down
4 changes: 2 additions & 2 deletions java/org/apache/catalina/valves/ValveBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ protected void initInternal() throws LifecycleException {
* used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
protected void startInternal() throws LifecycleException {
setState(LifecycleState.STARTING);
}

Expand All @@ -155,7 +155,7 @@ protected synchronized void startInternal() throws LifecycleException {
* used
*/
@Override
protected synchronized void stopInternal() throws LifecycleException {
protected void stopInternal() throws LifecycleException {
setState(LifecycleState.STOPPING);
}

Expand Down
Loading

0 comments on commit 54012bd

Please sign in to comment.