本文整理汇总了Java中net.jini.core.discovery.LookupLocator.getPort方法的典型用法代码示例。如果您正苦于以下问题:Java LookupLocator.getPort方法的具体用法?Java LookupLocator.getPort怎么用?Java LookupLocator.getPort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.jini.core.discovery.LookupLocator
的用法示例。
在下文中一共展示了LookupLocator.getPort方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addOne
import net.jini.core.discovery.LookupLocator; //导入方法依赖的package包/类
private void addOne(ServiceRegistrar registrar) {
LookupLocator loc;
try {
loc = registrar.getLocator();
} catch (Throwable t) {
logger.log(Level.INFO, "obtaining locator failed", t);
return;
}
String host = loc.getHost();
if (loc.getPort() != Constants.discoveryPort) {
host += ":" + loc.getPort();
}
JRadioButtonMenuItem reg =
new RegistrarMenuItem(host, registrar.getServiceID());
reg.addActionListener(wrap(new Lookup(registrar)));
if (!(registrars.getMenuComponent(0) instanceof JRadioButtonMenuItem)) {
registrars.removeAll();
}
registrars.add(reg);
}
示例2: ServiceNode
import net.jini.core.discovery.LookupLocator; //导入方法依赖的package包/类
ServiceNode(ServiceItem item){
try{
_serviceItem=item;
_atts=item.attributeSets;
if(_serviceItem.service instanceof ServiceRegistrar){
ServiceRegistrar reggie=(ServiceRegistrar)_serviceItem.service;
LookupLocator ll=reggie.getLocator();
_strValue=ll.getHost()+":"+ll.getPort();
}else{
setName();
//_serviceItem.service.toString();
}
}catch(Exception ex){
ex.printStackTrace();
_strValue=_serviceItem.service.toString();
}
}
示例3: addServicesToGlyph
import net.jini.core.discovery.LookupLocator; //导入方法依赖的package包/类
private String addServicesToGlyph(Glyph lus,
DefaultMutableTreeNode selectedNode, String label) {
// add the services
int n = selectedNode.getChildCount();
// _logger.info("+++ Number of glyphs "+lus.getText()+" = "+n);
for (int i = 0; i < n; i++) {
DefaultMutableTreeNode kid = (DefaultMutableTreeNode) selectedNode
.getChildAt(i);
Object userObject = kid.getUserObject();
if (userObject instanceof ServiceNode) {
ServiceNode kidObject = (ServiceNode) userObject;
Object proxy = kidObject.getServiceItem().service;
label = TreeRenderer.getJiniName(proxy, kidObject.toString());
if (proxy instanceof ServiceRegistrar) {
try {
ServiceRegistrar reggie = (ServiceRegistrar) proxy;
LookupLocator loc = reggie.getLocator();
label += " " + loc.getHost() + ":" + loc.getPort();
} catch (Exception ex) {
_logger.info("" + ex);
}
} else {
// REMOVED for 2.3
// int delim=label.lastIndexOf(".");
// if(delim!=-1){
// label=label.substring(delim+1);
// }
}
// _logger.info("+++ adding glyph "+label);
Glyph g1 = new Glyph(label,/*
* TreeRenderer._serviceGlyphIcon.getImage
* ()
*/
null);
// modified v4.5 [ix-02]
g1.setUserObject(kidObject);// .getServiceItem());
lus.addChild(g1);
}
}
return label;
}