📄 multicastserver.java
字号:
package net.sf.dz.pnp;import org.freehold.jukebox.logger.LogChannel;import org.freehold.jukebox.service.ActiveService;/** * An abstract multicast server. * * <p> * * Provides a protocol independent announcer abstraction for plug-and-play * features. * * @author Copyright © <a href="mailto:vt@freehold.crocodile.org">Vadim Tkachenko</a> 2004 * @version $Id: MulticastServer.java,v 1.2 2004/06/28 20:35:49 vtt Exp $ */abstract public class MulticastServer extends ActiveService { public static final LogChannel CH_MS = new LogChannel("MulticastServer"); private String message; /** * Make an announce. * * The message will be broadcast immediately, and then repeated * according to predefined announce interval. If no message was supplied * yet, no message will be broadcast. * * @param message Message to broadcast. */ public final void announce(String message) { this.message = message; } protected final void execute() throws Throwable { while ( isEnabled() ) { try { if ( message != null ) { complain(LOG_DEBUG, CH_MS, "Announcing: " + message); announce(); } } catch ( Throwable t ) { complain(LOG_WARNING, CH_MS, "Failed to announce", t); } // VT: FIXME: Now, this is cruel to the network... Thread.sleep(5000); } } abstract protected void announce() throws Throwable; /** * Get the announcement message. */ public String getMessage() { return message; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -