1 29 30 package com.caucho.server.cluster; 31 32 import com.caucho.server.hmux.HmuxProtocol; 33 import com.caucho.server.port.Port; 34 import com.caucho.util.L10N; 35 36 import javax.annotation.PostConstruct; 37 38 41 public class ClusterPort extends Port { 42 private static final L10N L = new L10N(ClusterPort.class); 43 44 private ClusterServer _server; 45 46 private int _clientWeight = 100; 47 48 public ClusterPort(ClusterServer server) 49 { 50 _server = server; 51 52 try { 53 setAddress("127.0.0.1"); 54 setPort(6800); 55 56 setProtocol(new HmuxProtocol()); 57 } catch (Exception e) { 58 throw new RuntimeException (e); 59 } 60 } 61 62 65 public ClusterServer getClusterServer() 66 { 67 return _server; 68 } 69 70 73 public int getIndex() 74 { 75 return _server.getIndex(); 76 } 77 78 81 public void setClientWeight(int weight) 82 { 83 _clientWeight = weight; 84 } 85 86 89 public int getClientWeight() 90 { 91 return _clientWeight; 92 } 93 94 @PostConstruct 95 public void init() 96 { 97 } 98 99 public String toString() 100 { 101 if (getAddress() != null) 102 return "ClusterPort[address=" + getAddress() + ",port=" + getPort() + "]"; 103 else 104 return "ClusterPort[address=*,port=" + getPort() + "]"; 105 } 106 } 107 | Popular Tags |