In an effort to simplify use of the library Reduces visibility for a number of methods that user applications won't need to access.

This commit is contained in:
emcho 2010-05-08 21:39:25 +00:00
parent 90a9e347f7
commit 7da2ab5222
5 changed files with 34 additions and 61 deletions

View File

@ -674,7 +674,7 @@ public class Agent
* @return the number of {@link CheckList}s that are currently active. * @return the number of {@link CheckList}s that are currently active.
* *
*/ */
public int getActiveCheckListCount() protected int getActiveCheckListCount()
{ {
synchronized(mediaStreams) synchronized(mediaStreams)
{ {
@ -885,11 +885,11 @@ public class Agent
* @param useCandidate indicates whether the incoming check {@link Request} * @param useCandidate indicates whether the incoming check {@link Request}
* contained the USE-CANDIDATE ICE attribute. * contained the USE-CANDIDATE ICE attribute.
*/ */
public void incomingCheckReceived(TransportAddress remoteAddress, protected void incomingCheckReceived(TransportAddress remoteAddress,
TransportAddress localAddress, TransportAddress localAddress,
long priority, long priority,
String remoteUFrag, String remoteUFrag,
boolean useCandidate) boolean useCandidate)
{ {
LocalCandidate localCandidate = findLocalCandidate(localAddress); LocalCandidate localCandidate = findLocalCandidate(localAddress);
Component parentComponent = localCandidate.getParentComponent(); Component parentComponent = localCandidate.getParentComponent();
@ -1011,7 +1011,7 @@ public class Agent
* *
* @param validPair the {@link CandidatePair} we'd like to validate. * @param validPair the {@link CandidatePair} we'd like to validate.
*/ */
public void validatePair(CandidatePair validPair) protected void validatePair(CandidatePair validPair)
{ {
IceMediaStream parentStream IceMediaStream parentStream
= validPair.getParentComponent().getParentStream(); = validPair.getParentComponent().getParentStream();
@ -1032,7 +1032,7 @@ System.out.println("valid pair was nominated " + validPair);
* @param pairToNominate the {@link CandidatePair} whose nomination has * @param pairToNominate the {@link CandidatePair} whose nomination has
* just been confirmed. * just been confirmed.
*/ */
public void nominationConfirmed(CandidatePair pairToNominate) protected void nominationConfirmed(CandidatePair pairToNominate)
{ {
pairToNominate.nominate(); pairToNominate.nominate();
System.out.println("pair nomination confirmed"); System.out.println("pair nomination confirmed");
@ -1061,7 +1061,7 @@ System.out.println("checklist " + checkList.getName() + " became " + checkList.g
* or a timeout event the method goes through all check lists and tries * or a timeout event the method goes through all check lists and tries
* to assess the state of ICE processing. * to assess the state of ICE processing.
*/ */
public void checkListStatesUpdated() protected void checkListStatesUpdated()
{ {
boolean allListsEnded = true; boolean allListsEnded = true;
boolean atLeastOneListSucceeded = false; boolean atLeastOneListSucceeded = false;
@ -1151,7 +1151,7 @@ System.out.println("checklist " + checkList.getName() + " became " + checkList.g
* a pre-configured value if the application has set one. * a pre-configured value if the application has set one.
* <p> * <p>
*/ */
public long calculateTa() protected long calculateTa()
{ {
//if application specified a value - use it. other wise return .... //if application specified a value - use it. other wise return ....
// eeeer ... a "dynamically" calculated one ;) // eeeer ... a "dynamically" calculated one ;)
@ -1194,7 +1194,7 @@ System.out.println("checklist " + checkList.getName() + " became " + checkList.g
* @return the value of the retransmission timer to use in STUN * @return the value of the retransmission timer to use in STUN
* transactions, while harvesting addresses. * transactions, while harvesting addresses.
*/ */
public long calculateStunHarvestRTO() protected long calculateStunHarvestRTO()
{ {
/* RFC 5245 says: /* RFC 5245 says:
* RTO = MAX (100ms, Ta * (number of pairs)) * RTO = MAX (100ms, Ta * (number of pairs))
@ -1217,7 +1217,7 @@ System.out.println("checklist " + checkList.getName() + " became " + checkList.g
* @return the value of the retransmission timer to use in STUN connectivity * @return the value of the retransmission timer to use in STUN connectivity
* check transactions.. * check transactions..
*/ */
public long calculateStunConnCheckRTO() protected long calculateStunConnCheckRTO()
{ {
/* RFC 5245 says: /* RFC 5245 says:
* For connectivity checks, RTO SHOULD be configurable and SHOULD have * For connectivity checks, RTO SHOULD be configurable and SHOULD have

View File

@ -50,7 +50,7 @@ public class CheckList
* *
* @param name the name of the check list. * @param name the name of the check list.
*/ */
public CheckList(String name) protected CheckList(String name)
{ {
this.name = name; this.name = name;
} }
@ -70,7 +70,7 @@ public class CheckList
* *
* @param state the <tt>CheckListState</tt> for this list. * @param state the <tt>CheckListState</tt> for this list.
*/ */
public void setState(CheckListState state) protected void setState(CheckListState state)
{ {
this.state = state; this.state = state;
} }
@ -82,7 +82,7 @@ public class CheckList
* *
* @param pair the pair to schedule a triggered check for. * @param pair the pair to schedule a triggered check for.
*/ */
public void scheduleTriggeredCheck(CandidatePair pair) protected void scheduleTriggeredCheck(CandidatePair pair)
{ {
synchronized(triggeredCheckQueue) synchronized(triggeredCheckQueue)
{ {
@ -101,7 +101,7 @@ public class CheckList
* @return the first {@link CandidatePair} in the triggered check queue or * @return the first {@link CandidatePair} in the triggered check queue or
* <tt>null</tt> if that queue is empty. * <tt>null</tt> if that queue is empty.
*/ */
public CandidatePair popTriggeredCheck() protected CandidatePair popTriggeredCheck()
{ {
synchronized(triggeredCheckQueue) synchronized(triggeredCheckQueue)
{ {
@ -122,9 +122,8 @@ public class CheckList
* connectivity check, which would either be the highest priority * connectivity check, which would either be the highest priority
* <tt>Waiting</tt> pair or, when there's no such pair, the highest priority * <tt>Waiting</tt> pair or, when there's no such pair, the highest priority
* <tt>Frozen</tt> pair or <tt>null</tt> otherwise * <tt>Frozen</tt> pair or <tt>null</tt> otherwise
*
*/ */
public synchronized CandidatePair getNextOrdinaryPairToCheck() protected synchronized CandidatePair getNextOrdinaryPairToCheck()
{ {
if (size() < 1) if (size() < 1)
return null; return null;
@ -169,7 +168,7 @@ public class CheckList
* @return <tt>true</tt> if this list is active and <tt>false</tt> * @return <tt>true</tt> if this list is active and <tt>false</tt>
* otherwise. * otherwise.
*/ */
public synchronized boolean isActive() protected synchronized boolean isActive()
{ {
for (CandidatePair pair : this) for (CandidatePair pair : this)
{ {
@ -187,7 +186,7 @@ public class CheckList
* @return <tt>true</tt> if all pairs in this list are frozen and * @return <tt>true</tt> if all pairs in this list are frozen and
* <tt>false</tt> otherwise. * <tt>false</tt> otherwise.
*/ */
public synchronized boolean isFrozen() protected synchronized boolean isFrozen()
{ {
for (CandidatePair pair : this) for (CandidatePair pair : this)
{ {
@ -228,7 +227,7 @@ public class CheckList
* component ID to Waiting. If there is more than one such pair, the one * component ID to Waiting. If there is more than one such pair, the one
* with the highest priority is used. * with the highest priority is used.
*/ */
public synchronized void computeInitialCheckListPairStates() protected synchronized void computeInitialCheckListPairStates()
{ {
Map<String, CandidatePair> pairsToWait Map<String, CandidatePair> pairsToWait
= new Hashtable<String, CandidatePair>(); = new Hashtable<String, CandidatePair>();
@ -314,7 +313,7 @@ public class CheckList
* @param nominatedPair the {@link CandidatePair} whose nomination we need * @param nominatedPair the {@link CandidatePair} whose nomination we need
* to handle. * to handle.
*/ */
public synchronized void handleNomination(CandidatePair nominatedPair) protected synchronized void handleNomination(CandidatePair nominatedPair)
{ {
Component cmp = nominatedPair.getParentComponent(); Component cmp = nominatedPair.getParentComponent();
Iterator<CandidatePair> pairsIter = iterator(); Iterator<CandidatePair> pairsIter = iterator();

View File

@ -12,14 +12,16 @@ import java.util.logging.*;
import org.ice4j.*; import org.ice4j.*;
import org.ice4j.attribute.*; import org.ice4j.attribute.*;
import org.ice4j.ice.*;
import org.ice4j.message.*; import org.ice4j.message.*;
import org.ice4j.stack.*; import org.ice4j.stack.*;
/** /**
* The class that will be generating our outgoing connectivity checks and that
* will be handling their responses or lack thereof.
*
* @author Emil Ivov * @author Emil Ivov
*/ */
public class ConnectivityCheckClient class ConnectivityCheckClient
implements ResponseCollector implements ResponseCollector
{ {
/** /**
@ -44,12 +46,6 @@ public class ConnectivityCheckClient
*/ */
private final List<PaceMaker> paceMakers = new LinkedList<PaceMaker>(); private final List<PaceMaker> paceMakers = new LinkedList<PaceMaker>();
/**
* Contains the system time at the moment we last started a {@link
* PaceMaker}.
*/
private long lastPaceMakerStarted = 0;
/** /**
* Creates a new <tt>ConnectivityCheckHandler</tt> setting * Creates a new <tt>ConnectivityCheckHandler</tt> setting
* <tt>parentAgent</tt> as the agent that will be used for retrieving * <tt>parentAgent</tt> as the agent that will be used for retrieving
@ -679,28 +675,4 @@ logger.fine("checklist " + checkList.getName() + " ran out of checks");
parentClient.paceMakers.remove(this); parentClient.paceMakers.remove(this);
} }
} }
/**
* Returns the {@link PaceMaker} responsible for running checks for the
* specified {@link CheckList}
*
* @param list the {@link CheckList} whose {@link PaceMaker} we are trying
* to find.
*
* @return the {@link PaceMaker} responsible for running checks for the
* specified {@link CheckList} or <tt>null</tt> if we couldn't find one.
*/
private PaceMaker findPaceMaker(CheckList list)
{
synchronized(paceMakers)
{
for(PaceMaker paceMaker : paceMakers)
{
if (paceMaker.checkList == list)
return paceMaker;
}
}
return null;
}
} }

View File

@ -10,14 +10,16 @@ import java.util.logging.*;
import org.ice4j.*; import org.ice4j.*;
import org.ice4j.attribute.*; import org.ice4j.attribute.*;
import org.ice4j.ice.*;
import org.ice4j.message.*; import org.ice4j.message.*;
import org.ice4j.security.*; import org.ice4j.security.*;
import org.ice4j.stack.*; import org.ice4j.stack.*;
/** /**
* The class that would be handling and responding to incoming connectivity
* checks.
*
* @author Emil Ivov * @author Emil Ivov
*/ */
public class ConnectivityCheckServer class ConnectivityCheckServer
implements RequestListener, implements RequestListener,
CredentialsAuthority CredentialsAuthority
{ {

View File

@ -552,7 +552,7 @@ public class IceMediaStream
* *
* @param pair the {@link CandidatePair} to add to our valid list. * @param pair the {@link CandidatePair} to add to our valid list.
*/ */
public void addValidPair(CandidatePair pair) protected void addValidPair(CandidatePair pair)
{ {
synchronized (validList) synchronized (validList)
{ {
@ -571,7 +571,7 @@ public class IceMediaStream
* @return <tt>true</tt> if this stream's <tt>validList</tt> contains a * @return <tt>true</tt> if this stream's <tt>validList</tt> contains a
* pair with the specified <tt>foundation</tt> and <tt>false</tt> otherwise. * pair with the specified <tt>foundation</tt> and <tt>false</tt> otherwise.
*/ */
public boolean validListContainsFoundation(String foundation) protected boolean validListContainsFoundation(String foundation)
{ {
synchronized(validList) synchronized(validList)
{ {
@ -592,7 +592,7 @@ public class IceMediaStream
* one {@link CandidatePair} for each {@link Component} of the stream and * one {@link CandidatePair} for each {@link Component} of the stream and
* <tt>false</tt> otherwise. * <tt>false</tt> otherwise.
*/ */
public boolean validListContainsAllComponents() protected boolean validListContainsAllComponents()
{ {
List<Component> cmpList = getComponents(); List<Component> cmpList = getComponents();
for(Component cmp : cmpList) for(Component cmp : cmpList)
@ -617,7 +617,7 @@ public class IceMediaStream
* CandidatePair} in the valid list for every {@link Component} of this * CandidatePair} in the valid list for every {@link Component} of this
* stream and <tt>false</tt> otherwise. * stream and <tt>false</tt> otherwise.
*/ */
public boolean allComponentsAreNominated() protected boolean allComponentsAreNominated()
{ {
List<Component> components = getComponents(); List<Component> components = getComponents();
@ -641,7 +641,7 @@ public class IceMediaStream
* @return a valid {@link CandidatePair} for the specified * @return a valid {@link CandidatePair} for the specified
* <tt>component</tt> if at least one exists, and <tt>null</tt> otherwise. * <tt>component</tt> if at least one exists, and <tt>null</tt> otherwise.
*/ */
public CandidatePair getValidPair(Component component) protected CandidatePair getValidPair(Component component)
{ {
synchronized(validList) synchronized(validList)
{ {