All Downloads are FREE. Search and download functionalities are using the official Maven repository.

IceMX.ObserverWithDelegate Maven / Gradle / Ivy

Go to download

Ice is a comprehensive RPC framework that helps you build distributed applications with minimal effort using familiar object-oriented idioms

The newest version!
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//

package IceMX;

public class ObserverWithDelegate extends Observer
{
    @Override
    public void
    attach()
    {
        super.attach();
        if(_delegate != null)
        {
            _delegate.attach();
        }
    }

    @Override
    public void
    detach()
    {
        super.detach();
        if(_delegate != null)
        {
            _delegate.detach();
        }
    }

    @Override
    public void
    failed(String exceptionName)
    {
        super.failed(exceptionName);
        if(_delegate != null)
        {
            _delegate.failed(exceptionName);
        }
    }

    public O
    getDelegate()
    {
        return _delegate;
    }

    public void
    setDelegate(O del)
    {
        _delegate = del;
    }

    @SuppressWarnings("unchecked")
    public ,
        Obs extends Ice.Instrumentation.Observer> Obs
    getObserver(String mapName, MetricsHelper helper, Class mcl, Class ocl, Obs delegate)
    {
        ObserverImpl obsv = super.getObserver(mapName, helper, mcl, ocl);
        if(obsv != null)
        {
            obsv.setDelegate(delegate);
            return (Obs)obsv;
        }
        return delegate;
    }

    protected O _delegate;
}