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.jrms;
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 JRMS implementation of TransportServerChannel
031 *
032 * @version $Revision$
033 */
034 public class JRMSTransportServerChannel extends TransportServerChannelSupport {
035
036 private static final Log log = LogFactory.getLog(JRMSTransportServerChannel.class);
037
038 private SynchronizedBoolean started;
039
040
041 public JRMSTransportServerChannel(WireFormat wireFormat, URI bindAddr) {
042 super(bindAddr);
043 started = new SynchronizedBoolean(false);
044 }
045
046
047 /**
048 * start listeneing for events
049 *
050 * @throws JMSException if an error occurs
051 */
052 public void start() throws JMSException {
053 if (started.commit(false, true)) {
054 log.info("JRMS ServerChannel at: " + getUrl());
055 }
056 }
057
058
059 /**
060 * @return pretty print of this
061 */
062 public String toString() {
063 return "JRMSTransportServerChannel@" + getUrl();
064 }
065 }