Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.jacorb.notification.servant;
  
  /*
   *        JacORB - a free Java ORB
   *
   *   Copyright (C) 1997-2012 Gerald Brose / The JacORB Team.
   *
   *   This library is free software; you can redistribute it and/or
   *   modify it under the terms of the GNU Library General Public
  *   License as published by the Free Software Foundation; either
  *   version 2 of the License, or (at your option) any later version.
  *
  *   This library is distributed in the hope that it will be useful,
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  *   Library General Public License for more details.
  *
  *   You should have received a copy of the GNU Library General Public
  *   License along with this library; if not, write to the Free
  *   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 

Author(s):
Alphonse Bendt
Jmx.mbean:
extends = "AbstractProxyPushSupplierMBean"
Jboss.xmbean:
 
 
 public class TypedProxyPushSupplierImpl extends AbstractProxyPushSupplier implements
 {
     private class PushTypedOperation implements PushOperation 
     {
         private final Request request_;
 
         public PushTypedOperation(Request request) {
              = request;
         }
 
         public void invokePush() throws Disconnected {
             deliverMessageInternal();
         }
 
         public void dispose() {
             // No Op
         }
     }
     
     private TypedPushConsumer pushConsumer_;
 
     private org.omg.CORBA.Object typedConsumer_;
 
     private static final TypeCode TYPE_CODE_VOID = org.omg.CORBA.ORBSingleton.init().get_primitive_tc(.);
 
     private final String supportedInterface_;
 
     private long timeSpent_ = 0;
 
     public TypedProxyPushSupplierImpl(ITypedAdmin adminConsumerAdmin consumerAdminORB orb,
             POA poaConfiguration confTaskProcessor taskProcessorPushTaskExecutorFactory pushTaskExecutorFactory,
             OfferManager offerManagerSubscriptionManager subscriptionManager)
             throws ConfigurationException
     {
         super(adminorbpoaconftaskProcessorpushTaskExecutorFactoryofferManager,
                 subscriptionManagerconsumerAdmin);
 
          = admin.getSupportedInterface();
     }
 
     public void disconnect_push_supplier()
    {
        destroy();
    }
    public void connect_typed_push_consumer(TypedPushConsumer typedPushConsumer)
            throws AlreadyConnectedTypeError
    {
        logger_.info("connect typed_push_supplier");
        checkIsNotConnected();
        connectClient(typedPushConsumer);
         = typedPushConsumer;
        {
            throw new TypeError();
        }
    }
    public ProxyType MyType()
    {
        return .;
    }
    public void isIDLAssignable(final String ifNamethrows IllegalArgumentException
    {
        if (._is_a(ifName))
        {
            return;
        }
        if (ifName.indexOf("Pull") > 0)
        {
            final int idx = ifName.indexOf("Pull");
            final StringBuffer _nonPullIF = new StringBuffer();
            _nonPullIF.append(ifName.substring(0, idx));
            _nonPullIF.append(ifName.substring(idx + 4));
            if (._is_a(_nonPullIF.toString()))
            {
                return;
            }
        }
        throw new IllegalArgumentException();
    }
    public boolean pushEvent()
    {
        final Message _message = getMessageNoBlock();
        if (_message != null)
        {
            try
            {
                return deliverMessageWithRetry(_message);
            } finally
            {
                _message.dispose();
            }
        }
        return false;
    }
    
    private boolean deliverMessageWithRetry(Message message)
    {
        try
        {
            final Property[] _props = message.toTypedEvent();
            final String _fullQualifiedOperation;
            if (..equals(_props[0].))
            {
                _fullQualifiedOperation = _props[0]..extract_string();
            }
            else if (..equals(_props[0].))
            {
                _fullQualifiedOperation = EventTypeHelper.extract(_props[0].).;
                final String _idlType = EventTypeHelper.extract(_props[0].).;
                isIDLAssignable(_idlType);
            }
            else
            {
                throw new IllegalArgumentException();
            }
            final int _idx = _fullQualifiedOperation.lastIndexOf("::");
            final String _operation = _fullQualifiedOperation.substring(_idx + 2);
            final Request _request = ._request(_operation);
            final NVList _arguments = _request.arguments();
            for (int x = 1; x < _props.length; ++x)
            {
                _arguments.add_value(_props[x]._props[x]..);
            }
            _request.set_return_type();
            try
            {
                deliverMessageInternal(_request);
                
                return true;
            } catch (Exception t)
            {
                final PushTypedOperation _failedOperation = new PushTypedOperation(_request);
                handleFailedPushOperation(_failedOperationt);
                
                return false;
            }
        } catch (NoTranslationException e)
        {
            // ignore
            // nothing will be delivered to the consumer
            logger_.info("No Translation possible"e);
            
            return true;
        }
    }
    private void deliverMessageInternal(final Request request)
    {
        final long now = System.currentTimeMillis();
        request.invoke();
         += (System.currentTimeMillis() - now);
        resetErrorCounter();
    }
    protected void disconnectClient()
    {
        if ( != null)
        {
            .disconnect_push_consumer();
             = null;
        }
    }
    public Servant newServant()
    {
        return new TypedProxyPushSupplierPOATie(this);
    }
    protected long getCost()
    {
        return ;
    }
    
    

Jmx.managed:
attribute access = "read-only"
    public String getSupportedInterface()
    {
        return ;
    }
New to GrepCode? Check out our FAQ X