Oracle® Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.2.1.4.0)

E90870-01

coherence/net/AddressProvider.hpp

00001 /*
00002 * AddressProvider.hpp
00003 *
00004 * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
00005 *
00006 * Oracle is a registered trademarks of Oracle Corporation and/or its
00007 * affiliates.
00008 *
00009 * This software is the confidential and proprietary information of Oracle
00010 * Corporation. You shall not disclose such confidential and proprietary
00011 * information and shall use it only in accordance with the terms of the
00012 * license agreement you entered into with Oracle.
00013 *
00014 * This notice may not be removed or altered.
00015 */
00016 #ifndef COH_ADDRESS_PROVIDER_HPP
00017 #define COH_ADDRESS_PROVIDER_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 #include "coherence/net/InetSocketAddress.hpp"
00022 
00023 COH_OPEN_NAMESPACE2(coherence,net)
00024 
00025 using coherence::net::InetSocketAddress;
00026 
00027 /**
00028 * The AddressProvider is an interface that serves as a means to provide
00029 * addresses to a consumer. Simple implementations could be backed by a
00030 * static list; more complex ones could use dynamic discovery protocols.
00031 *
00032 * @author gg,jh  2008-08-14
00033 * @author gm 2008-08-25
00034 * @since Coherence 3.4
00035 */
00036 class COH_EXPORT AddressProvider
00037     : public interface_spec<AddressProvider >
00038     {
00039     public:
00040         /**
00041         * Obtain a next available address to use. If the caller can
00042         * successfully use the returned address (e.g. a connection was
00043         * established), it should call the AddressProvider's
00044         * {@link #accept()}
00045         *
00046         * @return the next available address or NULL if the list of available
00047         *         addresses was exhausted
00048         */
00049         virtual InetSocketAddress::View getNextAddress() = 0;
00050 
00051         /**
00052         * This method should be called by the client immediately after it
00053         * determines that it can successfully use an address returned by the
00054         * {@link #getNextAddress} method.
00055         */
00056         virtual void accept() = 0;
00057 
00058         /**
00059         * This method should be called by the client immediately after it
00060         * determines that an attempt to use an address returned by the
00061         * {@link #getNextAddress} method has failed.
00062         *
00063         * @param oheCause (optional) an exception that carries the reason why
00064         *                 the the caller rejected the previously returned
00065         *                 address
00066         */
00067         virtual void reject(Exception::Holder oheCause) = 0;
00068     };
00069 
00070 COH_CLOSE_NAMESPACE2
00071 
00072 #endif // COH_ADDRESS_PROVIDER_HPP
Copyright © 2000, 2019, Oracle and/or its affiliates. All rights reserved.