Search in sources :

Example 1 with ResourcePOATie

use of org.omg.CosTransactions.ResourcePOATie in project narayana by jbosstm.

the class ServiceImpl01 method oper.

public void oper(ResourceBehavior[] resource_behaviors, Control ctrl) {
    _resourceImpl = new ResourceImpl01[resource_behaviors.length];
    _resource = new Resource[resource_behaviors.length];
    for (int index = 0; index < resource_behaviors.length; index++) {
        try {
            _resourceImpl[index] = new ResourceImpl01(_objectNumber, index, resource_behaviors[index]);
            ResourcePOATie servant = new ResourcePOATie(_resourceImpl[index]);
            OAInterface.objectIsReady(servant);
            _resource[index] = ResourceHelper.narrow(OAInterface.corbaReference(servant));
            ctrl.get_coordinator().register_resource(_resource[index]);
        } catch (Exception exception) {
            System.err.println("ImplicitObjectImpl01.oper: " + exception);
            exception.printStackTrace(System.err);
            _isCorrect = false;
        }
    }
}
Also used : ResourcePOATie(org.omg.CosTransactions.ResourcePOATie)

Example 2 with ResourcePOATie

use of org.omg.CosTransactions.ResourcePOATie in project narayana by jbosstm.

the class ServiceImpl01 method setup_oper.

public void setup_oper(int number_of_resources) {
    _resourceImpl = new ResourceImpl01[number_of_resources];
    _resource = new Resource[number_of_resources];
    _recoveryCoordinator = new RecoveryCoordinator[number_of_resources];
    for (int index = 0; index < number_of_resources; index++) {
        try {
            _resourceImpl[index] = new ResourceImpl01(_objectNumber, index);
            ResourcePOATie servant = new ResourcePOATie(_resourceImpl[index]);
            OAInterface.objectIsReady(servant);
            _resource[index] = ResourceHelper.narrow(OAInterface.corbaReference(servant));
            _recoveryCoordinator[index] = OTS.current().get_control().get_coordinator().register_resource(_resource[index]);
        } catch (Exception exception) {
            System.err.println("ServiceImpl01.setup_oper: " + exception);
            exception.printStackTrace(System.err);
            _isCorrect = false;
        }
    }
}
Also used : ResourcePOATie(org.omg.CosTransactions.ResourcePOATie)

Example 3 with ResourcePOATie

use of org.omg.CosTransactions.ResourcePOATie in project narayana by jbosstm.

the class BeforeCrashServiceImpl01 method setup_oper.

public void setup_oper(ResourceBehavior[] resource_behaviors) {
    ResourceImpl01[] resourceImpl = new ResourceImpl01[resource_behaviors.length];
    Resource[] resource = new Resource[resource_behaviors.length];
    RecoveryCoordinator[] recoveryCoordinator = new RecoveryCoordinator[resource_behaviors.length];
    for (int index = 0; index < resource_behaviors.length; index++) {
        try {
            resourceImpl[index] = new ResourceImpl01(_serviceNumber, _objectNumber, index, resource_behaviors[index]);
            ResourcePOATie servant = new ResourcePOATie(resourceImpl[index]);
            OAInterface.objectIsReady(servant);
            resource[index] = ResourceHelper.narrow(OAInterface.corbaReference(servant));
            recoveryCoordinator[index] = OTS.current().get_control().get_coordinator().register_resource(resource[index]);
            System.out.println("BeforeCrashServiceImpl01: storing IOR \"RecoveryCoordinator_" + _serviceNumber + "_" + _objectNumber + "_" + index + "\"");
            ServerIORStore.storeIOR("RecoveryCoordinator_" + _serviceNumber + "_" + _objectNumber + "_" + index, ORBInterface.orb().object_to_string(recoveryCoordinator[index]));
        } catch (Exception exception) {
            System.err.println("BeforeCrashServiceImpl01.setup_oper: " + exception);
            exception.printStackTrace(System.err);
            _isCorrect = false;
        }
    }
}
Also used : Resource(org.omg.CosTransactions.Resource) RecoveryCoordinator(org.omg.CosTransactions.RecoveryCoordinator) ResourcePOATie(org.omg.CosTransactions.ResourcePOATie)

Example 4 with ResourcePOATie

use of org.omg.CosTransactions.ResourcePOATie in project narayana by jbosstm.

the class ServiceImpl02 method oper.

public void oper(ResourceBehavior[] resource_behaviors) {
    _resourceImpl = new ResourceImpl01[resource_behaviors.length];
    _resource = new Resource[resource_behaviors.length];
    for (int index = 0; index < resource_behaviors.length; index++) {
        try {
            _resourceImpl[index] = new ResourceImpl01(_objectNumber, index, resource_behaviors[index]);
            ResourcePOATie servant = new ResourcePOATie(_resourceImpl[index]);
            OAInterface.objectIsReady(servant);
            _resource[index] = ResourceHelper.narrow(OAInterface.corbaReference(servant));
            try {
                OTS.current().get_control().get_coordinator().register_resource(_resource[index]);
                _isCorrect = false;
            } catch (TRANSACTION_ROLLEDBACK transactionRolledback) {
            }
        } catch (Exception exception) {
            System.err.println("ServiceImpl02.oper: " + exception);
            exception.printStackTrace(System.err);
            _isCorrect = false;
        }
    }
}
Also used : TRANSACTION_ROLLEDBACK(org.omg.CORBA.TRANSACTION_ROLLEDBACK) ResourcePOATie(org.omg.CosTransactions.ResourcePOATie)

Example 5 with ResourcePOATie

use of org.omg.CosTransactions.ResourcePOATie in project narayana by jbosstm.

the class ServiceImpl02 method oper.

public void oper(ResourceBehavior[] resource_behaviors, Control ctrl) {
    _resourceImpl = new ResourceImpl01[resource_behaviors.length];
    _resource = new Resource[resource_behaviors.length];
    for (int index = 0; index < resource_behaviors.length; index++) {
        try {
            _resourceImpl[index] = new ResourceImpl01(_objectNumber, index, resource_behaviors[index]);
            ResourcePOATie servant = new ResourcePOATie(_resourceImpl[index]);
            OAInterface.objectIsReady(servant);
            _resource[index] = ResourceHelper.narrow(OAInterface.corbaReference(servant));
            try {
                ctrl.get_coordinator().register_resource(_resource[index]);
                _isCorrect = false;
            } catch (TRANSACTION_ROLLEDBACK transactionRolledback) {
            }
        } catch (Exception exception) {
            System.err.println("ImplicitObjectImpl01.oper: " + exception);
            exception.printStackTrace(System.err);
            _isCorrect = false;
        }
    }
}
Also used : TRANSACTION_ROLLEDBACK(org.omg.CORBA.TRANSACTION_ROLLEDBACK) ResourcePOATie(org.omg.CosTransactions.ResourcePOATie)

Aggregations

ResourcePOATie (org.omg.CosTransactions.ResourcePOATie)6 TRANSACTION_ROLLEDBACK (org.omg.CORBA.TRANSACTION_ROLLEDBACK)2 RecoveryCoordinator (org.omg.CosTransactions.RecoveryCoordinator)1 Resource (org.omg.CosTransactions.Resource)1