View Javadoc

1   package org.jumpmind.symmetric.transport;
2   
3   import java.util.Map;
4   
5   import org.jumpmind.symmetric.transport.ConcurrentConnectionManager.NodeConnectionStatistics;
6   import org.jumpmind.symmetric.transport.ConcurrentConnectionManager.Reservation;
7   
8   public interface IConcurrentConnectionManager {
9   
10      public static enum ReservationType {
11  
12          /***
13           * A hard reservation is one that is expected to be released. It does
14           * not have a timeout.
15           */
16          HARD,
17  
18          /***
19           * A soft reservation is one that will time out eventually.
20           */
21          SOFT
22  
23      };
24  
25      /***
26       * @param nodeId
27       * @param reservationRequest
28       *                if true then hold onto reservation for the time it
29       *                typically takes for a node to reconnect after the initial
30       *                request. Otherwise, we know that the node has actually
31       *                connected for activity.
32       * @return true if the connection has been reserved and the node is meant to
33       *         proceed with its current operation.
34       */
35      public boolean reserveConnection(String nodeId, String poolId, ReservationType reservationRequest);
36  
37      public boolean releaseConnection(String nodeId, String poolId);
38  
39      public int getReservationCount(String poolId);
40  
41      public Map<String, Map<String, NodeConnectionStatistics>> getNodeConnectionStatisticsByPoolByNodeId();
42  
43      public Map<String, Map<String, Reservation>> getActiveReservationsByNodeByPool();
44  
45      public void addToWhitelist(String nodeId);
46  
47      public String[] getWhiteList();
48  
49      public void removeFromWhiteList(String nodeId);
50  
51  }