Archived

This forum has been archived. Please start a new discussion on GitHub.

Enhancement request: IceStorm.TopicManager.createOrRetrieve

Hello all,

Every time that I need to get an IceStorm topic, I need to write the same double try-catch sequence like this:
        TopicManagerPrx tm = // ... initialisation

        TopicPrx langTopic = null;
        try {
            langTopic = tm.create(_LanguageListenerDisp.ice_staticId());
        } catch (TopicExists e) {
            try {
                langTopic = tm.retrieve(_LanguageListenerDisp.ice_staticId());
            } catch (NoSuchTopic e2) {
                logger.log(LogLevel.Warning, "Couldn't connect to language listener topic");
            }
        }

It would be really nice if TopicManagerPrx provided an atomic "createOrRetrieve" method that would encapsulate all of that boilerplate...

MEF

Comments