if ( service == null ) {
coreServicesWP.getServices().put( SchedulerService.class.getName(),
gsd );
service = gsd;
}
Address address = null;
if ( service.getAddresses().get( "socket" ) != null ) {
address = service.getAddresses().get( "socket" );
} else {
address = service.addAddress( "socket" );
}
InetSocketAddress[] addresses = (InetSocketAddress[]) address.getObject();
if ( addresses != null && addresses.length >= 1 ) {
InetSocketAddress[] newAddresses = new InetSocketAddress[ addresses.length + 1 ];
if ( addresses != null ) {
System.arraycopy( addresses,
0,
newAddresses,
0,
addresses.length );
}
newAddresses[addresses.length] = new InetSocketAddress( mss.getIp(),
port );
ServiceConfiguration conf = new SchedulerServiceConfiguration( newAddresses );
service.setData( conf );
} else {
InetSocketAddress[] newAddress = new InetSocketAddress[ 1 ];
newAddress[0] = new InetSocketAddress( mss.getIp(),
port );
address.setObject( newAddress );
ServiceConfiguration conf = new SchedulerServiceConfiguration( newAddress );
service.setData( conf );
}
}