001/**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.camel.spi;
018
019import java.util.Map;
020
021/**
022 * Various statistics about endpoint utilization, such as from EIP patterns that uses dynamic endpoints.
023 */
024public interface EndpointUtilizationStatistics {
025
026    /**
027     * Maximum number of elements that we can have information about
028     */
029    int maxCapacity();
030
031    /**
032     * Current number of endpoints we have information about
033     */
034    int size();
035
036    /**
037     * Callback when an endpoint is being utilizated by an {@link org.apache.camel.Processor} EIP
038     * such as sending a message to a dynamic endpoint.
039     *
040     * @param uri  the endpoint uri
041     */
042    void onHit(String uri);
043
044    /**
045     * To remove an endpoint from tracking information about its utilization
046     *
047     * @param uri  the endpoint uri
048     */
049    void remove(String uri);
050
051    /**
052     * Gets the endpoint utilization statistics.
053     *
054     * @return a map with uri and number of usage of the endpoint.
055     */
056    Map<String, Long> getStatistics();
057
058    /**
059     * Clears all information.
060     */
061    void clear();
062
063}