当前位置: 首页>>代码示例>>Java>>正文


Java ServiceDiscoveryEvent类代码示例

本文整理汇总了Java中net.jini.lookup.ServiceDiscoveryEvent的典型用法代码示例。如果您正苦于以下问题:Java ServiceDiscoveryEvent类的具体用法?Java ServiceDiscoveryEvent怎么用?Java ServiceDiscoveryEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ServiceDiscoveryEvent类属于net.jini.lookup包,在下文中一共展示了ServiceDiscoveryEvent类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: serviceAdded

import net.jini.lookup.ServiceDiscoveryEvent; //导入依赖的package包/类
@Override
public void serviceAdded(final ServiceDiscoveryEvent event) {
    final ServiceItem serviceItem = event.getPostEventServiceItem();
    final Object service = serviceItem.service;
    if (service instanceof GSM) {
        initGSM((GSM) service, serviceItem.serviceID, serviceItem);
    } else if (service instanceof ESM) {
        initESM((ESM) service, serviceItem.serviceID, serviceItem);
    } else if (service instanceof GSA) {
        initGSA((GSA) service, serviceItem.serviceID, serviceItem);
    } else if (service instanceof GSC) {
        initGSC((GSC) service, serviceItem.serviceID, serviceItem);
    } else if (service instanceof PUServiceBean) {
        initPU((PUServiceBean) service, serviceItem.serviceID, serviceItem);
    } else if (service instanceof IJSpace) {
        initSpaceProxy((ISpaceProxy) service, serviceItem.serviceID);
    }
}
 
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:19,代码来源:DiscoveryService.java

示例2: serviceAdded

import net.jini.lookup.ServiceDiscoveryEvent; //导入依赖的package包/类
public synchronized void serviceAdded(ServiceDiscoveryEvent event) {
    PUServiceBean service = (PUServiceBean) event.getPostEventServiceItem().service;
    try {
        Object[] details = service.listServiceDetails();
        ClusterInfo clusterInfo = service.getClusterInfo();
        for (Object detail : details) {
            if (detail instanceof JeeServiceDetails) {
                JeeServiceDetails jeeDetails = (JeeServiceDetails) detail;
                LoadBalancerInfo loadBalancersInfo = loadBalancersInfoMap.get(clusterInfo.getName());
                if (loadBalancersInfo == null) {
                    loadBalancersInfo = new LoadBalancerInfo(clusterInfo.getName());
                    loadBalancersInfoMap.put(clusterInfo.getName(), loadBalancersInfo);
                }
                clusterInfoMap.put(event.getPostEventServiceItem().serviceID, clusterInfo);
                jeeServiceDetailsMap.put(event.getPostEventServiceItem().serviceID, jeeDetails);
                loadBalancersInfo.putNode(new LoadBalancerNodeInfo(event.getPostEventServiceItem().serviceID, clusterInfo, (JeeServiceDetails) detail));
                loadBalancersInfo.setDirty(true);

                System.out.println("[" + clusterInfo.getName() + "]: Adding [" + event.getPostEventServiceItem().serviceID + "] [" + jeeDetails.getHost() + ":" + jeeDetails.getPort() + jeeDetails.getContextPath() + "]");
            }
        }
    } catch (Exception e) {
        System.out.println("Failed to add service");
        e.printStackTrace(System.out);
    }
}
 
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:27,代码来源:ApacheLoadBalancerAgent.java

示例3: serviceRemoved

import net.jini.lookup.ServiceDiscoveryEvent; //导入依赖的package包/类
public synchronized void serviceRemoved(ServiceDiscoveryEvent event) {
    try {
        ClusterInfo clusterInfo = clusterInfoMap.remove(event.getPreEventServiceItem().serviceID);
        JeeServiceDetails jeeServiceDetails = jeeServiceDetailsMap.remove(event.getPreEventServiceItem().serviceID);
        if (clusterInfo != null) {
            LoadBalancerInfo loadBalancersInfo = loadBalancersInfoMap.get(clusterInfo.getName());
            if (loadBalancersInfo != null) {
                loadBalancersInfo.removeNode(new LoadBalancerNodeInfo(event.getPreEventServiceItem().serviceID, clusterInfo, jeeServiceDetails));
                loadBalancersInfo.setDirty(true);
                System.out.println("[" + clusterInfo.getName() + "]: Removing [" + event.getPreEventServiceItem().serviceID + "] [" + jeeServiceDetails.getHost() + ":" + jeeServiceDetails.getPort() + jeeServiceDetails.getContextPath() + "]");
            }
        }
    } catch (Exception e) {
        System.out.println("Failed to remove service");
        e.printStackTrace(System.out);
    }
}
 
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:18,代码来源:ApacheLoadBalancerAgent.java

示例4: serviceChanged

import net.jini.lookup.ServiceDiscoveryEvent; //导入依赖的package包/类
public void serviceChanged(ServiceDiscoveryEvent ev) {
	ServiceItem pre = ev.getPreEventServiceItem();
	ServiceItem post = ev.getPostEventServiceItem();

	// This should not happen
	if (pre == null && post == null) {
		logger.info(">>serviceChanged::Null serviceItem! ? ");
		return;
	} else if (pre.service == null && post.service != null) {
		logger.info(">>serviceChanged::The proxy's service is now not null \n");
		logger.info(">>serviceChanged::Proxy later: post.service ("
				+ post.service.getClass().getName() + ")\n");
	} else if (pre.service != null && post.service == null) {
		logger.info(">>serviceChanged::The service's proxy has become null::check codebase problem");
		logger.info(">>serviceChanged::Proxy later: pre.service ("
				+ pre.service.getClass().getName() + ")\n");
		cinfo.remove(post);
	} else {
		logger.debug("Service attribute has changed pre=" + pre
				+ " post=" + post);
		cinfo.remove(pre);
		cinfo.addServiceItem(post);
	}
	refreshScreen("++++ SERVICE CHANGED ++++");
}
 
开发者ID:mwsobol,项目名称:SORCER,代码行数:26,代码来源:ServiceCataloger.java

示例5: serviceRemoved

import net.jini.lookup.ServiceDiscoveryEvent; //导入依赖的package包/类
@Override
public void serviceRemoved(final ServiceDiscoveryEvent event) {
	final Object service = event.getPreEventServiceItem().service;
	final ServiceID serviceID = event.getPreEventServiceItem().serviceID;
	try {
	admin.scheduleNonBlockingStateChange(new Runnable() {
        @Override
        public void run() {
            if (service instanceof GSM) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Service Removed [GSM] with uid [" + serviceID + "]");
                }
                admin.removeGridServiceManager(serviceID.toString());
            } else if (service instanceof ESM) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Service Removed [ESM] with uid [" + serviceID + "]");
                }
                admin.removeElasticServiceManager(serviceID.toString());
            } else if (service instanceof GSA) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Service Removed [GSA] with uid [" + serviceID + "]");
                }
                admin.removeGridServiceAgent(serviceID.toString());
            } else if (service instanceof GSC) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Service Removed [GSC] with uid [" + serviceID + "]");
                }
                admin.removeGridServiceContainer(serviceID.toString());
            } else if (service instanceof PUServiceBean) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Service Removed [Processing Unit Instance] with uid [" + serviceID + "]");
                }
                admin.removeProcessingUnitInstance(serviceID.toString(), !discoverUnmanagedSpaces);
            } else if (service instanceof IJSpace) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Service Removed [Space Instance] with uid [" + serviceID + "]");
                }
                admin.removeSpaceInstance(serviceID.toString());
            }
        }
    });
    } catch (AdminClosedException e) {
        if (logger.isDebugEnabled()) {
            logger.debug(
                    "Failed to remove service " + service.getClass()
                            + " id " + serviceID
                            + " since admin is already closed", e);
        }
    }
}
 
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:51,代码来源:DiscoveryService.java

示例6: serviceChanged

import net.jini.lookup.ServiceDiscoveryEvent; //导入依赖的package包/类
@Override
public void serviceChanged(ServiceDiscoveryEvent event) {
    // TODO do we really care about this?
}
 
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:5,代码来源:DiscoveryService.java

示例7: serviceChanged

import net.jini.lookup.ServiceDiscoveryEvent; //导入依赖的package包/类
public synchronized void serviceChanged(ServiceDiscoveryEvent event) {
    // don't care about this one
}
 
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:4,代码来源:ApacheLoadBalancerAgent.java

示例8: serviceAdded

import net.jini.lookup.ServiceDiscoveryEvent; //导入依赖的package包/类
public void serviceAdded(ServiceDiscoveryEvent ev) {
	cinfo.addServiceItem(ev.getPostEventServiceItem());
	refreshScreen("++++ SERVICE ADDED ++++");
}
 
开发者ID:mwsobol,项目名称:SORCER,代码行数:5,代码来源:ServiceCataloger.java

示例9: serviceRemoved

import net.jini.lookup.ServiceDiscoveryEvent; //导入依赖的package包/类
public void serviceRemoved(ServiceDiscoveryEvent ev) {
	refreshScreen("++++ SERVICE REMOVING ++++");
	cinfo.removeServiceItem(ev.getPreEventServiceItem());
	refreshScreen("++++ SERVICE REMOVED ++++");
}
 
开发者ID:mwsobol,项目名称:SORCER,代码行数:6,代码来源:ServiceCataloger.java

示例10: serviceAdded

import net.jini.lookup.ServiceDiscoveryEvent; //导入依赖的package包/类
@Override
public void serviceAdded(ServiceDiscoveryEvent event) {
    if (filter.check(event.getPostEventServiceItem()))
        listener.serviceAdded(event);
}
 
开发者ID:mwsobol,项目名称:SORCER,代码行数:6,代码来源:FilteredServiceDiscoveryListener.java

示例11: serviceRemoved

import net.jini.lookup.ServiceDiscoveryEvent; //导入依赖的package包/类
@Override
public void serviceRemoved(ServiceDiscoveryEvent event) {
    if (filter.check(event.getPreEventServiceItem()))
        listener.serviceRemoved(event);
}
 
开发者ID:mwsobol,项目名称:SORCER,代码行数:6,代码来源:FilteredServiceDiscoveryListener.java

示例12: serviceChanged

import net.jini.lookup.ServiceDiscoveryEvent; //导入依赖的package包/类
@Override
public void serviceChanged(ServiceDiscoveryEvent event) {
    if (filter.check(event.getPreEventServiceItem())
            || filter.check(event.getPostEventServiceItem()))
        listener.serviceChanged(event);
}
 
开发者ID:mwsobol,项目名称:SORCER,代码行数:7,代码来源:FilteredServiceDiscoveryListener.java

示例13: serviceAdded

import net.jini.lookup.ServiceDiscoveryEvent; //导入依赖的package包/类
@Override public void serviceAdded(ServiceDiscoveryEvent sdEvent) {
    ServiceItem item = sdEvent.getPostEventServiceItem();
    logger.info("Discovered {}", item);
    register((RemoteLogger) item.service);
}
 
开发者ID:mwsobol,项目名称:SORCER,代码行数:6,代码来源:RemoteLoggerListener.java

示例14: serviceRemoved

import net.jini.lookup.ServiceDiscoveryEvent; //导入依赖的package包/类
@Override public void serviceRemoved(ServiceDiscoveryEvent sdEvent) {
    ServiceItem item = sdEvent.getPreEventServiceItem();
    if(eventRegistrations.remove((RemoteLogger)item.service)!=null)
        logger.debug("Removed {}", item.service);
}
 
开发者ID:mwsobol,项目名称:SORCER,代码行数:6,代码来源:RemoteLoggerListener.java


注:本文中的net.jini.lookup.ServiceDiscoveryEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。