Class LeaderFollowerTeam

  • All Implemented Interfaces:
    Team

    public class LeaderFollowerTeam
    extends java.lang.Object
    implements Team
    Team implementation of many Thread instances that follow the leader follower pattern.
    Author:
    Daniel Sagenschneider
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected net.officefloor.frame.impl.spi.team.LeaderFollowerTeam.TeamMember[] teamMembers
      LeaderFollowerTeam.TeamMember instances.
    • Constructor Summary

      Constructors 
      Constructor Description
      LeaderFollowerTeam​(int teamMemberCount, java.util.concurrent.ThreadFactory threadFactory, long waitTime)
      Initiate with the name of team.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void assignJob​(Job job)
      Assigns a Job to be executed by this Team.
      void startWorking()
      Indicates for the Team to start working.
      void stopWorking()
      Indicates for the Team to stop working.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • teamMembers

        protected final net.officefloor.frame.impl.spi.team.LeaderFollowerTeam.TeamMember[] teamMembers
        LeaderFollowerTeam.TeamMember instances.
    • Constructor Detail

      • LeaderFollowerTeam

        public LeaderFollowerTeam​(int teamMemberCount,
                                  java.util.concurrent.ThreadFactory threadFactory,
                                  long waitTime)
        Initiate with the name of team.
        Parameters:
        teamMemberCount - Number of LeaderFollowerTeam.TeamMember instances within this LeaderFollowerTeam.
        threadFactory - ThreadFactory.
        waitTime - Time to wait in milliseconds for a Job.
    • Method Detail

      • startWorking

        public void startWorking()
        Description copied from interface: Team
        Indicates for the Team to start working.
        Specified by:
        startWorking in interface Team
      • assignJob

        public void assignJob​(Job job)
        Description copied from interface: Team
        Assigns a Job to be executed by this Team.
        Specified by:
        assignJob in interface Team
        Parameters:
        job - Job.
      • stopWorking

        public void stopWorking()
        Description copied from interface: Team

        Indicates for the Team to stop working.

        This method should block and only return control when the Team has stopped working and is no longer assigned Job instances to complete.

        Specified by:
        stopWorking in interface Team