GridServiceDescriptionImpl gsd = (GridServiceDescriptionImpl) coreServicesWP.lookup( SchedulerService.class );
if ( gsd == null ) {
gsd = new GridServiceDescriptionImpl( SchedulerService.class, grid.getId() );
}
SocketService mss = grid.get( SocketService.class );
// GridServiceDescription service = coreServicesWP.getServices().get( SchedulerService.class.getName() );
// 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(),
// this.port);
// ServiceConfiguration conf = new SchedulerServiceConfiguration(newAddresses);
// service.setData(conf);
// }else{
// InetSocketAddress[] newAddress = new InetSocketAddress[1];
// newAddress[0]= new InetSocketAddress( mss.getIp(),
// this.port);
// address.setObject( newAddress );
// ServiceConfiguration conf = new SchedulerServiceConfiguration(newAddress);
// service.setData(conf);
// }
mss.addService( SchedulerService.class.getName(),
this.port,
sched );
}
}