本文整理了Java中com.sun.enterprise.config.serverbeans.Server.getCluster()
方法的一些代码示例,展示了Server.getCluster()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.getCluster()
方法的具体详情如下:
包路径:com.sun.enterprise.config.serverbeans.Server
类名称:Server
方法名:getCluster
[英]Returns the cluster instance this instance is referenced in or null if there is no cluster referencing this server instance.
[中]返回引用此实例的群集实例,如果没有引用此服务器实例的群集,则返回null。
代码示例来源:origin: org.glassfish.admin/config-api
public static List<Cluster> getClustersOnNode(Domain domain, String nodeName) {
HashMap<String,Cluster> clMap = new HashMap<String,Cluster>();
List<Server> serverList = getInstancesOnNode(domain, nodeName);
try {
for(Server server : serverList) {
Cluster mycl = server.getCluster();
if(nodeName.equals(server.getNodeRef()) ) {
clMap.put(mycl.getName(),mycl);
}
}
}
catch(Exception e) {
Logger.getAnonymousLogger().warning("Error when getting clusters on node " + e.getLocalizedMessage());
}
return new ArrayList(clMap.values());
}
代码示例来源:origin: org.glassfish.main.admin/config-api
public static List<Cluster> getClustersOnNode(Domain domain, String nodeName) {
HashMap<String,Cluster> clMap = new HashMap<String,Cluster>();
List<Server> serverList = getInstancesOnNode(domain, nodeName);
try {
for(Server server : serverList) {
Cluster mycl = server.getCluster();
if(nodeName.equals(server.getNodeRef()) ) {
clMap.put(mycl.getName(),mycl);
}
}
}
catch(Exception e) {
logger.log(Level.WARNING, ConfigApiLoggerInfo.errorGettingCluster, e.getLocalizedMessage());
}
return new ArrayList(clMap.values());
}
代码示例来源:origin: org.glassfish.main.resourcebase.resources/nucleus-resources
public Set<String> getTargetsReferringResourceRef(String refName) {
Set<String> targets = new HashSet<String>();
List<Server> servers = domain.getServers().getServer();
for(Server server: servers){
if(server.getResourceRef(refName) != null){
if(server.getCluster() != null){
targets.add(server.getCluster().getName());
}else if(server.isDas()){
targets.add(SystemPropertyConstants.DAS_SERVER_NAME);
}else if(server.isInstance()){
targets.add(server.getName());
}
}
}
return targets;
}
代码示例来源:origin: org.glassfish.admin/admin-util
public Set<String> getTargetsReferringResourceRef(String refName) {
Set<String> targets = new HashSet<String>();
List<Server> servers = domain.getServers().getServer();
for(Server server: servers){
if(server.getResourceRef(refName) != null){
if(server.getCluster() != null){
targets.add(server.getCluster().getName());
}else if(server.isDas()){
targets.add(SystemPropertyConstants.DAS_SERVER_NAME);
}else if(server.isInstance()){
targets.add(server.getName());
}
}
}
return targets;
}
代码示例来源:origin: org.glassfish.main.cluster/cluster-admin
boolean clustered = server.getCluster() != null;
代码示例来源:origin: org.glassfish.cluster/cluster-admin
boolean clustered = server.getCluster() != null;
代码示例来源:origin: org.glassfish.main.admin/config-api
protected void decorate() {
Server server = habitat.getService(Server.class, env.getInstanceName());
if (server == null) {
LogRecord lr = new LogRecord(Level.SEVERE,
badEnv);
lr.setLoggerName(getClass().getName());
EarlyLogHandler.earlyMessages.add(lr);
return;
}
ServiceLocatorUtilities.addOneConstant(habitat, server,
ServerEnvironment.DEFAULT_INSTANCE_NAME, Server.class);
server.getConfig().addIndex(habitat, ServerEnvironment.DEFAULT_INSTANCE_NAME);
Cluster c = server.getCluster();
if (c != null) {
ServiceLocatorUtilities.addOneConstant(habitat, c,
ServerEnvironment.DEFAULT_INSTANCE_NAME, Cluster.class);
}
}
代码示例来源:origin: org.glassfish.main.cluster/gms-bootstrap
/**
* Starts the application loader service.
*/
@Override
public void postConstruct() {
if (startupContext != null) {
Properties args = startupContext.getArguments();
if (args != null && Boolean.valueOf(args.getProperty("-upgrade"))) {
return;
}
}
if (clusters != null) {
if (env.isDas()) {
checkAllClusters(clusters);
} else {
Cluster cluster = server.getCluster();
if (cluster != null) {
checkCluster(cluster);
}
}
}
}
代码示例来源:origin: eclipse-ee4j/glassfish
/**
* Starts the application loader service.
*/
@Override
public void postConstruct() {
if (startupContext != null) {
Properties args = startupContext.getArguments();
if (args != null && Boolean.valueOf(args.getProperty("-upgrade"))) {
return;
}
}
if (clusters != null) {
if (env.isDas()) {
checkAllClusters(clusters);
} else {
Cluster cluster = server.getCluster();
if (cluster != null) {
checkCluster(cluster);
}
}
}
}
代码示例来源:origin: org.glassfish.main.cluster/cluster-admin
private List<Cluster> createClusterList() {
// 1. no whichTarget specified
if (!StringUtils.ok(whichTarget))
return allClusters.getCluster();
ReferenceContainer rc = domain.getReferenceContainerNamed(whichTarget);
// 2. Not a server or a cluster. Could be a config or a Node
if (rc == null) {
return getClustersForNodeOrConfig();
}
else if (rc.isServer()) {
Server s =((Server) rc);
List<Cluster> cl = new LinkedList<Cluster>();
cl.add(s.getCluster());
return cl;
}
else if (rc.isCluster()) {
Cluster cluster = (Cluster) rc;
List<Cluster> cl = new LinkedList<Cluster>();
cl.add(cluster);
return cl;
}
else
return null;
}
代码示例来源:origin: org.glassfish.cluster/cluster-admin
private List<Cluster> createClusterList() {
// 1. no whichTarget specified
if (!StringUtils.ok(whichTarget))
return allClusters.getCluster();
ReferenceContainer rc = domain.getReferenceContainerNamed(whichTarget);
// 2. Not a server or a cluster. Could be a config or a Node
if (rc == null) {
return getClustersForNodeOrConfig();
}
else if (rc.isServer()) {
Server s =((Server) rc);
List<Cluster> cl = new LinkedList<Cluster>();
cl.add(s.getCluster());
return cl;
}
else if (rc.isCluster()) {
Cluster cluster = (Cluster) rc;
List<Cluster> cl = new LinkedList<Cluster>();
cl.add(cluster);
return cl;
}
else
return null;
}
代码示例来源:origin: org.glassfish.main.admin/config-api
public static List<String> getAllTargets(Domain d) {
List<String> targets = new ArrayList<String>();
// only add non-clustered servers as the cluster
// targets will be separately added
for (Server server : d.getServers().getServer()) {
if (server.getCluster() == null) {
targets.add(server.getName());
}
}
if (d.getClusters() != null) {
for (Cluster cluster : d.getClusters().getCluster()) {
targets.add(cluster.getName());
}
}
return targets;
}
代码示例来源:origin: org.glassfish.admin/config-api
public static List<String> getAllTargets(Domain d) {
List<String> targets = new ArrayList<String>();
// only add non-clustered servers as the cluster
// targets will be separately added
for (Server server : d.getServers().getServer()) {
if (server.getCluster() == null) {
targets.add(server.getName());
}
}
if (d.getClusters() != null) {
for (Cluster cluster : d.getClusters().getCluster()) {
targets.add(cluster.getName());
}
}
return targets;
}
代码示例来源:origin: org.glassfish.main.cluster/gms-adapter
instanceName = env.getInstanceName();
isDas = env.isDas();
cluster = server.getCluster();
if (cluster == null && clusters != null) {
代码示例来源:origin: org.glassfish.admin/config-api
protected void decorate() {
Server server = habitat.getComponent(Server.class, env.getInstanceName());
habitat.addIndex(new ExistingSingletonInhabitant<Server>(server),
Server.class.getName(), ServerEnvironment.DEFAULT_INSTANCE_NAME);
habitat.addIndex(new ExistingSingletonInhabitant<Config>(habitat.getComponent(Config.class, server.getConfigRef())),
Config.class.getName(), ServerEnvironment.DEFAULT_INSTANCE_NAME);
Cluster c = server.getCluster();
if (c != null) {
habitat.addIndex(new ExistingSingletonInhabitant<Cluster>(c),
Cluster.class.getName(), ServerEnvironment.DEFAULT_INSTANCE_NAME);
}
}
代码示例来源:origin: org.glassfish.main.orb/orb-iiop
private Map<String,ClusterInstanceInfo> getAllClusterInstanceInfo() {
final Cluster myCluster = myServer.getCluster() ;
fineLog( "getAllClusterInstanceInfo: myCluster {0}", myCluster ) ;
final Config myConfig = getConfigForServer( myServer ) ;
fineLog( "getAllClusterInstanceInfo: myConfig {0}", myConfig ) ;
final Map<String,ClusterInstanceInfo> result =
new HashMap<String,ClusterInstanceInfo>() ;
//When myServer is DAS's situation, myCluster is null.
//null check is needed.
if (myCluster != null) {
for (Server server : myCluster.getInstances()) {
ClusterInstanceInfo cii = getClusterInstanceInfo(server,
myConfig, false);
if (cii != null) {
result.put(server.getName(), cii);
}
}
}
fineLog( "getAllClusterInstanceInfo: result {0}", result ) ;
return result ;
}
代码示例来源:origin: org.glassfish.main.core/kernel
final boolean isNewInstanceAppRefStateEnabled)
throws TransactionFailure, PropertyVetoException {
final Cluster clusterContainingInstance = servr.getCluster();
if (clusterContainingInstance != null) {
代码示例来源:origin: org.glassfish.main.connectors/connectors-inbound-runtime
Cluster cluster = domain.getServerNamed(instanceName).getCluster();
代码示例来源:origin: org.glassfish.main.core/kernel
private void setSystemPropertiesFromDomainXml() {
// precedence order from high to low
// 0. server
// 1. cluster
// 2. <server>-config or <cluster>-config
// 3. domain
// so we need to add System Properties in *reverse order* to get the
// right precedence.
List<SystemProperty> domainSPList = domain.getSystemProperty();
List<SystemProperty> configSPList = getConfigSystemProperties();
Cluster cluster = server.getCluster();
List<SystemProperty> clusterSPList = null;
if (cluster != null) {
clusterSPList = cluster.getSystemProperty();
}
List<SystemProperty> serverSPList = server.getSystemProperty();
setSystemProperties(
domainSPList);
setSystemProperties(
configSPList);
if (clusterSPList != null) {
setSystemProperties(clusterSPList);
}
setSystemProperties(serverSPList);
}
代码示例来源:origin: org.glassfish.main.core/kernel
defs++;
Server server = (Server)bag;
Cluster cluster = server.getCluster();
if (cluster != null && cluster.containsProperty(propName))
defs++;
内容来源于网络,如有侵权,请联系作者删除!