浅析weblogic10 plugin中的DynamicServerList
2009-09-22 00:00:00 来源:WEB开发网ServletResponseImpl.java
1 /*package*/ final void writeHeaders() throws IOException {
2
3 HttpServer httper = getHttpServer();
4 if (httper != null) {
5 boolean isPlugin = false;
6 ServerMBean serverMBean = ManagementService.getRuntimeAccess(
7 WebAppConfigManager.KERNEL_ID).getServer();
8 if (serverMBean.getCluster() != null &&
9 request.getHeader(X_WEBLOGIC_REQUEST_CLUSTERINFO) != null) {
10
11 String hash = request.getHeader(X_WEBLOGIC_CLUSTER_HASH);
12 String oldHash = hash == null ? "" : hash;
//MemberControllerImpl is a singlton instance and it's hash is changed when cluster changs
13 String currentHash = MembershipControllerImpl.getInstance().getHash();
14 String passedHash = headers.getHeader(X_WEBLOGIC_CLUSTER_HASH);
15 if (currentHash != null && !currentHash.equals(oldHash)) {
16 String[] servers =
17 MembershipControllerImpl.getInstance().getClusterList(
18 request.getConnection().getChannel());
19
20 headers.setHeader(X_WEBLOGIC_CLUSTER_HASH, currentHash);
21 headers.setHeader(X_WEBLOGIC_CLUSTER_LIST, sb.toString());//sb presents servers list string
22 }
23 }
24 }
25 }
更多精彩
赞助商链接