Search in sources :

Example 1 with ObjectImpl

use of org.omg.CORBA.portable.ObjectImpl in project wildfly by wildfly.

the class HandleDelegateImpl method reconnect.

protected void reconnect(Object object) throws IOException {
    if (object instanceof ObjectImpl) {
        try {
            // Check we are still connected
            ObjectImpl objectImpl = (ObjectImpl) object;
            objectImpl._get_delegate();
        } catch (BAD_OPERATION e) {
            try {
                // Reconnect
                final Stub stub = (Stub) object;
                final ORB orb = (ORB) new InitialContext().lookup("java:comp/ORB");
                stub.connect(orb);
            } catch (NamingException ne) {
                throw EjbLogger.ROOT_LOGGER.failedToLookupORB();
            }
        }
    } else {
        throw EjbLogger.ROOT_LOGGER.notAnObjectImpl(object.getClass());
    }
}
Also used : Stub(javax.rmi.CORBA.Stub) NamingException(javax.naming.NamingException) BAD_OPERATION(org.omg.CORBA.BAD_OPERATION) ObjectImpl(org.omg.CORBA.portable.ObjectImpl) InitialContext(javax.naming.InitialContext) ORB(org.omg.CORBA.ORB)

Aggregations

InitialContext (javax.naming.InitialContext)1 NamingException (javax.naming.NamingException)1 Stub (javax.rmi.CORBA.Stub)1 BAD_OPERATION (org.omg.CORBA.BAD_OPERATION)1 ORB (org.omg.CORBA.ORB)1 ObjectImpl (org.omg.CORBA.portable.ObjectImpl)1