2009-10-28 48 views
0

我是JBOSS的新手。我正在嘗試編寫一個mBean,它將使用JGroups通過多播信道從AS內進行通信。我用我的MBean是下面的代碼...JBOSS AppServer和客戶端通過多播進行通信

public void create() throws Exception { 
channel=new JChannel("test/udp.xml"); 
channel.connect("ChatCluster"); 

}

public void sendMsg() throws ChannelNotConnectedException, 
             ChannelClosedException { 
channel.send(new org.jgroups.Message(
        null,null, "hello from the server!")); 

}

我還創建了一個客戶端,在通道上監聽,但兩者不溝通..這是通道的XML ..

<UDP 
    mcast_port="45700" 
    mcast_addr="224.0.0.11" 
    tos="8" 
    ucast_recv_buf_size="20000000" 
    ucast_send_buf_size="640000" 
    mcast_recv_buf_size="25000000" 
    mcast_send_buf_size="640000" 
    loopback="true" 
    discard_incompatible_packets="true" 
    max_bundle_size="64000" 
    max_bundle_timeout="30" 
    ip_ttl="${jgroups.udp.ip_ttl:32}" 
    enable_bundling="true" 
    enable_diagnostics="true" 
    thread_naming_pattern="cl" 

    thread_pool.enabled="true" 
    thread_pool.min_threads="2" 
    thread_pool.max_threads="8" 
    thread_pool.keep_alive_time="5000" 
    thread_pool.queue_enabled="true" 
    thread_pool.queue_max_size="10000" 
    thread_pool.rejection_policy="discard" 

    oob_thread_pool.enabled="true" 
    oob_thread_pool.min_threads="1" 
    oob_thread_pool.max_threads="8" 
    oob_thread_pool.keep_alive_time="5000" 
    oob_thread_pool.queue_enabled="false" 
    oob_thread_pool.queue_max_size="100" 
    oob_thread_pool.rejection_policy="Run"/> 

任何幫助將不勝感激,因爲我花了一些配合這一點,並試圖弄清楚這一點。我寧願使用一些其他機制進行通信,但是我僅限於使用多播...長故事..

謝謝!

〜博爾特

回答

0

事實證明,我的系統上有多個NIC卡,所以我設置了標誌receive_on_all_interfaces =「true」。

0

是您的網絡設置爲多播? JGroups的文檔有幾個指針。東西不工作,還有一些測試程序。請參閱Installation Guide,第2.6節。如果你的網絡沒問題,那麼簡單的程序就可以開箱即用了。如果是這樣的話,我會選擇一個已知的JGroups配置,然後配置你的系統,並從那裏開始工作。

+0

是的,平局確實有效。如果運行兩個使用上述XML的客戶端,他們會「彼此看」。問題是試圖讓mBean「看」客戶,反之亦然。我猜它與JBOSS配置有關...... – Boltimuss 2009-10-28 15:41:42

相關問題