public void registerSlave(TPCSlaveInfo slave) {
    	lock.lock();
        synchronized(slaves) {
        	for (int i = 0; i < slaves.size(); i++) {
        		if (slaves.get(i).getSlaveID() == slave.getSlaveID()) {
        			slaves.set(i , slave);
        			break;
        		}
        		
        		if (isLessThanUnsigned(slave.getSlaveID() , slaves.get(i).getSlaveID())) {
        			if (slaves.size() == numSlaves)
        				break;
        			slaves.add(i , slave);
        			break;
        		}
        	}
        	
        	if (slaves.size() < numSlaves)
        		slaves.add(slave);
        	
        	if (slaves.size() == numSlaves)
        		enoughSlaves.signalAll();
        }
        lock.unlock();
    }