jtrix.base.INode

This interface is passed to a netlet by the node on initialisation. It is used by the netlet to communicate with the node.


public interface INode extends IFacetCollection
{
    /** Request that the client netlet be terminated.
     */
    public void requestTermination();    
    
    /** Ask the node to make a service connection. The node will instantiate a
     * service netlet. That netlet could be a proxy to the actual service.
     * @param warrant  The warrant that is used to bind to the service.
     * @param consumer  The consumer side of service. I.e. a service connection
     *     from the actual netlet making the request.
     * @return  The server side of the service.
     */
    public IService bindService(Warrant warrant, IService consumer)
        throws ServiceBindException;    

    /** Create a service proxy, i.e. something with the same semantics
     * as a service connection but without binding a warrant.  This
     * proxy can be freely passed to other netlets.  Any facets passed
     * through the proxy will be dependent on the proxy, and will be
     * shutdown along with this proxy.  The proxy may have its own
     * thread pool.
     * @param impl  Something implementing the proxy
     * @param facet  The name of the interface that the proxy represents.
     *     The proxy object can then be cast into this.
     * @return  An interface to manage the service proxy, from which the
     *     proxied service itself can be obtained.
     */
    public IProxy createServiceProxy(IRemote impl, String facet);

    /** Tell the node how many concurrent threads it can start on the netlet's
     * behalf. For example, if we set the concurrency to 10 then the netlet
     * will only be able to accept 10 service requests, or 9 service requests
     * and 1 notification of termination. This does not affect how many
     * service requests the netlet can initiate. But if the netlet makes an
     * asynchronous call to a facet and the concurrency threshold is too low
     * then it may never receive the response. Since incoming calls are
     * otherwise out of the netlet's control, this method allows this resource
     * (threads) to have an upper limit.
     *
     * @param threads  Maximum number of threads the node can start for the
     *     netlet. Setting this to zero or less is silly, since it prevents
     *     the netlet from responding to any incoming request, including a
     *     notification of termination.
     *
     * @param thread_reuse  Can this netlet reuse threads? If a netlet invokes
     *     outwards synchronously then a causal incoming call was called
     *     synchronously then the original thread can be reused. Default is
     *     <tt>false</tt> (no thread reuse).
     */
    public void setConcurrency(int threads, boolean thread_reuse);
}

Nik Silver 2002-03-09