2 * Copyright 2015 Open Networking Laboratory
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.onosproject.store.cluster.messaging.impl;
18 import org.apache.felix.scr.annotations.Activate;
19 import org.apache.felix.scr.annotations.Component;
20 import org.apache.felix.scr.annotations.Deactivate;
21 import org.apache.felix.scr.annotations.Reference;
22 import org.apache.felix.scr.annotations.ReferenceCardinality;
23 import org.apache.felix.scr.annotations.Service;
24 import org.onlab.nio.service.IOLoopMessaging;
25 import org.onosproject.cluster.ClusterDefinitionService;
26 import org.onosproject.cluster.ControllerNode;
27 import org.onosproject.store.cluster.messaging.Endpoint;
28 import org.slf4j.Logger;
29 import org.slf4j.LoggerFactory;
32 * IOLoop based MessagingService.
34 @Component(immediate = true, enabled = false)
36 public class IOLoopMessagingManager extends IOLoopMessaging {
38 private final Logger log = LoggerFactory.getLogger(getClass());
40 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
41 protected ClusterDefinitionService clusterDefinitionService;
44 public void activate() throws Exception {
45 ControllerNode localNode = clusterDefinitionService.localNode();
46 super.start(new Endpoint(localNode.ip(), localNode.tcpPort()));
51 public void deactivate() throws Exception {