001 /**
002 *
003 * Copyright 2004 Protique Ltd
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 *
017 **/
018 package org.activemq.transport.multicast;
019
020 import EDU.oswego.cs.dl.util.concurrent.SynchronizedBoolean;
021 import org.apache.commons.logging.Log;
022 import org.apache.commons.logging.LogFactory;
023 import org.activemq.io.WireFormat;
024 import org.activemq.transport.TransportServerChannelSupport;
025
026 import javax.jms.JMSException;
027 import java.net.URI;
028
029 /**
030 * A Multicast implementation of TransportServerChannel
031 *
032 * @version $Revision: 1.1.1.1 $
033 */
034 public class MulticastTransportServerChannel extends TransportServerChannelSupport {
035
036 private static final Log log = LogFactory.getLog(MulticastTransportServerChannel.class);
037
038 protected URI bindAddress;
039 private SynchronizedBoolean started;
040
041 public MulticastTransportServerChannel(WireFormat wireFormat, URI bindAddr) {
042 super(bindAddr);
043 this.bindAddress = bindAddr;
044 started = new SynchronizedBoolean(false);
045 log.info("ServerChannel at: " + bindAddress);
046 }
047
048
049 /**
050 * start listeneing for events
051 *
052 * @throws JMSException if an error occurs
053 */
054 public void start() throws JMSException {
055 if (started.commit(false, true)) {
056 }
057 }
058
059 /**
060 * @return pretty print of this
061 */
062 public String toString() {
063 return "MulticastTransportServerChannel@" + bindAddress;
064 }
065 }