Skip to content

Commit

Permalink
[#1058] cluster code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
minwoo-jung authored and Xylus committed Apr 13, 2017
1 parent 683fdc6 commit bd96699
Show file tree
Hide file tree
Showing 10 changed files with 379 additions and 283 deletions.
@@ -0,0 +1,35 @@
/*
* Copyright 2017 NAVER Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.pinpoint.collector.cluster.connection;

import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.List;

/**
* @author minwoo.jung
*/
public interface ClusterConnectionManager {
void start();

void stop();

void connectPointIfAbsent(InetSocketAddress address);

public void disconnectPoint(SocketAddress address);

public List<SocketAddress> getConnectedAddressList();
}
Expand Up @@ -30,7 +30,7 @@
/**
* @Author Taejin Koo
*/
public class CollectorClusterConnectionManager {
public class CollectorClusterConnectionManager implements ClusterConnectionManager {

private final Logger logger = LoggerFactory.getLogger(this.getClass());

Expand All @@ -53,6 +53,7 @@ public CollectorClusterConnectionManager(String clusterId, CollectorClusterConne
this.clusterAcceptor = acceptor;
}

@Override
public void start() {
logger.info("{} initialization started.", ClassUtils.simpleClassName(this));

Expand All @@ -67,6 +68,7 @@ public void start() {
logger.info("{} initialization completed.", ClassUtils.simpleClassName(this));
}

@Override
public void stop() {
logger.info("{} destroying started.", ClassUtils.simpleClassName(this));

Expand All @@ -87,6 +89,7 @@ public void stop() {
logger.info("{} destroying completed.", ClassUtils.simpleClassName(this));
}

@Override
public void connectPointIfAbsent(InetSocketAddress address) {
logger.info("localhost -> {} connect started.", address);

Expand All @@ -100,6 +103,7 @@ public void connectPointIfAbsent(InetSocketAddress address) {
logger.info("localhost -> {} connect completed.", address);
}

@Override
public void disconnectPoint(SocketAddress address) {
logger.info("localhost -> {} disconnect started.", address);

Expand All @@ -112,6 +116,7 @@ public void disconnectPoint(SocketAddress address) {
}
}

@Override
public List<SocketAddress> getConnectedAddressList() {
return socketRepository.getAddressList();
}
Expand Down

0 comments on commit bd96699

Please sign in to comment.