<commit_before>package org.imirsel.nema.flowservice;

/**
 * Given a set of {@link MeandreServerProxy}s, determines which server will get
 * the next job request.
 *
 * @author shirk
 * @since 0.4.0
 */
public interface MeandreLoadBalancer {

   //~ Methods -----------------------------------------------------------------

   /**
    * Return the {@link MeandreServerProxy} to receive the next job execution 
    * request.
    *
    * @return The next eligible {@link MeandreServerProxy} to receive a job, or 
    * <code>null</code> if no servers are available.
    */
   public MeandreServerProxy nextAvailableServer();

   /**
    * Test if there are any servers currently available for processing a job.
    *
    * @return True if at least one server is available.
    */
   public boolean hasAvailableServer();

   /**
    * Register a new {@link MeandreServerProxy} with the load balancer.
    *
    * @param server The {@link MeandreServerProxy} to add.
    */
   public void addServer(MeandreServerProxy server);

   /**
    * Remove a {@link MeandreServerProxy} from the load balancer.
    *
    * @param server The server to remove.
    * @throws IllegalStateException if the server is currently processing a
    * job.
    */
   public void removeServer(MeandreServerProxy server) throws IllegalStateException;
   
   /**
    * Number of servers the load balancer is aware of.
    * 
    * @return Number of servers the load balancer is aware of.
    */
   public int size();
<commit_msg>Removing a server while it is processing jobs no longer throws an exception.<commit_after>package org.imirsel.nema.flowservice;

/**
 * Given a set of {@link MeandreServerProxy}s, determines which server will get
 * the next job request.
 *
 * @author shirk
 * @since 0.4.0
 */
public interface MeandreLoadBalancer {

   //~ Methods -----------------------------------------------------------------

   /**
    * Return the {@link MeandreServerProxy} to receive the next job execution 
    * request.
    *
    * @return The next eligible {@link MeandreServerProxy} to receive a job, or 
    * <code>null</code> if no servers are available.
    */
   public MeandreServerProxy nextAvailableServer();

   /**
    * Test if there are any servers currently available for processing a job.
    *
    * @return True if at least one server is available.
    */
   public boolean hasAvailableServer();

   /**
    * Register a new {@link MeandreServerProxy} with the load balancer.
    *
    * @param server The {@link MeandreServerProxy} to add.
    */
   public void addServer(MeandreServerProxy server);

   /**
    * Remove a {@link MeandreServerProxy} from the load balancer.
    *
    * @param server The server to remove.
    */
   public void removeServer(MeandreServerProxy server);
   
   /**
    * Number of servers the load balancer is aware of.
    * 
    * @return Number of servers the load balancer is aware of.
    */
   public int size();

{'fraction_non_alphanumeric': 0.1290213342363698, 'fraction_numerical': 0.002031832035218422, 'mean_word_length': 2.422943221320973, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4824286', 'n_tokens_mistral': 815, 'n_tokens_neox': 794, 'n_words': 304}