Oracle Coherence for C++ API
Release 3.6.1.0
E18813-01

- Main Page
- Namespaces
- Classes
- Files

# coherence/net/Invocable.hpp

    00001 /*
    00002 * Invocable.hpp
    00003 *
    00004 * Copyright (c) 2000, 2010, 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_INVOCABLE_HPP
    00017 #define COH_INVOCABLE_HPP
    00018
    00019 #include "coherence/lang.ns"
    00020
    00021 COH_OPEN_NAMESPACE2(coherence,net)
    00022
    00023 class InvocationService;
    00024
    00025
    00026 /**
    00027 * The Invocable object is a cluster-portable object that can be invoked on
    00028 * any set of remote members and each can optionally register a return value
    00029 * for the invocation.
    00030 *
    00031 * When an Invocable object is received for execution, the order of execution
    00032 * is:
    00033 * <ul>
    00034 * <li>the Invocable object is deserialized by the InvocationService;
    00035 * <li>the InvocationService provides a reference to itself to the Invocable
    00036 *     object by calling the init method;
    00037 * <li>the InvocationService invokes the Invocable object by calling the run
    00038 *     method;
    00039 * <li>if the InvocationService is responsible for returning a value from the
    00040 *     invocation, it obtains the value by calling the getResult method.
    00041 * </ul>
    00042 *
    00043 * @author jh  2007.12.21
    00044 */
    00045 class COH_EXPORT Invocable
    00046     : public interface_spec<Invocable,
    00047         implements<Runnable> >
    00048     {
    00049     // ----- handle definitions ---------------------------------------------
    00050
    00051     public:
    00052         /**
    00053         * InvocationService Handle definition.
    00054         */
    00055         typedef TypedHandle<InvocationService> InvocationServiceHandle;
    00056
    00057         /**
    00058         * InvocationService View definition.
    00059         */
    00060         typedef TypedHandle<const InvocationService> InvocationServiceView;
    00061
    00062
    00063     // ----- Invocable interface --------------------------------------------
    00064
    00065     public:
    00066         /**
    00067         * Called by the InvocationService exactly once on this Invocable
    00068         * object as part of its initialization.
    00069         * <p>
    00070         * <b>Note:</b> implementations of the Invocable interface that store
    00071         * the service reference must do so only in a transient field.
    00072         *
    00073         * @param hService  the containing InvocationService
    00074         */
    00075         virtual void init(InvocationServiceHandle hService) = 0;
    00076
    00077         /**
    00078         * Determine the result from the invocation of this object. This
    00079         * method is called by the InvocationService after the run() method
    00080         * returns.
    00081         *
    00082         * @return the invocation result, if any
    00083         */
    00084         virtual Object::Holder getResult() const = 0;
    00085     };
    00086
    00087 COH_CLOSE_NAMESPACE2
    00088
    00089 #endif // COH_INVOCABLE_HPP

Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.