[utilities COMMIT] in /spring-extensions/trunk/src/main/java/net/shibboleth/ext/spring/service: AbstractServiceableCo...

noreply at shibboleth.net noreply at shibboleth.net
Mon Dec 1 12:56:16 EST 2014


Author: scantor
Date: Mon Dec  1 12:56:16 2014
New Revision: 694

URL: http://svn.shibboleth.net/view/utilities?rev=694&view=rev
Log:
IDP-526 - add some logging, fix eol props.

Modified:
    spring-extensions/trunk/src/main/java/net/shibboleth/ext/spring/service/AbstractServiceableComponent.java   (contents, props changed)
    spring-extensions/trunk/src/main/java/net/shibboleth/ext/spring/service/ClassBasedServiceStrategy.java   (contents, props changed)
    spring-extensions/trunk/src/main/java/net/shibboleth/ext/spring/service/ReloadableSpringService.java   (contents, props changed)
    spring-extensions/trunk/src/main/java/net/shibboleth/ext/spring/service/package-info.java   (contents, props changed)

Modified: spring-extensions/trunk/src/main/java/net/shibboleth/ext/spring/service/AbstractServiceableComponent.java
URL: http://svn.shibboleth.net/view/utilities/spring-extensions/trunk/src/main/java/net/shibboleth/ext/spring/service/AbstractServiceableComponent.java?rev=694&r1=693&r2=694&view=diff
==============================================================================
--- spring-extensions/trunk/src/main/java/net/shibboleth/ext/spring/service/AbstractServiceableComponent.java (original)
+++ spring-extensions/trunk/src/main/java/net/shibboleth/ext/spring/service/AbstractServiceableComponent.java Mon Dec  1 12:56:16 2014
@@ -1,134 +1,134 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development, 
- * Inc. (UCAID) under one or more contributor license agreements.  See the 
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache 
- * License, Version 2.0 (the "License"); you may not use this file except in 
- * compliance with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.ext.spring.service;
-
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent;
-import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-import net.shibboleth.utilities.java.support.component.ComponentSupport;
-import net.shibboleth.utilities.java.support.service.ServiceableComponent;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import org.springframework.context.ConfigurableApplicationContext;
-
-/**
- * Implementation of {@link ServiceableComponent} that does most of the work required. It leverages the spring
- * environment to allow easy cleanup.
- * 
- * @param <T> The type of service.
- */
-public abstract class AbstractServiceableComponent<T> extends AbstractIdentifiedInitializableComponent implements
-        ServiceableComponent<T>, ApplicationContextAware {
-
-    /** Class logger. */
-    private final Logger log = LoggerFactory.getLogger(AbstractServiceableComponent.class);
-
-    /** The context used to load this bean. */
-    private ApplicationContext applicationContext;
-
-    /**
-     * Lock for this service. We make it unfair since we will control access and there will only ever be contention
-     * during unload.
-     */
-    private final ReentrantReadWriteLock serviceLock = new ReentrantReadWriteLock(false);
-
-    /** {@inheritDoc} */
-    @Override public void setApplicationContext(ApplicationContext context) {
-        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
-        applicationContext = context;
-    }
-
-    /**
-     * Get the context used to load this bean.
-     * 
-     * @return the context.
-     */
-    @Nullable public ApplicationContext getApplicationContext() {
-        return applicationContext;
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override @Nonnull public abstract T getComponent();
-
-    /**
-     * {@inheritDoc} Grab the service lock shared. This will block unloads until {@link #unpinComponent()} is called.
-     */
-    @Override public void pinComponent() {
-        serviceLock.readLock().lock();
-    }
-
-    /** {@inheritDoc} drop the shared lock. */
-    @Override public void unpinComponent() {
-        serviceLock.readLock().unlock();
-    }
-
-    /** {@inheritDoc}. Grab the service lock ex and then call spring to tear everything down. */
-    @Override public void unloadComponent() {
-        if (null == applicationContext) {

[... 1243 lines stripped ...]


More information about the commits mailing list