KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > broker > jmx > ManagedTransportConnector


1 /**
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one or more
4  * contributor license agreements. See the NOTICE file distributed with
5  * this work for additional information regarding copyright ownership.
6  * The ASF licenses this file to You under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with
8  * the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.apache.activemq.broker.jmx;
19
20 import org.apache.activemq.broker.Broker;
21 import org.apache.activemq.broker.Connection;
22 import org.apache.activemq.broker.TransportConnector;
23 import org.apache.activemq.transport.Transport;
24 import org.apache.activemq.transport.TransportServer;
25
26 import javax.management.MBeanServer JavaDoc;
27 import javax.management.ObjectName JavaDoc;
28
29 import java.io.IOException JavaDoc;
30 import java.net.URISyntaxException JavaDoc;
31
32 /**
33  * A managed transport connector which can create multiple managed connections
34  * as clients connect.
35  *
36  * @version $Revision: 1.1 $
37  */

38 public class ManagedTransportConnector extends TransportConnector {
39
40     static long nextConnectionId = 1;
41     
42     private final MBeanServer JavaDoc mbeanServer;
43     private final ObjectName JavaDoc connectorName;
44
45     public ManagedTransportConnector(MBeanServer JavaDoc mbeanServer, ObjectName JavaDoc connectorName, Broker next, TransportServer server) {
46         super(next, server);
47         this.mbeanServer = mbeanServer;
48         this.connectorName = connectorName;
49     }
50
51     public ManagedTransportConnector asManagedConnector(MBeanServer JavaDoc mbeanServer, ObjectName JavaDoc connectorName) throws IOException JavaDoc, URISyntaxException JavaDoc {
52         return this;
53     }
54
55     protected Connection createConnection(Transport transport) throws IOException JavaDoc {
56         return new ManagedTransportConnection(this, transport, getBroker(), isDisableAsyncDispatch() ? null : getTaskRunnerFactory(), mbeanServer, connectorName);
57     }
58
59     protected static synchronized long getNextConnectionId() {
60         return nextConnectionId++;
61     }
62
63 }
64
Popular Tags