Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
黄志磊
committed
Dec 31, 2015
1 parent
8baa691
commit 65b9fd8
Showing
3 changed files
with
56 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
mpush-tools/src/main/java/com/shinemo/mpush/tools/zk/manage/ServerAppManage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.shinemo.mpush.tools.zk.manage; | ||
|
||
import java.util.Collection; | ||
import java.util.Collections; | ||
import java.util.Map; | ||
|
||
import org.apache.commons.lang3.builder.ToStringBuilder; | ||
import org.apache.commons.lang3.builder.ToStringStyle; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import com.google.common.collect.Maps; | ||
import com.shinemo.mpush.tools.zk.ServerApp; | ||
|
||
/** | ||
* 系统中当前可用的app列表 | ||
* | ||
*/ | ||
public class ServerAppManage { | ||
|
||
private static final Logger log = LoggerFactory.getLogger(ServerAppManage.class); | ||
|
||
private static Map<String,ServerApp> holder = Maps.newConcurrentMap(); | ||
|
||
public static final ServerAppManage instance = new ServerAppManage(); | ||
|
||
private ServerAppManage() { | ||
} | ||
|
||
public void addOrUpdate(String fullPath,ServerApp app){ | ||
printAppList(); | ||
} | ||
|
||
public void remove(String fullPath){ | ||
printAppList(); | ||
} | ||
|
||
public void init(){ | ||
printAppList(); | ||
} | ||
|
||
public Collection<ServerApp> getAppList() { | ||
return Collections.unmodifiableCollection(holder.values()); | ||
} | ||
|
||
private void printAppList(){ | ||
for(ServerApp app:holder.values()){ | ||
log.warn(ToStringBuilder.reflectionToString(app, ToStringStyle.DEFAULT_STYLE)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters