View Javadoc

1   package com.github.triceo.splitlog.api;
2   
3   import java.util.Collection;
4   
5   /**
6    * Follower that is capable of merging multiple {@link Follower}s.
7    *
8    * They receive all messages that their {@link #getMerged()} receive. It is left
9    * to the discretion of users to {@link #waitFor(MidDeliveryMessageCondition)}
10   * any message or just for messages from a particular {@link MessageProducer}.
11   *
12   * Unlike {@link Follower}, this one can not tag. However, it will retrieve
13   * every tag that has been made using any of the {@link #getMerged()}.
14   *
15   */
16  public interface MergingFollower extends CommonFollower<MergingFollower, Follower> {
17  
18      /**
19       * Retrieve followers that are currently part of this merge.
20       *
21       * @return Unmodifiable collections of followers in this merge.
22       */
23      Collection<Follower> getMerged();
24  
25      /**
26       * Will return an instance whose {@link #getMerged()} does not contain the
27       * given follower.
28       *
29       * @param f
30       *            The follower to remove from the merge.
31       * @return New instance of the follower containing the followers without
32       *         this one, if {@link #getMerged()} contained it. If it didn't, the
33       *         same instance is returned. Null is returned when the merge would
34       *         be empty after this call.
35       */
36      MergingFollower remove(Follower f);
37  
38      /**
39       * Will remove the follower from {@link #getMerged()}. As a result, this
40       * merge will act as if it never knew of this follower.
41       *
42       * It is the responsibility of this method to notify the {@link Follower} to
43       * no longer notify of new messages.
44       *
45       * @param f
46       *            The follower to remove from the merge.
47       * @return True if the follower was part of the merge, false if it was
48       *         already separate or never merged.
49       */
50      @Deprecated
51      boolean separate(Follower f);
52  
53  }