MCPcopy Index your code
hub / github.com/apache/tomcat / setRealm

Method setRealm

java/org/apache/catalina/core/ContainerBase.java:512–553  ·  view source on GitHub ↗
(Realm realm)

Source from the content-addressed store, hash-verified

510 }
511
512 @Override
513 public void setRealm(Realm realm) {
514
515 Realm oldRealm;
516 Lock l = realmLock.writeLock();
517 l.lock();
518 try {
519 // Change components if necessary
520 oldRealm = this.realm;
521 if (oldRealm == realm) {
522 return;
523 }
524 this.realm = realm;
525
526 // Start the new component if necessary
527 if (realm != null) {
528 realm.setContainer(this);
529 }
530 } finally {
531 l.unlock();
532 }
533
534 // Stop the old component if necessary
535 if (getState().isAvailable() && oldRealm instanceof Lifecycle) {
536 try {
537 ((Lifecycle) oldRealm).stop();
538 } catch (LifecycleException e) {
539 log.error(sm.getString("containerBase.realm.stop"), e);
540 }
541 }
542
543 if (getState().isAvailable() && realm instanceof Lifecycle) {
544 try {
545 ((Lifecycle) realm).start();
546 } catch (LifecycleException e) {
547 log.error(sm.getString("containerBase.realm.start"), e);
548 }
549 }
550
551 // Report this property change to interested listeners
552 support.firePropertyChange("realm", oldRealm, this.realm);
553 }
554
555
556 // ------------------------------------------------------ Container Methods

Callers

nothing calls this directly

Calls 10

writeLockMethod · 0.80
lockMethod · 0.65
setContainerMethod · 0.65
unlockMethod · 0.65
isAvailableMethod · 0.65
getStateMethod · 0.65
stopMethod · 0.65
errorMethod · 0.65
getStringMethod · 0.65
startMethod · 0.65

Tested by

no test coverage detected