本文整理了Java中com.hazelcast.core.Member.getInetSocketAddress()
方法的一些代码示例,展示了Member.getInetSocketAddress()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Member.getInetSocketAddress()
方法的具体详情如下:
包路径:com.hazelcast.core.Member
类名称:Member
方法名:getInetSocketAddress
[英]Returns the InetSocketAddress of this member.
[中]返回此成员的InetSocketAddress。
代码示例来源:origin: apache/usergrid
@Test
public void doTest() {
logger.info( "do test" );
Hazelcast.addInstanceListener( this );
ITopic<Object> topic = Hazelcast.getTopic( "default" );
topic.addMessageListener( this );
topic.publish( "my-message-object" );
Collection<Instance> instances = Hazelcast.getInstances();
for ( Instance instance : instances ) {
logger.info( "ID: [" + instance.getId() + "] Type: [" + instance.getInstanceType() + "]" );
}
Set<Member> setMembers = Hazelcast.getCluster().getMembers();
for ( Member member : setMembers ) {
logger.info( "isLocalMember " + member.localMember() );
logger.info( "member.inetsocketaddress " + member.getInetSocketAddress() );
}
}
代码示例来源:origin: com.hazelcast.stabilizer/stabilizer
private void signalStartToAgent() {
String address;
if (serverInstance == null) {
address = "client:" + getHostAddress();
} else {
InetSocketAddress socketAddress = serverInstance.getCluster().getLocalMember().getInetSocketAddress();
address = socketAddress.getAddress().getHostAddress() + ":" + socketAddress.getPort();
}
File file = new File("worker.address");
writeObject(address, file);
}
代码示例来源:origin: org.sonatype.sisu/sisu-locks
/**
* Qualifies the given results by appending the IP address of the local Hazelcast instance.
*
* @param results Local results
* @return Qualified results
*/
private List<String> qualifyResults( final List<String> results )
{
if ( method.endsWith( "Threads" ) )
{
final String addr = toString( instance.getCluster().getLocalMember().getInetSocketAddress() );
for ( int i = 0; i < results.size(); i++ )
{
results.set( i, results.get( i ) + " @ " + addr );
}
}
return results;
}
代码示例来源:origin: org.sonatype.sisu/sisu-locks
for ( final Member m : instance.getCluster().getMembers() )
if ( addr.equals( m.getInetSocketAddress() ) )
for ( final Member m : instance.getCluster().getMembers() )
if ( addr.equals( m.getInetSocketAddress().getAddress() ) )
代码示例来源:origin: com.hazelcast.simulator/simulator
private static InetSocketAddress getInetSocketAddress(HazelcastInstance hazelcastInstance) {
try {
return (InetSocketAddress) hazelcastInstance.getLocalEndpoint().getSocketAddress();
} catch (NoSuchMethodError ignored) {
try {
return hazelcastInstance.getCluster().getLocalMember().getInetSocketAddress();
} catch (Exception e) {
return null;
}
}
}
内容来源于网络,如有侵权,请联系作者删除!