Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2014 Cisco Systems, Inc. Licensed 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 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.
Abstract base class for lookup and registration manger
 public abstract class AbstractServiceDirectoryManager implements StoppableAutoCloseable {
     public static final Logger LOGGER = LoggerFactory.getLogger(AbstractServiceDirectoryManager.class);

Mark component started or not
     protected final AtomicBoolean isStarted = new AtomicBoolean(false);

Mark the Manager closed. The manager can not be reused when it is closed.
     protected final AtomicBoolean isClosed = new AtomicBoolean(false);
     private CloseListener listener;

listener The CloseListener
     public synchronized void setCloseListener(CloseListener listener){
         this. = listener;
     public void start() {
     public void stop() {

Check if the manager is started or not

boolean indicating whether it is started or not
     public boolean isStarted() throws ServiceException {
         return .get();
     public void close() throws ServiceException {
         try {
         }catch(Throwable cause){
             .error("{} is failed to close"this);
             throw new ServiceException(.,cause,
         .info("{} is closed",this);
     protected void fireClose() {
         if ( !=null) {
     public String toString() {
         return getClass().getSimpleName() + "@" + Integer.toHexString(hashCode());


The ServiceDirectoryService
    public abstract ServiceDirectoryService getService();
New to GrepCode? Check out our FAQ X