1 package com.ubermq.jms.server.journal.impl; 2 3 import com.ubermq.jms.server.journal.*; 4 import com.ubermq.kernel.*; 5 import java.io.*; 6 7 12 public class SingletonArbiter 13 implements DurableConnectionArbiter 14 { 15 private DatagramSink theNode; 16 17 public SingletonArbiter() 18 { 19 theNode = null; 20 } 21 22 public void output(IDatagram d, 23 IOverflowHandler h) 24 throws IOException 25 { 26 if (theNode != null) 27 theNode.output(d, h); 28 else throw new IOException(); 29 } 30 31 public boolean isOpen() 32 { 33 return (theNode != null && theNode.isOpen()); 34 } 35 36 public void connect(DatagramSink cdn) 37 { 38 theNode = cdn; 39 } 40 41 public void disconnect(DatagramSink cdn) 42 { 43 if (theNode.equals(cdn)) 44 theNode = null; 45 } 46 47 public void disconnectAll() 48 { 49 theNode = null; 50 } 51 52 58 public String toHtml() 59 { 60 if (theNode != null) 61 return "<b>Connection: </b>" + AbstractMultipleArbiter.getDisplayName(theNode); 62 else 63 return "<b>Disconnected</b>"; 64 } 65 66 67 } 68 | Popular Tags |