您的位置:程序门 -> java -> j2se / 扩展类



jms: 如何删除注销服务器上的topic


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


jms: 如何删除注销服务器上的topic
发表于:2007-12-26 10:34:18 楼主
我用的是activemq,用topic   topic   =   session.createtopic(topicname);
创建topic。因为每次启动系统都会创建名字(topicname)不一样的topic,后发现服务器上积攒了许多topic,系统关闭后
并没有被注销掉。(服务器重新启动后topic好像都没有了,不过显然不能去重启)/
有什么方法可以在代码里面删除指定topic,不知道哪位高手遇到过类似的问题,还望不吝赐教~~!   比较急,谢谢了~!
发表于:2007-12-26 14:30:141楼 得分:0
顶一下吧,
不懂
session删除后都会留着的阿
发表于:2008-01-08 14:34:142楼 得分:0
可以用jboss的invoke方法,我写了一个,你看看能不能用

        private   void   deletetopicinjboss(string   topicname)   throws   exception   {
                hashtable   <string,   string>   jndi   =   new   hashtable   <string,   string> ();
                jndi.put(context.initial_context_factory,   "org.jnp.interfaces.namingcontextfactory");
                jndi.put(context.url_pkg_prefixes,   "org.jboss.naming:org.jnp.interfaces");
                jndi.put(context.provider_url,   "localhost:1099");

                context   context   =   new   initialcontext(jndi);
                mbeanserverconnection   server   =   (mbeanserverconnection)   context.lookup("jmx/invoker/rmiadaptor");
                server.invoke(new   objectname("jboss.mq:service=destinationmanager"),
                                            "destroytopic",
                                            new   object[]   {"topic/"   +   topicname},
                                            new   string[]   {"java.lang.string"});
        }
发表于:2008-01-08 23:59:563楼 得分:0
学习学习
服务器的东东还没怎用过


快速检索

最新资讯
热门点击