C++ Client API Reference for Oracle Coherence
14c (14.1.2.0.0)

F79659-03

coherence/net/AddressProvider.hpp

00001 /*
00002  * Copyright (c) 2000, 2020, Oracle and/or its affiliates.
00003  *
00004  * Licensed under the Universal Permissive License v 1.0 as shown at
00005  * http://oss.oracle.com/licenses/upl.
00006  */
00007 #ifndef COH_ADDRESS_PROVIDER_HPP
00008 #define COH_ADDRESS_PROVIDER_HPP
00009 
00010 #include "coherence/lang.ns"
00011 
00012 #include "coherence/net/InetSocketAddress.hpp"
00013 
00014 COH_OPEN_NAMESPACE2(coherence,net)
00015 
00016 using coherence::net::InetSocketAddress;
00017 
00018 /**
00019 * The AddressProvider is an interface that serves as a means to provide
00020 * addresses to a consumer. Simple implementations could be backed by a
00021 * static list; more complex ones could use dynamic discovery protocols.
00022 *
00023 * @author gg,jh  2008-08-14
00024 * @author gm 2008-08-25
00025 * @since Coherence 3.4
00026 */
00027 class COH_EXPORT AddressProvider
00028     : public interface_spec<AddressProvider >
00029     {
00030     public:
00031         /**
00032         * Obtain a next available address to use. If the caller can
00033         * successfully use the returned address (e.g. a connection was
00034         * established), it should call the AddressProvider's
00035         * {@link #accept()}
00036         *
00037         * @return the next available address or NULL if the list of available
00038         *         addresses was exhausted
00039         */
00040         virtual InetSocketAddress::View getNextAddress() = 0;
00041 
00042         /**
00043         * This method should be called by the client immediately after it
00044         * determines that it can successfully use an address returned by the
00045         * {@link #getNextAddress} method.
00046         */
00047         virtual void accept() = 0;
00048 
00049         /**
00050         * This method should be called by the client immediately after it
00051         * determines that an attempt to use an address returned by the
00052         * {@link #getNextAddress} method has failed.
00053         *
00054         * @param oheCause (optional) an exception that carries the reason why
00055         *                 the the caller rejected the previously returned
00056         *                 address
00057         */
00058         virtual void reject(Exception::Holder oheCause) = 0;
00059     };
00060 
00061 COH_CLOSE_NAMESPACE2
00062 
00063 #endif // COH_ADDRESS_PROVIDER_HPP
Copyright © 2000, 2025, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.